(head: string, signature: string, key: string)
| 115 | |
| 116 | /** Timing-safe verification of a head signature. PURE. */ |
| 117 | export function verifyChainSignature(head: string, signature: string, key: string): boolean { |
| 118 | const expected = signChainHead(head, key); |
| 119 | if (expected.length !== signature.length) return false; |
| 120 | try { return timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(signature, 'hex')); } |
| 121 | catch { return false; } |
| 122 | } |
| 123 | |
| 124 | /** Assemble the exportable log, signing the head when a key is provided. PURE (pass `exportedAt`). */ |
| 125 | export function buildSignedAuditLog(runs: AuditableRun[], opts: { exportedAt: string; key?: string }): SignedAuditLog { |
no test coverage detected