* 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)
| 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; |
no test coverage detected