Hmac

loom-sprint-scaffoldsourcetypescript
Path: loom-sprint-scaffold/loom/src/lib/hmac.tsRelative: loom/src/lib/hmac.tsSubproject: loom-sprint-scaffoldCategory: other
Lines: 77Bytes: 2,257Imports: 1Exports: 6

Content Preview

  1. /**
  2. * HMAC utilities shared by Loop 1 (token-mint) and Loop 3 (reversibility-gate).
  3. * WebCrypto only — workerd-compatible.
  4. *
  5. * The message format used by Loop 3's verifier is:
  6. * `tool\u0000${canonicalJSON(args)}`
  7. *
  8. * New token-mint messages additionally embed structured metadata
  9. * (goal_id, stage_id, expires_at, nonce) alongside tool args so that
  10. * single-use enforcement and TTL checking can be done without modifying
  11. * the existing Loop 3 verifier.
  12. */
  13. import { canonicalJSON } from