SigningMethod can be used add new methods for signing or verifying tokens. It takes a decoded signature as an input in the Verify function and produces a signature in Sign. The signature is then usually base64 encoded as part of a JWT.
| 12 | // signature in Sign. The signature is then usually base64 encoded as part of a |
| 13 | // JWT. |
| 14 | type SigningMethod interface { |
| 15 | Verify(signingString string, sig []byte, key any) error // Returns nil if signature is valid |
| 16 | Sign(signingString string, key any) ([]byte, error) // Returns signature or error |
| 17 | Alg() string // returns the alg identifier for this method (example: 'HS256') |
| 18 | } |
| 19 | |
| 20 | // RegisterSigningMethod registers the "alg" name and a factory function for signing method. |
| 21 | // This is typically done during init() in the method's implementation |
no outgoing calls
no test coverage detected