Skip to main content

Module email_verification

Module email_verification 

Source
Expand description

Email Verification API Endpoints

Handles email address verification through token-based confirmation.

§Storage keys

  • email_verify:{token} — user_id bytes, TTL 24 hours (verification link)
  • User JSON email_verified field — true once verified

§Flow

  1. User registers → email_verified set to false in user record
  2. POST /auth/verify-email/send → generates a verification token and hands it to the configured EmailVerificationSender
  3. POST /auth/verify-email → verifies token, sets email_verified: true
  4. POST /auth/resend-verification → same as 2 for a not-yet-logged-in user

The token proves control of the mailbox, so it is delivered ONLY through the sender (see ApiState::with_email_verification_sender) and is never part of a response. Without a sender nothing can be delivered and verification cannot complete.

Structs§

ResendVerificationRequest
Request body for POST /auth/resend-verification.
VerificationSentResponse
Response to a request to send a verification message. It never contains the token.
VerifyEmailRequest
Request body for POST /auth/verify-email.

Traits§

EmailVerificationSender
Delivers a verification token to the mailbox it proves ownership of.

Functions§

resend_verification
POST /auth/resend-verification
send_verification
POST /auth/verify-email/send
verify_email
POST /auth/verify-email