Securing Indexer Webhooks

In order to verify that the webhooks that you're receiving from your event indexers are coming from Graffle, and that the contents are valid, you can specify an optional HMAC token (https://en.wikipedia.org/wiki/HMAC) at the project level:

NOTE: The HMAC token must be a base64 encoded string.

To get started, you'll need two pieces of information:

  1. Your Graffle company Id - available in the top right corner of the portal.

  2. A secret HMAC token that you set on the project settings page. NOTE: This token must be a base-64 encoded string.

Once you've set an HMAC token, your webhooks will now include an authorization header in the form of:

hmacauth companyId:base64RequestSignature:nonce:requestTimestamp"

companyID: - Your Graffle company Id

base64RequestSignature: - A HMACSHA256 hash of the request and its properties using your HMAC token.

nonce: - A nonce (https://en.wikipedia.org/wiki/Cryptographic_nonce) that can be used to prevent replay attacks.

requestTimestamp: - The UNIX timestamp of when the webhook was sent.

C# HMAC Decoding Example

Node.js HMAC Decoding Example

The GUIDs in the example are dummy values provided for the example only.

Last updated