MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / buildSignedAuditLog

Function buildSignedAuditLog

src/cli/maintain-audit.ts:125–141  ·  view source on GitHub ↗
(runs: AuditableRun[], opts: { exportedAt: string; key?: string })

Source from the content-addressed store, hash-verified

123
124/** Assemble the exportable log, signing the head when a key is provided. PURE (pass `exportedAt`). */
125export function buildSignedAuditLog(runs: AuditableRun[], opts: { exportedAt: string; key?: string }): SignedAuditLog {
126 const entries = buildAuditChain(runs);
127 const head = chainHead(entries);
128 const base: SignedAuditLog = {
129 kind: 'qodex-maintain-audit',
130 version: MAINTAIN_AUDIT_VERSION,
131 exportedAt: opts.exportedAt,
132 count: entries.length,
133 head,
134 entries,
135 algo: 'sha256-chain',
136 };
137 if (opts.key) {
138 return { ...base, algo: 'sha256-chain+hmac-sha256', keyId: keyIdFor(opts.key), signature: signChainHead(head, opts.key) };
139 }
140 return base;
141}
142
143/** Serialize to pretty JSON. PURE. */
144export function serializeAuditLog(log: SignedAuditLog): string {

Callers 2

index.tsFile · 0.85

Calls 4

buildAuditChainFunction · 0.85
chainHeadFunction · 0.85
keyIdForFunction · 0.85
signChainHeadFunction · 0.85

Tested by

no test coverage detected