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:"totp_secret,notnull"` ExpiresAt time.Time `bun:"expires_at,notnull"` Active bool `bun:"active,notnull"` } type MFAScratchCode struct { bun.BaseModel `bun:"table:multifactor_scratchcodes"` Code string `bun:"code,pk"` UserName string `bun:"username,notnull"` IsUsed bool `bun:"is_used,notnull"` } type MFATemplateObject struct { Key string Image string } type MFASetupResponse struct { Error bool `json:"error"` Message string `json:"message,omitempty"` RecoveryTokens []string `json:"recovery_tokens,omitempty"` }