-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c83c227
commit 61d967e
Showing
16 changed files
with
97 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package paseto | ||
|
||
import "fmt" | ||
|
||
func errorKeyLength(expected, given int) error { | ||
return fmt.Errorf("key length incorrect (%d), expected %d", given, expected) | ||
} | ||
|
||
func errorSeedLength(expected, given int) error { | ||
return fmt.Errorf("seed length incorrect (%d), expected %d", given, expected) | ||
} | ||
|
||
func errorMessageParts(given int) error { | ||
return fmt.Errorf("invalid number of message parts in token (%d)", given) | ||
} | ||
|
||
func errorMessageHeader(expected Protocol, givenHeader string) error { | ||
return fmt.Errorf("message header `%s' is not valid, expected `%s'", givenHeader, expected.Header()) | ||
} | ||
|
||
func errorMessageHeaderDecrypt(expected Protocol, givenHeader string) error { | ||
return fmt.Errorf("cannot decrypt message: %w", errorMessageHeader(expected, givenHeader)) | ||
} | ||
|
||
func errorMessageHeaderVerify(expected Protocol, givenHeader string) error { | ||
return fmt.Errorf("cannot verify message: %w", errorMessageHeader(expected, givenHeader)) | ||
} | ||
|
||
var unsupportedPasetoVersion = fmt.Errorf("unsupported PASETO version") | ||
var unsupportedPasetoPurpose = fmt.Errorf("unsupported PASETO purpose") | ||
var unsupportedPayload = fmt.Errorf("unsupported payload") | ||
|
||
var errorPayloadShort = fmt.Errorf("payload is not long enough to be a valid PASETO message") | ||
var errorBadSignature = fmt.Errorf("bad signature") | ||
var errorBadMAC = fmt.Errorf("bad message authentication code") | ||
|
||
func errorDecrypt(err error) error { | ||
return fmt.Errorf("the message could not be decrypted: %w", err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.