1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright 2026 AlphaOne LLC
# SPDX-License-Identifier: Apache-2.0
"""Webhook signature verification.
When the server delivers a subscription event it adds an
``X-AI-Memory-Signature`` header of the form ``sha256=<hex>`` computed as
``hmac_sha256(secret, body)``. :func:`verify_webhook_signature` performs a
constant-time compare of that signature against a locally computed one.
"""
"""Verify an HMAC-SHA256 signature produced by the ai-memory daemon.
Args:
body: The raw request body bytes exactly as received (do **not**
re-encode a parsed JSON payload; whitespace differences will
break the HMAC).
signature: The value of the ``X-AI-Memory-Signature`` header.
Accepts either ``"sha256=<hex>"`` (the preferred form) or a
bare hex digest.
secret: The shared secret configured when the subscription was
created.
Returns:
``True`` when the signature matches, ``False`` otherwise. Returns
``False`` — never raises — for malformed input so callers can treat
any non-``True`` result as "reject this delivery."
"""
return False
=
=
=
return False
=
return