Skip to content

Commit

Permalink
fix: return ErrHashUnavailable when hash is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
ss49919201 committed Dec 24, 2023
1 parent 4d0edcd commit c12025f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interfa
func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte, error) {
if keyBytes, ok := key.([]byte); ok {
if !m.Hash.Available() {
return nil, newError("HMAC sign expects []byte", ErrInvalidKeyType)
return nil, ErrHashUnavailable
}

hasher := hmac.New(m.Hash.New, keyBytes)
Expand Down

0 comments on commit c12025f

Please sign in to comment.