KuromoryOriginal post
Rank 2: Process
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:
Plain text
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; }Summary
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.