Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

[Documentation] Keyfunc #456

Open
moloch-- opened this issue Feb 28, 2021 · 1 comment
Open

[Documentation] Keyfunc #456

moloch-- opened this issue Feb 28, 2021 · 1 comment

Comments

@moloch--
Copy link

The https://pkg.go.dev/github.com/dgrijalva/jwt-go#Keyfunc does not specify what should be returned, it simply says "supply the key for verification." Should the function return the JSON key structure? A byte array of the base64 encoded public key? A byte array of the raw key material? A PEM encoded key? A parsed RSA Key?

The documentation should specify what is returned when, assuming different values should be returned for different signing mechanism.

The function signature is also documented as func(token *jwt.Token) ([]byte, error), however in practice it seems the function must be implemented as func(token *jwt.Token) (interface{}, error)

@moloch--
Copy link
Author

moloch-- commented Mar 3, 2021

For anyone that finds this, you want to return the parsed rsa.* key or ecsda.* key, not a []byte.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant