Skip to content

refactor(deps): replace webcrypto-core converters with @peculiar/utils 4.1 - #98

Merged
donskov merged 1 commit into
masterfrom
donskov/webcrypto-5-utils
Oct 27, 2026
Merged

donskov merged 1 commit into
masterfrom
donskov/webcrypto-5-utils

Conversation

@donskov

@donskov donskov commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #97 (part 5 of 7 for @peculiar/webcrypto 2.0.0; merge in order).

  • core.PemConverter → pem.decodeFirst/pem.encode from @peculiar/utils/pem (Ed25519/X25519 PEM storage, 6 call sites); core.BufferSourceConverter → toArrayBuffer/toUint8Array (HKDF from @peculiar/utils/bytes, Ed25519 sign from the root import the file already used).
  • @peculiar/utils ^2.0.2 → ^4.1.0, root and subpaths only, no /legacy. It runs next to webcrypto-core 1 (which keeps its own stateless utils 2 copy), so the core bump in PR 6 needs no code changes.
  • No behavior change. The PEM text is never consumer input: it comes from Node.js KeyObject.export({ format: "pem" }) or our own encode, and every such input decodes to the same bytes as before (see the comparison table in the summary). New specs (pass on the old and new code): pkcs8/spki export equals Node.js DER, byte-for-byte round trips, JWK → pkcs8, HKDF RFC 5869 with offset views, JWK base64url rules (unpadded only).

Placed after build! so master never ships a CommonJS build that require()s the ESM-only utils 4 while declaring >=14.18.0.

@donskov
donskov force-pushed the donskov/webcrypto-4-build branch 2 times, most recently from 7a1d61c to 1f210fb Compare October 27, 2026 11:07
Base automatically changed from donskov/webcrypto-4-build to master October 27, 2026 11:09
…s 4.1

Ed25519/X25519 keys use pem.decodeFirst/pem.encode from
@peculiar/utils/pem instead of core.PemConverter, and HKDF and Ed25519
use toArrayBuffer/toUint8Array instead of core.BufferSourceConverter.
webcrypto-core 2 no longer exports either class, so this keeps the
core upgrade small. @peculiar/utils moves from ^2.0.2 to ^4.1.0
(root and subpath API only, no /legacy).

No behavior change: the PEM text is internal (Node.js KeyObject
exports and our own encode), and every such input decodes to the same
bytes as before. New specs pin it: pkcs8/spki export equals Node.js
DER, byte-for-byte round trips, JWK -> pkcs8. Also covered: HKDF
against RFC 5869 with offset views, and the base64url rules for JWK
members (unpadded only; padding, +/ and invalid characters rejected),
which match 1.7.1.
@donskov donskov self-assigned this Oct 27, 2026
@donskov
donskov force-pushed the donskov/webcrypto-5-utils branch from e5d2030 to 640fb71 Compare October 27, 2026 11:10
@donskov
donskov merged commit 3cdf36b into master Oct 27, 2026
1 of 2 checks passed
@donskov
donskov deleted the donskov/webcrypto-5-utils branch October 27, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant