diff options
author | Wim <wim@42.be> | 2019-09-07 22:46:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-07 22:46:58 +0200 |
commit | a3bee01e0af3394c19360b98fd2db1b647f49299 (patch) | |
tree | ffc5778361d55d592a718354a37c9251e75fc7f6 /vendor/github.com/nlopes/slack/security.go | |
parent | 1dc93ec4f001edd01daccbe408767d4878be25a3 (diff) | |
download | matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.tar.gz matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.tar.bz2 matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.zip |
Update dependencies (#886)
Diffstat (limited to 'vendor/github.com/nlopes/slack/security.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/security.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/vendor/github.com/nlopes/slack/security.go b/vendor/github.com/nlopes/slack/security.go index 35727027..dbe8fb2d 100644 --- a/vendor/github.com/nlopes/slack/security.go +++ b/vendor/github.com/nlopes/slack/security.go @@ -4,7 +4,6 @@ import ( "crypto/hmac" "crypto/sha256" "encoding/hex" - "errors" "fmt" "hash" "net/http" @@ -34,7 +33,7 @@ func unsafeSignatureVerifier(header http.Header, secret string) (_ SecretsVerifi stimestamp := header.Get(hTimestamp) if signature == "" || stimestamp == "" { - return SecretsVerifier{}, errors.New("missing headers") + return SecretsVerifier{}, ErrMissingHeaders } if bsignature, err = hex.DecodeString(strings.TrimPrefix(signature, "v0=")); err != nil { @@ -70,7 +69,7 @@ func NewSecretsVerifier(header http.Header, secret string) (sv SecretsVerifier, diff := absDuration(time.Since(time.Unix(timestamp, 0))) if diff > 5*time.Minute { - return SecretsVerifier{}, fmt.Errorf("timestamp is too old") + return SecretsVerifier{}, ErrExpiredTimestamp } return sv, err @@ -88,7 +87,7 @@ func (v SecretsVerifier) Ensure() error { return nil } - return fmt.Errorf("Expected signing signature: %s, but computed: %s", v.signature, computed) + return fmt.Errorf("Expected signing signature: %s, but computed: %s", hex.EncodeToString(v.signature), hex.EncodeToString(computed)) } func abs64(n int64) int64 { |