Skip to content

feat: upgrade jose dependency to v6#486

Merged
cschetan77 merged 5 commits intomasterfrom
feat/jose-6
Feb 27, 2026
Merged

feat: upgrade jose dependency to v6#486
cschetan77 merged 5 commits intomasterfrom
feat/jose-6

Conversation

@cschetan77
Copy link
Contributor

@cschetan77 cschetan77 commented Feb 17, 2026

🚀 Changes

This PR updates the jose dependency to v6.
The APIs used by the SDK -

  • importJWK
  • exportSPKI
  • decodeJWT
  • decodeProtectedHeader

This upgrade introduces the following breaking changes and architectural shifts:

  1. Shift to CryptoKey Return Type
    In jose@6, importJWK has transitioned to returning a CryptoKey object (part of the Web Crypto API) rather than the legacy Node.js-specific KeyObject.

Impact: This ensures the SDK uses standardized web primitives, making the underlying cryptographic operations more future-proof and compatible with modern environments.
Note: Support or KeyObject is still kept.

  1. Removal of secp256k1 (ES256K) Support
    This release drops support for the ES256K algorithm (secp256k1 curve).

Reason: jose has moved to a strict WebCrypto-first model. Because secp256k1 is not a standardized curve in the SubtleCrypto specification, maintaining a non-standard implementation would compromise the library's goal of strict spec alignment and cross-platform consistency.

Benefit: This change significantly reduces the maintenance surface and potential attack vectors by relying solely on standardized, highly-audited cryptographic implementations.

⚠️ Breaking Changes

Minimum Node.js Version: Requires Node.js >= 20.19.0 (as established in the PR #485 ).

Algorithm Support: Users relying on ES256K for signing/verification will need to transition to a supported curve (e.g., ES256 / P-256) or handle legacy keys externally.

References

Testing

  1. Unit tests
  2. Standalone SDK API calls
  3. Examples

@cschetan77 cschetan77 requested a review from a team as a code owner February 17, 2026 15:10
@cschetan77 cschetan77 changed the title feat: Upgrade jose to v6 feat: upgrade jose dependency to v6 Feb 18, 2026
package.json Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update this ("node": ">=14") as-well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rebase this PR once node upgrade PR #485 merges, and should reflect above.

switch (jwk.crv) {
case 'P-256':
return 'ES256';
case 'secp256k1':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ES256K is still allowed in config.js.

So ES256K is allowed first, but fail later when the signing key is resolved.

Is this expected ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not expected.
I've removed the ES256K from the list of supported algorithms in config.js.

case 'P-256':
return 'ES256';
case 'secp256k1':
return 'ES256K';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add test coverage for this removal ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was reluctant to add a spec for this specific unsupported algo (also there was no file for utils spec).
But have created a utitls.test.js and added a spec.

@cschetan77 cschetan77 merged commit 8c9bcc4 into master Feb 27, 2026
12 checks passed
@cschetan77 cschetan77 deleted the feat/jose-6 branch February 27, 2026 07:47
@cschetan77 cschetan77 mentioned this pull request Feb 27, 2026
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.

jwks-rsa has high score vulnerability from jose dependency Bump jose to v5

2 participants