Documentation / @zerotal/auth / Hash
Variable: Hash
constHash:HashService
Defined in: auth/src/facades/Hash.ts:26
The Hash facade — password hashing, backed by HashService (native
Bun.password).
Remarks
Resolves the hash binding from the container, so it is usable only after
app.boot(). The service uses argon2id by default (stronger than bcrypt
for new projects); the algorithm marker is embedded in the returned hash, so
check and needsRehash
need no configuration to verify existing hashes. Auth.attempt calls
needsRehash and transparently upgrades stored hashes on login.
Available methods: make(password), check(password, hash),
needsRehash(hash), selfTest() — see HashService.
Example
import { Hash } from '@zerotal/auth';
const hash = await Hash.make('secret123'); // argon2id hash to persist
const valid = await Hash.check('secret123', hash); // true