Changelog - 2026-11-02
CredentialHelper.hash writes argon2id by default
Behavior ChangeIn one line. CredentialHelper.hash in @venizia/ignis-helpers now writes an argon2id hash instead of a bcrypt hash; pass algorithm: 'bcrypt' to keep writing bcrypt.
What changed
- New option
algorithm.hash({ password, algorithm?, cost? })takes'argon2id'or'bcrypt'. The default is'argon2id', with the default parameters ofBun.password(m=65536, t=2, p=1). The output starts with$argon2id$. Before, it always started with$2b$. - Why.
Bun.password.hashwrites argon2id by default. An application that already stores argon2id and adoptedhashwould have moved every new and reset password to the weaker bcrypt, mixed into one column. costis for bcrypt only. It is an integer from 4 to 31, default 10. Passingcostwith argon2id, by default or by name, throws an error that says to passalgorithm: 'bcrypt'. It is not ignored. An unknownalgorithmthrows too.verifyis unchanged. It reads bcrypt (including the 72-byte retry for hashes thebcryptpackage wrote) and argon2 hashes. Hashes already stored keep working and nothing is rehashed.- No 72-byte limit for argon2id. The 72-byte notes apply to bcrypt hashes only.
Who is affected
- Callers of
hashthat pass noalgorithm. New hashes are argon2id. To keep writing bcrypt, passalgorithm: 'bcrypt'. - Callers that pass
cost. Addalgorithm: 'bcrypt', orhashthrows. - Stored hashes. Not affected.
Details
typescript
import { CredentialHelper } from '@venizia/ignis-helpers';
// argon2id, the default
const stored = await CredentialHelper.hash({ password: 'hunter2' });
// bcrypt, as before
const legacy = await CredentialHelper.hash({ password: 'hunter2', algorithm: 'bcrypt', cost: 12 });
// refused: cost applies to bcrypt only
await CredentialHelper.hash({ password: 'hunter2', cost: 12 });