feat: signJWT
, verifyJWT
and decodeJWT
utils
#39
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.
π Linked issue
Note
I accidentally closed the PR #23. This PR includes the same changes.
#17
β Type of change
π Description
Resolves #17.
The following JWT utilities will be available with this PR (migrated from
unjwt
):signJWT
verifyJWT
decodeJWT
I have kept the code as simple as possible to cover the basic needs for JWT signing, verification and decoding. Method parameters have a balance between sensible defaults and customization.
Example usage:
Please verify if the general direction of this PR makes sense to you. If you, I'm willing to add tests as best as I can.
Notes
crypto.web
andcrypto.node
tocrypto-web
, respectivelycrypto-node
, because unbuild v2 complained about the file extensions.unjwt
package β explicitly withoutuncrypto
, since I rely onunenv
to resolve the usage von the Web Crypto API.jose
, I successfully migrated to these new utilities. No user got logged out. πQuestions
atob
andbtoa
are available in latest Node and worker versions, so I haven't added any usage ofbuffer
. Is that OK for you?π Checklist