Versions in this module Expand all Collapse all v1 v1.0.0 Mar 21, 2026 Changes in this version + type DisableUseCase struct + EventBus models.EventBus + Logger models.Logger + TOTPRepo TOTPRepository + func NewDisableUseCase(logger models.Logger, eventBus models.EventBus, totpRepo TOTPRepository) *DisableUseCase + func (uc *DisableUseCase) Disable(ctx context.Context, userID string) error + type EnableUseCase struct + BackupCodeService *services.BackupCodeService + Config *types.TOTPPluginConfig + EventBus models.EventBus + Logger models.Logger + TOTPRepo TOTPRepository + TOTPService *services.TOTPService + TokenService rootservices.TokenService + UserService rootservices.UserService + Verification rootservices.VerificationService + func NewEnableUseCase(config *types.TOTPPluginConfig, logger models.Logger, eventBus models.EventBus, ...) *EnableUseCase + func (uc *EnableUseCase) Enable(ctx context.Context, userID string, issuer string) (*types.EnableResult, error) + type GenerateBackupCodesUseCase struct + BackupCodeService *services.BackupCodeService + TOTPRepo TOTPRepository + func NewGenerateBackupCodesUseCase(backupCodeService *services.BackupCodeService, totpRepo TOTPRepository) *GenerateBackupCodesUseCase + func (uc *GenerateBackupCodesUseCase) Generate(ctx context.Context, userID string) ([]string, error) + type GetTOTPURIUseCase struct + Config *types.TOTPPluginConfig + TOTPRepo TOTPReadRepository + TOTPService *services.TOTPService + TokenService rootservices.TokenService + UserService rootservices.UserService + func NewGetTOTPURIUseCase(config *types.TOTPPluginConfig, userService rootservices.UserService, ...) *GetTOTPURIUseCase + func (uc *GetTOTPURIUseCase) GetTOTPURI(ctx context.Context, userID string, issuer string) (string, error) + type TOTPCreateRepository interface + Create func(ctx context.Context, userID, secret, backupCodes string) (*types.TOTPRecord, error) + CreateTrustedDevice func(ctx context.Context, userID, token, userAgent string, expiresAt time.Time) (*types.TrustedDevice, error) + type TOTPReadRepository interface + GetByUserID func(ctx context.Context, userID string) (*types.TOTPRecord, error) + type TOTPRepository interface + type TOTPTrustedDeviceRepository interface + DeleteTrustedDevicesByUserID func(ctx context.Context, userID string) error + type TOTPWriteRepository interface + CompareAndSwapBackupCodes func(ctx context.Context, userID, expectedBackupCodes, newBackupCodes string) (bool, error) + DeleteByUserID func(ctx context.Context, userID string) error + SetEnabled func(ctx context.Context, userID string, enabled bool) error + UpdateBackupCodes func(ctx context.Context, userID, backupCodes string) error + type UseCases struct + Disable *DisableUseCase + Enable *EnableUseCase + GenerateBackupCodes *GenerateBackupCodesUseCase + GetTOTPURI *GetTOTPURIUseCase + VerifyBackupCode *VerifyBackupCodeUseCase + VerifyTOTP *VerifyTOTPUseCase + type VerifyBackupCodeUseCase struct + BackupCodeService *services.BackupCodeService + Config *types.TOTPPluginConfig + EventBus models.EventBus + GlobalConfig *models.Config + Logger models.Logger + SessionService rootservices.SessionService + TOTPRepo TOTPRepository + TokenService rootservices.TokenService + UserService rootservices.UserService + VerificationService rootservices.VerificationService + func NewVerifyBackupCodeUseCase(globalConfig *models.Config, config *types.TOTPPluginConfig, ...) *VerifyBackupCodeUseCase + func (uc *VerifyBackupCodeUseCase) Verify(ctx context.Context, pendingToken, code string, trustDevice bool, ...) (*types.VerifyResult, error) + type VerifyTOTPUseCase struct + Config *types.TOTPPluginConfig + EventBus models.EventBus + GlobalConfig *models.Config + Logger models.Logger + SessionService rootservices.SessionService + TOTPRepo TOTPRepository + TOTPService *services.TOTPService + TokenService rootservices.TokenService + UserService rootservices.UserService + VerificationService rootservices.VerificationService + func NewVerifyTOTPUseCase(globalConfig *models.Config, config *types.TOTPPluginConfig, ...) *VerifyTOTPUseCase + func (uc *VerifyTOTPUseCase) Verify(ctx context.Context, pendingToken, code string, trustDevice bool, ...) (*types.VerifyResult, error)