Remove jsonwebtoken and base64url in favor of native crypto (#318) - #441
Open
shubhransh-gupta wants to merge 1 commit into
Open
Remove jsonwebtoken and base64url in favor of native crypto (#318)#441shubhransh-gupta wants to merge 1 commit into
shubhransh-gupta wants to merge 1 commit into
Conversation
Author
|
Hi @alexanderjordanbaker — Friendly reminder on this PR when you have time for a review. It resolves #318 by migrating from jsonwebtoken and base64url to Node.js native crypto. Full TypeScript build and test suite pass with 100% test coverage. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
jsonwebtokenandbase64urldependencies with Node.js built-incrypto(sign,verify, andBuffer.from(..., 'base64url')).Fixes #318
Motivation & Problem
jsonwebtokenhas unmaintained transitive dependencies (jws,jwa,ecdsa-sig-formatter,safe-buffer) that cause compatibility and packaging errors when used with modern ESM bundlers (such asesbuild,Vite,Rollup,webpack) and alternative runtimes (such asBun).By using standard Node.js built-in
cryptoprimitives:jsonwebtoken,@types/jsonwebtoken,base64url, and their 20+ transitive dependencies.safe-buffer.What Changed
index.ts: ImplementedcreateBearerToken()using Node'ssign('SHA256', ..., { key, dsaEncoding: 'ieee-p1363' }).jws_signature_creator.ts: ImplementedinternalCreateSignature()using Node's built-incrypto.signandBuffer.from(..., 'base64url').jws_verification.ts: Decodes JWT headers and payloads using native base64url buffer conversions, and verifies ES256 signatures with Node'sverify('SHA256', ..., { key: publicKey, dsaEncoding: 'ieee-p1363' }, ...).package.json&yarn.lock: Removedjsonwebtoken,@types/jsonwebtoken, andbase64url.NOTICE.txt: Updated third-party notices accordingly.api_client.test.ts,jws_signature_creator.test.ts,util.ts): Updated test utilities and mocks to use native crypto / base64url decoding.Test Plan
npm run build(tsc -p .) builds cleanly with zero errors.npm testpasses all 22 test suites and 344/344 unit tests.npm run build-docsgenerates TypeDoc documentation with 0 errors.