-
Bcrypt work factor for user passwords.
configureMiddlewareinstalls it as the app’s password hasher.Declaration
Swift
static let bcryptCost: Int -
Bcrypt hash of a random throwaway value, at
bcryptCost. When an account lookup fails, verify the submitted secret against this anyway, so the response takes about as long as it would for a real account.Declaration
Swift
static let dummyPasswordHash: String -
dummyPasswordVerify(_:Asynchronouson: ) Burns one bcrypt verification’s worth of time. The result is always discarded.
Declaration
Swift
static func dummyPasswordVerify(_ secret: String, on req: Request) async -
Bcrypt work factor for recovery keys. Higher than
bcryptCostbecause a 3-word recovery key has far less entropy than a typical password, and recovery keys are hashed and verified rarely enough that the cost is cheap.Declaration
Swift
static let recoveryKeyBcryptCost: Int -
Bcrypt hash of a random throwaway value, at
recoveryKeyBcryptCost. SeedummyPasswordHash.Declaration
Swift
static let dummyRecoveryKeyHash: String -
hashRecoveryKey(_:Asynchronouson: ) Hashes a normalized recovery key at
recoveryKeyBcryptCoston the thread pool, off the event loop.Declaration
Swift
static func hashRecoveryKey(_ normalizedKey: String, on req: Request) async throws -> String -
dummyRecoveryKeyVerify(_:Asynchronouson: ) Burns one recovery-key verification’s worth of time. The result is always discarded.
Declaration
Swift
static func dummyRecoveryKeyVerify(_ secret: String, on req: Request) async -
Hash a String. ChatGPT wrote this.
Declaration
Swift
static func sha256Hash(of string: String) -> String
View on GitHub