Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @node-rs/jsonwebtoken to verify JWT faster #493

Open
pasha-vuiko opened this issue Oct 19, 2024 · 6 comments
Open

Use @node-rs/jsonwebtoken to verify JWT faster #493

pasha-vuiko opened this issue Oct 19, 2024 · 6 comments

Comments

@pasha-vuiko
Copy link

Hey! First of all, thank you for creating this awesome library.

Recently I found the package:
https://www.npmjs.com/package/@node-rs/jsonwebtoken
I was thinking, maybe you would consider to use this to verify JWT instead of node:crypto, as the package uses Rust bindings to verify JWT, and it works 3x faster than node:crypto.
What do you think?

@ilteoood
Copy link
Contributor

We have that library in our benchmarks (see this PR).

At the moment, we are still investigating what benefits we could have by generally including Rust in our toolchain.

@pasha-vuiko
Copy link
Author

I got it, thank you!

I think you would benefit from Rust bindings, because it much faster than node:crypto

@HsinHeng
Copy link

HsinHeng commented Nov 3, 2024

https://www.npmjs.com/package/@node-rs/jsonwebtoken

We may consider sodium-native to replace node:crypto which is used by fastify/secure-session.

and i found someone who implement sodium version: https://www.npmjs.com/package/@mgcrea/node-sodium-jwt.

@pasha-vuiko
Copy link
Author

Wow, interesting, I'll check this out

@simoneb
Copy link
Member

simoneb commented Nov 12, 2024

Based on the outcome of the benchmarks, and although I'm surprised that performance benefits change so much depending on the signing algorithm, at the moment we're not considering to integrate this library out of the box. My understanding is that it would be a replacement for this library anyway, so I'm not sure what we would do about it really. It's more an alternative to this library.

@pasha-vuiko
Copy link
Author

Based on the outcome of the benchmarks, and although I'm surprised that performance benefits change so much depending on the signing algorithm, at the moment we're not considering to integrate this library out of the box. My understanding is that it would be a replacement for this library anyway, so I'm not sure what we would do about it really. It's more an alternative to this library.

For example the Rust based library lacks LRU cache that fast-jwt has, so in my opinion it still worth it 🙂

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

No branches or pull requests

4 participants