Skip to content

Commit 6bcdd9d

Browse files
authored
Fix error return from HMAC signing method (#371)
1 parent 3c0777d commit 6bcdd9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hmac.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interfa
9191
func (m*SigningMethodHMAC) Sign(signingStringstring, keyinterface{}) ([]byte, error) {
9292
ifkeyBytes, ok:=key.([]byte); ok {
9393
if!m.Hash.Available() {
94-
returnnil, newError("HMAC sign expects []byte", ErrInvalidKeyType)
94+
returnnil, ErrHashUnavailable
9595
}
9696

9797
hasher:=hmac.New(m.Hash.New, keyBytes)
@@ -100,5 +100,5 @@ func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte,
100100
returnhasher.Sum(nil), nil
101101
}
102102

103-
returnnil, ErrInvalidKeyType
103+
returnnil, newError("HMAC sign expects []byte", ErrInvalidKeyType)
104104
}

0 commit comments

Comments
 (0)
close