When you use the hash Handlebars helper to generate an authentication header or URI parameter, integrator.io provides a hashOptions object you can use to build the signature. hashOptions is a JSON object whose fields hold values that are commonly used in authentication signatures, such as the request body and the URI. This article lists the available fields.
The examples in this article use the following full URL:
https://www.celigo-test.com/this/is/a/test?username=Integrator&domain=IO
Usage
{{{hash algorithm key encoding data}}}
algorithm -- The hash algorithm, for example "sha256".
key -- The secret key, typically hashOptions.http.encrypted.hashKey.
encoding -- The output encoding, for example "base64" or "hex".
data -- The value to hash, such as hashOptions.URI or hashOptions.body.
hashOptions fields
| Field | Description |
|---|---|
hashOptions.headers |
Path to the parameters sent in the request header. |
hashOptions.body |
The HTTP request body, as a string. |
hashOptions.bodyParametersMap |
Path to the parameters sent in the request body. |
hashOptions.method |
The HTTP request method, for example PUT, POST, or GET. |
hashOptions.http.encrypted |
The contents of the http.encrypted field from your HTTP connection. If you store the key as hashKey, reference it as hashOptions.http.encrypted.hashKey. |
hashOptions.baseURI |
The base URI used in the request. In the example: www.celigo-test.com. |
hashOptions.relativeURI |
The relative URI used in the request. In the example: /this/is/a/test. |
hashOptions.urlParameters * |
The URL parameters used in the request. In the example: username=Integrator&domain=IO. |
hashOptions.urlParametersMap |
Path to the parameters sent in the request URL. |
hashOptions.URI * |
The full URI used in the request. In the example: https://www.celigo-test.com/this/is/a/test?username=Integrator&domain=IO. |
* These fields aren't available with authentication URL parameters.
Examples
Hash the full URI in base64
This creates a SHA-256 digest of the full URI, encoded in base64.
{{{hash "sha256" hashOptions.http.encrypted.hashKey "base64" hashOptions.URI}}}
Hash the request body in hexadecimal
This creates a SHA-256 digest of the request body, encoded in hexadecimal.
{{{hash "sha256" hashOptions.http.encrypted.hashKey "hex" hashOptions.body}}}
Notes and constraints
- Use triple braces (
{{{ }}}) so that the digest isn't escaped or reformatted. - The
hashOptions.urlParametersandhashOptions.URIfields aren't available with authentication URL parameters.