go-urlsh/models/multifactor.go

37 lines
918 B
Go

package models
import (
"time"
"github.com/uptrace/bun"
)
type TokenRequest struct {
Token string `json:"token"`
}
type MFALoginTransaction struct {
bun.BaseModel `bun:"table:logintransactions"`
SessionKey string `bun:"sessionkey,pk"`
UserName string `bun:"username,notnull"`
Expires time.Time `bun:"expires,notnull"`
}
// TODO: Rework Scratch tokens:
// Only one Scratch token
// Possibility to regenerate scratch token
// mark Tokens as used
type MFAConfig struct {
bun.BaseModel `bun:"table:multifactor"`
ID int64 `bun:"id,pk,autoincrement"`
UserName string `bun:"username,notnull"`
TOTPSecret string `bun:"totpurl,notnull"`
RecoveryCodes []string `bun:"recoverycodes,notnull,array"`
ExpiresAt time.Time `bun:"expiresat,notnull"`
Active bool `bun:"active,notnull"`
}
type MFATemplateObject struct {
Key string
Image string
}