-
Notifications
You must be signed in to change notification settings - Fork 6
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
[IMP] remove dependency on jwt library #18
base: master
Are you sure you want to change the base?
Conversation
0deba45
to
9d4f078
Compare
6577df8
to
4750916
Compare
9963efd
to
0d8ed3c
Compare
src/services/auth.js
Outdated
* @returns {string} - The signed JWT token | ||
* @throws {AuthenticationError} | ||
*/ | ||
export function sign(payload, key = jwtKey, { algorithm = ALGORITHM.HS256 } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to bother with all of these params if we're only using the default one?
In particular if ALGORITHM_FUNCTIONS
doesn't support any other one anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is heavily inspired by the lib, IMO this is fine to copy them even if we only have a single algorithm at hand now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept them to keep the expected API of JWT functions and to make it more clear in the code what are JWT core features vs parameters, it's also more similar to our python implementation that way
b380313
to
c0f6aac
Compare
Instead, it is now a local implementation of JWT, this makes the server less dependent on external libraries for its security and removes a potential source of dependency injection. This commit also removes unnecessary async/await (the old jsonwebtoken was also used synchronously).
c0f6aac
to
01ec896
Compare
just added better typing |
Instead, it is now a local implementation of JWT, this makes
the server less dependent on external libraries for its security
and removes a potential source of dependency injection.
This commit also removes unnecessary async/await
(the old jsonwebtoken was also used synchronously).