@xtr-dev/rondevu-server 0.5.12 → 0.5.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.
- package/README.md +9 -21
- package/dist/index.js +939 -1110
- package/dist/index.js.map +4 -4
- package/migrations/0009_public_key_auth.sql +74 -0
- package/migrations/fresh_schema.sql +20 -21
- package/package.json +2 -1
- package/src/config.ts +1 -47
- package/src/crypto.ts +70 -304
- package/src/index.ts +2 -3
- package/src/rpc.ts +90 -272
- package/src/storage/d1.ts +72 -235
- package/src/storage/factory.ts +4 -17
- package/src/storage/memory.ts +46 -151
- package/src/storage/mysql.ts +66 -187
- package/src/storage/postgres.ts +66 -186
- package/src/storage/sqlite.ts +65 -194
- package/src/storage/types.ts +30 -88
- package/src/worker.ts +4 -9
- package/wrangler.toml +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**WebRTC signaling server with tags-based discovery**
|
|
6
6
|
|
|
7
|
-
HTTP signaling server with
|
|
7
|
+
HTTP signaling server with stateless Ed25519 authentication, tag-based offer discovery, and JSON-RPC interface. Multiple storage backends supported.
|
|
8
8
|
|
|
9
9
|
## Quick Start
|
|
10
10
|
|
|
@@ -57,21 +57,10 @@ npm install pg # for PostgreSQL
|
|
|
57
57
|
|
|
58
58
|
All API calls go to `POST /rpc` with JSON-RPC format. Requests must be arrays.
|
|
59
59
|
|
|
60
|
-
### Generate Credentials
|
|
61
|
-
|
|
62
|
-
```json
|
|
63
|
-
[{ "method": "generateCredentials", "params": { "name": "alice" } }]
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Response:
|
|
67
|
-
```json
|
|
68
|
-
[{ "success": true, "result": { "name": "alice", "secret": "5a7f3e..." } }]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
60
|
### Publish Offer (authenticated)
|
|
72
61
|
|
|
73
62
|
```
|
|
74
|
-
Headers: X-
|
|
63
|
+
Headers: X-PublicKey, X-Timestamp, X-Nonce, X-Signature
|
|
75
64
|
```
|
|
76
65
|
|
|
77
66
|
```json
|
|
@@ -81,7 +70,7 @@ Headers: X-Name, X-Timestamp, X-Nonce, X-Signature
|
|
|
81
70
|
}]
|
|
82
71
|
```
|
|
83
72
|
|
|
84
|
-
### Discover Offers
|
|
73
|
+
### Discover Offers (unauthenticated)
|
|
85
74
|
|
|
86
75
|
```json
|
|
87
76
|
[{ "method": "discover", "params": { "tags": ["chat"], "limit": 10 } }]
|
|
@@ -97,18 +86,20 @@ Headers: X-Name, X-Timestamp, X-Nonce, X-Signature
|
|
|
97
86
|
|
|
98
87
|
- `addIceCandidates` - Add ICE candidates
|
|
99
88
|
- `getIceCandidates` - Get ICE candidates
|
|
100
|
-
- `poll` - Poll for answers
|
|
89
|
+
- `poll` - Poll for answers and ICE candidates
|
|
101
90
|
- `deleteOffer` - Delete an offer
|
|
102
91
|
|
|
103
92
|
## Authentication
|
|
104
93
|
|
|
105
|
-
|
|
94
|
+
**Stateless Ed25519**: No registration required. Generate a keypair locally and sign requests.
|
|
106
95
|
|
|
107
96
|
```
|
|
108
|
-
Message: timestamp:nonce:method:
|
|
109
|
-
Headers: X-
|
|
97
|
+
Message: timestamp:nonce:method:canonicalJSON(params)
|
|
98
|
+
Headers: X-PublicKey, X-Timestamp, X-Nonce, X-Signature (base64 Ed25519)
|
|
110
99
|
```
|
|
111
100
|
|
|
101
|
+
The server verifies signatures directly using the public key from the header - no identity table, no registration step. Your public key IS your identity.
|
|
102
|
+
|
|
112
103
|
## Configuration
|
|
113
104
|
|
|
114
105
|
| Variable | Default | Description |
|
|
@@ -119,12 +110,9 @@ Headers: X-Name, X-Timestamp, X-Nonce, X-Signature (base64 HMAC)
|
|
|
119
110
|
| `DATABASE_URL` | - | Connection string (for `mysql`/`postgres`) |
|
|
120
111
|
| `DB_POOL_SIZE` | `10` | Connection pool size (for `mysql`/`postgres`) |
|
|
121
112
|
| `CORS_ORIGINS` | `*` | Allowed origins |
|
|
122
|
-
| `MASTER_ENCRYPTION_KEY` | - | 64-char hex for secret encryption |
|
|
123
113
|
| `OFFER_DEFAULT_TTL` | `60000` | Default offer TTL (ms) |
|
|
124
114
|
| `OFFER_MAX_TTL` | `86400000` | Max offer TTL (24h) |
|
|
125
115
|
|
|
126
|
-
Generate encryption key: `openssl rand -hex 32`
|
|
127
|
-
|
|
128
116
|
## Tag Validation
|
|
129
117
|
|
|
130
118
|
Tags: 1-64 chars, lowercase alphanumeric with dots/dashes.
|