3 Commits

Author SHA1 Message Date
Alex Dunmow
742f4434b1 feat(captcha): SetSecret for live HMAC secret rotation
Server now holds the secret in an atomic.Pointer so a running instance can
swap it; outstanding challenge and verification tokens signed with the old
secret immediately fail verification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 14:20:43 +08:00
Alex Dunmow
8bd92ea5c4 feat(captcha): single-use verification tokens (replay hardening)
VerifyToken now consumes a redemption token on its first successful verify:
a replayed token within its 5-min TTL is rejected. Mirrors the existing
single-use challenge-nonce store with a per-Server used-token store keyed on
the token's random id, same GC/expiry approach (entries live only for the
remaining TTL). The token is burned only on a successful verify (valid HMAC +
unexpired + unused); forged/expired tokens never touch the store.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 12:32:52 +08:00
Alex Dunmow
cbc9ff495f feat(captcha): stateless Cap protocol Server (challenge/redeem/verify) 2026-07-03 17:24:19 +08:00