types

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSameSite

func ParseSameSite(s string) http.SameSite

Types

type EnableResponse

type EnableResponse struct {
	TotpURI     string   `json:"totp_uri"`
	BackupCodes []string `json:"backup_codes"`
}

Response payloads

type EnableResult

type EnableResult struct {
	TotpURI      string
	BackupCodes  []string
	PendingToken string
}

Internal result types

type GenerateBackupCodesResponse

type GenerateBackupCodesResponse struct {
	BackupCodes []string `json:"backup_codes"`
}

type GetTOTPURIResponse

type GetTOTPURIResponse struct {
	TotpURI string `json:"totp_uri"`
}

type TOTPPluginConfig

type TOTPPluginConfig struct {
	Enabled                       bool          `json:"enabled" toml:"enabled"`
	SkipVerificationOnEnable      bool          `json:"skip_verification_on_enable" toml:"skip_verification_on_enable"`
	BackupCodeCount               int           `json:"backup_code_count" toml:"backup_code_count"`
	TrustedDeviceDuration         time.Duration `json:"trusted_device_duration" toml:"trusted_device_duration"`
	TrustedDevicesAutoCleanup     bool          `json:"trusted_devices_auto_cleanup" toml:"trusted_devices_auto_cleanup"`
	TrustedDevicesCleanupInterval time.Duration `json:"trusted_devices_cleanup_interval" toml:"trusted_devices_cleanup_interval"`
	PendingTokenExpiry            time.Duration `json:"pending_token_expiry" toml:"pending_token_expiry"`
	SecureCookie                  bool          `json:"secure_cookie" toml:"secure_cookie"`
	SameSite                      string        `json:"same_site" toml:"same_site"`
}

func (*TOTPPluginConfig) ApplyDefaults

func (c *TOTPPluginConfig) ApplyDefaults()

type TOTPRecord

type TOTPRecord struct {
	bun.BaseModel `bun:"table:totp"`

	ID          string    `bun:"column:id,pk"`
	UserID      string    `bun:"column:user_id"`
	Secret      string    `bun:"column:secret"`
	BackupCodes string    `bun:"column:backup_codes"`
	Enabled     bool      `bun:"column:enabled"`
	CreatedAt   time.Time `bun:"column:created_at,default:current_timestamp"`
	UpdatedAt   time.Time `bun:"column:updated_at,default:current_timestamp"`
}

type TOTPRedirectResponse

type TOTPRedirectResponse struct {
	TOTPRedirect bool `json:"totp_redirect"`
}

type TrustedDevice

type TrustedDevice struct {
	bun.BaseModel `bun:"table:trusted_devices"`

	ID        string    `bun:"column:id,pk"`
	UserID    string    `bun:"column:user_id"`
	Token     string    `bun:"column:token"`
	UserAgent string    `bun:"column:user_agent"`
	ExpiresAt time.Time `bun:"column:expires_at"`
	CreatedAt time.Time `bun:"column:created_at,default:current_timestamp"`
}

type VerifyBackupCodeRequest

type VerifyBackupCodeRequest struct {
	Code        string `json:"code"`
	TrustDevice bool   `json:"trust_device,omitempty"`
}

type VerifyBackupCodeResponse

type VerifyBackupCodeResponse struct {
	User    *models.User    `json:"user"`
	Session *models.Session `json:"session"`
}

type VerifyResult

type VerifyResult struct {
	User               *models.User
	Session            *models.Session
	SessionToken       string
	TrustedDeviceToken string // empty if not issued
}

type VerifyTOTPRequest

type VerifyTOTPRequest struct {
	Code        string `json:"code"`
	TrustDevice bool   `json:"trust_device,omitempty"`
}

type VerifyTOTPResponse

type VerifyTOTPResponse struct {
	User    *models.User    `json:"user"`
	Session *models.Session `json:"session"`
}

type ViewBackupCodesResponse

type ViewBackupCodesResponse struct {
	RemainingCount int `json:"remaining_count"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL