DecoyVerify.ts overview
Constant-work password verification shared by the password sign-in flows (EmailPassword, Username). Internal: not exported from any barrel.
Exports Grouped by Category
utils
lazyDecoyHash
A getter for a decoy hash, computed with passwordHasher on first use and cached, so an attempt against a missing account does the same hashing work as one against a real account.
Signature
declare const lazyDecoyHash: (
passwordHasher: typeof PasswordHasher.Service,
spanName: string
) => () => Effect.Effect<string, Errors.HashingError>
storedPasswordVerifier
The check for a password against a user’s stored hash, resolved once where the caller resolves its other services: MultiAlgorithmVerifier when it is in context, so a hash written by a previous hasher still verifies after a switch, else passwordHasher.
Signature
declare const storedPasswordVerifier: (
passwordHasher: typeof PasswordHasher.Service
) => Effect.Effect<(password: string, hash: string) => Effect.Effect<boolean, Errors.HashingError>>
verifyPasswordOrDecoy
Verify password against the stored hash, or against the decoy hash when there is none, so timing is constant whether or not the account exists. Routes through MultiAlgorithmVerifier when present so a hasher switch does not lock out existing users, and reads a HashingError from the verifier as false so sign-in answers invalid credentials, never a 500.
Signature
declare const verifyPasswordOrDecoy: (
passwordHasher: typeof PasswordHasher.Service,
password: string,
passwordHash: Option.Option<string>,
decoyHash: () => Effect.Effect<string, Errors.HashingError>
) => Effect.Effect<boolean, Errors.HashingError>