(socket: Duplex, key: string)
| 90 | } |
| 91 | |
| 92 | function acceptWebSocket(socket: Duplex, key: string): void { |
| 93 | const accept = crypto |
| 94 | .createHash('sha1') |
| 95 | .update(`${key}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`) |
| 96 | .digest('base64'); |
| 97 | socket.write( |
| 98 | [ |
| 99 | 'HTTP/1.1 101 Switching Protocols', |
| 100 | 'Upgrade: websocket', |
| 101 | 'Connection: Upgrade', |
| 102 | `Sec-WebSocket-Accept: ${accept}`, |
| 103 | '\r\n', |
| 104 | ].join('\r\n'), |
| 105 | ); |
| 106 | } |
| 107 | |
| 108 | test('installed package exposes Node APIs and packaged companion tunnel entrypoint', async (t) => { |
| 109 | const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-installed-package-')); |
no test coverage detected