diff options
Diffstat (limited to 'vendor/github.com/nlopes/slack/security.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/security.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/nlopes/slack/security.go b/vendor/github.com/nlopes/slack/security.go index 6ab3c698..35727027 100644 --- a/vendor/github.com/nlopes/slack/security.go +++ b/vendor/github.com/nlopes/slack/security.go @@ -42,7 +42,9 @@ func unsafeSignatureVerifier(header http.Header, secret string) (_ SecretsVerifi } hash := hmac.New(sha256.New, []byte(secret)) - hash.Write([]byte(fmt.Sprintf("v0:%s:", stimestamp))) + if _, err = hash.Write([]byte(fmt.Sprintf("v0:%s:", stimestamp))); err != nil { + return SecretsVerifier{}, err + } return SecretsVerifier{ signature: bsignature, @@ -66,7 +68,7 @@ func NewSecretsVerifier(header http.Header, secret string) (sv SecretsVerifier, return SecretsVerifier{}, err } - diff := absDuration(time.Now().Sub(time.Unix(timestamp, 0))) + diff := absDuration(time.Since(time.Unix(timestamp, 0))) if diff > 5*time.Minute { return SecretsVerifier{}, fmt.Errorf("timestamp is too old") } |