auth0 / node-jsonwebtoken

JsonWebToken implementation for node.js http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html
MIT License
17.49k stars 1.21k forks source link

Support for RSA payload decryption #94

Open smof opened 9 years ago

smof commented 9 years ago

If a JWT is encrypted and not just signed, would be nice to have ability to decrypt the verified contents. If this is an RFE? If so could I patch

jfromaniello commented 8 years ago

Do you mean JWE? If so, I think agree and your pull-req will be welcome.

Sorry for the delay

mavvverick commented 6 years ago

@jfromaniello Hey, I have integrated JWE encryption within node-jsonwebtoken based on works of node-webtokens.

I have implemented modifications in sign.js which takes extra options key 'encrypt' to opt JWE automatically and verify.js is [WIP].

jwt.sign({ foo: 'bar' }, cert, { algorithm: 'RSA-OAEP', encrypt: 'A256GCM' },function (err, signedToken) { console.log(signedToken); })

JWE uses crypto.js for content and key encryption which is included in lib, please check supported key management algorithms and content encryption algorithms here.

Do let me know if it looks good and I will raise a pull request for same.

Note, Work In Progress: jwt.verify()

darylteo commented 1 month ago

Hi this would be good to support out of the box with NestJS 🙏