( socket: string, )
| 266 | } |
| 267 | |
| 268 | export async function readUdsCapabilityToken( |
| 269 | socket: string, |
| 270 | ): Promise<string | undefined> { |
| 271 | try { |
| 272 | const parsed = jsonParse( |
| 273 | await readFile(getCapabilityPath(socket), 'utf-8'), |
| 274 | ) as Record<string, unknown> |
| 275 | if (parsed.socketPath === socket && typeof parsed.authToken === 'string') { |
| 276 | return parsed.authToken |
| 277 | } |
| 278 | } catch { |
| 279 | // Missing or unreadable capability file means the peer is not addressable. |
| 280 | } |
| 281 | return undefined |
| 282 | } |
| 283 | |
| 284 | // --------------------------------------------------------------------------- |
| 285 | // Inbox |
no test coverage detected