When you receive a data payload from Wix, it includes a header called digest
. The header holds a JSON Web Token (JWT) with the signed data.
Before using the data you've received, you should:
Here's a sample JWT:
To verify that the data came from Wix:
Here's what the data looks like once its been decoded and verified with your public key:
Note: View a sample decoded JWT in the JWT debugger.
In some cases, the payload data will be encrypted as a security precaution. If the data is encrypted, it's crucial to ensure its integrity and confirm that it hasn't been altered during transit.
Note: Webhook payloads are not encrypted.
The encrypted payload data includes an object with a hash of the payload data, and the hash type as its key. For example:
To verify the integrity of the data:
Take the encrypted body data you received and hash it using the same hashing algorithm listed in the data object. In our example:
Compare the new hash with the hash listed in the data object. For example: Sha256({"mydata":"is secured"}) yields 3fd05dfe429837da86cbc710190c9a67296203bbd4bd3160ab0ff07b659b0160.