Changelog - 2026-08-30
A Real Hash Class, and hash() Is Removed
New Feature Security Breaking ChangeIn one line. Hash joins AES/RSA/ECDH in the crypto module. The old hash() free function is removed, not deprecated, and every caller must migrate to Hash.
What changed
- New
Hashclass built likeAES/RSA(Hash.withAlgorithm(algorithm), options-object methods), with nodecryptsince a digest cannot be reversed.digest({ message, opts? })- a plain digest. Takes no secret.hmac({ message, secret, opts? })- a keyed HMAC. A missing or emptysecretthrows instead of silently degrading to a plain digest.
- Five algorithms, three output encodings:
HashAlgorithms(MD5,SHA1,SHA256,SHA384,SHA512) andHashOutputEncodings(HEX,BASE64,BASE64URL). hash()is removed, with no shim or alias. The old function returnedtextunhashed when a SHA256secretwas missing or the algorithm was unknown, with no error. That bug is gone with it.
import { Hash, HashAlgorithms } from '@venizia/ignis-helpers';
// Plain digest - no secret possible, by design.
Hash.withAlgorithm(HashAlgorithms.SHA256).digest({ message: 'payload' });
// HMAC - secret required, validated non-empty.
Hash.withAlgorithm(HashAlgorithms.SHA256).hmac({ message: 'payload', secret: 'my-secret' });Who is affected
- Every existing
hash()caller. Any code that imports it fails to compile. Migrate toHashusing the table below. - Digests are unchanged byte-for-byte, so a migrated call site produces the same value, and a payment gateway checksum still verifies.
- MD5 and SHA1 remain available for wire-protocol compatibility (VNPay checksums and similar). They are unsuitable for security decisions. Prefer SHA256 or better for anything new.
Breaking changes
WARNING
hash() is removed, not deprecated. Migrate every call site to Hash before upgrading. Output is identical, only the call shape changes.
| Old call | New call |
|---|---|
hash(data, { algorithm: 'MD5', outputType: 'hex' }) | Hash.withAlgorithm(HashAlgorithms.MD5).digest({ message: data, opts: { outputEncoding: HashOutputEncodings.HEX } }) |
hash(data, { algorithm: 'SHA256', secret, outputType: 'base64' }) | Hash.withAlgorithm(HashAlgorithms.SHA256).hmac({ message: data, secret, opts: { outputEncoding: HashOutputEncodings.BASE64 } }) |
hash(data, { algorithm: 'SHA256', secret, outputType: 'hex' }) | Hash.withAlgorithm(HashAlgorithms.SHA256).hmac({ message: data, secret, opts: { outputEncoding: HashOutputEncodings.HEX } }) |
outputEncoding defaults to hex, so opts can be dropped for hex:
Hash.withAlgorithm(HashAlgorithms.MD5).digest({ message: data });AES Key Derivation Accepts a Per-Deployment Salt
New Feature SecurityIn one line. AES.encrypt/decrypt accept optional kdfSalt/kdfIterations. Omit both and nothing changes.
Every IGNIS deployment derives AES keys with the same default salt, DEFAULT_KDF_SALT, so one precomputed table works against every deployment that uses a weak passphrase. The default cannot change, because existing ciphertext would become unreadable. This is an opt-in override.
- Supply the same values on both sides of a round trip. Omit both and the derivation is identical to before.
- A
kdfSaltunder 16 UTF-8 bytes throws. LegacyAES,RSAandECDHdo not accept these options.
| Option | Type | Default | Meaning |
|---|---|---|---|
kdfSalt | string | DEFAULT_KDF_SALT | PBKDF2 salt. Minimum 16 UTF-8 bytes when supplied. |
kdfIterations | number | DEFAULT_KDF_ITERATIONS (100,000) | PBKDF2 iteration count. |
import { AES } from '@venizia/ignis-helpers';
const aes = AES.withAlgorithm('aes-256-gcm');
const isolated = aes.encrypt({
message: 'payload',
secret: 'my-secret',
opts: { kdfSalt: 'this-deployment-only-salt-value' },
});
// The same salt is required to decrypt - a mismatched or missing one fails.
aes.decrypt({
message: isolated,
secret: 'my-secret',
opts: { kdfSalt: 'this-deployment-only-salt-value' },
});Who is affected. Existing callers need to do nothing. A deployment wanting isolation should pass a unique kdfSalt (16+ bytes) and keep it identical between encrypt and decrypt, since it is stored nowhere else.