1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Token => signature

This commit is contained in:
DarthSim 2018-11-20 19:05:16 +06:00
parent adf6055e6b
commit 2209063ce3
2 changed files with 7 additions and 7 deletions

View File

@ -8,16 +8,16 @@ import (
)
var (
errInvalidToken = errors.New("Invalid token")
errInvalidTokenEncoding = errors.New("Invalid token encoding")
errInvalidSignature = errors.New("Invalid signature")
errInvalidSignatureEncoding = errors.New("Invalid signature encoding")
)
type securityKey []byte
func validatePath(token, path string) error {
messageMAC, err := base64.RawURLEncoding.DecodeString(token)
func validatePath(signature, path string) error {
messageMAC, err := base64.RawURLEncoding.DecodeString(signature)
if err != nil {
return errInvalidTokenEncoding
return errInvalidSignatureEncoding
}
for i := 0; i < len(conf.Keys); i++ {
@ -26,7 +26,7 @@ func validatePath(token, path string) error {
}
}
return errInvalidToken
return errInvalidSignature
}
func signatureFor(str string, pairInd int) []byte {

View File

@ -555,7 +555,7 @@ func (s *ProcessingOptionsTestSuite) TestParsePathSignedInvalid() {
_, err := parsePath(context.Background(), req)
require.Error(s.T(), err)
assert.Equal(s.T(), errInvalidToken.Error(), err.Error())
assert.Equal(s.T(), errInvalidSignature.Error(), err.Error())
}
func TestProcessingOptions(t *testing.T) {