HOW TO: How can I pass a base64-decoded private key (sha1 or sha256) and JSON request body in the hmac function?
hmacOptions are defined automatically by integrator.io, so they are automatically generated by your HTTP connector, which will fetch properties like the HTTP verb and the request body and make them available for you to use in your handlebar helper as "hmacOptions". If you need to create an hmac digest from the JSON request body, you would then use "hmacOptions.body", which will supply the value for you.
Here's a few examples of the formatting:
MIVA-HMAC-SHA256 {{{connection.http.encrypted.apiToken}}}:{{{hmac "sha256" connection.http.encrypted.key "base64" hmacOptions.body}}}
For Sears hmac connection:
HMAC-SHA256 emailaddress=account_email,timestamp={{{dateFormat 'YYYY-MM-DDTHH:mm:ss[Z]'}}},signature={{{hmac "sha256" connection.http.encrypted.apiSecret "hex" (join ":" "account_id" "account_email" (dateFormat 'YYYY-MM-DDTHH:mm:ss[Z]'))}}}
Check out our Handlebars Library to learn more about handlebars and what's supported for hmac.
0
Comments
Please sign in to leave a comment.