@av-pi-studio/client 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -151,6 +151,27 @@ interface Transport {
|
|
|
151
151
|
implementation. Inject your own `Transport` for tests, or to run over a different underlying
|
|
152
152
|
channel.
|
|
153
153
|
|
|
154
|
+
### Relay transport (E2EE, via `@av-pi-studio/relay`)
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { createRelayTransport, parsePairingUrl } from "@av-pi-studio/client";
|
|
158
|
+
|
|
159
|
+
const offer = parsePairingUrl(pairingUrlOrFragment); // { publicKey, publicKeyB64, host? }
|
|
160
|
+
const transport = createRelayTransport({
|
|
161
|
+
sessionId: relaySessionId, // rendezvous id shared with the daemon's outbound relay connection
|
|
162
|
+
daemonPublicKey: offer!.publicKey,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const daemon = new DaemonClient({ url: relayWsUrl, clientId, clientType: "cli", transport });
|
|
166
|
+
await daemon.connect(); // completes the E2EE handshake before the `hello` RPC ever crosses the wire
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`createRelayTransport` implements the exact same `Transport` contract as
|
|
170
|
+
`createWebSocketTransport` — swap it in via `DaemonClientOptions.transport` and every other
|
|
171
|
+
`DaemonClient`/`PiStudioClient` API works unchanged, whether the daemon is direct or reached
|
|
172
|
+
through a relay. See `@av-pi-studio/relay`'s README for running a relay server and
|
|
173
|
+
`@av-pi-studio/server`'s README for pointing a daemon at one.
|
|
174
|
+
|
|
154
175
|
## Design rules
|
|
155
176
|
|
|
156
177
|
- **`RpcTimeoutError` never closes the socket.** A slow RPC is an operation-level failure, not a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@av-pi-studio/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@av-pi-studio/protocol": "^0.0.
|
|
22
|
-
"@av-pi-studio/relay": "^0.0.
|
|
21
|
+
"@av-pi-studio/protocol": "^0.0.10",
|
|
22
|
+
"@av-pi-studio/relay": "^0.0.10"
|
|
23
23
|
}
|
|
24
24
|
}
|