auradefi 0.1.1
PyPI GitHub

verify_signature

auradefi.webhooks.sign · source

Return None iff signature is valid AND fresh.

Raises plain AuthError: one class, one message, for every failure: a mismatched signature, a missing or wrong v1= prefix, a mutated body, a wrong secret, and a timestamp outside the window are INDISTINGUISHABLE to the caller.

Freshness is abs(now_ms - timestamp_ms) <= tolerance_ms (inclusive at both edges, past and future). Comparison is hmac.compare_digest, never str.__eq__.

Parameters

secretrequired, str

The endpoint secret, shown once at registration.

timestamp_msrequired, int

The X-Auradefi-Timestamp header value.

bodyrequired, str

The RAW request body. Re-serialising breaks the signature.

signaturerequired, str

The X-Auradefi-Signature header value.

now_msrequired, int

Your current time, for the staleness window.

tolerance_msoptional, int, default 300000

none

Raises

AuthError

Returns

None