Documentation
¶
Overview ¶
Package emailverification manages email ownership verification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyVerified = errors.New("email already verified") ErrAttemptBlocked = errors.New("email verification attempt blocked") ErrConflict = errors.New("email verification conflict") ErrInactiveToken = errors.New("email verification token is inactive") ErrInvalidConfig = errors.New("invalid email verification configuration") ErrInvalidRecord = errors.New("invalid email verification record") ErrInvalidToken = token.ErrInvalidToken ErrNotFound = errors.New("email verification record not found") )
Functions ¶
This section is empty.
Types ¶
type AttemptGuard ¶
type Config ¶
type Config struct {
Lifetime time.Duration
Sender Sender
AttemptGuard AttemptGuard
SecurityEvents SecurityEventSink
NormalizeEmail emailaddress.Normalizer
Now func() time.Time
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) IsVerified ¶
type RequestInput ¶
type SecurityEvent ¶
type SecurityEventSink ¶
type SecurityEventSink interface {
Record(ctx context.Context, event SecurityEvent)
}
type Store ¶
type Store interface {
FindUserByEmail(ctx context.Context, normalizedEmail string) (User, error)
Issue(ctx context.Context, record Record) error
Verify(ctx context.Context, tokenHash TokenHash, verifiedAt time.Time) (User, error)
}
Issue replaces the user's earlier token. Verify accepts the current token once before expiry and marks the same email as verified in one storage operation.