100 Commits
Author SHA1 Message Date
Filip Skokan 754d5d49e4 ci: track staged npm release availability 2026-07-30 01:17:32 +02:00
Filip Skokan fb41b2616d chore(release): 6.2.5 2026-07-30 00:49:35 +02:00
Filip Skokan d162246556 refactor(types): trim published declaration comments
Signed-off-by: Filip Skokan <[email protected]>
2026-07-30 00:37:15 +02:00
Filip Skokan 882c770fe8 ci: enforce the family split and check the built dist
Rename the CI job to package, restore the cached dist from the build job,
fail on cache misses, and run the bundle-family check against that
artifact.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan 98996e04f4 refactor: fold single-consumer modules into their consumers
Move key-management algorithms into key_management.ts, key export
conversion into key/export.ts, and key validation and conversion into
key.ts. Freeze mutable asymmetric JWK inputs and key_ops before cached
import.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan 3df4582060 refactor: discriminate a key once
Return a tagged key shape from checkKeyType and consume it in prepareKey,
combining validation and conversion into one discrimination pass.
Validate supplied ECDH-ES ephemeral keys through the same private-key
path.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan 3f50c6dadc refactor: parse a Protected Header in one place
Add parseJoseHeader and use it to decode and validate protected headers
for JWS, JWE, and decodeProtectedHeader.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan 474c6d39be refactor: write each algorithm identifier once
Construct the algorithm registries with a shared null-prototype table
helper that assigns each record key as the entry identifier.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan 30494d7538 refactor: generate and import keys from the entry
Use algorithm registry entries to supply WebCrypto parameters and key
usages for asymmetric key generation and ASN.1 imports.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan 0339ecf34f refactor: assert key shape and type from the entry
Validate CryptoKey algorithms and JWK key types and operations from
registry entry metadata. Describe direct content-encryption keys and
operation-specific ECDH key_ops in their entries.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan cf922ce649 refactor: resolve the content encryption algorithm once
Resolve the content-encryption entry with the protected header and pass
it through JWE processing. Use entry metadata for CEK and IV sizing,
cipher selection, and AES-GCM key wrapping.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan de5a61a7fd refactor: keep JWE out of the JWKS and embedded-JWK paths
Resolve JWKS and embedded-JWK imports against the JWS registry and import
with jwkToKey. Use registry metadata for candidate filtering and apply
RSA oth rejection in the shared import path.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan d8b3f3d179 refactor: keep JWS and JWE out of each other's bundles
Split algorithm metadata into JWS and JWE registries and pass resolved
key descriptors through JWK conversion, key normalization, and JOSE
operations. Enforce family boundaries with check:bundles.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:03 +02:00
Filip Skokan e043a2f8ce refactor: describe each JWS algorithm once
Define JWS key metadata, WebCrypto parameters, usages, and RSA limits in
a single registry. Pass resolved entries through JWS
signing and verification.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:52:02 +02:00
Filip Skokan 4d970fe995 refactor: validate each token once rather than once per layer
Route compact, flattened, general, and JWT operations through shared JWS
and JWE cores so each token is validated, parsed, and encoded once.
Consolidate critical-header and algorithm-option validation.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 336062cca8 test: cover General JOSE across runtimes
Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 89d71ed07d build: add a per-subpath bundle report
Report each published subpath's minified size, reachable modules, and
cross-family algorithm leakage. Include package artifact sizes, JSON
output, baseline comparisons, and a check mode.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 5d1cff6065 test(types): cover public type regressions
Add regression coverage for JWK interoperability, open JOSE
identifiers, resolver signatures and result inference, error
discrimination, and conditional key result helpers.

Compile a second target without DOM or Node ambient types to exercise
the structural CryptoKey fallback and ensure it cannot degrade to any.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 101557a764 docs: document consumer-supplied type parameters
Document PayloadType on JWT results and decoders, and KeyType on
dynamic key resolvers so consumers know what each explicit argument
controls. Correct ResolvedKey type-parameter tags in generated docs.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 2fbc402cb1 build: normalize declaration comments
Run declaration comment cleanup during build:types instead of postbump.
Local builds and package checks now inspect the declarations shipped in
releases. Remove examples, subpath notes, and docs-only tags. Relabel
GitHub alerts for editor hovers.

Use fence-aware parsing so TypeScript examples do not leave orphaned
code in published declarations.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 5b3786bcbf build: stop building for deno.land/x
Remove the obsolete deno.land/x artifact and its release handling now
that the registry is read-only. Check the original sources with Deno
instead; JSR and npm remain supported distribution paths.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 02f16209ca build: strip subpath notes from declarations
Remove repeated import-location prose from emitted declaration
comments to keep editor hovers concise. Keep it in source JSDoc because
generated API pages rely on it for actual package specifiers.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 36412c8517 build: pin package validation tools
Install publint and ATTW from the lockfile so package validation cannot
change between CI runs.

Resolve the local ATTW CLI directly and use `npm exec --no` for other
installed tools, preventing implicit network fetches.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan a0b786baca ci: add type and package checks
Build every nested declaration and type-check the emitted entry points
across supported module-resolution and library configurations.

Validate type regressions, documented subpaths, package metadata, type
resolution, and generated docs in CI. Expand dist cache inputs.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan f7ef7912cd docs: correct subpaths and API documentation
Correct subpath names that otherwise lead users to unexported entries,
and fix examples, links, and missing descriptions in published JSDoc.

Use instanceof in JWKS recovery examples so strict TypeScript can
narrow caught errors.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan abec502715 refactor(types): add discriminated JOSE error types
Pair each JOSE error subclass with its stable code so code switches can
narrow safely without closing subclass code values.

Share typed causes and reasons across JWT claim-validation errors, and
make consumer-created multiple-match errors safely iterable. Add
compile-time coverage for the public type surface.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan acb2913e8e refactor(types): improve key and result inference
Thread resolver return types through verify and decrypt results. Add
overloads so wrappers can forward either keys or resolvers.

Infer importJWK and generateSecret results from their inputs. Keep JWT
payload generics unconstrained while rejecting known non-object shapes.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 86eecfc557 refactor(types): add JOSE identifier unions and JWK narrowing
Expose supported JOSE and HTTP signature identifiers to editors while
keeping arbitrary strings assignable for extension algorithms.

Add AnyJWK so callers can narrow supported JWK shapes by "kty".

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00
Filip Skokan 2bcf40f7be build: simplify generated type documentation
Render open identifier unions as `string` because their extra arms only
drive editor completion without narrowing accepted values. Fold the
equivalent inline unions as well.

Omit the redundant `JWK = object` and `JWKParameters = object` lines;
their pages list the object members immediately below.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:45:18 +02:00
Filip Skokan fa8a53f6c5 refactor: tighten key property checks
Read JWKS keys and `Symbol.toStringTag` through explicit structural
types. Replace the remaining `@ts-ignore` directives with
`@ts-expect-error` so stale suppressions fail the build.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:45:03 +02:00
Filip Skokan f14cbe56b5 fix: reject truncated ASN.1 key data
Check ASN.1 byte and subarray reads so truncated DER fails at the parse
site instead of propagating invalid offsets into Web Crypto.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:45:03 +02:00
Filip Skokan 54c3627474 fix(types): correct key resolver and JWT header types
Match the protected header of each resolver callback to the value
supplied by its operation. Expose the members attached to local and
remote JWKS resolvers through named callable interfaces.

Allow `JWTHeaderParameters.b64` to be boolean. A false value is inert
unless "b64" is listed in "crit", so signing and verification accept it.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:45:03 +02:00
Filip Skokan 8d9ece5c1a fix(types): correct JWK and CryptoKey types
Declare JWK shapes as aliases so they satisfy the implicit index
signatures used by host `JsonWebKey` types. Export the AKP variants,
add "oth", and exclude private members from embedded JWK headers.

Alias the host `CryptoKey` when available and use a checked fallback
otherwise, avoiding both a competing nominal type and an `any` result.
Narrow `KeyObject.type` to the values it can hold.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:44:48 +02:00
Filip Skokan fb02fad15a build: tighten TypeScript checks
Use NodeNext resolution so imports follow the exports map and require
the .js extensions used by the source. Enable stricter checks to catch
future regressions.

Require isolated declarations before publishing and add the explicit
internal annotations needed to keep declaration emit stable.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:44:48 +02:00
Filip Skokan 6d2d9ed4d8 refactor: unify base64 decode errors
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 16:08:57 +02:00
Filip Skokan f41cd06ee1 test: correct the RFC 7520 cookbook section labels
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan 3111d229bd docs: stop claiming the JWK "use" parameter is used during import
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan 2e922ad0aa fix: reject invalid UTF-8 in JOSE Headers and JWT Claims Sets
TextDecoder defaults to fatal: false, so ill-formed sequences became U+FFFD
rather than failing RFC 7519 Section 7.2 step 10. A strict decoder is used
for structural decoding only.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan 95e037aae0 fix: reject duplicate "crit" values when producing
RFC 7515 Section 4.1.11 forbids duplicate names in the "crit" list.
Consuming stays permissive, as the same section only lets a recipient
consider them invalid.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan cbb355fc25 fix: surface non-ASCII token segments as JOSE errors
The JWS payload and the JWE "aad" member reach the ASCII-only encode()
before they are base64url decoded, so a non-ASCII value threw a bare
TypeError instead of a JOSEError.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan 0ad8df964a refactor: correct swapped JWE unprotected header type error messages
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan ae8f949a48 fix: handle a zero-length JWE additional authenticated data
An empty JWE AAD is now equivalent to none.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan 53c4920fc6 fix: reject an unencoded payload in the JWS Compact Serialization
The guard tested jws.payload === undefined, which FlattenedSign never
produces, so CompactSign emitted a JWS with an empty payload segment.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:05 +02:00
Filip Skokan 46a7c575f4 fix: reject a generateKeyPair crv option the algorithm does not imply
options.crv was only read in the ECDH-ES branch, so asking for Ed448
returned an Ed25519 key instead of an error.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:04 +02:00
Filip Skokan 19d2420233 fix: validate the clockTolerance and currentDate options are finite
NaN and Infinity passed the typeof switch and made every timestamp
comparison false, turning the "nbf", "exp", and maxTokenAge checks into
no-ops.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:04 +02:00
Filip Skokan c1145ac9b2 fix: compare claim values for falsy validation options
The value comparisons were gated on truthiness while the presence checks
use !== undefined, so an empty string or a maxTokenAge of 0 required the
claim to be present and then accepted any value for it.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:04 +02:00
Filip Skokan 5731ebdc62 fix: forward key management parameters for a single JWE recipient
GeneralEncrypt's single-recipient path omitted setKeyManagementParameters,
dropping "apu" and "apv" for ECDH-ES and falling back to the default PBES2
"p2c".

Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:04 +02:00
Filip SkokanandYarchik 74641a241c fix: reject characters outside the Base64URL alphabet
The fallback path translated "-" and "_" into "+" and "/" and handed the
result to atob, which accepts them, so "a+b/" decoded as an alias instead
of being rejected on runtimes without Uint8Array.fromBase64.

Closes: #879
Co-authored-by: Yarchik <[email protected]>
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 14:10:04 +02:00
Filip Skokan 19fe4ee44e docs: update CHANGELOG.md
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 12:27:23 +02:00
Filip Skokan 79ca7939eb chore: update references to the new RFC editor 2026-07-28 12:19:30 +02:00
Filip Skokan 04c82a0767 build: add a standalone script for docs generation
Signed-off-by: Filip Skokan <[email protected]>
2026-07-28 12:12:23 +02:00
Filip Skokan fcc680a84b chore(release): 6.2.4 2026-07-21 23:24:41 +02:00
Filip Skokan 0f222197ff chore: bump packages 2026-07-21 23:24:28 +02:00
Filip Skokan 6fc93fe5e5 refactor: normalize JWK export members from runtime quirks 2026-07-21 23:22:30 +02:00
Filip Skokan 9ad2fe448a chore: bump packages 2026-07-18 21:31:38 +02:00
Filip Skokan 6d9a2dc9c6 test: update electron expectations
Signed-off-by: Filip Skokan <[email protected]>
2026-07-08 15:03:45 +02:00
Filip Skokan f11ec7e891 test: update electron expectations
Signed-off-by: Filip Skokan <[email protected]>
2026-07-05 16:51:23 +02:00
Filip Skokan 4bd4b84fa8 test: update expected runtime support
Signed-off-by: Filip Skokan <[email protected]>
2026-06-12 19:13:14 +02:00
Filip Skokan 61451bed5c chore: bump packages 2026-05-28 13:54:41 +02:00
Filip Skokan f7778bd313 build: use staged publishing for npm packages
Signed-off-by: Filip Skokan <[email protected]>
2026-05-22 20:33:46 +02:00
Filip Skokan 2b3ac0840e chore: bump packages 2026-05-21 09:14:39 +02:00
Filip Skokan 93e98d4b90 chore: update dilithium link 2026-05-20 09:18:15 +02:00
Filip Skokan 7a9c9a1b58 test: update remote jwks tests to run on node 26 2026-05-04 15:42:01 +02:00
Filip Skokan 095658eb7b docs: update README.md and SECURITY.md to reflect passed EOL dates
Signed-off-by: Filip Skokan <[email protected]>
2026-05-04 12:41:25 +02:00
Filip Skokan fa9e8e95a2 chore: update SECURITY.md 2026-04-28 10:47:07 +02:00
Filip Skokan 6140bd9557 chore: update SECURITY.md 2026-04-28 10:17:02 +02:00
Filip Skokan c98f86467e chore: update SECURITY.md 2026-04-28 09:59:28 +02:00
Filip Skokan 1f4408fd93 chore(release): 6.2.3 2026-04-27 17:22:37 +02:00
Filip Skokan 946bf64241 chore: account for commit-and-tag-version instead of standard-version 2026-04-27 17:22:19 +02:00
Filip Skokan 9bfd68ecdb chore: update CHANGELOG.md header 2026-04-27 17:19:15 +02:00
Filip Skokan ab6a4b128d refactor: cleanly reject invalid PBES2 p2c 2026-04-27 17:18:50 +02:00
Filip Skokan 5d1f2675b5 test: update Bun expectations 2026-04-20 13:46:01 +02:00
Filip Skokan c1ff8b91f4 chore: use fs.globSync 2026-04-13 15:54:41 +02:00
Filip Skokan 5b41f07893 build: replace rollup umd build with a custom esbuild iife wrap 2026-04-13 15:48:26 +02:00
Filip Skokan b91332f052 chore: bump packages 2026-04-13 15:36:22 +02:00
Filip Skokan ef7f0ad231 chore: bump packages 2026-03-28 13:09:14 +01:00
Filip Skokan df46e2a36b test: update deno expectations 2026-03-26 08:20:19 +01:00
Filip Skokan 5fad4fb7bf chore: bump packages 2026-03-19 15:41:14 +01:00
Filip Skokan cf9faea8eb chore(release): 6.2.2 2026-03-18 22:26:23 +01:00
Filip Skokan d88fee07fc fix: reject failed decompression with JWEInvalid error 2026-03-18 22:16:09 +01:00
Filip Skokan 2b522267cc chore(release): 6.2.1 2026-03-09 09:45:34 +01:00
Filip Skokan 795b9d385e refactor: reorganize internals, less files, smaller footprint 2026-03-09 09:43:39 +01:00
Filip Skokan 6f87fdd0bc test: use playwright instead of testcafe 2026-03-07 18:11:41 +01:00
Filip Skokan e9bf92a3f3 chore: bump packages 2026-03-05 11:27:19 +01:00
Filip Skokan 51aefa9771 chore(release): 6.2.0 2026-03-05 11:19:24 +01:00
Filip Skokan 2678f16e32 feat: re-introduce JWE "zip" (Compression Algorithm) Header Parameter support
Uses the CompressionStream/DecompressionStream APIs with "deflate-raw"
to support the "DEF" compression algorithm value.

Decompressed output is limited to 250 KB by default, configurable via the
maxDecompressedLength decrypt option.

Runtimes lacking CompressionStream/DecompressionStream will continue to
throw JOSENotSupported when zip is encountered.
2026-03-05 11:18:43 +01:00
Filip Skokan 0d0ec59c36 test: update deno expectations 2026-03-03 18:43:31 +01:00
Filip Skokan 53e5a28bca chore: reformat new docs 2026-02-25 11:02:13 +01:00
Filip Skokan ca85e5b4c1 chore: update SECURITY.md 2026-02-24 20:32:07 +01:00
Filip Skokan 05d4b15c8c docs: clarify return of general jws and jwe 2026-02-24 20:17:45 +01:00
Filip Skokan d288fdb700 chore: extend/clarify resource exhaustion threat model 2026-02-24 19:40:13 +01:00
Filip Skokan 6068c3cac6 test: cap workerd compatibilityDate 2026-02-23 12:54:24 +01:00
Filip Skokan 5e560c3152 chore: bump packages 2026-01-26 11:50:11 +01:00
Filip Skokan c783059006 chore: bump packages 2026-01-14 16:21:23 +01:00
Filip Skokan b97c11172e ci: resume browser testcafe testing 2025-12-23 18:49:08 +01:00
Filip Skokan f0025ab2c8 ci: pin GHA dependencies 2025-12-08 08:58:20 +01:00
Filip Skokan 09569b7b65 chore(release): 6.1.3 2025-12-02 14:22:12 +01:00
Filip Skokan c239275120 refactor: avoid export * as for google closure's compiler sake
refs: #832
2025-12-02 14:17:18 +01:00
Filip Skokan 68668140ad chore: bump packages 2025-12-01 09:07:53 +01:00
Filip Skokan 4cb285f668 chore: update error message 2025-11-30 18:25:47 +01:00