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

Method answerChallenge

src/mcp/daemon.ts:555–559  ·  view source on GitHub ↗

* Answer a client-hello's challenge with this user's proof (see * `./daemon-proof`), so the client can tell this daemon from a stand-in at * its socket before it sends anything. `null` when no key only this user can * read can be had: the client then treats this daemon as none.

(socket: net.Socket, challenge: string)

Source from the content-addressed store, hash-verified

553 * read can be had: the client then treats this daemon as none.
554 */
555 private answerChallenge(socket: net.Socket, challenge: string): void {
556 const key = daemonKey();
557 const proof = key ? daemonProof(key, challenge, this.socketPath) : null;
558 try { socket.write(JSON.stringify({ codegraph_proof: proof }) + '\n'); } catch { /* the client hung up */ }
559 }
560
561 private dropClient(session: MCPSession): void {
562 if (!this.clients.delete(session)) return;

Callers 1

handleConnectionMethod · 0.95

Calls 3

daemonKeyFunction · 0.90
daemonProofFunction · 0.90
writeMethod · 0.65

Tested by

no test coverage detected