@byoky/relay 0.4.10 → 0.4.14

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.
Files changed (2) hide show
  1. package/README.md +79 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @byoky/relay
2
+
3
+ WebSocket relay server for [Byoky](https://byoky.com). Enables real-time pairing between web apps and mobile wallets when the browser extension isn't available.
4
+
5
+ ```
6
+ Web App <--WebSocket--> Relay Server <--WebSocket--> Mobile Wallet
7
+ ```
8
+
9
+ ## What It Does
10
+
11
+ The relay is a stateless message broker. When a user doesn't have the Byoky browser extension, the web app generates a pairing code. The user scans it with the Byoky mobile app, and both sides connect to this relay. All API requests are then proxied through the phone's wallet -- keys never leave the device.
12
+
13
+ The relay never inspects payloads. It just forwards JSON messages between paired peers.
14
+
15
+ ## Deploy
16
+
17
+ ### Self-hosted
18
+
19
+ ```bash
20
+ npm install @byoky/relay
21
+ PORT=8787 npx byoky-relay
22
+ ```
23
+
24
+ ### Docker
25
+
26
+ ```dockerfile
27
+ FROM node:20-alpine
28
+ RUN npm install -g @byoky/relay
29
+ EXPOSE 8787
30
+ CMD ["byoky-relay"]
31
+ ```
32
+
33
+ ### Railway / Fly.io / Render
34
+
35
+ Deploy as a standard Node.js WebSocket server. Set the `PORT` environment variable if needed.
36
+
37
+ ## Configuration
38
+
39
+ | Env Variable | Default | Description |
40
+ |-------------|---------|-------------|
41
+ | `PORT` | `8787` | Server listen port |
42
+
43
+ ## How It Works
44
+
45
+ 1. Web app creates a room with a random ID and auth token
46
+ 2. Mobile app scans the QR code containing room ID + token
47
+ 3. Both connect to the relay and authenticate with `relay:auth`
48
+ 4. Relay assigns sender (phone) and recipient (browser) roles
49
+ 5. All subsequent messages are forwarded between the pair
50
+ 6. Idle rooms are cleaned up after 5 minutes
51
+
52
+ ### Security
53
+
54
+ - Auth tokens are compared using constant-time comparison
55
+ - Rate-limited to 5 auth attempts per 60 seconds per connection
56
+ - No message payloads are stored or inspected
57
+
58
+ ## Using with the SDK
59
+
60
+ Point the SDK to your relay instance:
61
+
62
+ ```typescript
63
+ import { Byoky } from '@byoky/sdk';
64
+
65
+ const byoky = new Byoky({
66
+ relayUrl: 'wss://your-relay.example.com',
67
+ });
68
+
69
+ const session = await byoky.connect({
70
+ providers: [{ id: 'anthropic', required: true }],
71
+ modal: true,
72
+ });
73
+ ```
74
+
75
+ The default relay is `wss://relay.byoky.com`.
76
+
77
+ ## License
78
+
79
+ [MIT](../../LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byoky/relay",
3
- "version": "0.4.10",
3
+ "version": "0.4.14",
4
4
  "description": "WebSocket relay server for Byoky",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",