Hmac.Test

_archivetesttypescript
Path: _archive/loom-stale-pre-sprint-snapshot/tests/hmac.test.tsRelative: loom-stale-pre-sprint-snapshot/tests/hmac.test.tsSubproject: _archiveCategory: archived
Lines: 42Bytes: 2,124Imports: 2Exports: 0has tests

Content Preview

  1. import { describe, expect, test } from "bun:test";
  2. import { mintApprovalToken, verifyApprovalToken } from "../src/lib/hmac";
  3. const SECRET = "test-secret-at-least-32-bytes-long!!";
  4. const SCOPE = { goalId: "goal_a1b2c3d4e5f6", stageId: "stg_a1b2c3d4e5f6" };
  5. const future = Math.floor(Date.now() / 1000) + 600;
  6. describe("HMAC approval tokens (H1.5 mint / H3.3 verify)", () => {
  7. test("round-trip verifies", async () => {
  8. const t = await mintApprovalToken({ gid: SCOPE.goalId, sid: SCOPE.stageId,