Actually print calcuated signature to stdout

This commit is contained in:
Akbar Rahman 2021-08-04 22:12:59 +01:00
parent 0953baae50
commit 081aaee9c7

View File

@ -63,9 +63,13 @@ func webhookHandler(w http.ResponseWriter, r *http.Request) {
// Verify that signature provided matches signature calculated using secretsss // Verify that signature provided matches signature calculated using secretsss
signature := r.Header.Get(service.SignatureHeader) signature := r.Header.Get(service.SignatureHeader)
calculatedSignature := fmt.Sprintf("%v%v", service.SignaturePrefix, getSha256HMACSignature([]byte(service.Secret), payload)) calculatedSignature := fmt.Sprintf(
"%v%v",
service.SignaturePrefix,
getSha256HMACSignature([]byte(service.Secret), payload),
)
fmt.Printf("signature = %v\n", signature) fmt.Printf("signature = %v\n", signature)
fmt.Printf("calcuatedSignature = %v\n", signature) fmt.Printf("calcuatedSignature = %v\n", calculatedSignature)
if signature != calculatedSignature && checkSignature { if signature != calculatedSignature && checkSignature {
writeResponse(w, 400, "Bad Request: Signatures do not match") writeResponse(w, 400, "Bad Request: Signatures do not match")
return return