Handle cookie signing errors

This commit is contained in:
Nick Meves
2020-08-09 07:55:40 -07:00
parent 65c228394f
commit 1c8c5b08d7
6 changed files with 64 additions and 39 deletions
+4 -2
View File
@@ -88,8 +88,10 @@ func TestSignAndValidate(t *testing.T) {
value := base64.URLEncoding.EncodeToString([]byte("I am soooo encoded"))
epoch := "123456789"
sha256sig := cookieSignature(sha256.New, seed, key, value, epoch)
sha1sig := cookieSignature(sha1.New, seed, key, value, epoch)
sha256sig, err := cookieSignature(sha256.New, seed, key, value, epoch)
assert.NoError(t, err)
sha1sig, err := cookieSignature(sha1.New, seed, key, value, epoch)
assert.NoError(t, err)
assert.True(t, checkSignature(sha256sig, seed, key, value, epoch))
// This should be switched to False after fully deprecating SHA1