Skip to content

v1.7.0

Latest

Choose a tag to compare

@ljoy913 ljoy913 released this 29 Jun 13:55
48b662f

v1.7.0

First release on the new build/test/packaging foundation, bringing the library's
error and validation behavior in line with the W3C Web Crypto specification.
This release contains breaking changes — please review the migration notes below.

Added

  • Rewritten TypeScript declarations (types/msrCrypto.d.ts) describing the MsrCrypto
    surface and resolving for the @microsoft/msrcrypto import (export =).
  • Errors test module asserting correct rejection/throw names, plus the
    previously-unwired CryptoKey test module.
  • npm package metadata (keywords, author, homepage, bugs, exports,
    sideEffects, publishConfig) and a prepublishOnly build guard.
  • Dormant GitHub Actions release workflow that builds, verifies the package, and
    publishes to npm with provenance on tagged releases.

Changed

  • SubtleCrypto algorithm params accept a string AlgorithmIdentifier (e.g.
    "SHA-256") in addition to an object.
  • Invalid input / unsupported algorithms surface as rejected promises per the Web
    Crypto contract.
  • Library errors are DOMExceptions (NotSupportedError, OperationError,
    InvalidAccessError, DataError), with an Error fallback on engines lacking
    DOMException.
  • Bundle version injected from package.json at build time, eliminating version drift.
  • Build migrated to esbuild (build.mjs), producing unminified and minified bundles;
    Node 18+ required.

⚠️ Breaking changes — migration

  • Async errors: wrap SubtleCrypto calls with .catch()/await instead of
    try/catch. Missing/wrong-type arguments reject with TypeError.
  • Error shape: inspect error.name (e.g. OperationError, DataError) rather than
    error.message or custom fields. On engines without DOMException (e.g. IE8), a
    fallback Error carries the same name and legacy code.
  • getRandomValues: throws QuotaExceededError for requests > 65,536 bytes and
    TypeMismatchError for floating-point typed arrays.
  • Stricter generateKey: AES rejects key lengths other than 128/192/256 bits; HMAC
    interprets length as bits.
  • Layout: built output moved lib/dist/, declarations definitions/
    types/. Imports by package name are unaffected; deep paths like
    @microsoft/msrcrypto/lib/... must be updated.
  • Node: minimum supported version is now 18.

Fixed

  • HMAC generateKey honors the optional length (bits) and zeroes unused trailing bits
    for non-byte-aligned lengths.
  • AES generateKey (CBC, GCM, KW) rejects key lengths other than 128/192/256 bits.
  • Removed a stray console.log that leaked exported key material during wrapKey.
  • Fixed a worker result-path error when assigning to read-only DOMException.code.
  • RSA generateKey honors requested usages (routing each to the applicable
    public/private key); RSA-OAEP with ["wrapKey","unwrapKey"] now yields usable keys.

Removed

  • Dead wrapKey.js module and its orphaned JWK byte-serializer. Public
    wrapKey/unwrapKey continue to work via the standard
    export-then-encrypt / decrypt-then-import path.