I want to validate if the webhook was indeed from Appwrite and it works if the payload does not include special UTF-8 characters like ä,ü,ö etc. But when the payload includes these characters the hash/signature is diffrent...
I use C# for validateing the hash... here is the code:
TypeScript
string payload;
using var reader = new StreamReader(context.Request.InputStream, Encoding.UTF8);
payload = await reader.ReadToEndAsync();
string signature = _webHookUrl + payload.Trim();
string hash = Convert.ToBase64String(hMACSHA1.ComputeHash(Encoding.UTF8.GetBytes(signature)));
if (!context.Request?.Headers?.Get("x-appwrite-webhook-signature")?.Equals(hash) ?? true)
{
// Error hash is invalid
return;
}
TL;DR
Webhook verification fails when payloads have UTF-8 characters. The hash/signature is different when special characters like ä,ü,ö are present. The issue stems from Unicode encoding. Ensure consistent encoding when calculating hash.Recommended threads
- SSL certificate generation failed even t...
Hello, I have an Appwrite Site for which I added a custom domain. However, even though the domain is verified, the SSL certificate generation is failing. It is ...
- [Self-hosted] Realtime crashes with "Mis...
- How to use Operator.arrayAppend on a rel...
Hi, is it possible to use any operator on a relationship column? I have a One to Many relationship column on a table and I would like to add entries to the colu...