MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / verifyChecksum

Function verifyChecksum

pkg/npm/install.js:690–708  ·  view source on GitHub ↗
(archivePath, archiveName, source)

Source from the content-addressed store, hash-verified

688
689// Fetch checksums.txt from the same download base and verify the archive hash.
690async function verifyChecksum(archivePath, archiveName, source) {
691 const url = `${source.base}/checksums.txt`;
692 const tmpChecksums = archivePath + '.checksums';
693 try {
694 await download(url, tmpChecksums, source.loopback);
695 const expected = parseExpectedChecksum(
696 fs.readFileSync(tmpChecksums, 'utf-8'), archiveName,
697 );
698 const actual = fileSha256(archivePath);
699 if (expected !== actual) {
700 throw new Error(
701 `Checksum mismatch for ${archiveName}:\n expected: ${expected}\n actual: ${actual}`,
702 );
703 }
704 process.stdout.write('codebase-memory-mcp: checksum verified.\n');
705 } finally {
706 try { fs.unlinkSync(tmpChecksums); } catch (_) { /* ignore */ }
707 }
708}
709
710async function main() {
711 const platform = getPlatform();

Callers 1

mainFunction · 0.70

Calls 4

parseExpectedChecksumFunction · 0.85
fileSha256Function · 0.85
downloadFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected