Security
To ensure that the webhook requests are genuinely from Magna and have not been tampered with, Magna uses HMAC signatures. Each request sent to your webhook endpoint includes a signature in the x-magna-signature
header.
Signature Generation
Magna generates the signature using the following process:
Serialize the Request Body: The JSON payload is stringified.
Create HMAC Hash: An HMAC SHA1 hash is created using the generated secret.
Format the Signature: The final signature is prefixed with
sha1=
followed by the hexadecimal representation of the hash.
Verifying Signatures
To verify the integrity and authenticity of the incoming webhook requests, you must calculate the signature on your end and compare it with the x-magna-signature
header provided in the request.
TypeScript Signature Calculation
Last updated
Was this helpful?