summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2021-07-04 17:13:28 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2021-07-04 17:13:28 +0100
commit5881f58af573346eb0c25945a433bf9859191ac5 (patch)
treebe668c6173795acbbc660b980a1e55d7373afe7b /pkg
parente59a2421c020d4b7c224750e486f40d09db52c89 (diff)
Check and log more possible errors
Diffstat (limited to 'pkg')
-rw-r--r--pkg/twilio/filter.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/twilio/filter.go b/pkg/twilio/filter.go
index 90e84cc..48e92ef 100644
--- a/pkg/twilio/filter.go
+++ b/pkg/twilio/filter.go
@@ -8,6 +8,7 @@ import (
"crypto/sha1"
"encoding/base64"
"errors"
+ "fmt"
"log"
"net/http"
"sort"
@@ -55,7 +56,9 @@ func (th *Filter) CheckRequestSignature(r *http.Request) error {
}
s := r.URL.String() + strings.Join(parts, "")
h := hmac.New(sha1.New, th.AuthToken)
- h.Write([]byte(s))
+ if _, err := h.Write([]byte(s)); err != nil {
+ return fmt.Errorf("failed to write bytes to calculate signature: %s", err)
+ }
ourSig := h.Sum(nil)
if !hmac.Equal(reqSig, ourSig) {