AgentStack
SKILL verified MIT Self-run

Br Hmac Signature

skill-lonsdale201-wp-agent-skills-br-hmac-signature · by Lonsdale201

Configure better-route 0.6.0 HmacSignatureMiddleware for signed server-to-server REST requests and webhooks. Use when adding X-Signature, X-Timestamp, X-Key-Id, HmacSecretProviderInterface, ArrayHmacSecretProvider, request body HMAC verification, timestamp replay window checks, multi-key rotation, or replacing unsigned public POST endpoints with shared-secret authentication. Updated 2026-05-02.

No reviews yet
0 installs
6 views
0.0% view→install

Install

$ agentstack add skill-lonsdale201-wp-agent-skills-br-hmac-signature

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Br Hmac Signature? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

better-route: HMAC request signatures

Use this for server-to-server endpoints, webhooks, and back-channel calls where a bearer user token is not the right primitive. The middleware validates headers before the handler runs.

Pattern

use BetterRoute\Middleware\Auth\ArrayHmacSecretProvider;
use BetterRoute\Middleware\Auth\HmacSignatureMiddleware;

$hmac = new HmacSignatureMiddleware(
    secrets: new ArrayHmacSecretProvider([
        'primary' => getenv('MYAPP_WEBHOOK_SECRET'),
        'next' => getenv('MYAPP_WEBHOOK_SECRET_NEXT'),
    ]),
    signatureHeader: 'X-Signature',
    timestampHeader: 'X-Timestamp',
    keyIdHeader: 'X-Key-Id',
    replayWindowSeconds: 300,
    algorithm: 'sha256'
);

$router->post('/webhooks/provider', $handler)
    ->middleware([$hmac])
    ->publicRoute();

Canonical input

The signature input is:

timestamp + "\n" + method + "\n" + path + "\n" + sha256(body)

Default headers:

  • X-Signature
  • X-Timestamp
  • X-Key-Id

Accepted signature encodings:

  • lowercase hex
  • uppercase hex
  • base64
  • base64url
  • the same values prefixed with sha256=

Critical rules

  • Unknown key ID fails closed.
  • Missing signature/timestamp/key-id fails closed with 401.
  • Timestamp outside replayWindowSeconds fails closed.
  • Signature comparison uses Crypto::equals().
  • Keep secrets outside code; use constants/env/options managed by the host application.
  • HMAC authenticates the sender and request body. It does not make the route private at the WordPress permission layer; pair public webhook routes with ->publicRoute() deliberately.

Cross-references

  • Use br-network-security if the same route also needs a CIDR allowlist.
  • Use br-routes for publicRoute() vs protectedByMiddleware() intent.
  • Use br-error-contract for 401 invalid_signature and stale_signature handling.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.