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

Feature: function to return list of supported algorithms #763

Open
raijinsetsu opened this issue Jan 27, 2021 · 3 comments
Open

Feature: function to return list of supported algorithms #763

raijinsetsu opened this issue Jan 27, 2021 · 3 comments

Comments

@raijinsetsu
Copy link

Describe the problem you'd like to have solved

While implementing some configuration validation logic, which accepts a array of Algorithm values to be used with jsonwebtoken, I found that the library does not expose the values in a way that can be used at run-time.

In Typescript, we have the Algorithms type, but there is no actual array against which to validate data received from outside sources. It also does not make sense to have that array in our code where we would need to keep it in sync with the library.

Describe the ideal solution

This can be accomplished fairly easily:

export const Algorithm = ['RS256', ...];

The types in "@types/jsonwebtoken" could be easily updated so that Algorithm is a type (as it is now) and also a const array of values.

Alternatives and current work-arounds

Manually keeping the array up-to-date in our software up-to-date with the library.

@raijinsetsu
Copy link
Author

PS - I am willing to code and submit a PR for this, assuming the maintainers agree that this feature is useful.

@ghost
Copy link

ghost commented Oct 1, 2021

@raijinsetsu This feature request actually belongs to "@types/jsonwebtoken" as you state, so a pull request here would not help.

If I checked correctly, then this was already included, so this issue can be closed.
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jsonwebtoken/index.d.ts#L143

@AlirezaEiji191379
Copy link

i will fix this issue!

@AlirezaEiji191379 AlirezaEiji191379 mentioned this issue Feb 4, 2022
4 tasks
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

2 participants