Auth.PasswordReset
Auth
Password-reset tokens.
Mirrors Email.verificationToken with purpose = "password.reset". Compose with Email.send in the app to deliver the link; this module only mints and checks tokens.
Types
Error
type Error = BadTokenWhy token verification failed.
Examples
Err Auth.PasswordReset.BadTokenValues
token
token : String -> Int -> String -> StringMint a reset token for email.
ttlSeconds must be positive. Uses HS256 with secret (same rules as Jwt.signWithExp).
Examples
Auth.PasswordReset.token secret 3600 "ada@example.com"verify
verify : String -> String -> Result Error StringVerify a token from token.
Returns the email on success. Wrong secret, bad signature, wrong purpose, missing email claim, or expired exp are Err BadToken.
Examples
Auth.PasswordReset.verify secret resetTokenerrorToString
errorToString : Error -> StringHuman-readable form of an Error for logs.
Examples
Auth.PasswordReset.errorToString BadToken