Documentation
¶
Index ¶
- Variables
- type CompleteEmailChangeChallengeInput
- type Config
- type CreateEmailChangeChallengeInput
- type CreatePasswordResetChallengeInput
- type CreateSignupChallengeInput
- type EmailTemplateRenderer
- type Service
- func (s *Service) BeginRequiredEmailVerification(ctx context.Context, userID uuid.UUID, sessionID uuid.UUID, audience string, ...) (domain.EmailVerificationTransaction, error)
- func (s *Service) CompleteEmailChangeChallenge(ctx context.Context, in CompleteEmailChangeChallengeInput, ...) error
- func (s *Service) CompletePasswordResetChallenge(ctx context.Context, challengeID uuid.UUID, code string, ...) error
- func (s *Service) CompleteRequiredEmailVerification(ctx context.Context, transactionID uuid.UUID, challengeID uuid.UUID, ...) (domain.EmailVerificationTransaction, domain.User, error)
- func (s *Service) CreateEmailChangeChallenge(ctx context.Context, in CreateEmailChangeChallengeInput, now time.Time) (uuid.UUID, error)
- func (s *Service) CreateOpaqueChallenge(ctx context.Context, now time.Time, purpose domain.ChallengePurpose, ...) (uuid.UUID, error)
- func (s *Service) CreatePasswordResetChallenge(ctx context.Context, in CreatePasswordResetChallengeInput, now time.Time) (uuid.UUID, error)
- func (s *Service) CreateRequiredEmailVerificationChallenge(ctx context.Context, transactionID uuid.UUID, targetEmail string, ...) (uuid.UUID, error)
- func (s *Service) CreateSignupChallenge(ctx context.Context, in CreateSignupChallengeInput, now time.Time) (uuid.UUID, error)
- func (s *Service) GetEmailVerificationTransaction(ctx context.Context, id uuid.UUID, now time.Time) (domain.EmailVerificationTransaction, domain.User, error)
- func (s *Service) ResendChallenge(ctx context.Context, challengeID uuid.UUID, now time.Time) error
- func (s *Service) VerifySignupChallenge(ctx context.Context, challengeID uuid.UUID, code string, ...) (*VerifySignupChallengeResult, error)
- type VerificationCodeService
- type VerifySignupChallengeResult
- type Worker
- type WorkerConfig
- type WorkerMetrics
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrChallengeExpired = errors.New("challenge expired") ErrChallengeConsumed = errors.New("challenge already consumed") ErrTooManyAttempts = errors.New("too many verification attempts") ErrTooManyResends = errors.New("too many resend attempts") ErrResendTooSoon = errors.New("resend requested too soon") ErrInvalidVerificationCode = errors.New("invalid verification code") ErrUnsupportedChallengePurpose = errors.New("unsupported challenge purpose") ErrEmailChangeNotAuthorized = errors.New("email change not authorized for session") ErrEmailAlreadyInUse = errors.New("email already in use") ErrEmailVerificationRequired = errors.New("email verification required") ErrEmailVerificationInvalid = errors.New("email verification transaction is invalid or expired") )
View Source
var ErrVerificationCodeSecretNotConfigured = errors.New("verification code secret is not configured")
Functions ¶
This section is empty.
Types ¶
type CompleteEmailChangeChallengeInput ¶ added in v0.22.0
type Config ¶
type Config struct {
Store *store.Store
Tx *tx.Manager
AllowlistEnabled bool
ChallengeTTL time.Duration
MaxAttempts int
MaxResends int
MinResendInterval time.Duration
Policy config.ChallengePolicyReader
AuthenticationPolicy config.AuthenticationPolicyReader
AllowlistPolicy config.AllowlistPolicyReader
WebhookPublisher webhook.Publisher
AccessTokenRevocations *token.AccessTokenRevocations
SecurityEvents securityevent.Recorder
}
type CreateEmailChangeChallengeInput ¶ added in v0.1.15
type CreatePasswordResetChallengeInput ¶ added in v0.1.14
type EmailTemplateRenderer ¶ added in v0.20.0
type EmailTemplateRenderer interface {
Render(context.Context, domain.EmailTemplate, email.TemplateData) (email.Message, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) BeginRequiredEmailVerification ¶ added in v0.22.0
func (*Service) CompleteEmailChangeChallenge ¶ added in v0.22.0
func (s *Service) CompleteEmailChangeChallenge( ctx context.Context, in CompleteEmailChangeChallengeInput, verifier *VerificationCodeService, now time.Time, ) error
func (*Service) CompletePasswordResetChallenge ¶ added in v0.22.0
func (*Service) CompleteRequiredEmailVerification ¶ added in v0.22.0
func (*Service) CreateEmailChangeChallenge ¶ added in v0.1.15
func (*Service) CreateOpaqueChallenge ¶
func (*Service) CreatePasswordResetChallenge ¶ added in v0.1.14
func (*Service) CreateRequiredEmailVerificationChallenge ¶ added in v0.22.0
func (*Service) CreateSignupChallenge ¶
func (*Service) GetEmailVerificationTransaction ¶ added in v0.22.0
func (*Service) ResendChallenge ¶
func (*Service) VerifySignupChallenge ¶
type VerificationCodeService ¶
type VerificationCodeService struct {
// contains filtered or unexported fields
}
func NewVerificationCodeServiceWithPolicy ¶ added in v0.21.0
func NewVerificationCodeServiceWithPolicy( store *store.Store, policy config.ChallengePolicyReader, secrets ...[]byte, ) *VerificationCodeService
func (*VerificationCodeService) GenerateCode ¶
type VerifySignupChallengeResult ¶
type VerifySignupChallengeResult struct {
Challenge domain.Challenge
Action domain.PendingSignupAction
}
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker( store *store.Store, codeSvc *VerificationCodeService, templates EmailTemplateRenderer, sender email.Sender, logger *slog.Logger, cfg WorkerConfig, ) *Worker
type WorkerConfig ¶
type WorkerConfig struct {
WorkerCount int
PollInterval time.Duration
JobMaxAttempts int
RetryBaseDelay time.Duration
RetryMaxDelay time.Duration
ProcessingStaleAfter time.Duration
StaleReaperInterval time.Duration
MaintenanceBatchSize int
CleanupSentAfter time.Duration
CleanupFailedAfter time.Duration
SendTimeout time.Duration
TransitionTimeout time.Duration
Policy config.EmailPolicyReader
Metrics WorkerMetrics
RandomFloat64 func() float64
}
type WorkerMetrics ¶ added in v0.19.0
Click to show internal directories.
Click to hide internal directories.