Autonoma.HMAC (Autonoma v0.2.9)

Copy Markdown View Source

HMAC-SHA256 signing and verification for request authentication.

Summary

Functions

Constant-time string comparison to prevent timing attacks.

Sign a body string with a secret using HMAC-SHA256. Returns a 64-character lowercase hex string.

Verify a signature against a body and secret. Uses constant-time comparison to prevent timing attacks.

Functions

secure_compare(a, b)

Constant-time string comparison to prevent timing attacks.

sign_body(body, secret)

Sign a body string with a secret using HMAC-SHA256. Returns a 64-character lowercase hex string.

verify_signature(body, signature, secret)

Verify a signature against a body and secret. Uses constant-time comparison to prevent timing attacks.