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

cmd: list supported algorithms #123

Merged
merged 1 commit into from Nov 16, 2021

Conversation

AlexanderYastrebov
Copy link
Contributor

@AlexanderYastrebov AlexanderYastrebov commented Nov 10, 2021

The help message looks like:

  -alg string
        signing algorithm identifier, one of
        ES256, ES384, ES512, EdDSA, HS256, HS384, HS512,
        PS256, PS384, PS512, RS256, RS384, RS512, none

Also fixes #63

Signed-off-by: Alexander Yastrebov yastrebov.alex@gmail.com

cmd/jwt/main.go Outdated
"strings"

"github.com/golang-jwt/jwt/v4"
)

var (
// Options
flagAlg = flag.String("alg", "", "signing algorithm identifier")
flagAlg = flag.String("alg", "", fmt.Sprintf("signing algorithm identifier %v", algs()))
Copy link
Member

@mfridman mfridman Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts if we made this a bit easier to read:

- flagAlg     = flag.String("alg", "", fmt.Sprintf("signing algorithm identifier %v", algs()))
+ flagAlg     = flag.String("alg", "", fmt.Sprintf("signing algorithm identifiers:\n%v", strings.Join(algs(), ",")))

Printing out:

  -alg string
    	signing algorithm identifiers:
    	ES256,ES384,ES512,EdDSA,HS256,HS384,HS512,PS256,PS384,PS512,RS256,RS384,RS512,none

instead of:

  -alg string
    	signing algorithm identifier [ES256 ES384 ES512 EdDSA HS256 HS384 HS512 PS256 PS384 PS512 RS256 RS384 RS512 none]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to

  -alg string
        signing algorithm identifier, one of
        ES256, ES384, ES512, EdDSA, HS256, HS384, HS512,
        PS256, PS384, PS512, RS256, RS384, RS512, none

The help message looks like:
```
  -alg string
        signing algorithm identifier, one of
        ES256, ES384, ES512, EdDSA, HS256, HS384, HS512,
        PS256, PS384, PS512, RS256, RS384, RS512, none
```

Also fixes golang-jwt#63

Signed-off-by: Alexander Yastrebov <yastrebov.alex@gmail.com>
mfridman
mfridman previously approved these changes Nov 15, 2021
@AlexanderYastrebov
Copy link
Contributor Author

@mfridman Was there something else (I am not sure what dismissed means)?
Screenshot from 2021-11-15 16-39-48

@oxisto
Copy link
Collaborator

oxisto commented Nov 15, 2021

@mfridman Was there something else (I am not sure what dismissed means)?

Screenshot from 2021-11-15 16-39-48

A (positive) review automatically gets dismissed by GitHub if you add more changes to the branch. Basically to prevent that somebody approves it and then does not see the later changes.

@mfridman
Copy link
Member

This is the specific GitHub setting in case you're curious (screenshot).

CleanShot 2021-11-15 at 12 36 04@2x

@mfridman mfridman merged commit a725c1f into golang-jwt:main Nov 16, 2021
@AlexanderYastrebov AlexanderYastrebov deleted the cmd-list-algs branch November 16, 2021 17:31
oxisto pushed a commit to moneszarrugh/jwt that referenced this pull request Feb 21, 2023
oxisto pushed a commit to twocs/jwt that referenced this pull request Mar 29, 2023
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

Successfully merging this pull request may close these issues.

Add API to list all available signing methods
3 participants