Token Mint

loom-sprint-scaffoldsourcetypescript
Path: loom-sprint-scaffold/loom/src/orchestrator/core/token-mint.tsRelative: loom/src/orchestrator/core/token-mint.tsSubproject: loom-sprint-scaffoldCategory: other
Lines: 208Bytes: 6,815Imports: 6Exports: 2

Content Preview

  1. /**
  2. * H1.5 — HMAC single-use, stage-scoped, TTL'd approval tokens for destructive
  3. * actions. WebCrypto only.
  4. *
  5. * Token format compatibility with Loop 3's verifier:
  6. * - Loop 3 checks `tool\u0000${canonicalJSON(args)}` HMAC
  7. * - Mint signs the SAME message format, with structured metadata
  8. * (goal_id, stage_id, expires_at, nonce) embedded in args
  9. *
  10. * Single-use enforcement via consumed-nonce set in storage.
  11. */
  12. import { createLogger } from "../../lib/logger";
  13. import { importHmacKey