Steps
Use the following steps to verify the Circle signature on a webhook notification.Step 1: Get the digital signature and ID of the notification
Every webhook notification is digitally signed with an asymmetric key. The asymmetric key is random for each webhook, so you must perform this full authentication flow to validate the key. This signature is available in the header of the message. Each message contains the following headers:X-Circle-Signature: the digital signature generated by CircleX-Circle-Key-Id: the public key ID in UUID format
Step 2: Get the public key and encryption algorithm
Using theX-Circle-Key-Id value, query the
/v2/cpn/notifications/publicKey/{keyId}
endpoint.
Shell
JSON
Note: To avoid making multiple requests to the public key endpoint, you
should cache the public key associated with a given public key ID.
Step 3: Verify the signature
Use the public key and the specified algorithm from the response in step 2, along with theX-Circle-Signature value, to verify the integrity of the
webhook’s payload.
The following Python code demonstrates how to verify the X-Circle-Signature
value:
Python