Skip to content

Commit

Permalink
improve_alerts_authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
allanpetersoon committed Jan 18, 2024
1 parent 85209cf commit 204eebf
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion docs/alerts_authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ To this end, you should verify webhook signatures.

Leaf generates signatures using a hash-based message authentication code (HMAC) with SHA-256, and
the secret specified when you created the alerts' configuration as the HMAC key.
Be careful with deserialization of the request body when using it to verify the signature. It's recommended that you get the request body as bytes. The signed content has no line breaks, it's a string of the raw JSON with white-spaces after “:” and “,”.
Be careful with deserialization of the request body when using it to verify the signature.
It's recommended that you get the request body as bytes. The signed content has no line breaks and spaces after symbols, it's a string of the raw JSON with white-spaces after “:” and “,”.

The digest is added to the X-Leaf-Signature header encoded in base 64.

Expand Down Expand Up @@ -68,3 +69,23 @@ MessageDigest.isEqual(sigHeader, signatureBytes)

</TabItem>
</Tabs>

For the value of `request_body_bytes`.

The event is sent as follows:

```
{
"source": "REST",
"leafUserId": "the id of the file owner",
"fieldId": "the id of the created field",
"timestamp": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'",
"type": "mergedFieldCreated"
}
```

And it should be normalized as follows:

```
{"source": "REST", "leafUserId": "the id of the file owner", "fieldId": "the id of the created field", "timestamp": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'", "type": "mergedFieldCreated"}
```

0 comments on commit 204eebf

Please sign in to comment.