MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / proofFor

Function proofFor

__tests__/fake-daemon.ts:62–69  ·  view source on GitHub ↗
(challenge: string)

Source from the content-addressed store, hash-verified

60 const challenges: string[] = [];
61 const sockets = new Set<net.Socket>();
62 const proofFor = (challenge: string): string | null => {
63 const mode = opts.proof ?? 'valid';
64 if (mode === 'none') return null;
65 if (mode === 'other-key') return daemonProof(randomBytes(32), challenge, socketPath);
66 // A key this process can't read (a test faking another uid) proves nothing, as in the daemon.
67 const key = daemonKey();
68 return key ? daemonProof(key, challenge, mode === 'other-path' ? `${socketPath}-elsewhere` : socketPath) : null;
69 };
70 const server = net.createServer((socket) => {
71 sockets.add(socket);
72 socket.on('close', () => sockets.delete(socket));

Callers 1

startFakeDaemonFunction · 0.85

Calls 2

daemonProofFunction · 0.90
daemonKeyFunction · 0.90

Tested by

no test coverage detected