Docs - v1beta2 - Providers - Key type
michaelsatish opened this issue · comments
Satish Michael commented
There is a type issue in the example provided for Generic Webhook with HMAC.
The function verifySignature takes a key of type byte array.
func verifySignature(signature string, payload, key []byte) error
A string value is provided to the function when it gets called in the handleRequest
function
// Verify signature using the same token as the Secret referenced in
// Provider
key := "<token>"
if err := verifySignature(r.Header.Get("X-Signature"), body, key); err != nil {
http.Error(w, fmt.Sprintf("failed to verify HMAC signature: %s", err.Error()), http.StatusBadRequest)
return
}
Somtochi Onyekwere commented
@michaelsatish thanks for catching this.
The key can be converted to a byte array. as it is passed to the function.
Would you like to open a PR for it?
Satish Michael commented
@somtochiama More than happy to open a PR. Opened PR #585