From c9b532b51b1bb4e6c6f336ebb0549b5863f292ab Mon Sep 17 00:00:00 2001 From: Dave Grijalva Date: Tue, 26 Aug 2014 14:18:59 -0700 Subject: [PATCH] cleanup and documentation updates --- VERSION_HISTORY.md | 3 +++ jwt.go | 5 +++++ rsa.go | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/VERSION_HISTORY.md b/VERSION_HISTORY.md index 8da9c75..c44751d 100644 --- a/VERSION_HISTORY.md +++ b/VERSION_HISTORY.md @@ -5,6 +5,9 @@ * **Compatibility Breaking Changes** * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` + * `KeyFunc` now returns `interface{}` instead of `[]byte` + * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key + * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key * Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. * Added public package global `SigningMethodHS256` * Added public package global `SigningMethodHS384` diff --git a/jwt.go b/jwt.go index c9bfe42..6dce51b 100644 --- a/jwt.go +++ b/jwt.go @@ -20,6 +20,11 @@ var TimeFunc = time.Now // Header of the token (such as `kid`) to identify which key to use. type Keyfunc func(*Token) (interface{}, error) +// Error constants +var ( + ErrInvalidKey = errors.New("Key is invalid or of invalid type.") +) + // A JWT Token. Different fields will be used depending on whether you're // creating or parsing/verifying a token. type Token struct { diff --git a/rsa.go b/rsa.go index aba6d7a..0a10988 100644 --- a/rsa.go +++ b/rsa.go @@ -18,7 +18,6 @@ var ( SigningMethodRS256 *SigningMethodRSA SigningMethodRS384 *SigningMethodRSA SigningMethodRS512 *SigningMethodRSA - ErrInvalidKey = errors.New("An invalid key was passed. Expected a []byte") ) func init() {