HashManager class final

Creates and verifies password hashes off the event loop.

Both make and check run in warm compute isolates, so a 100 ms Argon2id derivation never stalls other requests on the HTTP isolate (ADR-004/ADR-008). At most HashConfig.concurrency run at once; others wait, up to HashConfig.maxQueue of them for HashConfig.queueTimeout, and past that fail with HashingSaturatedException (a 503), so a login burst queues instead of spawning an isolate per attempt.

Constructors

HashManager(HashConfig config)
A manager hashing with config.

Properties

config → HashConfig
The hash settings.
final
hashCode → int
The hash code for this object.
no setterinherited
isolates → int
Hashing isolates alive right now.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
waiting → int
Hashes waiting for an isolate right now.
no setter

Methods

check(String plain, String hashed) → Future<bool>
Verifies plain against hashed; the driver is detected from the hash prefix. Unknown or malformed hashes never match.
checkAgainstDummy(String plain) → Future<void>
Spends the same time as a real check of plain, for when no user matched the credentials, so response timing does not reveal which accounts exist (BLUEPRINT_V2 §9.2 item 9). Completes normally, whatever plain is, unless hashing itself fails (HashingSaturatedException); a failed dummy hash is made again by the next call.
close() → Future<void>
Stops the hashing isolates (Application.shutdown); the next hash starts them again.
info(String hashed) → HashInfo
Parses the driver and cost parameters out of hashed.
isHashed(String hashed) → bool
Whether hashed looks like a hash produced by any known driver.
make(String plain, {HashDriver? driver}) → Future<String>
Hashes plain with the configured driver (or driver).
needsRehash(String hashed) → bool
Whether hashed was produced by a different driver or cost than the current configuration (call after a successful login to upgrade).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited