Changelog
June 26, 2026 ยท View on GitHub
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.7.0 - 2026-06-26
Breaking Changes
- Errors for invalid input and unsupported algorithms are now delivered as a
rejected promise instead of being thrown synchronously. Code relying on a
synchronous
try/catcharoundSubtleCryptocalls must move to.catch()/await. - Error objects changed shape: failures are now
DOMExceptions with specification names (e.g.OperationError,DataError) rather than plainErrors. Code inspectingerror.messageor custom error fields may need to switch toerror.name. getRandomValuesnow throwsQuotaExceededErrorfor requests larger than 65,536 bytes andTypeMismatchErrorfor floating-point typed arrays, where previously such calls may have succeeded.generateKeyvalidation is stricter: AES rejects key lengths other than 128, 192, or 256 bits, and HMAC interpretslengthas bits. Inputs accepted by earlier versions may now be rejected.- Built output moved from
lib/todist/and type declarations fromdefinitions/totypes/. Imports by package name are unaffected, but deep paths such as@microsoft/msrcrypto/lib/...must be updated. - The minimum supported Node.js version is now 18.
Added
- TypeScript declarations (
types/msrCrypto.d.ts) were rewritten to describe the library's ownMsrCryptosurface and to resolve for the@microsoft/msrcryptoimport specifier (viaexport =). - An
Errorstest module that asserts the public APIs reject/throw with the correct error names, plus the previously-unwiredCryptoKeytest module. - npm package metadata (
keywords,author,homepage,bugs,exports,sideEffects,publishConfig) and aprepublishOnlybuild guard. - Dormant GitHub Actions release workflow that builds, verifies the package, and publishes to npm with provenance on tagged releases.
Changed
SubtleCryptoalgorithm parameters now accept a stringAlgorithmIdentifier(e.g."SHA-256") in addition to an object, matching the W3C Web Crypto spec.SubtleCryptomethods now surface invalid input and unsupported algorithms as a rejected promise instead of throwing synchronously, per the Web Crypto contract. Missing or wrong-type arguments reject with aTypeError.- Errors raised by the library are now
DOMExceptions with specification names (NotSupportedError,OperationError,InvalidAccessError,DataError), falling back to anErrorcarrying the name and legacy code on engines without aDOMExceptionconstructor (e.g. IE8). getRandomValuesnow throwsQuotaExceededErrorfor requests larger than 65,536 bytes andTypeMismatchErrorfor floating-point typed arrays.- The library version is now injected into the bundle from
package.jsonat build time, eliminating version drift between the package and the bundle. - The build system was migrated to esbuild (driven
by
build.mjs), producing the unminified and minified bundles, and the minimum supported Node.js version was raised to 18. - Repository layout: built output moved from
lib/todist/, type declarations fromdefinitions/totypes/, and sources undersrc/. The publishedmain/typespaths are resolved throughpackage.json, so installs via the package name are unaffected; only deep paths such as@microsoft/msrcrypto/lib/...changed.
Fixed
- HMAC
generateKeynow honors the optionallengthparameter correctly (bits, not bytes) and zeroes the unused trailing bits of the final byte for non-byte-aligned lengths, matching native Web Crypto behavior. - AES
generateKey(CBC, GCM, KW) now rejects key lengths other than 128, 192, or 256 bits instead of accepting any multiple of 8. - Removed a stray
console.logthat leaked exported key material duringwrapKey. - Fixed an error in the worker result path that threw when assigning to the
read-only
DOMException.codeproperty. SubtleCrypto.generateKeyfor RSA algorithms now honors the requested key usages (routing each usage to the public or private key it applies to) instead of forcing a fixed pair. Generating anRSA-OAEPkey with["wrapKey", "unwrapKey"]now yields keys usable withwrapKey/unwrapKey.
Removed
- Dead, unreachable
wrapKey.jsmodule (legacy JWE-style key wrapping that was never dispatched) and its orphaned JWK byte-serializer helper. The publicwrapKey/unwrapKeycontinue to work via the standard export-then-encrypt / decrypt-then-import path.
1.6.0
- Automatic web-worker usage is disabled by default. When enabled, it may cause problems when the library is bundled with other scripts.
rawkey import support for HMAC & ECDH.spkipublic key import for RSA.wrapKeysupport for AES-CBC, AES-GCM, RSA-OAEP.- PBKDF2 key derivation algorithm.
- Additional side-channel protection.
- Moved source to GitHub.
1.5.0
- Added support for streaming input/output data to crypto calls.
- Allow concurrent crypto calls of the same type at the same time.
- Added
rawkeyImport/keyExport format for HMAC, AES-CBC, AES-GCM. - Added
IE11PromiseWrapper.jsto wrap the IE11 non-standard Web Crypto API so it behaves like the current standard Promise-based API. - Removed RSASSA-PKCS1-v1_5 encrypt/decrypt algorithm (obsolete, no longer supported by modern browsers).
- Added TypeScript definitions (
msrCrypto.d.ts). - Moved the Promise polyfill outside of the library so the built-in browser version can be used when available.
1.4.0
- Updated the API to the latest Web Crypto API spec and modern browser implementations.
- Promises are now supported; the IE11-style event callbacks were removed. This
is a breaking change for code using the pre-1.4
onComplete/onErrorcalling conventions.