@peers-app/peers-sdk 0.23.14 → 0.24.0

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 (80) hide show
  1. package/dist/contracts/index.d.ts +1 -0
  2. package/dist/contracts/index.js +4 -1
  3. package/dist/contracts/system/index.d.ts +2 -0
  4. package/dist/contracts/system/index.js +5 -1
  5. package/dist/contracts/system/invites-contract.d.ts +121 -0
  6. package/dist/contracts/system/invites-contract.js +150 -0
  7. package/dist/data/create-group.d.ts +24 -0
  8. package/dist/data/create-group.js +61 -0
  9. package/dist/data/group-secret.d.ts +10 -0
  10. package/dist/data/group-secret.js +26 -0
  11. package/dist/data/group-share.d.ts +0 -20
  12. package/dist/data/group-share.js +0 -35
  13. package/dist/data/index.d.ts +2 -0
  14. package/dist/data/index.js +2 -0
  15. package/dist/data/invites.d.ts +350 -0
  16. package/dist/data/invites.js +99 -0
  17. package/dist/data/users.js +4 -0
  18. package/dist/device-pairing/constants.d.ts +27 -9
  19. package/dist/device-pairing/constants.js +28 -10
  20. package/dist/device-pairing/cpace.d.ts +46 -0
  21. package/dist/device-pairing/cpace.js +173 -0
  22. package/dist/device-pairing/cpace.test.js +116 -0
  23. package/dist/device-pairing/crypto.d.ts +40 -15
  24. package/dist/device-pairing/crypto.js +74 -33
  25. package/dist/device-pairing/device-pairing.test.js +156 -119
  26. package/dist/device-pairing/index.d.ts +3 -1
  27. package/dist/device-pairing/index.js +3 -1
  28. package/dist/device-pairing/pairing-code.d.ts +27 -0
  29. package/dist/device-pairing/pairing-code.js +84 -0
  30. package/dist/device-pairing/pgp-word-list.d.ts +14 -0
  31. package/dist/device-pairing/pgp-word-list.js +531 -0
  32. package/dist/device-pairing/signaling.d.ts +17 -6
  33. package/dist/device-pairing/signaling.js +31 -8
  34. package/dist/device-pairing/transcript.d.ts +3 -3
  35. package/dist/device-pairing/transcript.js +6 -13
  36. package/dist/device-pairing/types.d.ts +870 -224
  37. package/dist/device-pairing/types.js +186 -108
  38. package/dist/index.d.ts +1 -2
  39. package/dist/index.js +1 -2
  40. package/dist/invites/data-box-schema.d.ts +15 -0
  41. package/dist/invites/data-box-schema.js +15 -0
  42. package/dist/invites/group-approval.d.ts +43 -0
  43. package/dist/invites/group-approval.js +155 -0
  44. package/dist/invites/group-approval.test.js +221 -0
  45. package/dist/invites/index.d.ts +5 -0
  46. package/dist/{group-invite → invites}/index.js +5 -3
  47. package/dist/invites/invite-epoch.d.ts +18 -0
  48. package/dist/invites/invite-epoch.js +35 -0
  49. package/dist/invites/invite-messages.d.ts +1354 -0
  50. package/dist/invites/invite-messages.js +145 -0
  51. package/dist/invites/invite-token.d.ts +334 -0
  52. package/dist/invites/invite-token.js +178 -0
  53. package/dist/invites/invite-token.test.d.ts +1 -0
  54. package/dist/invites/invite-token.test.js +123 -0
  55. package/dist/rpc-types.d.ts +5 -4
  56. package/dist/rpc-types.js +2 -1
  57. package/dist/system-ids.d.ts +22 -0
  58. package/dist/system-ids.js +23 -1
  59. package/package.json +1 -1
  60. package/dist/device-pairing/invitation.d.ts +0 -13
  61. package/dist/device-pairing/invitation.js +0 -85
  62. package/dist/group-invite/group-invite.d.ts +0 -53
  63. package/dist/group-invite/group-invite.js +0 -231
  64. package/dist/group-invite/group-invite.pvars.d.ts +0 -94
  65. package/dist/group-invite/group-invite.pvars.js +0 -139
  66. package/dist/group-invite/group-invite.types.d.ts +0 -124
  67. package/dist/group-invite/group-invite.types.js +0 -8
  68. package/dist/group-invite/index.d.ts +0 -3
  69. package/dist/user-connect/connection-code.d.ts +0 -67
  70. package/dist/user-connect/connection-code.js +0 -176
  71. package/dist/user-connect/connection-code.test.js +0 -213
  72. package/dist/user-connect/index.d.ts +0 -3
  73. package/dist/user-connect/index.js +0 -19
  74. package/dist/user-connect/user-connect.pvars.d.ts +0 -20
  75. package/dist/user-connect/user-connect.pvars.js +0 -63
  76. package/dist/user-connect/user-connect.pvars.test.js +0 -46
  77. package/dist/user-connect/user-connect.types.d.ts +0 -94
  78. package/dist/user-connect/user-connect.types.js +0 -68
  79. /package/dist/{user-connect/connection-code.test.d.ts → device-pairing/cpace.test.d.ts} +0 -0
  80. /package/dist/{user-connect/user-connect.pvars.test.d.ts → invites/group-approval.test.d.ts} +0 -0
@@ -1,52 +1,108 @@
1
1
  import { z } from "zod";
2
- /** A random 128-bit pairing-room identifier encoded as unpadded base64url. */
3
- export declare const pairingRoomIdSchema: z.ZodString;
4
- /** A random 256-bit pairing-room secret encoded as unpadded base64url. */
5
- export declare const pairingRoomSecretSchema: z.ZodString;
6
- /** A SHA-256 value encoded as unpadded base64url. */
2
+ /** A SHA-256 value or 256-bit key encoded as unpadded base64url. */
7
3
  export declare const pairingHashSchema: z.ZodString;
8
4
  /** A random 256-bit endpoint nonce encoded as unpadded base64url. */
9
5
  export declare const pairingEndpointNonceSchema: z.ZodString;
6
+ /** A 32-byte X25519 PAKE public share encoded as unpadded base64url. */
7
+ export declare const pairingPakeShareSchema: z.ZodString;
8
+ /** Small integer that names a signaling room; the first element of a pairing code. */
9
+ export declare const pairingNameplateSchema: z.ZodNumber;
10
10
  /** Source and destination roles in a two-party pairing room. */
11
11
  export declare const pairingRoleSchema: z.ZodEnum<["source", "destination"]>;
12
12
  /** Source or destination role in a two-party pairing room. */
13
13
  export type PairingRole = z.infer<typeof pairingRoleSchema>;
14
- /** Versioned invitation shared out-of-band from the signed-in source. */
15
- export declare const devicePairingInvitationSchema: z.ZodObject<{
16
- version: z.ZodLiteral<1>;
17
- roomId: z.ZodString;
18
- roomSecret: z.ZodString;
19
- expiresAt: z.ZodNumber;
14
+ /** HTTP(S) origin of the signaling service without a path. */
15
+ export declare const pairingServiceOriginSchema: z.ZodEffects<z.ZodString, string, string>;
16
+ /** Established rendezvous shared by both endpoints once the room exists. */
17
+ export declare const pairingRendezvousSchema: z.ZodObject<{
18
+ version: z.ZodLiteral<3>;
20
19
  serviceOrigin: z.ZodEffects<z.ZodString, string, string>;
20
+ nameplate: z.ZodNumber;
21
+ expiresAt: z.ZodNumber;
21
22
  }, "strict", z.ZodTypeAny, {
22
- version: 1;
23
+ version: 3;
23
24
  expiresAt: number;
24
- roomId: string;
25
- roomSecret: string;
26
25
  serviceOrigin: string;
26
+ nameplate: number;
27
27
  }, {
28
- version: 1;
28
+ version: 3;
29
29
  expiresAt: number;
30
- roomId: string;
31
- roomSecret: string;
32
30
  serviceOrigin: string;
31
+ nameplate: number;
33
32
  }>;
34
- /** Parsed device-pairing invitation. */
35
- export type DevicePairingInvitation = z.infer<typeof devicePairingInvitationSchema>;
33
+ /** Established rendezvous shared by both endpoints once the room exists. */
34
+ export type PairingRendezvous = z.infer<typeof pairingRendezvousSchema>;
36
35
  /** WebRTC session description carried inside an authenticated signaling message. */
37
36
  export declare const pairingSessionDescriptionSchema: z.ZodObject<{
38
37
  type: z.ZodEnum<["offer", "answer"]>;
39
38
  sdp: z.ZodString;
40
- endpointNonce: z.ZodString;
41
39
  }, "strict", z.ZodTypeAny, {
42
40
  type: "answer" | "offer";
43
41
  sdp: string;
44
- endpointNonce: string;
45
42
  }, {
46
43
  type: "answer" | "offer";
47
44
  sdp: string;
45
+ }>;
46
+ /** Data transports a pairing ceremony can negotiate after the PAKE. */
47
+ export declare const pairingTransportSchema: z.ZodEnum<["wrtc", "ws"]>;
48
+ /** Data transport a pairing ceremony negotiated: a scoped WebRTC peer or a direct WebSocket. */
49
+ export type PairingTransport = z.infer<typeof pairingTransportSchema>;
50
+ /** Socket.IO URL a destination hosts for the direct WebSocket transport. */
51
+ export declare const pairingWebSocketUrlSchema: z.ZodEffects<z.ZodString, string, string>;
52
+ /**
53
+ * Destination's transport options, sent right after both PAKE shares. `websocket.urls` are the
54
+ * Socket.IO origins the destination is listening on for a source that can reach them directly.
55
+ */
56
+ export declare const pairingTransportOptionsSchema: z.ZodObject<{
57
+ endpointNonce: z.ZodString;
58
+ webrtc: z.ZodBoolean;
59
+ websocket: z.ZodOptional<z.ZodObject<{
60
+ urls: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
61
+ }, "strict", z.ZodTypeAny, {
62
+ urls: string[];
63
+ }, {
64
+ urls: string[];
65
+ }>>;
66
+ }, "strict", z.ZodTypeAny, {
67
+ webrtc: boolean;
48
68
  endpointNonce: string;
69
+ websocket?: {
70
+ urls: string[];
71
+ } | undefined;
72
+ }, {
73
+ webrtc: boolean;
74
+ endpointNonce: string;
75
+ websocket?: {
76
+ urls: string[];
77
+ } | undefined;
49
78
  }>;
79
+ /** Destination's advertised transport options. */
80
+ export type PairingTransportOptions = z.infer<typeof pairingTransportOptionsSchema>;
81
+ /** Source's transport choice; `url` is the destination URL it connected to for `ws`. */
82
+ export declare const pairingTransportChoiceSchema: z.ZodDiscriminatedUnion<"selected", [z.ZodObject<{
83
+ endpointNonce: z.ZodString;
84
+ selected: z.ZodLiteral<"wrtc">;
85
+ }, "strict", z.ZodTypeAny, {
86
+ endpointNonce: string;
87
+ selected: "wrtc";
88
+ }, {
89
+ endpointNonce: string;
90
+ selected: "wrtc";
91
+ }>, z.ZodObject<{
92
+ endpointNonce: z.ZodString;
93
+ selected: z.ZodLiteral<"ws">;
94
+ url: z.ZodEffects<z.ZodString, string, string>;
95
+ }, "strict", z.ZodTypeAny, {
96
+ url: string;
97
+ endpointNonce: string;
98
+ selected: "ws";
99
+ }, {
100
+ url: string;
101
+ endpointNonce: string;
102
+ selected: "ws";
103
+ }>]>;
104
+ /** Source's transport choice. */
105
+ export type PairingTransportChoice = z.infer<typeof pairingTransportChoiceSchema>;
50
106
  /** ICE candidate carried inside an authenticated signaling message. */
51
107
  export declare const pairingIceCandidateSchema: z.ZodObject<{
52
108
  candidate: z.ZodString;
@@ -90,90 +146,231 @@ export declare const pairingIceServerSchema: z.ZodEffects<z.ZodObject<{
90
146
  }>;
91
147
  /** ICE server configuration safe to pass to a scoped pairing peer. */
92
148
  export type PairingIceServer = z.infer<typeof pairingIceServerSchema>;
93
- /** Unsigned offer, answer, or ICE message before its signaling MAC is attached. */
149
+ /** PAKE share exchanged before any key exists; it is not MACed and carries no secrets. */
150
+ export declare const pairingPakeSignalSchema: z.ZodObject<{
151
+ kind: z.ZodLiteral<"pake">;
152
+ payload: z.ZodObject<{
153
+ share: z.ZodString;
154
+ }, "strict", z.ZodTypeAny, {
155
+ share: string;
156
+ }, {
157
+ share: string;
158
+ }>;
159
+ version: z.ZodLiteral<3>;
160
+ nameplate: z.ZodNumber;
161
+ senderRole: z.ZodEnum<["source", "destination"]>;
162
+ sequence: z.ZodNumber;
163
+ }, "strict", z.ZodTypeAny, {
164
+ sequence: number;
165
+ version: 3;
166
+ kind: "pake";
167
+ payload: {
168
+ share: string;
169
+ };
170
+ nameplate: number;
171
+ senderRole: "source" | "destination";
172
+ }, {
173
+ sequence: number;
174
+ version: 3;
175
+ kind: "pake";
176
+ payload: {
177
+ share: string;
178
+ };
179
+ nameplate: number;
180
+ senderRole: "source" | "destination";
181
+ }>;
182
+ /** PAKE share signaling message. */
183
+ export type PairingPakeSignal = z.infer<typeof pairingPakeSignalSchema>;
184
+ /**
185
+ * Unsigned transport, offer, answer, or ICE message before its signaling MAC is attached.
186
+ *
187
+ * Order after both PAKE shares: destination `transport-options`, source `transport-choice`, then
188
+ * (WebRTC only) source `offer`, destination `answer`, and `candidate`s from either role.
189
+ */
94
190
  export declare const unsignedPairingSignalSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
191
+ kind: z.ZodLiteral<"transport-options">;
192
+ payload: z.ZodObject<{
193
+ endpointNonce: z.ZodString;
194
+ webrtc: z.ZodBoolean;
195
+ websocket: z.ZodOptional<z.ZodObject<{
196
+ urls: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
197
+ }, "strict", z.ZodTypeAny, {
198
+ urls: string[];
199
+ }, {
200
+ urls: string[];
201
+ }>>;
202
+ }, "strict", z.ZodTypeAny, {
203
+ webrtc: boolean;
204
+ endpointNonce: string;
205
+ websocket?: {
206
+ urls: string[];
207
+ } | undefined;
208
+ }, {
209
+ webrtc: boolean;
210
+ endpointNonce: string;
211
+ websocket?: {
212
+ urls: string[];
213
+ } | undefined;
214
+ }>;
215
+ version: z.ZodLiteral<3>;
216
+ nameplate: z.ZodNumber;
217
+ senderRole: z.ZodEnum<["source", "destination"]>;
218
+ sequence: z.ZodNumber;
219
+ }, "strict", z.ZodTypeAny, {
220
+ sequence: number;
221
+ version: 3;
222
+ kind: "transport-options";
223
+ payload: {
224
+ webrtc: boolean;
225
+ endpointNonce: string;
226
+ websocket?: {
227
+ urls: string[];
228
+ } | undefined;
229
+ };
230
+ nameplate: number;
231
+ senderRole: "source" | "destination";
232
+ }, {
233
+ sequence: number;
234
+ version: 3;
235
+ kind: "transport-options";
236
+ payload: {
237
+ webrtc: boolean;
238
+ endpointNonce: string;
239
+ websocket?: {
240
+ urls: string[];
241
+ } | undefined;
242
+ };
243
+ nameplate: number;
244
+ senderRole: "source" | "destination";
245
+ }>, z.ZodObject<{
246
+ kind: z.ZodLiteral<"transport-choice">;
247
+ payload: z.ZodDiscriminatedUnion<"selected", [z.ZodObject<{
248
+ endpointNonce: z.ZodString;
249
+ selected: z.ZodLiteral<"wrtc">;
250
+ }, "strict", z.ZodTypeAny, {
251
+ endpointNonce: string;
252
+ selected: "wrtc";
253
+ }, {
254
+ endpointNonce: string;
255
+ selected: "wrtc";
256
+ }>, z.ZodObject<{
257
+ endpointNonce: z.ZodString;
258
+ selected: z.ZodLiteral<"ws">;
259
+ url: z.ZodEffects<z.ZodString, string, string>;
260
+ }, "strict", z.ZodTypeAny, {
261
+ url: string;
262
+ endpointNonce: string;
263
+ selected: "ws";
264
+ }, {
265
+ url: string;
266
+ endpointNonce: string;
267
+ selected: "ws";
268
+ }>]>;
269
+ version: z.ZodLiteral<3>;
270
+ nameplate: z.ZodNumber;
271
+ senderRole: z.ZodEnum<["source", "destination"]>;
272
+ sequence: z.ZodNumber;
273
+ }, "strict", z.ZodTypeAny, {
274
+ sequence: number;
275
+ version: 3;
276
+ kind: "transport-choice";
277
+ payload: {
278
+ endpointNonce: string;
279
+ selected: "wrtc";
280
+ } | {
281
+ url: string;
282
+ endpointNonce: string;
283
+ selected: "ws";
284
+ };
285
+ nameplate: number;
286
+ senderRole: "source" | "destination";
287
+ }, {
288
+ sequence: number;
289
+ version: 3;
290
+ kind: "transport-choice";
291
+ payload: {
292
+ endpointNonce: string;
293
+ selected: "wrtc";
294
+ } | {
295
+ url: string;
296
+ endpointNonce: string;
297
+ selected: "ws";
298
+ };
299
+ nameplate: number;
300
+ senderRole: "source" | "destination";
301
+ }>, z.ZodObject<{
95
302
  kind: z.ZodLiteral<"offer">;
96
303
  payload: z.ZodObject<{
97
304
  sdp: z.ZodString;
98
- endpointNonce: z.ZodString;
99
305
  } & {
100
306
  type: z.ZodLiteral<"offer">;
101
307
  }, "strict", z.ZodTypeAny, {
102
308
  type: "offer";
103
309
  sdp: string;
104
- endpointNonce: string;
105
310
  }, {
106
311
  type: "offer";
107
312
  sdp: string;
108
- endpointNonce: string;
109
313
  }>;
110
- version: z.ZodLiteral<1>;
111
- roomId: z.ZodString;
314
+ version: z.ZodLiteral<3>;
315
+ nameplate: z.ZodNumber;
112
316
  senderRole: z.ZodEnum<["source", "destination"]>;
113
317
  sequence: z.ZodNumber;
114
318
  }, "strict", z.ZodTypeAny, {
115
319
  sequence: number;
116
- version: 1;
320
+ version: 3;
117
321
  kind: "offer";
118
- roomId: string;
119
322
  payload: {
120
323
  type: "offer";
121
324
  sdp: string;
122
- endpointNonce: string;
123
325
  };
326
+ nameplate: number;
124
327
  senderRole: "source" | "destination";
125
328
  }, {
126
329
  sequence: number;
127
- version: 1;
330
+ version: 3;
128
331
  kind: "offer";
129
- roomId: string;
130
332
  payload: {
131
333
  type: "offer";
132
334
  sdp: string;
133
- endpointNonce: string;
134
335
  };
336
+ nameplate: number;
135
337
  senderRole: "source" | "destination";
136
338
  }>, z.ZodObject<{
137
339
  kind: z.ZodLiteral<"answer">;
138
340
  payload: z.ZodObject<{
139
341
  sdp: z.ZodString;
140
- endpointNonce: z.ZodString;
141
342
  } & {
142
343
  type: z.ZodLiteral<"answer">;
143
344
  }, "strict", z.ZodTypeAny, {
144
345
  type: "answer";
145
346
  sdp: string;
146
- endpointNonce: string;
147
347
  }, {
148
348
  type: "answer";
149
349
  sdp: string;
150
- endpointNonce: string;
151
350
  }>;
152
- version: z.ZodLiteral<1>;
153
- roomId: z.ZodString;
351
+ version: z.ZodLiteral<3>;
352
+ nameplate: z.ZodNumber;
154
353
  senderRole: z.ZodEnum<["source", "destination"]>;
155
354
  sequence: z.ZodNumber;
156
355
  }, "strict", z.ZodTypeAny, {
157
356
  sequence: number;
158
- version: 1;
357
+ version: 3;
159
358
  kind: "answer";
160
- roomId: string;
161
359
  payload: {
162
360
  type: "answer";
163
361
  sdp: string;
164
- endpointNonce: string;
165
362
  };
363
+ nameplate: number;
166
364
  senderRole: "source" | "destination";
167
365
  }, {
168
366
  sequence: number;
169
- version: 1;
367
+ version: 3;
170
368
  kind: "answer";
171
- roomId: string;
172
369
  payload: {
173
370
  type: "answer";
174
371
  sdp: string;
175
- endpointNonce: string;
176
372
  };
373
+ nameplate: number;
177
374
  senderRole: "source" | "destination";
178
375
  }>, z.ZodObject<{
179
376
  kind: z.ZodLiteral<"candidate">;
@@ -193,126 +390,523 @@ export declare const unsignedPairingSignalSchema: z.ZodDiscriminatedUnion<"kind"
193
390
  sdpMLineIndex?: number | null | undefined;
194
391
  usernameFragment?: string | null | undefined;
195
392
  }>;
196
- version: z.ZodLiteral<1>;
197
- roomId: z.ZodString;
393
+ version: z.ZodLiteral<3>;
394
+ nameplate: z.ZodNumber;
198
395
  senderRole: z.ZodEnum<["source", "destination"]>;
199
396
  sequence: z.ZodNumber;
200
397
  }, "strict", z.ZodTypeAny, {
201
398
  sequence: number;
202
- version: 1;
399
+ version: 3;
203
400
  kind: "candidate";
204
- roomId: string;
205
401
  payload: {
206
402
  candidate: string;
207
403
  sdpMid?: string | null | undefined;
208
404
  sdpMLineIndex?: number | null | undefined;
209
405
  usernameFragment?: string | null | undefined;
210
406
  };
407
+ nameplate: number;
211
408
  senderRole: "source" | "destination";
212
409
  }, {
213
410
  sequence: number;
214
- version: 1;
411
+ version: 3;
215
412
  kind: "candidate";
216
- roomId: string;
217
413
  payload: {
218
414
  candidate: string;
219
415
  sdpMid?: string | null | undefined;
220
416
  sdpMLineIndex?: number | null | undefined;
221
417
  usernameFragment?: string | null | undefined;
222
418
  };
419
+ nameplate: number;
223
420
  senderRole: "source" | "destination";
224
421
  }>]>;
225
422
  /** Signaling message contents before authentication. */
226
423
  export type UnsignedPairingSignal = z.infer<typeof unsignedPairingSignalSchema>;
227
- /** HMAC-authenticated offer, answer, or ICE signaling message. */
228
- export declare const pairingSignalSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
424
+ /** HMAC-authenticated transport, offer, answer, or ICE signaling message. */
425
+ export declare const authenticatedPairingSignalSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
426
+ kind: z.ZodLiteral<"transport-options">;
427
+ payload: z.ZodObject<{
428
+ endpointNonce: z.ZodString;
429
+ webrtc: z.ZodBoolean;
430
+ websocket: z.ZodOptional<z.ZodObject<{
431
+ urls: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
432
+ }, "strict", z.ZodTypeAny, {
433
+ urls: string[];
434
+ }, {
435
+ urls: string[];
436
+ }>>;
437
+ }, "strict", z.ZodTypeAny, {
438
+ webrtc: boolean;
439
+ endpointNonce: string;
440
+ websocket?: {
441
+ urls: string[];
442
+ } | undefined;
443
+ }, {
444
+ webrtc: boolean;
445
+ endpointNonce: string;
446
+ websocket?: {
447
+ urls: string[];
448
+ } | undefined;
449
+ }>;
450
+ version: z.ZodLiteral<3>;
451
+ nameplate: z.ZodNumber;
452
+ senderRole: z.ZodEnum<["source", "destination"]>;
453
+ sequence: z.ZodNumber;
454
+ } & {
455
+ mac: z.ZodString;
456
+ }, "strict", z.ZodTypeAny, {
457
+ sequence: number;
458
+ version: 3;
459
+ kind: "transport-options";
460
+ payload: {
461
+ webrtc: boolean;
462
+ endpointNonce: string;
463
+ websocket?: {
464
+ urls: string[];
465
+ } | undefined;
466
+ };
467
+ nameplate: number;
468
+ senderRole: "source" | "destination";
469
+ mac: string;
470
+ }, {
471
+ sequence: number;
472
+ version: 3;
473
+ kind: "transport-options";
474
+ payload: {
475
+ webrtc: boolean;
476
+ endpointNonce: string;
477
+ websocket?: {
478
+ urls: string[];
479
+ } | undefined;
480
+ };
481
+ nameplate: number;
482
+ senderRole: "source" | "destination";
483
+ mac: string;
484
+ }>, z.ZodObject<{
485
+ kind: z.ZodLiteral<"transport-choice">;
486
+ payload: z.ZodDiscriminatedUnion<"selected", [z.ZodObject<{
487
+ endpointNonce: z.ZodString;
488
+ selected: z.ZodLiteral<"wrtc">;
489
+ }, "strict", z.ZodTypeAny, {
490
+ endpointNonce: string;
491
+ selected: "wrtc";
492
+ }, {
493
+ endpointNonce: string;
494
+ selected: "wrtc";
495
+ }>, z.ZodObject<{
496
+ endpointNonce: z.ZodString;
497
+ selected: z.ZodLiteral<"ws">;
498
+ url: z.ZodEffects<z.ZodString, string, string>;
499
+ }, "strict", z.ZodTypeAny, {
500
+ url: string;
501
+ endpointNonce: string;
502
+ selected: "ws";
503
+ }, {
504
+ url: string;
505
+ endpointNonce: string;
506
+ selected: "ws";
507
+ }>]>;
508
+ version: z.ZodLiteral<3>;
509
+ nameplate: z.ZodNumber;
510
+ senderRole: z.ZodEnum<["source", "destination"]>;
511
+ sequence: z.ZodNumber;
512
+ } & {
513
+ mac: z.ZodString;
514
+ }, "strict", z.ZodTypeAny, {
515
+ sequence: number;
516
+ version: 3;
517
+ kind: "transport-choice";
518
+ payload: {
519
+ endpointNonce: string;
520
+ selected: "wrtc";
521
+ } | {
522
+ url: string;
523
+ endpointNonce: string;
524
+ selected: "ws";
525
+ };
526
+ nameplate: number;
527
+ senderRole: "source" | "destination";
528
+ mac: string;
529
+ }, {
530
+ sequence: number;
531
+ version: 3;
532
+ kind: "transport-choice";
533
+ payload: {
534
+ endpointNonce: string;
535
+ selected: "wrtc";
536
+ } | {
537
+ url: string;
538
+ endpointNonce: string;
539
+ selected: "ws";
540
+ };
541
+ nameplate: number;
542
+ senderRole: "source" | "destination";
543
+ mac: string;
544
+ }>, z.ZodObject<{
229
545
  kind: z.ZodLiteral<"offer">;
230
546
  payload: z.ZodObject<{
231
547
  sdp: z.ZodString;
232
- endpointNonce: z.ZodString;
233
548
  } & {
234
549
  type: z.ZodLiteral<"offer">;
235
550
  }, "strict", z.ZodTypeAny, {
236
551
  type: "offer";
237
552
  sdp: string;
238
- endpointNonce: string;
239
553
  }, {
240
554
  type: "offer";
241
555
  sdp: string;
242
- endpointNonce: string;
243
556
  }>;
244
- mac: z.ZodString;
245
- version: z.ZodLiteral<1>;
246
- roomId: z.ZodString;
557
+ version: z.ZodLiteral<3>;
558
+ nameplate: z.ZodNumber;
247
559
  senderRole: z.ZodEnum<["source", "destination"]>;
248
560
  sequence: z.ZodNumber;
561
+ } & {
562
+ mac: z.ZodString;
249
563
  }, "strict", z.ZodTypeAny, {
250
564
  sequence: number;
251
- version: 1;
565
+ version: 3;
252
566
  kind: "offer";
253
- roomId: string;
254
567
  payload: {
255
568
  type: "offer";
256
569
  sdp: string;
257
- endpointNonce: string;
258
570
  };
571
+ nameplate: number;
259
572
  senderRole: "source" | "destination";
260
573
  mac: string;
261
574
  }, {
262
575
  sequence: number;
263
- version: 1;
576
+ version: 3;
264
577
  kind: "offer";
265
- roomId: string;
266
578
  payload: {
267
579
  type: "offer";
268
580
  sdp: string;
269
- endpointNonce: string;
270
581
  };
582
+ nameplate: number;
271
583
  senderRole: "source" | "destination";
272
584
  mac: string;
273
585
  }>, z.ZodObject<{
274
586
  kind: z.ZodLiteral<"answer">;
275
587
  payload: z.ZodObject<{
276
588
  sdp: z.ZodString;
277
- endpointNonce: z.ZodString;
278
589
  } & {
279
590
  type: z.ZodLiteral<"answer">;
280
591
  }, "strict", z.ZodTypeAny, {
281
592
  type: "answer";
282
593
  sdp: string;
283
- endpointNonce: string;
284
594
  }, {
285
595
  type: "answer";
286
596
  sdp: string;
597
+ }>;
598
+ version: z.ZodLiteral<3>;
599
+ nameplate: z.ZodNumber;
600
+ senderRole: z.ZodEnum<["source", "destination"]>;
601
+ sequence: z.ZodNumber;
602
+ } & {
603
+ mac: z.ZodString;
604
+ }, "strict", z.ZodTypeAny, {
605
+ sequence: number;
606
+ version: 3;
607
+ kind: "answer";
608
+ payload: {
609
+ type: "answer";
610
+ sdp: string;
611
+ };
612
+ nameplate: number;
613
+ senderRole: "source" | "destination";
614
+ mac: string;
615
+ }, {
616
+ sequence: number;
617
+ version: 3;
618
+ kind: "answer";
619
+ payload: {
620
+ type: "answer";
621
+ sdp: string;
622
+ };
623
+ nameplate: number;
624
+ senderRole: "source" | "destination";
625
+ mac: string;
626
+ }>, z.ZodObject<{
627
+ kind: z.ZodLiteral<"candidate">;
628
+ payload: z.ZodObject<{
629
+ candidate: z.ZodString;
630
+ sdpMid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
631
+ sdpMLineIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
632
+ usernameFragment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
633
+ }, "strict", z.ZodTypeAny, {
634
+ candidate: string;
635
+ sdpMid?: string | null | undefined;
636
+ sdpMLineIndex?: number | null | undefined;
637
+ usernameFragment?: string | null | undefined;
638
+ }, {
639
+ candidate: string;
640
+ sdpMid?: string | null | undefined;
641
+ sdpMLineIndex?: number | null | undefined;
642
+ usernameFragment?: string | null | undefined;
643
+ }>;
644
+ version: z.ZodLiteral<3>;
645
+ nameplate: z.ZodNumber;
646
+ senderRole: z.ZodEnum<["source", "destination"]>;
647
+ sequence: z.ZodNumber;
648
+ } & {
649
+ mac: z.ZodString;
650
+ }, "strict", z.ZodTypeAny, {
651
+ sequence: number;
652
+ version: 3;
653
+ kind: "candidate";
654
+ payload: {
655
+ candidate: string;
656
+ sdpMid?: string | null | undefined;
657
+ sdpMLineIndex?: number | null | undefined;
658
+ usernameFragment?: string | null | undefined;
659
+ };
660
+ nameplate: number;
661
+ senderRole: "source" | "destination";
662
+ mac: string;
663
+ }, {
664
+ sequence: number;
665
+ version: 3;
666
+ kind: "candidate";
667
+ payload: {
668
+ candidate: string;
669
+ sdpMid?: string | null | undefined;
670
+ sdpMLineIndex?: number | null | undefined;
671
+ usernameFragment?: string | null | undefined;
672
+ };
673
+ nameplate: number;
674
+ senderRole: "source" | "destination";
675
+ mac: string;
676
+ }>]>;
677
+ /** HMAC-authenticated transport, offer, answer, or ICE signaling message. */
678
+ export type AuthenticatedPairingSignal = z.infer<typeof authenticatedPairingSignalSchema>;
679
+ /** Any signaling message relayed by peers-services: the PAKE share or an authenticated signal. */
680
+ export declare const pairingSignalSchema: z.ZodUnion<[z.ZodObject<{
681
+ kind: z.ZodLiteral<"pake">;
682
+ payload: z.ZodObject<{
683
+ share: z.ZodString;
684
+ }, "strict", z.ZodTypeAny, {
685
+ share: string;
686
+ }, {
687
+ share: string;
688
+ }>;
689
+ version: z.ZodLiteral<3>;
690
+ nameplate: z.ZodNumber;
691
+ senderRole: z.ZodEnum<["source", "destination"]>;
692
+ sequence: z.ZodNumber;
693
+ }, "strict", z.ZodTypeAny, {
694
+ sequence: number;
695
+ version: 3;
696
+ kind: "pake";
697
+ payload: {
698
+ share: string;
699
+ };
700
+ nameplate: number;
701
+ senderRole: "source" | "destination";
702
+ }, {
703
+ sequence: number;
704
+ version: 3;
705
+ kind: "pake";
706
+ payload: {
707
+ share: string;
708
+ };
709
+ nameplate: number;
710
+ senderRole: "source" | "destination";
711
+ }>, z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
712
+ kind: z.ZodLiteral<"transport-options">;
713
+ payload: z.ZodObject<{
714
+ endpointNonce: z.ZodString;
715
+ webrtc: z.ZodBoolean;
716
+ websocket: z.ZodOptional<z.ZodObject<{
717
+ urls: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
718
+ }, "strict", z.ZodTypeAny, {
719
+ urls: string[];
720
+ }, {
721
+ urls: string[];
722
+ }>>;
723
+ }, "strict", z.ZodTypeAny, {
724
+ webrtc: boolean;
725
+ endpointNonce: string;
726
+ websocket?: {
727
+ urls: string[];
728
+ } | undefined;
729
+ }, {
730
+ webrtc: boolean;
287
731
  endpointNonce: string;
732
+ websocket?: {
733
+ urls: string[];
734
+ } | undefined;
288
735
  }>;
736
+ version: z.ZodLiteral<3>;
737
+ nameplate: z.ZodNumber;
738
+ senderRole: z.ZodEnum<["source", "destination"]>;
739
+ sequence: z.ZodNumber;
740
+ } & {
289
741
  mac: z.ZodString;
290
- version: z.ZodLiteral<1>;
291
- roomId: z.ZodString;
742
+ }, "strict", z.ZodTypeAny, {
743
+ sequence: number;
744
+ version: 3;
745
+ kind: "transport-options";
746
+ payload: {
747
+ webrtc: boolean;
748
+ endpointNonce: string;
749
+ websocket?: {
750
+ urls: string[];
751
+ } | undefined;
752
+ };
753
+ nameplate: number;
754
+ senderRole: "source" | "destination";
755
+ mac: string;
756
+ }, {
757
+ sequence: number;
758
+ version: 3;
759
+ kind: "transport-options";
760
+ payload: {
761
+ webrtc: boolean;
762
+ endpointNonce: string;
763
+ websocket?: {
764
+ urls: string[];
765
+ } | undefined;
766
+ };
767
+ nameplate: number;
768
+ senderRole: "source" | "destination";
769
+ mac: string;
770
+ }>, z.ZodObject<{
771
+ kind: z.ZodLiteral<"transport-choice">;
772
+ payload: z.ZodDiscriminatedUnion<"selected", [z.ZodObject<{
773
+ endpointNonce: z.ZodString;
774
+ selected: z.ZodLiteral<"wrtc">;
775
+ }, "strict", z.ZodTypeAny, {
776
+ endpointNonce: string;
777
+ selected: "wrtc";
778
+ }, {
779
+ endpointNonce: string;
780
+ selected: "wrtc";
781
+ }>, z.ZodObject<{
782
+ endpointNonce: z.ZodString;
783
+ selected: z.ZodLiteral<"ws">;
784
+ url: z.ZodEffects<z.ZodString, string, string>;
785
+ }, "strict", z.ZodTypeAny, {
786
+ url: string;
787
+ endpointNonce: string;
788
+ selected: "ws";
789
+ }, {
790
+ url: string;
791
+ endpointNonce: string;
792
+ selected: "ws";
793
+ }>]>;
794
+ version: z.ZodLiteral<3>;
795
+ nameplate: z.ZodNumber;
292
796
  senderRole: z.ZodEnum<["source", "destination"]>;
293
797
  sequence: z.ZodNumber;
798
+ } & {
799
+ mac: z.ZodString;
294
800
  }, "strict", z.ZodTypeAny, {
295
801
  sequence: number;
296
- version: 1;
802
+ version: 3;
803
+ kind: "transport-choice";
804
+ payload: {
805
+ endpointNonce: string;
806
+ selected: "wrtc";
807
+ } | {
808
+ url: string;
809
+ endpointNonce: string;
810
+ selected: "ws";
811
+ };
812
+ nameplate: number;
813
+ senderRole: "source" | "destination";
814
+ mac: string;
815
+ }, {
816
+ sequence: number;
817
+ version: 3;
818
+ kind: "transport-choice";
819
+ payload: {
820
+ endpointNonce: string;
821
+ selected: "wrtc";
822
+ } | {
823
+ url: string;
824
+ endpointNonce: string;
825
+ selected: "ws";
826
+ };
827
+ nameplate: number;
828
+ senderRole: "source" | "destination";
829
+ mac: string;
830
+ }>, z.ZodObject<{
831
+ kind: z.ZodLiteral<"offer">;
832
+ payload: z.ZodObject<{
833
+ sdp: z.ZodString;
834
+ } & {
835
+ type: z.ZodLiteral<"offer">;
836
+ }, "strict", z.ZodTypeAny, {
837
+ type: "offer";
838
+ sdp: string;
839
+ }, {
840
+ type: "offer";
841
+ sdp: string;
842
+ }>;
843
+ version: z.ZodLiteral<3>;
844
+ nameplate: z.ZodNumber;
845
+ senderRole: z.ZodEnum<["source", "destination"]>;
846
+ sequence: z.ZodNumber;
847
+ } & {
848
+ mac: z.ZodString;
849
+ }, "strict", z.ZodTypeAny, {
850
+ sequence: number;
851
+ version: 3;
852
+ kind: "offer";
853
+ payload: {
854
+ type: "offer";
855
+ sdp: string;
856
+ };
857
+ nameplate: number;
858
+ senderRole: "source" | "destination";
859
+ mac: string;
860
+ }, {
861
+ sequence: number;
862
+ version: 3;
863
+ kind: "offer";
864
+ payload: {
865
+ type: "offer";
866
+ sdp: string;
867
+ };
868
+ nameplate: number;
869
+ senderRole: "source" | "destination";
870
+ mac: string;
871
+ }>, z.ZodObject<{
872
+ kind: z.ZodLiteral<"answer">;
873
+ payload: z.ZodObject<{
874
+ sdp: z.ZodString;
875
+ } & {
876
+ type: z.ZodLiteral<"answer">;
877
+ }, "strict", z.ZodTypeAny, {
878
+ type: "answer";
879
+ sdp: string;
880
+ }, {
881
+ type: "answer";
882
+ sdp: string;
883
+ }>;
884
+ version: z.ZodLiteral<3>;
885
+ nameplate: z.ZodNumber;
886
+ senderRole: z.ZodEnum<["source", "destination"]>;
887
+ sequence: z.ZodNumber;
888
+ } & {
889
+ mac: z.ZodString;
890
+ }, "strict", z.ZodTypeAny, {
891
+ sequence: number;
892
+ version: 3;
297
893
  kind: "answer";
298
- roomId: string;
299
894
  payload: {
300
895
  type: "answer";
301
896
  sdp: string;
302
- endpointNonce: string;
303
897
  };
898
+ nameplate: number;
304
899
  senderRole: "source" | "destination";
305
900
  mac: string;
306
901
  }, {
307
902
  sequence: number;
308
- version: 1;
903
+ version: 3;
309
904
  kind: "answer";
310
- roomId: string;
311
905
  payload: {
312
906
  type: "answer";
313
907
  sdp: string;
314
- endpointNonce: string;
315
908
  };
909
+ nameplate: number;
316
910
  senderRole: "source" | "destination";
317
911
  mac: string;
318
912
  }>, z.ZodObject<{
@@ -333,90 +927,79 @@ export declare const pairingSignalSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
333
927
  sdpMLineIndex?: number | null | undefined;
334
928
  usernameFragment?: string | null | undefined;
335
929
  }>;
336
- mac: z.ZodString;
337
- version: z.ZodLiteral<1>;
338
- roomId: z.ZodString;
930
+ version: z.ZodLiteral<3>;
931
+ nameplate: z.ZodNumber;
339
932
  senderRole: z.ZodEnum<["source", "destination"]>;
340
933
  sequence: z.ZodNumber;
934
+ } & {
935
+ mac: z.ZodString;
341
936
  }, "strict", z.ZodTypeAny, {
342
937
  sequence: number;
343
- version: 1;
938
+ version: 3;
344
939
  kind: "candidate";
345
- roomId: string;
346
940
  payload: {
347
941
  candidate: string;
348
942
  sdpMid?: string | null | undefined;
349
943
  sdpMLineIndex?: number | null | undefined;
350
944
  usernameFragment?: string | null | undefined;
351
945
  };
946
+ nameplate: number;
352
947
  senderRole: "source" | "destination";
353
948
  mac: string;
354
949
  }, {
355
950
  sequence: number;
356
- version: 1;
951
+ version: 3;
357
952
  kind: "candidate";
358
- roomId: string;
359
953
  payload: {
360
954
  candidate: string;
361
955
  sdpMid?: string | null | undefined;
362
956
  sdpMLineIndex?: number | null | undefined;
363
957
  usernameFragment?: string | null | undefined;
364
958
  };
959
+ nameplate: number;
365
960
  senderRole: "source" | "destination";
366
961
  mac: string;
367
- }>]>;
368
- /** Authenticated signaling message relayed by peers-services. */
962
+ }>]>]>;
963
+ /** Any signaling message relayed by peers-services. */
369
964
  export type PairingSignal = z.infer<typeof pairingSignalSchema>;
370
- /** Request from the source to create a bounded signaling room. */
965
+ /** Request from the destination to create a bounded signaling room and receive a nameplate. */
371
966
  export declare const devicePairingCreateRoomRequestSchema: z.ZodObject<{
372
- version: z.ZodLiteral<1>;
373
- roomId: z.ZodString;
967
+ version: z.ZodLiteral<3>;
374
968
  expiresAt: z.ZodNumber;
375
- roomAccessTokenHash: z.ZodString;
376
969
  }, "strict", z.ZodTypeAny, {
377
- version: 1;
970
+ version: 3;
378
971
  expiresAt: number;
379
- roomId: string;
380
- roomAccessTokenHash: string;
381
972
  }, {
382
- version: 1;
973
+ version: 3;
383
974
  expiresAt: number;
384
- roomId: string;
385
- roomAccessTokenHash: string;
386
975
  }>;
387
- /** Source request to create a bounded signaling room. */
976
+ /** Destination request to create a bounded signaling room. */
388
977
  export type DevicePairingCreateRoomRequest = z.infer<typeof devicePairingCreateRoomRequestSchema>;
389
- /** Request from the destination to occupy the second room slot. */
978
+ /** Request from the source to occupy the room named by the typed or scanned nameplate. */
390
979
  export declare const devicePairingJoinRoomRequestSchema: z.ZodObject<{
391
- version: z.ZodLiteral<1>;
392
- roomId: z.ZodString;
393
- roomAccessToken: z.ZodString;
980
+ version: z.ZodLiteral<3>;
981
+ nameplate: z.ZodNumber;
394
982
  }, "strict", z.ZodTypeAny, {
395
- version: 1;
396
- roomId: string;
397
- roomAccessToken: string;
983
+ version: 3;
984
+ nameplate: number;
398
985
  }, {
399
- version: 1;
400
- roomId: string;
401
- roomAccessToken: string;
986
+ version: 3;
987
+ nameplate: number;
402
988
  }>;
403
- /** Destination request to join a bounded signaling room. */
989
+ /** Source request to join a bounded signaling room. */
404
990
  export type DevicePairingJoinRoomRequest = z.infer<typeof devicePairingJoinRoomRequestSchema>;
405
- /** Request from the source to tear down its signaling room. */
991
+ /** Request from the creating destination socket to tear down its signaling room. */
406
992
  export declare const devicePairingDeleteRoomRequestSchema: z.ZodObject<{
407
- version: z.ZodLiteral<1>;
408
- roomId: z.ZodString;
409
- roomAccessToken: z.ZodString;
993
+ version: z.ZodLiteral<3>;
994
+ nameplate: z.ZodNumber;
410
995
  }, "strict", z.ZodTypeAny, {
411
- version: 1;
412
- roomId: string;
413
- roomAccessToken: string;
996
+ version: 3;
997
+ nameplate: number;
414
998
  }, {
415
- version: 1;
416
- roomId: string;
417
- roomAccessToken: string;
999
+ version: 3;
1000
+ nameplate: number;
418
1001
  }>;
419
- /** Source request to delete a bounded signaling room. */
1002
+ /** Destination request to delete a bounded signaling room. */
420
1003
  export type DevicePairingDeleteRoomRequest = z.infer<typeof devicePairingDeleteRoomRequestSchema>;
421
1004
  /** Public signaling-service error codes that do not echo attacker input. */
422
1005
  export declare const devicePairingSignalingErrorCodeSchema: z.ZodEnum<["invalid", "not-found", "occupied", "expired", "forbidden", "rate-limited", "too-large", "out-of-order"]>;
@@ -441,7 +1024,32 @@ export declare const devicePairingSignalingAckSchema: z.ZodDiscriminatedUnion<"o
441
1024
  }>]>;
442
1025
  /** Acknowledgement returned by every signaling-room command. */
443
1026
  export type DevicePairingSignalingAck = z.infer<typeof devicePairingSignalingAckSchema>;
444
- /** Acknowledgement proving room creation/join and its service-authoritative expiry. */
1027
+ /** Acknowledgement returned to the destination with its allocated nameplate and expiry. */
1028
+ export declare const devicePairingRoomCreatedAckSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
1029
+ ok: z.ZodLiteral<true>;
1030
+ nameplate: z.ZodNumber;
1031
+ expiresAt: z.ZodNumber;
1032
+ }, "strict", z.ZodTypeAny, {
1033
+ ok: true;
1034
+ expiresAt: number;
1035
+ nameplate: number;
1036
+ }, {
1037
+ ok: true;
1038
+ expiresAt: number;
1039
+ nameplate: number;
1040
+ }>, z.ZodObject<{
1041
+ ok: z.ZodLiteral<false>;
1042
+ code: z.ZodEnum<["invalid", "not-found", "occupied", "expired", "forbidden", "rate-limited", "too-large", "out-of-order"]>;
1043
+ }, "strict", z.ZodTypeAny, {
1044
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
1045
+ ok: false;
1046
+ }, {
1047
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
1048
+ ok: false;
1049
+ }>]>;
1050
+ /** Room-created acknowledgement returned by create. */
1051
+ export type DevicePairingRoomCreatedAck = z.infer<typeof devicePairingRoomCreatedAckSchema>;
1052
+ /** Acknowledgement proving a room join and its service-authoritative expiry. */
445
1053
  export declare const devicePairingRoomReadyAckSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
446
1054
  ok: z.ZodLiteral<true>;
447
1055
  expiresAt: z.ZodNumber;
@@ -461,7 +1069,7 @@ export declare const devicePairingRoomReadyAckSchema: z.ZodDiscriminatedUnion<"o
461
1069
  code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
462
1070
  ok: false;
463
1071
  }>]>;
464
- /** Room-ready acknowledgement returned by create and join. */
1072
+ /** Room-ready acknowledgement returned by join. */
465
1073
  export type DevicePairingRoomReadyAck = z.infer<typeof devicePairingRoomReadyAckSchema>;
466
1074
  /** Acknowledgement containing room-bound, short-lived ICE configuration. */
467
1075
  export declare const devicePairingIceServersAckSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
@@ -513,10 +1121,17 @@ export declare const devicePairingIceServersAckSchema: z.ZodDiscriminatedUnion<"
513
1121
  }>]>;
514
1122
  /** ICE configuration acknowledgement returned only to a room member. */
515
1123
  export type DevicePairingIceServersAck = z.infer<typeof devicePairingIceServersAckSchema>;
516
- /** Canonical transcript input derived independently by both endpoints. */
1124
+ /**
1125
+ * Canonical transcript input derived independently by both endpoints.
1126
+ *
1127
+ * `transportBinding` pins the negotiated data channel: for `wrtc` it is the sorted SHA-256 DTLS
1128
+ * fingerprints of the offer and answer (`offer|answer`); for `ws` it is the destination URL the
1129
+ * source connected to, exactly as advertised in the MACed transport options.
1130
+ */
517
1131
  export declare const devicePairingTranscriptSchema: z.ZodObject<{
518
- version: z.ZodLiteral<1>;
519
- roomId: z.ZodString;
1132
+ version: z.ZodLiteral<3>;
1133
+ serviceOrigin: z.ZodEffects<z.ZodString, string, string>;
1134
+ nameplate: z.ZodNumber;
520
1135
  sourceIdentity: z.ZodObject<{
521
1136
  userId: z.ZodEffects<z.ZodString, string, string>;
522
1137
  deviceId: z.ZodEffects<z.ZodString, string, string>;
@@ -563,11 +1178,13 @@ export declare const devicePairingTranscriptSchema: z.ZodObject<{
563
1178
  }>;
564
1179
  sourceEndpointNonce: z.ZodString;
565
1180
  destinationEndpointNonce: z.ZodString;
566
- offerFingerprint: z.ZodString;
567
- answerFingerprint: z.ZodString;
1181
+ transport: z.ZodEnum<["wrtc", "ws"]>;
1182
+ transportBinding: z.ZodString;
568
1183
  }, "strict", z.ZodTypeAny, {
569
- version: 1;
570
- roomId: string;
1184
+ transport: "ws" | "wrtc";
1185
+ version: 3;
1186
+ serviceOrigin: string;
1187
+ nameplate: number;
571
1188
  sourceIdentity: {
572
1189
  publicKey: string;
573
1190
  publicBoxKey: string;
@@ -586,11 +1203,12 @@ export declare const devicePairingTranscriptSchema: z.ZodObject<{
586
1203
  };
587
1204
  sourceEndpointNonce: string;
588
1205
  destinationEndpointNonce: string;
589
- offerFingerprint: string;
590
- answerFingerprint: string;
1206
+ transportBinding: string;
591
1207
  }, {
592
- version: 1;
593
- roomId: string;
1208
+ transport: "ws" | "wrtc";
1209
+ version: 3;
1210
+ serviceOrigin: string;
1211
+ nameplate: number;
594
1212
  sourceIdentity: {
595
1213
  publicKey: string;
596
1214
  publicBoxKey: string;
@@ -609,8 +1227,7 @@ export declare const devicePairingTranscriptSchema: z.ZodObject<{
609
1227
  };
610
1228
  sourceEndpointNonce: string;
611
1229
  destinationEndpointNonce: string;
612
- offerFingerprint: string;
613
- answerFingerprint: string;
1230
+ transportBinding: string;
614
1231
  }>;
615
1232
  /** Inputs whose canonical hash identifies one pairing connection. */
616
1233
  export type DevicePairingTranscript = z.infer<typeof devicePairingTranscriptSchema>;
@@ -630,9 +1247,10 @@ export declare const pairingDevicePresentationSchema: z.ZodObject<{
630
1247
  }>;
631
1248
  /** Renderer-safe presentation of the remote endpoint. */
632
1249
  export type PairingDevicePresentation = z.infer<typeof pairingDevicePresentationSchema>;
633
- /** Payload exchanged by `pairing.describe` after the normal Connection handshake. */
634
- export declare const pairingDescriptionSchema: z.ZodObject<{
635
- version: z.ZodLiteral<1>;
1250
+ /** Unauthenticated contents of a `pairing.confirm` message. */
1251
+ export declare const pairingConfirmationContentsSchema: z.ZodObject<{
1252
+ version: z.ZodLiteral<3>;
1253
+ role: z.ZodEnum<["source", "destination"]>;
636
1254
  transcriptHash: z.ZodString;
637
1255
  device: z.ZodObject<{
638
1256
  userId: z.ZodEffects<z.ZodString, string, string>;
@@ -670,7 +1288,8 @@ export declare const pairingDescriptionSchema: z.ZodObject<{
670
1288
  deviceType?: string | undefined;
671
1289
  }>;
672
1290
  }, "strict", z.ZodTypeAny, {
673
- version: 1;
1291
+ role: "source" | "destination";
1292
+ version: 3;
674
1293
  device: {
675
1294
  publicKey: string;
676
1295
  publicBoxKey: string;
@@ -686,7 +1305,8 @@ export declare const pairingDescriptionSchema: z.ZodObject<{
686
1305
  deviceType?: string | undefined;
687
1306
  };
688
1307
  }, {
689
- version: 1;
1308
+ role: "source" | "destination";
1309
+ version: 3;
690
1310
  device: {
691
1311
  publicKey: string;
692
1312
  publicBoxKey: string;
@@ -702,91 +1322,107 @@ export declare const pairingDescriptionSchema: z.ZodObject<{
702
1322
  deviceType?: string | undefined;
703
1323
  };
704
1324
  }>;
705
- /** Payload exchanged by `pairing.describe`. */
706
- export type PairingDescription = z.infer<typeof pairingDescriptionSchema>;
707
- /** Contents of a signed, single-use user approval. */
708
- export declare const pairingApprovalContentsSchema: z.ZodObject<{
709
- version: z.ZodLiteral<1>;
710
- approvalId: z.ZodString;
711
- transcriptHash: z.ZodString;
1325
+ /** Unauthenticated contents of a `pairing.confirm` message. */
1326
+ export type PairingConfirmationContents = z.infer<typeof pairingConfirmationContentsSchema>;
1327
+ /**
1328
+ * Payload exchanged by `pairing.confirm` after the Connection handshake. The MAC uses the
1329
+ * PAKE-derived confirmation key, proving the peer knew the code and saw the same transcript.
1330
+ */
1331
+ export declare const pairingConfirmationSchema: z.ZodObject<{
1332
+ version: z.ZodLiteral<3>;
712
1333
  role: z.ZodEnum<["source", "destination"]>;
713
- expiresAt: z.ZodNumber;
714
- }, "strict", z.ZodTypeAny, {
715
- role: "source" | "destination";
716
- version: 1;
717
- expiresAt: number;
718
- approvalId: string;
719
- transcriptHash: string;
720
- }, {
721
- role: "source" | "destination";
722
- version: 1;
723
- expiresAt: number;
724
- approvalId: string;
725
- transcriptHash: string;
726
- }>;
727
- /** Contents of a signed pairing approval. */
728
- export type PairingApprovalContents = z.infer<typeof pairingApprovalContentsSchema>;
729
- /** Signed approval bound to one transcript and endpoint identity. */
730
- export declare const signedPairingApprovalSchema: z.ZodObject<{
731
- contents: z.ZodObject<{
732
- version: z.ZodLiteral<1>;
733
- approvalId: z.ZodString;
734
- transcriptHash: z.ZodString;
735
- role: z.ZodEnum<["source", "destination"]>;
736
- expiresAt: z.ZodNumber;
1334
+ transcriptHash: z.ZodString;
1335
+ device: z.ZodObject<{
1336
+ userId: z.ZodEffects<z.ZodString, string, string>;
1337
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
1338
+ publicKey: z.ZodString;
1339
+ publicBoxKey: z.ZodString;
1340
+ userName: z.ZodOptional<z.ZodString>;
1341
+ deviceName: z.ZodOptional<z.ZodString>;
1342
+ }, "strip", z.ZodTypeAny, {
1343
+ publicKey: string;
1344
+ publicBoxKey: string;
1345
+ userId: string;
1346
+ deviceId: string;
1347
+ deviceName?: string | undefined;
1348
+ userName?: string | undefined;
1349
+ }, {
1350
+ publicKey: string;
1351
+ publicBoxKey: string;
1352
+ userId: string;
1353
+ deviceId: string;
1354
+ deviceName?: string | undefined;
1355
+ userName?: string | undefined;
1356
+ }>;
1357
+ presentation: z.ZodObject<{
1358
+ deviceName: z.ZodOptional<z.ZodString>;
1359
+ userName: z.ZodOptional<z.ZodString>;
1360
+ deviceType: z.ZodOptional<z.ZodString>;
737
1361
  }, "strict", z.ZodTypeAny, {
738
- role: "source" | "destination";
739
- version: 1;
740
- expiresAt: number;
741
- approvalId: string;
742
- transcriptHash: string;
1362
+ deviceName?: string | undefined;
1363
+ userName?: string | undefined;
1364
+ deviceType?: string | undefined;
743
1365
  }, {
744
- role: "source" | "destination";
745
- version: 1;
746
- expiresAt: number;
747
- approvalId: string;
748
- transcriptHash: string;
1366
+ deviceName?: string | undefined;
1367
+ userName?: string | undefined;
1368
+ deviceType?: string | undefined;
749
1369
  }>;
750
- signature: z.ZodString;
751
- publicKey: z.ZodString;
1370
+ } & {
1371
+ mac: z.ZodString;
752
1372
  }, "strict", z.ZodTypeAny, {
753
- publicKey: string;
754
- signature: string;
755
- contents: {
756
- role: "source" | "destination";
757
- version: 1;
758
- expiresAt: number;
759
- approvalId: string;
760
- transcriptHash: string;
1373
+ role: "source" | "destination";
1374
+ version: 3;
1375
+ device: {
1376
+ publicKey: string;
1377
+ publicBoxKey: string;
1378
+ userId: string;
1379
+ deviceId: string;
1380
+ deviceName?: string | undefined;
1381
+ userName?: string | undefined;
1382
+ };
1383
+ mac: string;
1384
+ transcriptHash: string;
1385
+ presentation: {
1386
+ deviceName?: string | undefined;
1387
+ userName?: string | undefined;
1388
+ deviceType?: string | undefined;
761
1389
  };
762
1390
  }, {
763
- publicKey: string;
764
- signature: string;
765
- contents: {
766
- role: "source" | "destination";
767
- version: 1;
768
- expiresAt: number;
769
- approvalId: string;
770
- transcriptHash: string;
1391
+ role: "source" | "destination";
1392
+ version: 3;
1393
+ device: {
1394
+ publicKey: string;
1395
+ publicBoxKey: string;
1396
+ userId: string;
1397
+ deviceId: string;
1398
+ deviceName?: string | undefined;
1399
+ userName?: string | undefined;
1400
+ };
1401
+ mac: string;
1402
+ transcriptHash: string;
1403
+ presentation: {
1404
+ deviceName?: string | undefined;
1405
+ userName?: string | undefined;
1406
+ deviceType?: string | undefined;
771
1407
  };
772
1408
  }>;
773
- /** Signed approval bound to one transcript and endpoint identity. */
774
- export type SignedPairingApproval = z.infer<typeof signedPairingApprovalSchema>;
1409
+ /** Payload exchanged by `pairing.confirm`. */
1410
+ export type PairingConfirmation = z.infer<typeof pairingConfirmationSchema>;
775
1411
  /** Account credentials encrypted directly to the temporary destination identity. */
776
1412
  export declare const pairingCredentialContentsSchema: z.ZodObject<{
777
- version: z.ZodLiteral<1>;
1413
+ version: z.ZodLiteral<3>;
778
1414
  transcriptHash: z.ZodString;
779
1415
  expiresAt: z.ZodNumber;
780
1416
  userId: z.ZodEffects<z.ZodString, string, string>;
781
1417
  secretKey: z.ZodString;
782
1418
  }, "strict", z.ZodTypeAny, {
783
- version: 1;
1419
+ version: 3;
784
1420
  secretKey: string;
785
1421
  userId: string;
786
1422
  expiresAt: number;
787
1423
  transcriptHash: string;
788
1424
  }, {
789
- version: 1;
1425
+ version: 3;
790
1426
  secretKey: string;
791
1427
  userId: string;
792
1428
  expiresAt: number;
@@ -794,7 +1430,7 @@ export declare const pairingCredentialContentsSchema: z.ZodObject<{
794
1430
  }>;
795
1431
  /** Account credentials before they are signed and boxed. */
796
1432
  export type PairingCredentialContents = z.infer<typeof pairingCredentialContentsSchema>;
797
- /** Signed-and-boxed credential envelope sent over the WebRTC Connection. */
1433
+ /** Signed-and-boxed credential envelope sent over the pairing Connection. */
798
1434
  export declare const pairingCredentialEnvelopeSchema: z.ZodObject<{
799
1435
  contents: z.ZodString;
800
1436
  nonce: z.ZodString;
@@ -808,11 +1444,11 @@ export declare const pairingCredentialEnvelopeSchema: z.ZodObject<{
808
1444
  contents: string;
809
1445
  fromPublicKey: string;
810
1446
  }>;
811
- /** Signed-and-boxed credential envelope sent over the WebRTC Connection. */
1447
+ /** Signed-and-boxed credential envelope sent over the pairing Connection. */
812
1448
  export type PairingCredentialEnvelope = z.infer<typeof pairingCredentialEnvelopeSchema>;
813
1449
  /** Contents of the temporary destination identity's signed installation receipt. */
814
1450
  export declare const pairingInstallationReceiptContentsSchema: z.ZodObject<{
815
- version: z.ZodLiteral<1>;
1451
+ version: z.ZodLiteral<3>;
816
1452
  transcriptHash: z.ZodString;
817
1453
  initializedDevice: z.ZodObject<{
818
1454
  userId: z.ZodEffects<z.ZodString, string, string>;
@@ -838,7 +1474,7 @@ export declare const pairingInstallationReceiptContentsSchema: z.ZodObject<{
838
1474
  }>;
839
1475
  installedAt: z.ZodNumber;
840
1476
  }, "strict", z.ZodTypeAny, {
841
- version: 1;
1477
+ version: 3;
842
1478
  transcriptHash: string;
843
1479
  initializedDevice: {
844
1480
  publicKey: string;
@@ -850,7 +1486,7 @@ export declare const pairingInstallationReceiptContentsSchema: z.ZodObject<{
850
1486
  };
851
1487
  installedAt: number;
852
1488
  }, {
853
- version: 1;
1489
+ version: 3;
854
1490
  transcriptHash: string;
855
1491
  initializedDevice: {
856
1492
  publicKey: string;
@@ -867,7 +1503,7 @@ export type PairingInstallationReceiptContents = z.infer<typeof pairingInstallat
867
1503
  /** Receipt proving installation on the authenticated temporary destination endpoint. */
868
1504
  export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
869
1505
  contents: z.ZodObject<{
870
- version: z.ZodLiteral<1>;
1506
+ version: z.ZodLiteral<3>;
871
1507
  transcriptHash: z.ZodString;
872
1508
  initializedDevice: z.ZodObject<{
873
1509
  userId: z.ZodEffects<z.ZodString, string, string>;
@@ -893,7 +1529,7 @@ export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
893
1529
  }>;
894
1530
  installedAt: z.ZodNumber;
895
1531
  }, "strict", z.ZodTypeAny, {
896
- version: 1;
1532
+ version: 3;
897
1533
  transcriptHash: string;
898
1534
  initializedDevice: {
899
1535
  publicKey: string;
@@ -905,7 +1541,7 @@ export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
905
1541
  };
906
1542
  installedAt: number;
907
1543
  }, {
908
- version: 1;
1544
+ version: 3;
909
1545
  transcriptHash: string;
910
1546
  initializedDevice: {
911
1547
  publicKey: string;
@@ -923,7 +1559,7 @@ export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
923
1559
  publicKey: string;
924
1560
  signature: string;
925
1561
  contents: {
926
- version: 1;
1562
+ version: 3;
927
1563
  transcriptHash: string;
928
1564
  initializedDevice: {
929
1565
  publicKey: string;
@@ -939,7 +1575,7 @@ export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
939
1575
  publicKey: string;
940
1576
  signature: string;
941
1577
  contents: {
942
- version: 1;
1578
+ version: 3;
943
1579
  transcriptHash: string;
944
1580
  initializedDevice: {
945
1581
  publicKey: string;
@@ -954,15 +1590,22 @@ export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
954
1590
  }>;
955
1591
  /** Receipt proving installation on the authenticated temporary destination endpoint. */
956
1592
  export type SignedPairingInstallationReceipt = z.infer<typeof signedPairingInstallationReceiptSchema>;
957
- /** Renderer-visible phases of the short-lived pairing ceremony. */
958
- export declare const devicePairingPhaseSchema: z.ZodEnum<["idle", "inviting", "connecting", "comparing", "waiting-for-approval", "transferring", "complete", "rejected", "error"]>;
1593
+ /**
1594
+ * Renderer-visible phases of the short-lived pairing ceremony.
1595
+ *
1596
+ * - `showing-code`: destination is displaying its code and waiting for a source to join.
1597
+ * - `connecting`: room joined; transport negotiation and the Connection handshake are in progress.
1598
+ * - `authenticating`: PAKE-derived confirmations are being exchanged.
1599
+ * - `waiting-for-approval`: source must tap Approve; destination waits for it.
1600
+ */
1601
+ export declare const devicePairingPhaseSchema: z.ZodEnum<["idle", "showing-code", "connecting", "authenticating", "waiting-for-approval", "transferring", "complete", "rejected", "error"]>;
959
1602
  /** Renderer-visible phase of the short-lived pairing ceremony. */
960
1603
  export type DevicePairingPhase = z.infer<typeof devicePairingPhaseSchema>;
961
1604
  /** Sanitized pairing state safe to publish across the host/renderer boundary. */
962
1605
  export declare const devicePairingStateSchema: z.ZodObject<{
963
1606
  sessionId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
964
1607
  role: z.ZodOptional<z.ZodEnum<["source", "destination"]>>;
965
- phase: z.ZodEnum<["idle", "inviting", "connecting", "comparing", "waiting-for-approval", "transferring", "complete", "rejected", "error"]>;
1608
+ phase: z.ZodEnum<["idle", "showing-code", "connecting", "authenticating", "waiting-for-approval", "transferring", "complete", "rejected", "error"]>;
966
1609
  expiresAt: z.ZodOptional<z.ZodNumber>;
967
1610
  remoteDevice: z.ZodOptional<z.ZodObject<{
968
1611
  deviceName: z.ZodOptional<z.ZodString>;
@@ -977,10 +1620,14 @@ export declare const devicePairingStateSchema: z.ZodObject<{
977
1620
  userName?: string | undefined;
978
1621
  deviceType?: string | undefined;
979
1622
  }>>;
980
- sas: z.ZodOptional<z.ZodString>;
1623
+ /** Destination only: the code to show as text and QR while `showing-code`. */
1624
+ code: z.ZodOptional<z.ZodString>;
1625
+ /** Non-fatal message shown alongside the current phase (e.g. why a code was rotated). */
1626
+ notice: z.ZodOptional<z.ZodString>;
981
1627
  error: z.ZodOptional<z.ZodString>;
982
1628
  }, "strict", z.ZodTypeAny, {
983
- phase: "error" | "connecting" | "idle" | "complete" | "rejected" | "inviting" | "comparing" | "waiting-for-approval" | "transferring";
1629
+ phase: "error" | "connecting" | "idle" | "complete" | "rejected" | "showing-code" | "authenticating" | "waiting-for-approval" | "transferring";
1630
+ code?: string | undefined;
984
1631
  error?: string | undefined;
985
1632
  role?: "source" | "destination" | undefined;
986
1633
  sessionId?: string | undefined;
@@ -990,9 +1637,10 @@ export declare const devicePairingStateSchema: z.ZodObject<{
990
1637
  userName?: string | undefined;
991
1638
  deviceType?: string | undefined;
992
1639
  } | undefined;
993
- sas?: string | undefined;
1640
+ notice?: string | undefined;
994
1641
  }, {
995
- phase: "error" | "connecting" | "idle" | "complete" | "rejected" | "inviting" | "comparing" | "waiting-for-approval" | "transferring";
1642
+ phase: "error" | "connecting" | "idle" | "complete" | "rejected" | "showing-code" | "authenticating" | "waiting-for-approval" | "transferring";
1643
+ code?: string | undefined;
996
1644
  error?: string | undefined;
997
1645
  role?: "source" | "destination" | undefined;
998
1646
  sessionId?: string | undefined;
@@ -1002,18 +1650,16 @@ export declare const devicePairingStateSchema: z.ZodObject<{
1002
1650
  userName?: string | undefined;
1003
1651
  deviceType?: string | undefined;
1004
1652
  } | undefined;
1005
- sas?: string | undefined;
1653
+ notice?: string | undefined;
1006
1654
  }>;
1007
1655
  /** Sanitized pairing state safe to publish across the host/renderer boundary. */
1008
1656
  export type DevicePairingState = z.infer<typeof devicePairingStateSchema>;
1009
- /** One-time source start result; emitted state never contains the invitation URL. */
1010
- export interface DevicePairingStartSourceResult {
1011
- state: DevicePairingState;
1012
- invitationUrl: string;
1657
+ /** Input for starting a source-side ceremony from a typed or scanned pairing code. */
1658
+ export interface DevicePairingStartSourceInput {
1659
+ code: string;
1013
1660
  }
1014
- /** Input for starting a destination-side pairing ceremony. */
1661
+ /** Input for starting a destination-side ceremony that displays a code. */
1015
1662
  export interface DevicePairingStartDestinationInput {
1016
- invitation: string;
1017
1663
  deviceName?: string;
1018
1664
  deviceType?: string;
1019
1665
  }