feat(identity): confirm the email address with a six-digit code from the message

This commit is contained in:
shira committed 2026-10-10 00:52:46 +03:00
1 parent c94434cd09
commit d365a05c96
87 files changed
+4764 -224

No files matched your search

@@ -176,6 +176,20 @@ type EmailTokenRepository interface {
// ErrUserVersionConflict; the rollback also restores the token. The
// confirmation usecase maps that outcome to verification_token_invalid.
Consume(ctx context.Context, hash domain.SecretTokenHash, purpose domain.EmailTokenPurpose, at time.Time) (domain.EmailToken, error)
// FindOpenCodeByAddress returns the newest open verification token that
// carries a code for the unverified account with the normalized address,
// and whose registration is current. It returns ErrEmailTokenNotFound when
// there is none. The caller compares the code and the password, then
// consumes the token with Consume in its transaction.
FindOpenCodeByAddress(ctx context.Context, email domain.EmailAddress) (domain.EmailToken, error)
// RecordFailedCodeAttempt counts one wrong code or password against the
// open token with the ID at the given time. The attempt that reaches
// domain.VerificationCodeMaxFailedAttempts invalidates the token, drops
// its code and pending credentials, and reports burned true. A token that
// is no longer open is left unchanged and reports false without an error.
RecordFailedCodeAttempt(ctx context.Context, id uuid.UUID, at time.Time) (burned bool, err error)
}
// SessionRepository stores server-side sessions by the hash of their token.