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

Function readDaemonKey

src/mcp/daemon-proof.ts:44–54  ·  view source on GitHub ↗
(file: string = daemonKeyPath())

Source from the content-addressed store, hash-verified

42
43/** The key, when the file holds one that only this user can read; null otherwise. Never creates. */
44export function readDaemonKey(file: string = daemonKeyPath()): Buffer | null {
45 try {
46 const stat = fs.lstatSync(file);
47 if (!stat.isFile()) return null;
48 if (process.platform !== 'win32' && (stat.uid !== process.getuid?.() || (stat.mode & 0o077) !== 0)) return null;
49 const key = fs.readFileSync(file);
50 return key.length >= KEY_BYTES ? key : null;
51 } catch {
52 return null;
53 }
54}
55
56/**
57 * The key, made on first use; the daemon calls this when a client asks for a

Callers 4

onDataFunction · 0.90
connectWithHelloFunction · 0.90
daemonKeyFunction · 0.85

Calls 1

daemonKeyPathFunction · 0.85

Tested by

no test coverage detected