2024-05-04 17:06:01 +02:00
|
|
|
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"`
|
|
|
|
ExpiresAt time.Time `bun:"expiresat,notnull"`
|
|
|
|
Active bool `bun:"active,notnull"`
|
|
|
|
}
|
|
|
|
|
2024-05-06 15:32:53 +02:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2024-05-04 17:06:01 +02:00
|
|
|
type MFATemplateObject struct {
|
|
|
|
Key string
|
|
|
|
Image string
|
|
|
|
}
|
2024-05-06 15:32:53 +02:00
|
|
|
|
|
|
|
type MFASetupResponse struct {
|
|
|
|
Error bool `json:"error"`
|
|
|
|
Message string `json:"message,omitempty"`
|
|
|
|
RecoveryTokens []string `json:"recovery_tokens,omitempty"`
|
|
|
|
}
|