(id: string)
| 107 | } |
| 108 | |
| 109 | async function createUnixSocketAuthProxy(id: string): Promise<AuthProxyInfo> { |
| 110 | const socketPath = `/tmp/claude-ssh-auth-${id}.sock` |
| 111 | |
| 112 | const server = Bun.serve({ |
| 113 | unix: socketPath, |
| 114 | fetch: req => proxyFetch(req, null), |
| 115 | }) |
| 116 | |
| 117 | logForDebugging(`[SSHAuthProxy] listening on unix:${socketPath}`) |
| 118 | |
| 119 | const proxy: SSHAuthProxy = { |
| 120 | stop() { |
| 121 | server.stop(true) |
| 122 | try { |
| 123 | unlinkSync(socketPath) |
| 124 | } catch { |
| 125 | // Socket file may already be cleaned up |
| 126 | } |
| 127 | }, |
| 128 | } |
| 129 | |
| 130 | return { |
| 131 | proxy, |
| 132 | localAddress: socketPath, |
| 133 | authEnv: { ANTHROPIC_AUTH_SOCKET: socketPath }, |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | async function createTcpAuthProxy(id: string): Promise<AuthProxyInfo> { |
| 138 | const nonce = randomUUID() |
no test coverage detected