High-level
- The package is now ESM-only. ESM can finally be loaded from common.js on node v20.19+
- Node v20.19 is now the minimum required version
- Package imports now work correctly in bundler-less environments, such as browsers
- Reduces npm package size (traffic consumed): 152KB => 136KB
- Reduces unpacked npm size (on-disk space): 1.1MB => 669KB
- Make bundle sizes smaller, compared to v1.x
.jsextension must be used for all modules- Old:
@noble/hashes/sha3 - New:
@noble/hashes/sha3.js - This simplifies working in browsers natively without transpilers
- Old:
Changes
- Only allow Uint8Array as hash inputs, prohibit
string- Strict validation checks improve security
- To replicate previous behavior, use
utils.utf8ToBytes
- Rename / remove some modules for consistency. Previously, sha384 resided in sha512, which was weird
sha256,sha512=>sha2.js(consistent withsha3.js)blake2b,blake2s=>blake2.js(consistent withblake3.js,blake1.js)ripemd160,sha1,md5=>legacy.js(all low-security hashes are there)_assert=>utils.jscryptointernal module got removed: use built-in WebCrypto instead
- Improve typescript types & option autocomplete
- Upgrade typescript compilation env to ts5.9 and es2022
- Massively improve error messages, make them more descriptive
Full Changelog: 1.8.0...2.0.0