@byoky/relay 0.4.10 → 0.4.11

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 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/dist/server.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@byoky/relay",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "WebSocket relay server for Byoky",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
7
- "bin": {
8
- "byoky-relay": "dist/server.js"
7
+ "bin": { "byoky-relay": "dist/server.js" },
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "start": "node dist/server.js",
11
+ "dev": "tsx src/server.ts"
9
12
  },
10
13
  "dependencies": {
11
14
  "ws": "^8.16.0"
@@ -14,10 +17,5 @@
14
17
  "typescript": "^5.4.0",
15
18
  "tsx": "^4.7.0",
16
19
  "@types/ws": "^8.5.10"
17
- },
18
- "scripts": {
19
- "build": "tsc",
20
- "start": "node dist/server.js",
21
- "dev": "tsx src/server.ts"
22
20
  }
23
- }
21
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 byoky contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.