@peers-app/peers-sdk 0.20.6 → 0.21.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.
@@ -0,0 +1,1023 @@
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. */
7
+ export declare const pairingHashSchema: z.ZodString;
8
+ /** A random 256-bit endpoint nonce encoded as unpadded base64url. */
9
+ export declare const pairingEndpointNonceSchema: z.ZodString;
10
+ /** Source and destination roles in a two-party pairing room. */
11
+ export declare const pairingRoleSchema: z.ZodEnum<["source", "destination"]>;
12
+ /** Source or destination role in a two-party pairing room. */
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;
20
+ serviceOrigin: z.ZodEffects<z.ZodString, string, string>;
21
+ }, "strict", z.ZodTypeAny, {
22
+ version: 1;
23
+ expiresAt: number;
24
+ roomId: string;
25
+ roomSecret: string;
26
+ serviceOrigin: string;
27
+ }, {
28
+ version: 1;
29
+ expiresAt: number;
30
+ roomId: string;
31
+ roomSecret: string;
32
+ serviceOrigin: string;
33
+ }>;
34
+ /** Parsed device-pairing invitation. */
35
+ export type DevicePairingInvitation = z.infer<typeof devicePairingInvitationSchema>;
36
+ /** WebRTC session description carried inside an authenticated signaling message. */
37
+ export declare const pairingSessionDescriptionSchema: z.ZodObject<{
38
+ type: z.ZodEnum<["offer", "answer"]>;
39
+ sdp: z.ZodString;
40
+ endpointNonce: z.ZodString;
41
+ }, "strict", z.ZodTypeAny, {
42
+ type: "answer" | "offer";
43
+ sdp: string;
44
+ endpointNonce: string;
45
+ }, {
46
+ type: "answer" | "offer";
47
+ sdp: string;
48
+ endpointNonce: string;
49
+ }>;
50
+ /** ICE candidate carried inside an authenticated signaling message. */
51
+ export declare const pairingIceCandidateSchema: z.ZodObject<{
52
+ candidate: z.ZodString;
53
+ sdpMid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ sdpMLineIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
55
+ usernameFragment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ }, "strict", z.ZodTypeAny, {
57
+ candidate: string;
58
+ sdpMid?: string | null | undefined;
59
+ sdpMLineIndex?: number | null | undefined;
60
+ usernameFragment?: string | null | undefined;
61
+ }, {
62
+ candidate: string;
63
+ sdpMid?: string | null | undefined;
64
+ sdpMLineIndex?: number | null | undefined;
65
+ usernameFragment?: string | null | undefined;
66
+ }>;
67
+ /** ICE candidate carried inside an authenticated signaling message. */
68
+ export type PairingIceCandidate = z.infer<typeof pairingIceCandidateSchema>;
69
+ /** Validated ICE server configuration issued to a pairing-room member. */
70
+ export declare const pairingIceServerSchema: z.ZodEffects<z.ZodObject<{
71
+ urls: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">]>;
72
+ username: z.ZodOptional<z.ZodString>;
73
+ credential: z.ZodOptional<z.ZodString>;
74
+ }, "strict", z.ZodTypeAny, {
75
+ urls: string | string[];
76
+ username?: string | undefined;
77
+ credential?: string | undefined;
78
+ }, {
79
+ urls: string | string[];
80
+ username?: string | undefined;
81
+ credential?: string | undefined;
82
+ }>, {
83
+ urls: string | string[];
84
+ username?: string | undefined;
85
+ credential?: string | undefined;
86
+ }, {
87
+ urls: string | string[];
88
+ username?: string | undefined;
89
+ credential?: string | undefined;
90
+ }>;
91
+ /** ICE server configuration safe to pass to a scoped pairing peer. */
92
+ export type PairingIceServer = z.infer<typeof pairingIceServerSchema>;
93
+ /** Unsigned offer, answer, or ICE message before its signaling MAC is attached. */
94
+ export declare const unsignedPairingSignalSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
95
+ kind: z.ZodLiteral<"offer">;
96
+ payload: z.ZodObject<{
97
+ sdp: z.ZodString;
98
+ endpointNonce: z.ZodString;
99
+ } & {
100
+ type: z.ZodLiteral<"offer">;
101
+ }, "strict", z.ZodTypeAny, {
102
+ type: "offer";
103
+ sdp: string;
104
+ endpointNonce: string;
105
+ }, {
106
+ type: "offer";
107
+ sdp: string;
108
+ endpointNonce: string;
109
+ }>;
110
+ version: z.ZodLiteral<1>;
111
+ roomId: z.ZodString;
112
+ senderRole: z.ZodEnum<["source", "destination"]>;
113
+ sequence: z.ZodNumber;
114
+ }, "strict", z.ZodTypeAny, {
115
+ sequence: number;
116
+ version: 1;
117
+ kind: "offer";
118
+ roomId: string;
119
+ payload: {
120
+ type: "offer";
121
+ sdp: string;
122
+ endpointNonce: string;
123
+ };
124
+ senderRole: "source" | "destination";
125
+ }, {
126
+ sequence: number;
127
+ version: 1;
128
+ kind: "offer";
129
+ roomId: string;
130
+ payload: {
131
+ type: "offer";
132
+ sdp: string;
133
+ endpointNonce: string;
134
+ };
135
+ senderRole: "source" | "destination";
136
+ }>, z.ZodObject<{
137
+ kind: z.ZodLiteral<"answer">;
138
+ payload: z.ZodObject<{
139
+ sdp: z.ZodString;
140
+ endpointNonce: z.ZodString;
141
+ } & {
142
+ type: z.ZodLiteral<"answer">;
143
+ }, "strict", z.ZodTypeAny, {
144
+ type: "answer";
145
+ sdp: string;
146
+ endpointNonce: string;
147
+ }, {
148
+ type: "answer";
149
+ sdp: string;
150
+ endpointNonce: string;
151
+ }>;
152
+ version: z.ZodLiteral<1>;
153
+ roomId: z.ZodString;
154
+ senderRole: z.ZodEnum<["source", "destination"]>;
155
+ sequence: z.ZodNumber;
156
+ }, "strict", z.ZodTypeAny, {
157
+ sequence: number;
158
+ version: 1;
159
+ kind: "answer";
160
+ roomId: string;
161
+ payload: {
162
+ type: "answer";
163
+ sdp: string;
164
+ endpointNonce: string;
165
+ };
166
+ senderRole: "source" | "destination";
167
+ }, {
168
+ sequence: number;
169
+ version: 1;
170
+ kind: "answer";
171
+ roomId: string;
172
+ payload: {
173
+ type: "answer";
174
+ sdp: string;
175
+ endpointNonce: string;
176
+ };
177
+ senderRole: "source" | "destination";
178
+ }>, z.ZodObject<{
179
+ kind: z.ZodLiteral<"candidate">;
180
+ payload: z.ZodObject<{
181
+ candidate: z.ZodString;
182
+ sdpMid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
+ sdpMLineIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
184
+ usernameFragment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ candidate: string;
187
+ sdpMid?: string | null | undefined;
188
+ sdpMLineIndex?: number | null | undefined;
189
+ usernameFragment?: string | null | undefined;
190
+ }, {
191
+ candidate: string;
192
+ sdpMid?: string | null | undefined;
193
+ sdpMLineIndex?: number | null | undefined;
194
+ usernameFragment?: string | null | undefined;
195
+ }>;
196
+ version: z.ZodLiteral<1>;
197
+ roomId: z.ZodString;
198
+ senderRole: z.ZodEnum<["source", "destination"]>;
199
+ sequence: z.ZodNumber;
200
+ }, "strict", z.ZodTypeAny, {
201
+ sequence: number;
202
+ version: 1;
203
+ kind: "candidate";
204
+ roomId: string;
205
+ payload: {
206
+ candidate: string;
207
+ sdpMid?: string | null | undefined;
208
+ sdpMLineIndex?: number | null | undefined;
209
+ usernameFragment?: string | null | undefined;
210
+ };
211
+ senderRole: "source" | "destination";
212
+ }, {
213
+ sequence: number;
214
+ version: 1;
215
+ kind: "candidate";
216
+ roomId: string;
217
+ payload: {
218
+ candidate: string;
219
+ sdpMid?: string | null | undefined;
220
+ sdpMLineIndex?: number | null | undefined;
221
+ usernameFragment?: string | null | undefined;
222
+ };
223
+ senderRole: "source" | "destination";
224
+ }>]>;
225
+ /** Signaling message contents before authentication. */
226
+ 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<{
229
+ kind: z.ZodLiteral<"offer">;
230
+ payload: z.ZodObject<{
231
+ sdp: z.ZodString;
232
+ endpointNonce: z.ZodString;
233
+ } & {
234
+ type: z.ZodLiteral<"offer">;
235
+ }, "strict", z.ZodTypeAny, {
236
+ type: "offer";
237
+ sdp: string;
238
+ endpointNonce: string;
239
+ }, {
240
+ type: "offer";
241
+ sdp: string;
242
+ endpointNonce: string;
243
+ }>;
244
+ mac: z.ZodString;
245
+ version: z.ZodLiteral<1>;
246
+ roomId: z.ZodString;
247
+ senderRole: z.ZodEnum<["source", "destination"]>;
248
+ sequence: z.ZodNumber;
249
+ }, "strict", z.ZodTypeAny, {
250
+ sequence: number;
251
+ version: 1;
252
+ kind: "offer";
253
+ roomId: string;
254
+ payload: {
255
+ type: "offer";
256
+ sdp: string;
257
+ endpointNonce: string;
258
+ };
259
+ senderRole: "source" | "destination";
260
+ mac: string;
261
+ }, {
262
+ sequence: number;
263
+ version: 1;
264
+ kind: "offer";
265
+ roomId: string;
266
+ payload: {
267
+ type: "offer";
268
+ sdp: string;
269
+ endpointNonce: string;
270
+ };
271
+ senderRole: "source" | "destination";
272
+ mac: string;
273
+ }>, z.ZodObject<{
274
+ kind: z.ZodLiteral<"answer">;
275
+ payload: z.ZodObject<{
276
+ sdp: z.ZodString;
277
+ endpointNonce: z.ZodString;
278
+ } & {
279
+ type: z.ZodLiteral<"answer">;
280
+ }, "strict", z.ZodTypeAny, {
281
+ type: "answer";
282
+ sdp: string;
283
+ endpointNonce: string;
284
+ }, {
285
+ type: "answer";
286
+ sdp: string;
287
+ endpointNonce: string;
288
+ }>;
289
+ mac: z.ZodString;
290
+ version: z.ZodLiteral<1>;
291
+ roomId: z.ZodString;
292
+ senderRole: z.ZodEnum<["source", "destination"]>;
293
+ sequence: z.ZodNumber;
294
+ }, "strict", z.ZodTypeAny, {
295
+ sequence: number;
296
+ version: 1;
297
+ kind: "answer";
298
+ roomId: string;
299
+ payload: {
300
+ type: "answer";
301
+ sdp: string;
302
+ endpointNonce: string;
303
+ };
304
+ senderRole: "source" | "destination";
305
+ mac: string;
306
+ }, {
307
+ sequence: number;
308
+ version: 1;
309
+ kind: "answer";
310
+ roomId: string;
311
+ payload: {
312
+ type: "answer";
313
+ sdp: string;
314
+ endpointNonce: string;
315
+ };
316
+ senderRole: "source" | "destination";
317
+ mac: string;
318
+ }>, z.ZodObject<{
319
+ kind: z.ZodLiteral<"candidate">;
320
+ payload: z.ZodObject<{
321
+ candidate: z.ZodString;
322
+ sdpMid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
323
+ sdpMLineIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
324
+ usernameFragment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
325
+ }, "strict", z.ZodTypeAny, {
326
+ candidate: string;
327
+ sdpMid?: string | null | undefined;
328
+ sdpMLineIndex?: number | null | undefined;
329
+ usernameFragment?: string | null | undefined;
330
+ }, {
331
+ candidate: string;
332
+ sdpMid?: string | null | undefined;
333
+ sdpMLineIndex?: number | null | undefined;
334
+ usernameFragment?: string | null | undefined;
335
+ }>;
336
+ mac: z.ZodString;
337
+ version: z.ZodLiteral<1>;
338
+ roomId: z.ZodString;
339
+ senderRole: z.ZodEnum<["source", "destination"]>;
340
+ sequence: z.ZodNumber;
341
+ }, "strict", z.ZodTypeAny, {
342
+ sequence: number;
343
+ version: 1;
344
+ kind: "candidate";
345
+ roomId: string;
346
+ payload: {
347
+ candidate: string;
348
+ sdpMid?: string | null | undefined;
349
+ sdpMLineIndex?: number | null | undefined;
350
+ usernameFragment?: string | null | undefined;
351
+ };
352
+ senderRole: "source" | "destination";
353
+ mac: string;
354
+ }, {
355
+ sequence: number;
356
+ version: 1;
357
+ kind: "candidate";
358
+ roomId: string;
359
+ payload: {
360
+ candidate: string;
361
+ sdpMid?: string | null | undefined;
362
+ sdpMLineIndex?: number | null | undefined;
363
+ usernameFragment?: string | null | undefined;
364
+ };
365
+ senderRole: "source" | "destination";
366
+ mac: string;
367
+ }>]>;
368
+ /** Authenticated signaling message relayed by peers-services. */
369
+ export type PairingSignal = z.infer<typeof pairingSignalSchema>;
370
+ /** Request from the source to create a bounded signaling room. */
371
+ export declare const devicePairingCreateRoomRequestSchema: z.ZodObject<{
372
+ version: z.ZodLiteral<1>;
373
+ roomId: z.ZodString;
374
+ expiresAt: z.ZodNumber;
375
+ roomAccessTokenHash: z.ZodString;
376
+ }, "strict", z.ZodTypeAny, {
377
+ version: 1;
378
+ expiresAt: number;
379
+ roomId: string;
380
+ roomAccessTokenHash: string;
381
+ }, {
382
+ version: 1;
383
+ expiresAt: number;
384
+ roomId: string;
385
+ roomAccessTokenHash: string;
386
+ }>;
387
+ /** Source request to create a bounded signaling room. */
388
+ export type DevicePairingCreateRoomRequest = z.infer<typeof devicePairingCreateRoomRequestSchema>;
389
+ /** Request from the destination to occupy the second room slot. */
390
+ export declare const devicePairingJoinRoomRequestSchema: z.ZodObject<{
391
+ version: z.ZodLiteral<1>;
392
+ roomId: z.ZodString;
393
+ roomAccessToken: z.ZodString;
394
+ }, "strict", z.ZodTypeAny, {
395
+ version: 1;
396
+ roomId: string;
397
+ roomAccessToken: string;
398
+ }, {
399
+ version: 1;
400
+ roomId: string;
401
+ roomAccessToken: string;
402
+ }>;
403
+ /** Destination request to join a bounded signaling room. */
404
+ export type DevicePairingJoinRoomRequest = z.infer<typeof devicePairingJoinRoomRequestSchema>;
405
+ /** Request from the source to tear down its signaling room. */
406
+ export declare const devicePairingDeleteRoomRequestSchema: z.ZodObject<{
407
+ version: z.ZodLiteral<1>;
408
+ roomId: z.ZodString;
409
+ roomAccessToken: z.ZodString;
410
+ }, "strict", z.ZodTypeAny, {
411
+ version: 1;
412
+ roomId: string;
413
+ roomAccessToken: string;
414
+ }, {
415
+ version: 1;
416
+ roomId: string;
417
+ roomAccessToken: string;
418
+ }>;
419
+ /** Source request to delete a bounded signaling room. */
420
+ export type DevicePairingDeleteRoomRequest = z.infer<typeof devicePairingDeleteRoomRequestSchema>;
421
+ /** Public signaling-service error codes that do not echo attacker input. */
422
+ export declare const devicePairingSignalingErrorCodeSchema: z.ZodEnum<["invalid", "not-found", "occupied", "expired", "forbidden", "rate-limited", "too-large", "out-of-order"]>;
423
+ /** Public signaling-service error code. */
424
+ export type DevicePairingSignalingErrorCode = z.infer<typeof devicePairingSignalingErrorCodeSchema>;
425
+ /** Acknowledgement returned by every signaling-room command. */
426
+ export declare const devicePairingSignalingAckSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
427
+ ok: z.ZodLiteral<true>;
428
+ }, "strict", z.ZodTypeAny, {
429
+ ok: true;
430
+ }, {
431
+ ok: true;
432
+ }>, z.ZodObject<{
433
+ ok: z.ZodLiteral<false>;
434
+ code: z.ZodEnum<["invalid", "not-found", "occupied", "expired", "forbidden", "rate-limited", "too-large", "out-of-order"]>;
435
+ }, "strict", z.ZodTypeAny, {
436
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
437
+ ok: false;
438
+ }, {
439
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
440
+ ok: false;
441
+ }>]>;
442
+ /** Acknowledgement returned by every signaling-room command. */
443
+ export type DevicePairingSignalingAck = z.infer<typeof devicePairingSignalingAckSchema>;
444
+ /** Acknowledgement proving room creation/join and its service-authoritative expiry. */
445
+ export declare const devicePairingRoomReadyAckSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
446
+ ok: z.ZodLiteral<true>;
447
+ expiresAt: z.ZodNumber;
448
+ }, "strict", z.ZodTypeAny, {
449
+ ok: true;
450
+ expiresAt: number;
451
+ }, {
452
+ ok: true;
453
+ expiresAt: number;
454
+ }>, z.ZodObject<{
455
+ ok: z.ZodLiteral<false>;
456
+ code: z.ZodEnum<["invalid", "not-found", "occupied", "expired", "forbidden", "rate-limited", "too-large", "out-of-order"]>;
457
+ }, "strict", z.ZodTypeAny, {
458
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
459
+ ok: false;
460
+ }, {
461
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
462
+ ok: false;
463
+ }>]>;
464
+ /** Room-ready acknowledgement returned by create and join. */
465
+ export type DevicePairingRoomReadyAck = z.infer<typeof devicePairingRoomReadyAckSchema>;
466
+ /** Acknowledgement containing room-bound, short-lived ICE configuration. */
467
+ export declare const devicePairingIceServersAckSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
468
+ ok: z.ZodLiteral<true>;
469
+ iceServers: z.ZodArray<z.ZodEffects<z.ZodObject<{
470
+ urls: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">]>;
471
+ username: z.ZodOptional<z.ZodString>;
472
+ credential: z.ZodOptional<z.ZodString>;
473
+ }, "strict", z.ZodTypeAny, {
474
+ urls: string | string[];
475
+ username?: string | undefined;
476
+ credential?: string | undefined;
477
+ }, {
478
+ urls: string | string[];
479
+ username?: string | undefined;
480
+ credential?: string | undefined;
481
+ }>, {
482
+ urls: string | string[];
483
+ username?: string | undefined;
484
+ credential?: string | undefined;
485
+ }, {
486
+ urls: string | string[];
487
+ username?: string | undefined;
488
+ credential?: string | undefined;
489
+ }>, "many">;
490
+ }, "strict", z.ZodTypeAny, {
491
+ ok: true;
492
+ iceServers: {
493
+ urls: string | string[];
494
+ username?: string | undefined;
495
+ credential?: string | undefined;
496
+ }[];
497
+ }, {
498
+ ok: true;
499
+ iceServers: {
500
+ urls: string | string[];
501
+ username?: string | undefined;
502
+ credential?: string | undefined;
503
+ }[];
504
+ }>, z.ZodObject<{
505
+ ok: z.ZodLiteral<false>;
506
+ code: z.ZodEnum<["invalid", "not-found", "occupied", "expired", "forbidden", "rate-limited", "too-large", "out-of-order"]>;
507
+ }, "strict", z.ZodTypeAny, {
508
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
509
+ ok: false;
510
+ }, {
511
+ code: "invalid" | "expired" | "not-found" | "occupied" | "forbidden" | "rate-limited" | "too-large" | "out-of-order";
512
+ ok: false;
513
+ }>]>;
514
+ /** ICE configuration acknowledgement returned only to a room member. */
515
+ export type DevicePairingIceServersAck = z.infer<typeof devicePairingIceServersAckSchema>;
516
+ /** Canonical transcript input derived independently by both endpoints. */
517
+ export declare const devicePairingTranscriptSchema: z.ZodObject<{
518
+ version: z.ZodLiteral<1>;
519
+ roomId: z.ZodString;
520
+ sourceIdentity: z.ZodObject<{
521
+ userId: z.ZodEffects<z.ZodString, string, string>;
522
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
523
+ publicKey: z.ZodString;
524
+ publicBoxKey: z.ZodString;
525
+ userName: z.ZodOptional<z.ZodString>;
526
+ deviceName: z.ZodOptional<z.ZodString>;
527
+ }, "strip", z.ZodTypeAny, {
528
+ publicKey: string;
529
+ publicBoxKey: string;
530
+ userId: string;
531
+ deviceId: string;
532
+ deviceName?: string | undefined;
533
+ userName?: string | undefined;
534
+ }, {
535
+ publicKey: string;
536
+ publicBoxKey: string;
537
+ userId: string;
538
+ deviceId: string;
539
+ deviceName?: string | undefined;
540
+ userName?: string | undefined;
541
+ }>;
542
+ destinationIdentity: z.ZodObject<{
543
+ userId: z.ZodEffects<z.ZodString, string, string>;
544
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
545
+ publicKey: z.ZodString;
546
+ publicBoxKey: z.ZodString;
547
+ userName: z.ZodOptional<z.ZodString>;
548
+ deviceName: z.ZodOptional<z.ZodString>;
549
+ }, "strip", z.ZodTypeAny, {
550
+ publicKey: string;
551
+ publicBoxKey: string;
552
+ userId: string;
553
+ deviceId: string;
554
+ deviceName?: string | undefined;
555
+ userName?: string | undefined;
556
+ }, {
557
+ publicKey: string;
558
+ publicBoxKey: string;
559
+ userId: string;
560
+ deviceId: string;
561
+ deviceName?: string | undefined;
562
+ userName?: string | undefined;
563
+ }>;
564
+ sourceEndpointNonce: z.ZodString;
565
+ destinationEndpointNonce: z.ZodString;
566
+ offerFingerprint: z.ZodString;
567
+ answerFingerprint: z.ZodString;
568
+ }, "strict", z.ZodTypeAny, {
569
+ version: 1;
570
+ roomId: string;
571
+ sourceIdentity: {
572
+ publicKey: string;
573
+ publicBoxKey: string;
574
+ userId: string;
575
+ deviceId: string;
576
+ deviceName?: string | undefined;
577
+ userName?: string | undefined;
578
+ };
579
+ destinationIdentity: {
580
+ publicKey: string;
581
+ publicBoxKey: string;
582
+ userId: string;
583
+ deviceId: string;
584
+ deviceName?: string | undefined;
585
+ userName?: string | undefined;
586
+ };
587
+ sourceEndpointNonce: string;
588
+ destinationEndpointNonce: string;
589
+ offerFingerprint: string;
590
+ answerFingerprint: string;
591
+ }, {
592
+ version: 1;
593
+ roomId: string;
594
+ sourceIdentity: {
595
+ publicKey: string;
596
+ publicBoxKey: string;
597
+ userId: string;
598
+ deviceId: string;
599
+ deviceName?: string | undefined;
600
+ userName?: string | undefined;
601
+ };
602
+ destinationIdentity: {
603
+ publicKey: string;
604
+ publicBoxKey: string;
605
+ userId: string;
606
+ deviceId: string;
607
+ deviceName?: string | undefined;
608
+ userName?: string | undefined;
609
+ };
610
+ sourceEndpointNonce: string;
611
+ destinationEndpointNonce: string;
612
+ offerFingerprint: string;
613
+ answerFingerprint: string;
614
+ }>;
615
+ /** Inputs whose canonical hash identifies one pairing connection. */
616
+ export type DevicePairingTranscript = z.infer<typeof devicePairingTranscriptSchema>;
617
+ /** Renderer-safe presentation of the remote endpoint. */
618
+ export declare const pairingDevicePresentationSchema: z.ZodObject<{
619
+ deviceName: z.ZodOptional<z.ZodString>;
620
+ userName: z.ZodOptional<z.ZodString>;
621
+ deviceType: z.ZodOptional<z.ZodString>;
622
+ }, "strict", z.ZodTypeAny, {
623
+ deviceName?: string | undefined;
624
+ userName?: string | undefined;
625
+ deviceType?: string | undefined;
626
+ }, {
627
+ deviceName?: string | undefined;
628
+ userName?: string | undefined;
629
+ deviceType?: string | undefined;
630
+ }>;
631
+ /** Renderer-safe presentation of the remote endpoint. */
632
+ 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>;
636
+ transcriptHash: z.ZodString;
637
+ device: z.ZodObject<{
638
+ userId: z.ZodEffects<z.ZodString, string, string>;
639
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
640
+ publicKey: z.ZodString;
641
+ publicBoxKey: z.ZodString;
642
+ userName: z.ZodOptional<z.ZodString>;
643
+ deviceName: z.ZodOptional<z.ZodString>;
644
+ }, "strip", z.ZodTypeAny, {
645
+ publicKey: string;
646
+ publicBoxKey: string;
647
+ userId: string;
648
+ deviceId: string;
649
+ deviceName?: string | undefined;
650
+ userName?: string | undefined;
651
+ }, {
652
+ publicKey: string;
653
+ publicBoxKey: string;
654
+ userId: string;
655
+ deviceId: string;
656
+ deviceName?: string | undefined;
657
+ userName?: string | undefined;
658
+ }>;
659
+ presentation: z.ZodObject<{
660
+ deviceName: z.ZodOptional<z.ZodString>;
661
+ userName: z.ZodOptional<z.ZodString>;
662
+ deviceType: z.ZodOptional<z.ZodString>;
663
+ }, "strict", z.ZodTypeAny, {
664
+ deviceName?: string | undefined;
665
+ userName?: string | undefined;
666
+ deviceType?: string | undefined;
667
+ }, {
668
+ deviceName?: string | undefined;
669
+ userName?: string | undefined;
670
+ deviceType?: string | undefined;
671
+ }>;
672
+ }, "strict", z.ZodTypeAny, {
673
+ version: 1;
674
+ device: {
675
+ publicKey: string;
676
+ publicBoxKey: string;
677
+ userId: string;
678
+ deviceId: string;
679
+ deviceName?: string | undefined;
680
+ userName?: string | undefined;
681
+ };
682
+ transcriptHash: string;
683
+ presentation: {
684
+ deviceName?: string | undefined;
685
+ userName?: string | undefined;
686
+ deviceType?: string | undefined;
687
+ };
688
+ }, {
689
+ version: 1;
690
+ device: {
691
+ publicKey: string;
692
+ publicBoxKey: string;
693
+ userId: string;
694
+ deviceId: string;
695
+ deviceName?: string | undefined;
696
+ userName?: string | undefined;
697
+ };
698
+ transcriptHash: string;
699
+ presentation: {
700
+ deviceName?: string | undefined;
701
+ userName?: string | undefined;
702
+ deviceType?: string | undefined;
703
+ };
704
+ }>;
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;
712
+ role: z.ZodEnum<["source", "destination"]>;
713
+ expiresAt: z.ZodNumber;
714
+ }, "strict", z.ZodTypeAny, {
715
+ role: "source" | "destination";
716
+ version: 1;
717
+ expiresAt: number;
718
+ transcriptHash: string;
719
+ approvalId: string;
720
+ }, {
721
+ role: "source" | "destination";
722
+ version: 1;
723
+ expiresAt: number;
724
+ transcriptHash: string;
725
+ approvalId: 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;
737
+ }, "strict", z.ZodTypeAny, {
738
+ role: "source" | "destination";
739
+ version: 1;
740
+ expiresAt: number;
741
+ transcriptHash: string;
742
+ approvalId: string;
743
+ }, {
744
+ role: "source" | "destination";
745
+ version: 1;
746
+ expiresAt: number;
747
+ transcriptHash: string;
748
+ approvalId: string;
749
+ }>;
750
+ signature: z.ZodString;
751
+ publicKey: z.ZodString;
752
+ }, "strict", z.ZodTypeAny, {
753
+ publicKey: string;
754
+ signature: string;
755
+ contents: {
756
+ role: "source" | "destination";
757
+ version: 1;
758
+ expiresAt: number;
759
+ transcriptHash: string;
760
+ approvalId: string;
761
+ };
762
+ }, {
763
+ publicKey: string;
764
+ signature: string;
765
+ contents: {
766
+ role: "source" | "destination";
767
+ version: 1;
768
+ expiresAt: number;
769
+ transcriptHash: string;
770
+ approvalId: string;
771
+ };
772
+ }>;
773
+ /** Signed approval bound to one transcript and endpoint identity. */
774
+ export type SignedPairingApproval = z.infer<typeof signedPairingApprovalSchema>;
775
+ /** Account credentials encrypted directly to the temporary destination identity. */
776
+ export declare const pairingCredentialContentsSchema: z.ZodObject<{
777
+ version: z.ZodLiteral<1>;
778
+ transcriptHash: z.ZodString;
779
+ expiresAt: z.ZodNumber;
780
+ userId: z.ZodEffects<z.ZodString, string, string>;
781
+ secretKey: z.ZodString;
782
+ }, "strict", z.ZodTypeAny, {
783
+ version: 1;
784
+ secretKey: string;
785
+ userId: string;
786
+ expiresAt: number;
787
+ transcriptHash: string;
788
+ }, {
789
+ version: 1;
790
+ secretKey: string;
791
+ userId: string;
792
+ expiresAt: number;
793
+ transcriptHash: string;
794
+ }>;
795
+ /** Account credentials before they are signed and boxed. */
796
+ export type PairingCredentialContents = z.infer<typeof pairingCredentialContentsSchema>;
797
+ /** Signed-and-boxed credential envelope sent over the WebRTC Connection. */
798
+ export declare const pairingCredentialEnvelopeSchema: z.ZodObject<{
799
+ contents: z.ZodString;
800
+ nonce: z.ZodString;
801
+ fromPublicKey: z.ZodString;
802
+ }, "strict", z.ZodTypeAny, {
803
+ nonce: string;
804
+ contents: string;
805
+ fromPublicKey: string;
806
+ }, {
807
+ nonce: string;
808
+ contents: string;
809
+ fromPublicKey: string;
810
+ }>;
811
+ /** Signed-and-boxed credential envelope sent over the WebRTC Connection. */
812
+ export type PairingCredentialEnvelope = z.infer<typeof pairingCredentialEnvelopeSchema>;
813
+ /** Contents of the temporary destination identity's signed installation receipt. */
814
+ export declare const pairingInstallationReceiptContentsSchema: z.ZodObject<{
815
+ version: z.ZodLiteral<1>;
816
+ transcriptHash: z.ZodString;
817
+ initializedDevice: z.ZodObject<{
818
+ userId: z.ZodEffects<z.ZodString, string, string>;
819
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
820
+ publicKey: z.ZodString;
821
+ publicBoxKey: z.ZodString;
822
+ userName: z.ZodOptional<z.ZodString>;
823
+ deviceName: z.ZodOptional<z.ZodString>;
824
+ }, "strip", z.ZodTypeAny, {
825
+ publicKey: string;
826
+ publicBoxKey: string;
827
+ userId: string;
828
+ deviceId: string;
829
+ deviceName?: string | undefined;
830
+ userName?: string | undefined;
831
+ }, {
832
+ publicKey: string;
833
+ publicBoxKey: string;
834
+ userId: string;
835
+ deviceId: string;
836
+ deviceName?: string | undefined;
837
+ userName?: string | undefined;
838
+ }>;
839
+ installedAt: z.ZodNumber;
840
+ }, "strict", z.ZodTypeAny, {
841
+ version: 1;
842
+ transcriptHash: string;
843
+ initializedDevice: {
844
+ publicKey: string;
845
+ publicBoxKey: string;
846
+ userId: string;
847
+ deviceId: string;
848
+ deviceName?: string | undefined;
849
+ userName?: string | undefined;
850
+ };
851
+ installedAt: number;
852
+ }, {
853
+ version: 1;
854
+ transcriptHash: string;
855
+ initializedDevice: {
856
+ publicKey: string;
857
+ publicBoxKey: string;
858
+ userId: string;
859
+ deviceId: string;
860
+ deviceName?: string | undefined;
861
+ userName?: string | undefined;
862
+ };
863
+ installedAt: number;
864
+ }>;
865
+ /** Contents of a signed installation receipt. */
866
+ export type PairingInstallationReceiptContents = z.infer<typeof pairingInstallationReceiptContentsSchema>;
867
+ /** Receipt proving installation on the authenticated temporary destination endpoint. */
868
+ export declare const signedPairingInstallationReceiptSchema: z.ZodObject<{
869
+ contents: z.ZodObject<{
870
+ version: z.ZodLiteral<1>;
871
+ transcriptHash: z.ZodString;
872
+ initializedDevice: z.ZodObject<{
873
+ userId: z.ZodEffects<z.ZodString, string, string>;
874
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
875
+ publicKey: z.ZodString;
876
+ publicBoxKey: z.ZodString;
877
+ userName: z.ZodOptional<z.ZodString>;
878
+ deviceName: z.ZodOptional<z.ZodString>;
879
+ }, "strip", z.ZodTypeAny, {
880
+ publicKey: string;
881
+ publicBoxKey: string;
882
+ userId: string;
883
+ deviceId: string;
884
+ deviceName?: string | undefined;
885
+ userName?: string | undefined;
886
+ }, {
887
+ publicKey: string;
888
+ publicBoxKey: string;
889
+ userId: string;
890
+ deviceId: string;
891
+ deviceName?: string | undefined;
892
+ userName?: string | undefined;
893
+ }>;
894
+ installedAt: z.ZodNumber;
895
+ }, "strict", z.ZodTypeAny, {
896
+ version: 1;
897
+ transcriptHash: string;
898
+ initializedDevice: {
899
+ publicKey: string;
900
+ publicBoxKey: string;
901
+ userId: string;
902
+ deviceId: string;
903
+ deviceName?: string | undefined;
904
+ userName?: string | undefined;
905
+ };
906
+ installedAt: number;
907
+ }, {
908
+ version: 1;
909
+ transcriptHash: string;
910
+ initializedDevice: {
911
+ publicKey: string;
912
+ publicBoxKey: string;
913
+ userId: string;
914
+ deviceId: string;
915
+ deviceName?: string | undefined;
916
+ userName?: string | undefined;
917
+ };
918
+ installedAt: number;
919
+ }>;
920
+ signature: z.ZodString;
921
+ publicKey: z.ZodString;
922
+ }, "strict", z.ZodTypeAny, {
923
+ publicKey: string;
924
+ signature: string;
925
+ contents: {
926
+ version: 1;
927
+ transcriptHash: string;
928
+ initializedDevice: {
929
+ publicKey: string;
930
+ publicBoxKey: string;
931
+ userId: string;
932
+ deviceId: string;
933
+ deviceName?: string | undefined;
934
+ userName?: string | undefined;
935
+ };
936
+ installedAt: number;
937
+ };
938
+ }, {
939
+ publicKey: string;
940
+ signature: string;
941
+ contents: {
942
+ version: 1;
943
+ transcriptHash: string;
944
+ initializedDevice: {
945
+ publicKey: string;
946
+ publicBoxKey: string;
947
+ userId: string;
948
+ deviceId: string;
949
+ deviceName?: string | undefined;
950
+ userName?: string | undefined;
951
+ };
952
+ installedAt: number;
953
+ };
954
+ }>;
955
+ /** Receipt proving installation on the authenticated temporary destination endpoint. */
956
+ 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"]>;
959
+ /** Renderer-visible phase of the short-lived pairing ceremony. */
960
+ export type DevicePairingPhase = z.infer<typeof devicePairingPhaseSchema>;
961
+ /** Sanitized pairing state safe to publish across the host/renderer boundary. */
962
+ export declare const devicePairingStateSchema: z.ZodObject<{
963
+ sessionId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
964
+ role: z.ZodOptional<z.ZodEnum<["source", "destination"]>>;
965
+ phase: z.ZodEnum<["idle", "inviting", "connecting", "comparing", "waiting-for-approval", "transferring", "complete", "rejected", "error"]>;
966
+ expiresAt: z.ZodOptional<z.ZodNumber>;
967
+ remoteDevice: z.ZodOptional<z.ZodObject<{
968
+ deviceName: z.ZodOptional<z.ZodString>;
969
+ userName: z.ZodOptional<z.ZodString>;
970
+ deviceType: z.ZodOptional<z.ZodString>;
971
+ }, "strict", z.ZodTypeAny, {
972
+ deviceName?: string | undefined;
973
+ userName?: string | undefined;
974
+ deviceType?: string | undefined;
975
+ }, {
976
+ deviceName?: string | undefined;
977
+ userName?: string | undefined;
978
+ deviceType?: string | undefined;
979
+ }>>;
980
+ sas: z.ZodOptional<z.ZodString>;
981
+ error: z.ZodOptional<z.ZodString>;
982
+ }, "strict", z.ZodTypeAny, {
983
+ phase: "error" | "connecting" | "idle" | "complete" | "rejected" | "inviting" | "comparing" | "waiting-for-approval" | "transferring";
984
+ error?: string | undefined;
985
+ role?: "source" | "destination" | undefined;
986
+ sessionId?: string | undefined;
987
+ expiresAt?: number | undefined;
988
+ remoteDevice?: {
989
+ deviceName?: string | undefined;
990
+ userName?: string | undefined;
991
+ deviceType?: string | undefined;
992
+ } | undefined;
993
+ sas?: string | undefined;
994
+ }, {
995
+ phase: "error" | "connecting" | "idle" | "complete" | "rejected" | "inviting" | "comparing" | "waiting-for-approval" | "transferring";
996
+ error?: string | undefined;
997
+ role?: "source" | "destination" | undefined;
998
+ sessionId?: string | undefined;
999
+ expiresAt?: number | undefined;
1000
+ remoteDevice?: {
1001
+ deviceName?: string | undefined;
1002
+ userName?: string | undefined;
1003
+ deviceType?: string | undefined;
1004
+ } | undefined;
1005
+ sas?: string | undefined;
1006
+ }>;
1007
+ /** Sanitized pairing state safe to publish across the host/renderer boundary. */
1008
+ 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;
1013
+ }
1014
+ /** Input for starting a destination-side pairing ceremony. */
1015
+ export interface DevicePairingStartDestinationInput {
1016
+ invitation: string;
1017
+ deviceName?: string;
1018
+ deviceType?: string;
1019
+ }
1020
+ /** Input for an action against the active pairing ceremony. */
1021
+ export interface DevicePairingCeremonyAction {
1022
+ sessionId: string;
1023
+ }