[!NOTE]
I accidentally closed the PR #23. This PR includes the same changes.
17
โ Type of change
[ ] ๐ Documentation (updates to the documentation, readme, or JSdoc annotations)
[ ] ๐ Bug fix (a non-breaking change that fixes an issue)
[ ] ๐ Enhancement (improving an existing functionality like performance)
[x] โจ New feature (a non-breaking change that adds functionality)
[ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
[ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to 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.
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
I had to rename crypto.web and crypto.node to crypto-web, respectively crypto-node, because unbuild v2 complained about the file extensions.
No tests added yet. I have used these utils for a while now in some Nuxt projects and published them as unjwt package โ explicitly without uncrypto, since I rely on unenv to resolve the usage von the Web Crypto API.
In one project which used jose, I successfully migrated to these new utilities. No user got logged out. ๐
Questions
atob and btoa are available in latest Node and worker versions, so I haven't added any usage of buffer. Is that OK for you?
๐ Linked issue
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