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

Function verifyHistoryAudit

src/cli/maintain-history.ts:71–78  ·  view source on GitHub ↗
(runs: MaintainRun[], audit: HistoryAudit | undefined, key?: string)

Source from the content-addressed store, hash-verified

69
70/** Verify a snapshot's audit block against its own runs. PURE. */
71export function verifyHistoryAudit(runs: MaintainRun[], audit: HistoryAudit | undefined, key?: string): HistoryAuditVerdict {
72 if (!audit) return { present: false, ok: true }; // legacy snapshot — nothing to check
73 const headMatches = historyHead(runs.map(normalizeRun)) === audit.head;
74 const signaturePresent = !!audit.signature;
75 let signatureValid: boolean | undefined;
76 if (signaturePresent && key) signatureValid = verifyChainSignature(audit.head, audit.signature!, key);
77 return { present: true, headMatches, signaturePresent, signatureValid, ok: headMatches && (!signaturePresent || signatureValid !== false) };
78}
79
80/**
81 * Parse a history snapshot back into runs. Tolerant of extra fields and either the wrapped file

Callers 2

index.tsFile · 0.85

Calls 2

historyHeadFunction · 0.85
verifyChainSignatureFunction · 0.85

Tested by

no test coverage detected