@peers-app/peers-sdk 0.23.14 → 0.25.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 (96) hide show
  1. package/dist/context/user-context.d.ts +8 -0
  2. package/dist/context/user-context.js +9 -1
  3. package/dist/contracts/index.d.ts +1 -0
  4. package/dist/contracts/index.js +4 -1
  5. package/dist/contracts/system/index.d.ts +2 -0
  6. package/dist/contracts/system/index.js +5 -1
  7. package/dist/contracts/system/invites-contract.d.ts +121 -0
  8. package/dist/contracts/system/invites-contract.js +150 -0
  9. package/dist/data/create-group.d.ts +24 -0
  10. package/dist/data/create-group.js +61 -0
  11. package/dist/data/group-secret.d.ts +10 -0
  12. package/dist/data/group-secret.js +26 -0
  13. package/dist/data/group-share.d.ts +0 -20
  14. package/dist/data/group-share.js +0 -35
  15. package/dist/data/index.d.ts +2 -0
  16. package/dist/data/index.js +2 -0
  17. package/dist/data/invites.d.ts +350 -0
  18. package/dist/data/invites.js +99 -0
  19. package/dist/data/orm/data-query.d.ts +1 -0
  20. package/dist/data/orm/sql.data-source.d.ts +3 -2
  21. package/dist/data/orm/sql.data-source.js +5 -3
  22. package/dist/data/orm/subscribable.data-source.d.ts +3 -2
  23. package/dist/data/orm/subscribable.data-source.js +7 -11
  24. package/dist/data/users.d.ts +11 -0
  25. package/dist/data/users.js +17 -0
  26. package/dist/device/device-election.d.ts +23 -3
  27. package/dist/device/device-election.js +15 -0
  28. package/dist/device/device-election.test.js +73 -0
  29. package/dist/device-pairing/constants.d.ts +27 -9
  30. package/dist/device-pairing/constants.js +28 -10
  31. package/dist/device-pairing/cpace.d.ts +46 -0
  32. package/dist/device-pairing/cpace.js +173 -0
  33. package/dist/device-pairing/cpace.test.js +116 -0
  34. package/dist/device-pairing/crypto.d.ts +40 -15
  35. package/dist/device-pairing/crypto.js +74 -33
  36. package/dist/device-pairing/device-pairing.test.js +156 -119
  37. package/dist/device-pairing/index.d.ts +3 -1
  38. package/dist/device-pairing/index.js +3 -1
  39. package/dist/device-pairing/pairing-code.d.ts +27 -0
  40. package/dist/device-pairing/pairing-code.js +84 -0
  41. package/dist/device-pairing/pgp-word-list.d.ts +14 -0
  42. package/dist/device-pairing/pgp-word-list.js +531 -0
  43. package/dist/device-pairing/signaling.d.ts +17 -6
  44. package/dist/device-pairing/signaling.js +31 -8
  45. package/dist/device-pairing/transcript.d.ts +3 -3
  46. package/dist/device-pairing/transcript.js +6 -13
  47. package/dist/device-pairing/types.d.ts +870 -224
  48. package/dist/device-pairing/types.js +186 -108
  49. package/dist/index.d.ts +1 -2
  50. package/dist/index.js +1 -2
  51. package/dist/invites/data-box-schema.d.ts +15 -0
  52. package/dist/invites/data-box-schema.js +15 -0
  53. package/dist/invites/group-approval.d.ts +43 -0
  54. package/dist/invites/group-approval.js +155 -0
  55. package/dist/invites/group-approval.test.js +221 -0
  56. package/dist/invites/index.d.ts +5 -0
  57. package/dist/{group-invite → invites}/index.js +5 -3
  58. package/dist/invites/invite-epoch.d.ts +18 -0
  59. package/dist/invites/invite-epoch.js +35 -0
  60. package/dist/invites/invite-messages.d.ts +1354 -0
  61. package/dist/invites/invite-messages.js +145 -0
  62. package/dist/invites/invite-token.d.ts +334 -0
  63. package/dist/invites/invite-token.js +178 -0
  64. package/dist/invites/invite-token.test.d.ts +1 -0
  65. package/dist/invites/invite-token.test.js +123 -0
  66. package/dist/keys.d.ts +17 -1
  67. package/dist/keys.js +58 -5
  68. package/dist/keys.test.js +113 -0
  69. package/dist/rpc-types.d.ts +5 -4
  70. package/dist/rpc-types.js +2 -1
  71. package/dist/serial-json.d.ts +4 -1
  72. package/dist/serial-json.js +4 -1
  73. package/dist/system-ids.d.ts +22 -0
  74. package/dist/system-ids.js +23 -1
  75. package/package.json +1 -1
  76. package/dist/device-pairing/invitation.d.ts +0 -13
  77. package/dist/device-pairing/invitation.js +0 -85
  78. package/dist/group-invite/group-invite.d.ts +0 -53
  79. package/dist/group-invite/group-invite.js +0 -231
  80. package/dist/group-invite/group-invite.pvars.d.ts +0 -94
  81. package/dist/group-invite/group-invite.pvars.js +0 -139
  82. package/dist/group-invite/group-invite.types.d.ts +0 -124
  83. package/dist/group-invite/group-invite.types.js +0 -8
  84. package/dist/group-invite/index.d.ts +0 -3
  85. package/dist/user-connect/connection-code.d.ts +0 -67
  86. package/dist/user-connect/connection-code.js +0 -176
  87. package/dist/user-connect/connection-code.test.js +0 -213
  88. package/dist/user-connect/index.d.ts +0 -3
  89. package/dist/user-connect/index.js +0 -19
  90. package/dist/user-connect/user-connect.pvars.d.ts +0 -20
  91. package/dist/user-connect/user-connect.pvars.js +0 -63
  92. package/dist/user-connect/user-connect.pvars.test.js +0 -46
  93. package/dist/user-connect/user-connect.types.d.ts +0 -94
  94. package/dist/user-connect/user-connect.types.js +0 -68
  95. /package/dist/{user-connect/connection-code.test.d.ts → device-pairing/cpace.test.d.ts} +0 -0
  96. /package/dist/{user-connect/user-connect.pvars.test.d.ts → invites/group-approval.test.d.ts} +0 -0
@@ -0,0 +1,1354 @@
1
+ import { z } from "zod";
2
+ import { type IPublicPrivateKeys } from "../keys";
3
+ /** Recipient accepted a contact token; carries their identity back to the inviter. */
4
+ export declare const contactReplySchema: z.ZodObject<{
5
+ kind: z.ZodLiteral<"contact-reply">;
6
+ /** Nonce and epoch of the token that was accepted. */
7
+ inviteNonce: z.ZodString;
8
+ inviteEpoch: z.ZodNumber;
9
+ responder: z.ZodObject<{
10
+ userId: z.ZodEffects<z.ZodString, string, string>;
11
+ publicKey: z.ZodString;
12
+ publicBoxKey: z.ZodString;
13
+ displayName: z.ZodOptional<z.ZodString>;
14
+ }, "strict", z.ZodTypeAny, {
15
+ publicKey: string;
16
+ publicBoxKey: string;
17
+ userId: string;
18
+ displayName?: string | undefined;
19
+ }, {
20
+ publicKey: string;
21
+ publicBoxKey: string;
22
+ userId: string;
23
+ displayName?: string | undefined;
24
+ }>;
25
+ responderDeviceId: z.ZodEffects<z.ZodString, string, string>;
26
+ }, "strict", z.ZodTypeAny, {
27
+ kind: "contact-reply";
28
+ responder: {
29
+ publicKey: string;
30
+ publicBoxKey: string;
31
+ userId: string;
32
+ displayName?: string | undefined;
33
+ };
34
+ inviteNonce: string;
35
+ inviteEpoch: number;
36
+ responderDeviceId: string;
37
+ }, {
38
+ kind: "contact-reply";
39
+ responder: {
40
+ publicKey: string;
41
+ publicBoxKey: string;
42
+ userId: string;
43
+ displayName?: string | undefined;
44
+ };
45
+ inviteNonce: string;
46
+ inviteEpoch: number;
47
+ responderDeviceId: string;
48
+ }>;
49
+ /** Recipient accepted a contact token. */
50
+ export type ContactReply = z.infer<typeof contactReplySchema>;
51
+ /** Joiner asks to be admitted under a group token (approve or open mode). */
52
+ export declare const groupJoinRequestSchema: z.ZodObject<{
53
+ kind: z.ZodLiteral<"group-join-request">;
54
+ token: z.ZodObject<{
55
+ v: z.ZodLiteral<1>;
56
+ type: z.ZodEnum<["contact", "group"]>;
57
+ inviter: z.ZodObject<{
58
+ userId: z.ZodEffects<z.ZodString, string, string>;
59
+ publicKey: z.ZodString;
60
+ publicBoxKey: z.ZodString;
61
+ displayName: z.ZodOptional<z.ZodString>;
62
+ }, "strict", z.ZodTypeAny, {
63
+ publicKey: string;
64
+ publicBoxKey: string;
65
+ userId: string;
66
+ displayName?: string | undefined;
67
+ }, {
68
+ publicKey: string;
69
+ publicBoxKey: string;
70
+ userId: string;
71
+ displayName?: string | undefined;
72
+ }>;
73
+ expiresAt: z.ZodString;
74
+ nonce: z.ZodString;
75
+ epoch: z.ZodNumber;
76
+ uses: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<"unlimited">]>;
77
+ group: z.ZodOptional<z.ZodObject<{
78
+ groupId: z.ZodEffects<z.ZodString, string, string>;
79
+ name: z.ZodString;
80
+ publicKey: z.ZodString;
81
+ publicBoxKey: z.ZodString;
82
+ role: z.ZodNativeEnum<typeof import("../data").GroupMemberRole>;
83
+ mode: z.ZodEnum<["approve", "open"]>;
84
+ }, "strict", z.ZodTypeAny, {
85
+ name: string;
86
+ role: import("../data").GroupMemberRole;
87
+ publicKey: string;
88
+ groupId: string;
89
+ publicBoxKey: string;
90
+ mode: "open" | "approve";
91
+ }, {
92
+ name: string;
93
+ role: import("../data").GroupMemberRole;
94
+ publicKey: string;
95
+ groupId: string;
96
+ publicBoxKey: string;
97
+ mode: "open" | "approve";
98
+ }>>;
99
+ signature: z.ZodString;
100
+ }, "strict", z.ZodTypeAny, {
101
+ type: "group" | "contact";
102
+ nonce: string;
103
+ signature: string;
104
+ expiresAt: string;
105
+ v: 1;
106
+ inviter: {
107
+ publicKey: string;
108
+ publicBoxKey: string;
109
+ userId: string;
110
+ displayName?: string | undefined;
111
+ };
112
+ epoch: number;
113
+ uses: 1 | "unlimited";
114
+ group?: {
115
+ name: string;
116
+ role: import("../data").GroupMemberRole;
117
+ publicKey: string;
118
+ groupId: string;
119
+ publicBoxKey: string;
120
+ mode: "open" | "approve";
121
+ } | undefined;
122
+ }, {
123
+ type: "group" | "contact";
124
+ nonce: string;
125
+ signature: string;
126
+ expiresAt: string;
127
+ v: 1;
128
+ inviter: {
129
+ publicKey: string;
130
+ publicBoxKey: string;
131
+ userId: string;
132
+ displayName?: string | undefined;
133
+ };
134
+ epoch: number;
135
+ uses: 1 | "unlimited";
136
+ group?: {
137
+ name: string;
138
+ role: import("../data").GroupMemberRole;
139
+ publicKey: string;
140
+ groupId: string;
141
+ publicBoxKey: string;
142
+ mode: "open" | "approve";
143
+ } | undefined;
144
+ }>;
145
+ requester: z.ZodObject<{
146
+ userId: z.ZodEffects<z.ZodString, string, string>;
147
+ publicKey: z.ZodString;
148
+ publicBoxKey: z.ZodString;
149
+ displayName: z.ZodOptional<z.ZodString>;
150
+ }, "strict", z.ZodTypeAny, {
151
+ publicKey: string;
152
+ publicBoxKey: string;
153
+ userId: string;
154
+ displayName?: string | undefined;
155
+ }, {
156
+ publicKey: string;
157
+ publicBoxKey: string;
158
+ userId: string;
159
+ displayName?: string | undefined;
160
+ }>;
161
+ requesterDeviceId: z.ZodEffects<z.ZodString, string, string>;
162
+ }, "strict", z.ZodTypeAny, {
163
+ kind: "group-join-request";
164
+ token: {
165
+ type: "group" | "contact";
166
+ nonce: string;
167
+ signature: string;
168
+ expiresAt: string;
169
+ v: 1;
170
+ inviter: {
171
+ publicKey: string;
172
+ publicBoxKey: string;
173
+ userId: string;
174
+ displayName?: string | undefined;
175
+ };
176
+ epoch: number;
177
+ uses: 1 | "unlimited";
178
+ group?: {
179
+ name: string;
180
+ role: import("../data").GroupMemberRole;
181
+ publicKey: string;
182
+ groupId: string;
183
+ publicBoxKey: string;
184
+ mode: "open" | "approve";
185
+ } | undefined;
186
+ };
187
+ requester: {
188
+ publicKey: string;
189
+ publicBoxKey: string;
190
+ userId: string;
191
+ displayName?: string | undefined;
192
+ };
193
+ requesterDeviceId: string;
194
+ }, {
195
+ kind: "group-join-request";
196
+ token: {
197
+ type: "group" | "contact";
198
+ nonce: string;
199
+ signature: string;
200
+ expiresAt: string;
201
+ v: 1;
202
+ inviter: {
203
+ publicKey: string;
204
+ publicBoxKey: string;
205
+ userId: string;
206
+ displayName?: string | undefined;
207
+ };
208
+ epoch: number;
209
+ uses: 1 | "unlimited";
210
+ group?: {
211
+ name: string;
212
+ role: import("../data").GroupMemberRole;
213
+ publicKey: string;
214
+ groupId: string;
215
+ publicBoxKey: string;
216
+ mode: "open" | "approve";
217
+ } | undefined;
218
+ };
219
+ requester: {
220
+ publicKey: string;
221
+ publicBoxKey: string;
222
+ userId: string;
223
+ displayName?: string | undefined;
224
+ };
225
+ requesterDeviceId: string;
226
+ }>;
227
+ /** Joiner asks to be admitted under a group token. */
228
+ export type GroupJoinRequest = z.infer<typeof groupJoinRequestSchema>;
229
+ /**
230
+ * Everything a joiner needs to enter a group: the group record, their signed membership,
231
+ * Admin+ seed rows, the approver's identity, and the group secret boxed to the joiner.
232
+ */
233
+ export declare const groupApprovalSchema: z.ZodObject<{
234
+ kind: z.ZodLiteral<"group-approval">;
235
+ /** Nonce of the token or direct invite this approval answers, when there is one. */
236
+ inviteNonce: z.ZodOptional<z.ZodString>;
237
+ group: z.ZodLazy<z.ZodObject<{
238
+ groupId: z.ZodEffects<z.ZodString, string, string>;
239
+ name: z.ZodString;
240
+ description: z.ZodString;
241
+ iconClassName: z.ZodOptional<z.ZodString>;
242
+ publicRole: z.ZodOptional<z.ZodNativeEnum<typeof import("../data").GroupMemberRole>>;
243
+ disabled: z.ZodOptional<z.ZodBoolean>;
244
+ founderUserId: z.ZodEffects<z.ZodString, string, string>;
245
+ signature: z.ZodString;
246
+ publicKey: z.ZodString;
247
+ publicBoxKey: z.ZodString;
248
+ }, "strip", z.ZodTypeAny, {
249
+ name: string;
250
+ description: string;
251
+ publicKey: string;
252
+ signature: string;
253
+ groupId: string;
254
+ founderUserId: string;
255
+ publicBoxKey: string;
256
+ disabled?: boolean | undefined;
257
+ iconClassName?: string | undefined;
258
+ publicRole?: import("../data").GroupMemberRole | undefined;
259
+ }, {
260
+ name: string;
261
+ description: string;
262
+ publicKey: string;
263
+ signature: string;
264
+ groupId: string;
265
+ founderUserId: string;
266
+ publicBoxKey: string;
267
+ disabled?: boolean | undefined;
268
+ iconClassName?: string | undefined;
269
+ publicRole?: import("../data").GroupMemberRole | undefined;
270
+ }>>;
271
+ membership: z.ZodLazy<z.ZodObject<{
272
+ groupMemberId: z.ZodEffects<z.ZodString, string, string>;
273
+ groupId: z.ZodEffects<z.ZodString, string, string>;
274
+ userId: z.ZodEffects<z.ZodString, string, string>;
275
+ role: z.ZodNativeEnum<typeof import("../data").GroupMemberRole>;
276
+ signature: z.ZodString;
277
+ deleted: z.ZodOptional<z.ZodBoolean>;
278
+ }, "strip", z.ZodTypeAny, {
279
+ role: import("../data").GroupMemberRole;
280
+ signature: string;
281
+ groupId: string;
282
+ userId: string;
283
+ groupMemberId: string;
284
+ deleted?: boolean | undefined;
285
+ }, {
286
+ role: import("../data").GroupMemberRole;
287
+ signature: string;
288
+ groupId: string;
289
+ userId: string;
290
+ groupMemberId: string;
291
+ deleted?: boolean | undefined;
292
+ }>>;
293
+ seed: z.ZodObject<{
294
+ groupMembers: z.ZodArray<z.ZodLazy<z.ZodObject<{
295
+ groupMemberId: z.ZodEffects<z.ZodString, string, string>;
296
+ groupId: z.ZodEffects<z.ZodString, string, string>;
297
+ userId: z.ZodEffects<z.ZodString, string, string>;
298
+ role: z.ZodNativeEnum<typeof import("../data").GroupMemberRole>;
299
+ signature: z.ZodString;
300
+ deleted: z.ZodOptional<z.ZodBoolean>;
301
+ }, "strip", z.ZodTypeAny, {
302
+ role: import("../data").GroupMemberRole;
303
+ signature: string;
304
+ groupId: string;
305
+ userId: string;
306
+ groupMemberId: string;
307
+ deleted?: boolean | undefined;
308
+ }, {
309
+ role: import("../data").GroupMemberRole;
310
+ signature: string;
311
+ groupId: string;
312
+ userId: string;
313
+ groupMemberId: string;
314
+ deleted?: boolean | undefined;
315
+ }>>, "many">;
316
+ users: z.ZodArray<z.ZodLazy<z.ZodObject<{
317
+ userId: z.ZodEffects<z.ZodString, string, string>;
318
+ name: z.ZodString;
319
+ publicKey: z.ZodString;
320
+ publicBoxKey: z.ZodString;
321
+ signature: z.ZodOptional<z.ZodString>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ name: string;
324
+ publicKey: string;
325
+ publicBoxKey: string;
326
+ userId: string;
327
+ signature?: string | undefined;
328
+ }, {
329
+ name: string;
330
+ publicKey: string;
331
+ publicBoxKey: string;
332
+ userId: string;
333
+ signature?: string | undefined;
334
+ }>>, "many">;
335
+ devices: z.ZodArray<z.ZodLazy<z.ZodObject<{
336
+ userId: z.ZodEffects<z.ZodString, string, string>;
337
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
338
+ publicKey: z.ZodString;
339
+ publicBoxKey: z.ZodString;
340
+ userName: z.ZodOptional<z.ZodString>;
341
+ deviceName: z.ZodOptional<z.ZodString>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ publicKey: string;
344
+ publicBoxKey: string;
345
+ userId: string;
346
+ deviceId: string;
347
+ deviceName?: string | undefined;
348
+ userName?: string | undefined;
349
+ }, {
350
+ publicKey: string;
351
+ publicBoxKey: string;
352
+ userId: string;
353
+ deviceId: string;
354
+ deviceName?: string | undefined;
355
+ userName?: string | undefined;
356
+ }>>, "many">;
357
+ }, "strict", z.ZodTypeAny, {
358
+ users: {
359
+ name: string;
360
+ publicKey: string;
361
+ publicBoxKey: string;
362
+ userId: string;
363
+ signature?: string | undefined;
364
+ }[];
365
+ devices: {
366
+ publicKey: string;
367
+ publicBoxKey: string;
368
+ userId: string;
369
+ deviceId: string;
370
+ deviceName?: string | undefined;
371
+ userName?: string | undefined;
372
+ }[];
373
+ groupMembers: {
374
+ role: import("../data").GroupMemberRole;
375
+ signature: string;
376
+ groupId: string;
377
+ userId: string;
378
+ groupMemberId: string;
379
+ deleted?: boolean | undefined;
380
+ }[];
381
+ }, {
382
+ users: {
383
+ name: string;
384
+ publicKey: string;
385
+ publicBoxKey: string;
386
+ userId: string;
387
+ signature?: string | undefined;
388
+ }[];
389
+ devices: {
390
+ publicKey: string;
391
+ publicBoxKey: string;
392
+ userId: string;
393
+ deviceId: string;
394
+ deviceName?: string | undefined;
395
+ userName?: string | undefined;
396
+ }[];
397
+ groupMembers: {
398
+ role: import("../data").GroupMemberRole;
399
+ signature: string;
400
+ groupId: string;
401
+ userId: string;
402
+ groupMemberId: string;
403
+ deleted?: boolean | undefined;
404
+ }[];
405
+ }>;
406
+ approver: z.ZodObject<{
407
+ userId: z.ZodEffects<z.ZodString, string, string>;
408
+ publicKey: z.ZodString;
409
+ publicBoxKey: z.ZodString;
410
+ displayName: z.ZodOptional<z.ZodString>;
411
+ }, "strict", z.ZodTypeAny, {
412
+ publicKey: string;
413
+ publicBoxKey: string;
414
+ userId: string;
415
+ displayName?: string | undefined;
416
+ }, {
417
+ publicKey: string;
418
+ publicBoxKey: string;
419
+ userId: string;
420
+ displayName?: string | undefined;
421
+ }>;
422
+ approverDeviceId: z.ZodEffects<z.ZodString, string, string>;
423
+ /** Group encryption secret boxed to the joiner's `publicBoxKey`. */
424
+ boxedSecret: z.ZodObject<{
425
+ contents: z.ZodString;
426
+ nonce: z.ZodString;
427
+ fromPublicKey: z.ZodString;
428
+ }, "strict", z.ZodTypeAny, {
429
+ nonce: string;
430
+ contents: string;
431
+ fromPublicKey: string;
432
+ }, {
433
+ nonce: string;
434
+ contents: string;
435
+ fromPublicKey: string;
436
+ }>;
437
+ }, "strict", z.ZodTypeAny, {
438
+ group: {
439
+ name: string;
440
+ description: string;
441
+ publicKey: string;
442
+ signature: string;
443
+ groupId: string;
444
+ founderUserId: string;
445
+ publicBoxKey: string;
446
+ disabled?: boolean | undefined;
447
+ iconClassName?: string | undefined;
448
+ publicRole?: import("../data").GroupMemberRole | undefined;
449
+ };
450
+ kind: "group-approval";
451
+ membership: {
452
+ role: import("../data").GroupMemberRole;
453
+ signature: string;
454
+ groupId: string;
455
+ userId: string;
456
+ groupMemberId: string;
457
+ deleted?: boolean | undefined;
458
+ };
459
+ seed: {
460
+ users: {
461
+ name: string;
462
+ publicKey: string;
463
+ publicBoxKey: string;
464
+ userId: string;
465
+ signature?: string | undefined;
466
+ }[];
467
+ devices: {
468
+ publicKey: string;
469
+ publicBoxKey: string;
470
+ userId: string;
471
+ deviceId: string;
472
+ deviceName?: string | undefined;
473
+ userName?: string | undefined;
474
+ }[];
475
+ groupMembers: {
476
+ role: import("../data").GroupMemberRole;
477
+ signature: string;
478
+ groupId: string;
479
+ userId: string;
480
+ groupMemberId: string;
481
+ deleted?: boolean | undefined;
482
+ }[];
483
+ };
484
+ approver: {
485
+ publicKey: string;
486
+ publicBoxKey: string;
487
+ userId: string;
488
+ displayName?: string | undefined;
489
+ };
490
+ approverDeviceId: string;
491
+ boxedSecret: {
492
+ nonce: string;
493
+ contents: string;
494
+ fromPublicKey: string;
495
+ };
496
+ inviteNonce?: string | undefined;
497
+ }, {
498
+ group: {
499
+ name: string;
500
+ description: string;
501
+ publicKey: string;
502
+ signature: string;
503
+ groupId: string;
504
+ founderUserId: string;
505
+ publicBoxKey: string;
506
+ disabled?: boolean | undefined;
507
+ iconClassName?: string | undefined;
508
+ publicRole?: import("../data").GroupMemberRole | undefined;
509
+ };
510
+ kind: "group-approval";
511
+ membership: {
512
+ role: import("../data").GroupMemberRole;
513
+ signature: string;
514
+ groupId: string;
515
+ userId: string;
516
+ groupMemberId: string;
517
+ deleted?: boolean | undefined;
518
+ };
519
+ seed: {
520
+ users: {
521
+ name: string;
522
+ publicKey: string;
523
+ publicBoxKey: string;
524
+ userId: string;
525
+ signature?: string | undefined;
526
+ }[];
527
+ devices: {
528
+ publicKey: string;
529
+ publicBoxKey: string;
530
+ userId: string;
531
+ deviceId: string;
532
+ deviceName?: string | undefined;
533
+ userName?: string | undefined;
534
+ }[];
535
+ groupMembers: {
536
+ role: import("../data").GroupMemberRole;
537
+ signature: string;
538
+ groupId: string;
539
+ userId: string;
540
+ groupMemberId: string;
541
+ deleted?: boolean | undefined;
542
+ }[];
543
+ };
544
+ approver: {
545
+ publicKey: string;
546
+ publicBoxKey: string;
547
+ userId: string;
548
+ displayName?: string | undefined;
549
+ };
550
+ approverDeviceId: string;
551
+ boxedSecret: {
552
+ nonce: string;
553
+ contents: string;
554
+ fromPublicKey: string;
555
+ };
556
+ inviteNonce?: string | undefined;
557
+ }>;
558
+ /** Payload that admits a joiner to a group. */
559
+ export type GroupApproval = z.infer<typeof groupApprovalSchema>;
560
+ /** A party declined or denied an invite or join request. */
561
+ export declare const inviteDeclineSchema: z.ZodObject<{
562
+ kind: z.ZodLiteral<"invite-decline">;
563
+ inviteNonce: z.ZodString;
564
+ groupId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
565
+ by: z.ZodObject<{
566
+ userId: z.ZodEffects<z.ZodString, string, string>;
567
+ publicKey: z.ZodString;
568
+ publicBoxKey: z.ZodString;
569
+ displayName: z.ZodOptional<z.ZodString>;
570
+ }, "strict", z.ZodTypeAny, {
571
+ publicKey: string;
572
+ publicBoxKey: string;
573
+ userId: string;
574
+ displayName?: string | undefined;
575
+ }, {
576
+ publicKey: string;
577
+ publicBoxKey: string;
578
+ userId: string;
579
+ displayName?: string | undefined;
580
+ }>;
581
+ reason: z.ZodOptional<z.ZodString>;
582
+ }, "strict", z.ZodTypeAny, {
583
+ kind: "invite-decline";
584
+ inviteNonce: string;
585
+ by: {
586
+ publicKey: string;
587
+ publicBoxKey: string;
588
+ userId: string;
589
+ displayName?: string | undefined;
590
+ };
591
+ reason?: string | undefined;
592
+ groupId?: string | undefined;
593
+ }, {
594
+ kind: "invite-decline";
595
+ inviteNonce: string;
596
+ by: {
597
+ publicKey: string;
598
+ publicBoxKey: string;
599
+ userId: string;
600
+ displayName?: string | undefined;
601
+ };
602
+ reason?: string | undefined;
603
+ groupId?: string | undefined;
604
+ }>;
605
+ /** A party declined or denied an invite or join request. */
606
+ export type InviteDecline = z.infer<typeof inviteDeclineSchema>;
607
+ /**
608
+ * The recipient of a direct group invite or a profile-QR reply completed their side, so the
609
+ * other party can move its row from pending to accepted.
610
+ */
611
+ export declare const inviteAcceptedSchema: z.ZodObject<{
612
+ kind: z.ZodLiteral<"invite-accepted">;
613
+ inviteNonce: z.ZodString;
614
+ groupId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
615
+ by: z.ZodObject<{
616
+ userId: z.ZodEffects<z.ZodString, string, string>;
617
+ publicKey: z.ZodString;
618
+ publicBoxKey: z.ZodString;
619
+ displayName: z.ZodOptional<z.ZodString>;
620
+ }, "strict", z.ZodTypeAny, {
621
+ publicKey: string;
622
+ publicBoxKey: string;
623
+ userId: string;
624
+ displayName?: string | undefined;
625
+ }, {
626
+ publicKey: string;
627
+ publicBoxKey: string;
628
+ userId: string;
629
+ displayName?: string | undefined;
630
+ }>;
631
+ byDeviceId: z.ZodEffects<z.ZodString, string, string>;
632
+ }, "strict", z.ZodTypeAny, {
633
+ kind: "invite-accepted";
634
+ inviteNonce: string;
635
+ by: {
636
+ publicKey: string;
637
+ publicBoxKey: string;
638
+ userId: string;
639
+ displayName?: string | undefined;
640
+ };
641
+ byDeviceId: string;
642
+ groupId?: string | undefined;
643
+ }, {
644
+ kind: "invite-accepted";
645
+ inviteNonce: string;
646
+ by: {
647
+ publicKey: string;
648
+ publicBoxKey: string;
649
+ userId: string;
650
+ displayName?: string | undefined;
651
+ };
652
+ byDeviceId: string;
653
+ groupId?: string | undefined;
654
+ }>;
655
+ /** A party completed their side of a direct invite or profile reply. */
656
+ export type InviteAccepted = z.infer<typeof inviteAcceptedSchema>;
657
+ /** Any message that travels inside an invite envelope. */
658
+ export declare const inviteMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
659
+ kind: z.ZodLiteral<"contact-reply">;
660
+ /** Nonce and epoch of the token that was accepted. */
661
+ inviteNonce: z.ZodString;
662
+ inviteEpoch: z.ZodNumber;
663
+ responder: z.ZodObject<{
664
+ userId: z.ZodEffects<z.ZodString, string, string>;
665
+ publicKey: z.ZodString;
666
+ publicBoxKey: z.ZodString;
667
+ displayName: z.ZodOptional<z.ZodString>;
668
+ }, "strict", z.ZodTypeAny, {
669
+ publicKey: string;
670
+ publicBoxKey: string;
671
+ userId: string;
672
+ displayName?: string | undefined;
673
+ }, {
674
+ publicKey: string;
675
+ publicBoxKey: string;
676
+ userId: string;
677
+ displayName?: string | undefined;
678
+ }>;
679
+ responderDeviceId: z.ZodEffects<z.ZodString, string, string>;
680
+ }, "strict", z.ZodTypeAny, {
681
+ kind: "contact-reply";
682
+ responder: {
683
+ publicKey: string;
684
+ publicBoxKey: string;
685
+ userId: string;
686
+ displayName?: string | undefined;
687
+ };
688
+ inviteNonce: string;
689
+ inviteEpoch: number;
690
+ responderDeviceId: string;
691
+ }, {
692
+ kind: "contact-reply";
693
+ responder: {
694
+ publicKey: string;
695
+ publicBoxKey: string;
696
+ userId: string;
697
+ displayName?: string | undefined;
698
+ };
699
+ inviteNonce: string;
700
+ inviteEpoch: number;
701
+ responderDeviceId: string;
702
+ }>, z.ZodObject<{
703
+ kind: z.ZodLiteral<"group-join-request">;
704
+ token: z.ZodObject<{
705
+ v: z.ZodLiteral<1>;
706
+ type: z.ZodEnum<["contact", "group"]>;
707
+ inviter: z.ZodObject<{
708
+ userId: z.ZodEffects<z.ZodString, string, string>;
709
+ publicKey: z.ZodString;
710
+ publicBoxKey: z.ZodString;
711
+ displayName: z.ZodOptional<z.ZodString>;
712
+ }, "strict", z.ZodTypeAny, {
713
+ publicKey: string;
714
+ publicBoxKey: string;
715
+ userId: string;
716
+ displayName?: string | undefined;
717
+ }, {
718
+ publicKey: string;
719
+ publicBoxKey: string;
720
+ userId: string;
721
+ displayName?: string | undefined;
722
+ }>;
723
+ expiresAt: z.ZodString;
724
+ nonce: z.ZodString;
725
+ epoch: z.ZodNumber;
726
+ uses: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<"unlimited">]>;
727
+ group: z.ZodOptional<z.ZodObject<{
728
+ groupId: z.ZodEffects<z.ZodString, string, string>;
729
+ name: z.ZodString;
730
+ publicKey: z.ZodString;
731
+ publicBoxKey: z.ZodString;
732
+ role: z.ZodNativeEnum<typeof import("../data").GroupMemberRole>;
733
+ mode: z.ZodEnum<["approve", "open"]>;
734
+ }, "strict", z.ZodTypeAny, {
735
+ name: string;
736
+ role: import("../data").GroupMemberRole;
737
+ publicKey: string;
738
+ groupId: string;
739
+ publicBoxKey: string;
740
+ mode: "open" | "approve";
741
+ }, {
742
+ name: string;
743
+ role: import("../data").GroupMemberRole;
744
+ publicKey: string;
745
+ groupId: string;
746
+ publicBoxKey: string;
747
+ mode: "open" | "approve";
748
+ }>>;
749
+ signature: z.ZodString;
750
+ }, "strict", z.ZodTypeAny, {
751
+ type: "group" | "contact";
752
+ nonce: string;
753
+ signature: string;
754
+ expiresAt: string;
755
+ v: 1;
756
+ inviter: {
757
+ publicKey: string;
758
+ publicBoxKey: string;
759
+ userId: string;
760
+ displayName?: string | undefined;
761
+ };
762
+ epoch: number;
763
+ uses: 1 | "unlimited";
764
+ group?: {
765
+ name: string;
766
+ role: import("../data").GroupMemberRole;
767
+ publicKey: string;
768
+ groupId: string;
769
+ publicBoxKey: string;
770
+ mode: "open" | "approve";
771
+ } | undefined;
772
+ }, {
773
+ type: "group" | "contact";
774
+ nonce: string;
775
+ signature: string;
776
+ expiresAt: string;
777
+ v: 1;
778
+ inviter: {
779
+ publicKey: string;
780
+ publicBoxKey: string;
781
+ userId: string;
782
+ displayName?: string | undefined;
783
+ };
784
+ epoch: number;
785
+ uses: 1 | "unlimited";
786
+ group?: {
787
+ name: string;
788
+ role: import("../data").GroupMemberRole;
789
+ publicKey: string;
790
+ groupId: string;
791
+ publicBoxKey: string;
792
+ mode: "open" | "approve";
793
+ } | undefined;
794
+ }>;
795
+ requester: z.ZodObject<{
796
+ userId: z.ZodEffects<z.ZodString, string, string>;
797
+ publicKey: z.ZodString;
798
+ publicBoxKey: z.ZodString;
799
+ displayName: z.ZodOptional<z.ZodString>;
800
+ }, "strict", z.ZodTypeAny, {
801
+ publicKey: string;
802
+ publicBoxKey: string;
803
+ userId: string;
804
+ displayName?: string | undefined;
805
+ }, {
806
+ publicKey: string;
807
+ publicBoxKey: string;
808
+ userId: string;
809
+ displayName?: string | undefined;
810
+ }>;
811
+ requesterDeviceId: z.ZodEffects<z.ZodString, string, string>;
812
+ }, "strict", z.ZodTypeAny, {
813
+ kind: "group-join-request";
814
+ token: {
815
+ type: "group" | "contact";
816
+ nonce: string;
817
+ signature: string;
818
+ expiresAt: string;
819
+ v: 1;
820
+ inviter: {
821
+ publicKey: string;
822
+ publicBoxKey: string;
823
+ userId: string;
824
+ displayName?: string | undefined;
825
+ };
826
+ epoch: number;
827
+ uses: 1 | "unlimited";
828
+ group?: {
829
+ name: string;
830
+ role: import("../data").GroupMemberRole;
831
+ publicKey: string;
832
+ groupId: string;
833
+ publicBoxKey: string;
834
+ mode: "open" | "approve";
835
+ } | undefined;
836
+ };
837
+ requester: {
838
+ publicKey: string;
839
+ publicBoxKey: string;
840
+ userId: string;
841
+ displayName?: string | undefined;
842
+ };
843
+ requesterDeviceId: string;
844
+ }, {
845
+ kind: "group-join-request";
846
+ token: {
847
+ type: "group" | "contact";
848
+ nonce: string;
849
+ signature: string;
850
+ expiresAt: string;
851
+ v: 1;
852
+ inviter: {
853
+ publicKey: string;
854
+ publicBoxKey: string;
855
+ userId: string;
856
+ displayName?: string | undefined;
857
+ };
858
+ epoch: number;
859
+ uses: 1 | "unlimited";
860
+ group?: {
861
+ name: string;
862
+ role: import("../data").GroupMemberRole;
863
+ publicKey: string;
864
+ groupId: string;
865
+ publicBoxKey: string;
866
+ mode: "open" | "approve";
867
+ } | undefined;
868
+ };
869
+ requester: {
870
+ publicKey: string;
871
+ publicBoxKey: string;
872
+ userId: string;
873
+ displayName?: string | undefined;
874
+ };
875
+ requesterDeviceId: string;
876
+ }>, z.ZodObject<{
877
+ kind: z.ZodLiteral<"group-approval">;
878
+ /** Nonce of the token or direct invite this approval answers, when there is one. */
879
+ inviteNonce: z.ZodOptional<z.ZodString>;
880
+ group: z.ZodLazy<z.ZodObject<{
881
+ groupId: z.ZodEffects<z.ZodString, string, string>;
882
+ name: z.ZodString;
883
+ description: z.ZodString;
884
+ iconClassName: z.ZodOptional<z.ZodString>;
885
+ publicRole: z.ZodOptional<z.ZodNativeEnum<typeof import("../data").GroupMemberRole>>;
886
+ disabled: z.ZodOptional<z.ZodBoolean>;
887
+ founderUserId: z.ZodEffects<z.ZodString, string, string>;
888
+ signature: z.ZodString;
889
+ publicKey: z.ZodString;
890
+ publicBoxKey: z.ZodString;
891
+ }, "strip", z.ZodTypeAny, {
892
+ name: string;
893
+ description: string;
894
+ publicKey: string;
895
+ signature: string;
896
+ groupId: string;
897
+ founderUserId: string;
898
+ publicBoxKey: string;
899
+ disabled?: boolean | undefined;
900
+ iconClassName?: string | undefined;
901
+ publicRole?: import("../data").GroupMemberRole | undefined;
902
+ }, {
903
+ name: string;
904
+ description: string;
905
+ publicKey: string;
906
+ signature: string;
907
+ groupId: string;
908
+ founderUserId: string;
909
+ publicBoxKey: string;
910
+ disabled?: boolean | undefined;
911
+ iconClassName?: string | undefined;
912
+ publicRole?: import("../data").GroupMemberRole | undefined;
913
+ }>>;
914
+ membership: z.ZodLazy<z.ZodObject<{
915
+ groupMemberId: z.ZodEffects<z.ZodString, string, string>;
916
+ groupId: z.ZodEffects<z.ZodString, string, string>;
917
+ userId: z.ZodEffects<z.ZodString, string, string>;
918
+ role: z.ZodNativeEnum<typeof import("../data").GroupMemberRole>;
919
+ signature: z.ZodString;
920
+ deleted: z.ZodOptional<z.ZodBoolean>;
921
+ }, "strip", z.ZodTypeAny, {
922
+ role: import("../data").GroupMemberRole;
923
+ signature: string;
924
+ groupId: string;
925
+ userId: string;
926
+ groupMemberId: string;
927
+ deleted?: boolean | undefined;
928
+ }, {
929
+ role: import("../data").GroupMemberRole;
930
+ signature: string;
931
+ groupId: string;
932
+ userId: string;
933
+ groupMemberId: string;
934
+ deleted?: boolean | undefined;
935
+ }>>;
936
+ seed: z.ZodObject<{
937
+ groupMembers: z.ZodArray<z.ZodLazy<z.ZodObject<{
938
+ groupMemberId: z.ZodEffects<z.ZodString, string, string>;
939
+ groupId: z.ZodEffects<z.ZodString, string, string>;
940
+ userId: z.ZodEffects<z.ZodString, string, string>;
941
+ role: z.ZodNativeEnum<typeof import("../data").GroupMemberRole>;
942
+ signature: z.ZodString;
943
+ deleted: z.ZodOptional<z.ZodBoolean>;
944
+ }, "strip", z.ZodTypeAny, {
945
+ role: import("../data").GroupMemberRole;
946
+ signature: string;
947
+ groupId: string;
948
+ userId: string;
949
+ groupMemberId: string;
950
+ deleted?: boolean | undefined;
951
+ }, {
952
+ role: import("../data").GroupMemberRole;
953
+ signature: string;
954
+ groupId: string;
955
+ userId: string;
956
+ groupMemberId: string;
957
+ deleted?: boolean | undefined;
958
+ }>>, "many">;
959
+ users: z.ZodArray<z.ZodLazy<z.ZodObject<{
960
+ userId: z.ZodEffects<z.ZodString, string, string>;
961
+ name: z.ZodString;
962
+ publicKey: z.ZodString;
963
+ publicBoxKey: z.ZodString;
964
+ signature: z.ZodOptional<z.ZodString>;
965
+ }, "strip", z.ZodTypeAny, {
966
+ name: string;
967
+ publicKey: string;
968
+ publicBoxKey: string;
969
+ userId: string;
970
+ signature?: string | undefined;
971
+ }, {
972
+ name: string;
973
+ publicKey: string;
974
+ publicBoxKey: string;
975
+ userId: string;
976
+ signature?: string | undefined;
977
+ }>>, "many">;
978
+ devices: z.ZodArray<z.ZodLazy<z.ZodObject<{
979
+ userId: z.ZodEffects<z.ZodString, string, string>;
980
+ deviceId: z.ZodEffects<z.ZodString, string, string>;
981
+ publicKey: z.ZodString;
982
+ publicBoxKey: z.ZodString;
983
+ userName: z.ZodOptional<z.ZodString>;
984
+ deviceName: z.ZodOptional<z.ZodString>;
985
+ }, "strip", z.ZodTypeAny, {
986
+ publicKey: string;
987
+ publicBoxKey: string;
988
+ userId: string;
989
+ deviceId: string;
990
+ deviceName?: string | undefined;
991
+ userName?: string | undefined;
992
+ }, {
993
+ publicKey: string;
994
+ publicBoxKey: string;
995
+ userId: string;
996
+ deviceId: string;
997
+ deviceName?: string | undefined;
998
+ userName?: string | undefined;
999
+ }>>, "many">;
1000
+ }, "strict", z.ZodTypeAny, {
1001
+ users: {
1002
+ name: string;
1003
+ publicKey: string;
1004
+ publicBoxKey: string;
1005
+ userId: string;
1006
+ signature?: string | undefined;
1007
+ }[];
1008
+ devices: {
1009
+ publicKey: string;
1010
+ publicBoxKey: string;
1011
+ userId: string;
1012
+ deviceId: string;
1013
+ deviceName?: string | undefined;
1014
+ userName?: string | undefined;
1015
+ }[];
1016
+ groupMembers: {
1017
+ role: import("../data").GroupMemberRole;
1018
+ signature: string;
1019
+ groupId: string;
1020
+ userId: string;
1021
+ groupMemberId: string;
1022
+ deleted?: boolean | undefined;
1023
+ }[];
1024
+ }, {
1025
+ users: {
1026
+ name: string;
1027
+ publicKey: string;
1028
+ publicBoxKey: string;
1029
+ userId: string;
1030
+ signature?: string | undefined;
1031
+ }[];
1032
+ devices: {
1033
+ publicKey: string;
1034
+ publicBoxKey: string;
1035
+ userId: string;
1036
+ deviceId: string;
1037
+ deviceName?: string | undefined;
1038
+ userName?: string | undefined;
1039
+ }[];
1040
+ groupMembers: {
1041
+ role: import("../data").GroupMemberRole;
1042
+ signature: string;
1043
+ groupId: string;
1044
+ userId: string;
1045
+ groupMemberId: string;
1046
+ deleted?: boolean | undefined;
1047
+ }[];
1048
+ }>;
1049
+ approver: z.ZodObject<{
1050
+ userId: z.ZodEffects<z.ZodString, string, string>;
1051
+ publicKey: z.ZodString;
1052
+ publicBoxKey: z.ZodString;
1053
+ displayName: z.ZodOptional<z.ZodString>;
1054
+ }, "strict", z.ZodTypeAny, {
1055
+ publicKey: string;
1056
+ publicBoxKey: string;
1057
+ userId: string;
1058
+ displayName?: string | undefined;
1059
+ }, {
1060
+ publicKey: string;
1061
+ publicBoxKey: string;
1062
+ userId: string;
1063
+ displayName?: string | undefined;
1064
+ }>;
1065
+ approverDeviceId: z.ZodEffects<z.ZodString, string, string>;
1066
+ /** Group encryption secret boxed to the joiner's `publicBoxKey`. */
1067
+ boxedSecret: z.ZodObject<{
1068
+ contents: z.ZodString;
1069
+ nonce: z.ZodString;
1070
+ fromPublicKey: z.ZodString;
1071
+ }, "strict", z.ZodTypeAny, {
1072
+ nonce: string;
1073
+ contents: string;
1074
+ fromPublicKey: string;
1075
+ }, {
1076
+ nonce: string;
1077
+ contents: string;
1078
+ fromPublicKey: string;
1079
+ }>;
1080
+ }, "strict", z.ZodTypeAny, {
1081
+ group: {
1082
+ name: string;
1083
+ description: string;
1084
+ publicKey: string;
1085
+ signature: string;
1086
+ groupId: string;
1087
+ founderUserId: string;
1088
+ publicBoxKey: string;
1089
+ disabled?: boolean | undefined;
1090
+ iconClassName?: string | undefined;
1091
+ publicRole?: import("../data").GroupMemberRole | undefined;
1092
+ };
1093
+ kind: "group-approval";
1094
+ membership: {
1095
+ role: import("../data").GroupMemberRole;
1096
+ signature: string;
1097
+ groupId: string;
1098
+ userId: string;
1099
+ groupMemberId: string;
1100
+ deleted?: boolean | undefined;
1101
+ };
1102
+ seed: {
1103
+ users: {
1104
+ name: string;
1105
+ publicKey: string;
1106
+ publicBoxKey: string;
1107
+ userId: string;
1108
+ signature?: string | undefined;
1109
+ }[];
1110
+ devices: {
1111
+ publicKey: string;
1112
+ publicBoxKey: string;
1113
+ userId: string;
1114
+ deviceId: string;
1115
+ deviceName?: string | undefined;
1116
+ userName?: string | undefined;
1117
+ }[];
1118
+ groupMembers: {
1119
+ role: import("../data").GroupMemberRole;
1120
+ signature: string;
1121
+ groupId: string;
1122
+ userId: string;
1123
+ groupMemberId: string;
1124
+ deleted?: boolean | undefined;
1125
+ }[];
1126
+ };
1127
+ approver: {
1128
+ publicKey: string;
1129
+ publicBoxKey: string;
1130
+ userId: string;
1131
+ displayName?: string | undefined;
1132
+ };
1133
+ approverDeviceId: string;
1134
+ boxedSecret: {
1135
+ nonce: string;
1136
+ contents: string;
1137
+ fromPublicKey: string;
1138
+ };
1139
+ inviteNonce?: string | undefined;
1140
+ }, {
1141
+ group: {
1142
+ name: string;
1143
+ description: string;
1144
+ publicKey: string;
1145
+ signature: string;
1146
+ groupId: string;
1147
+ founderUserId: string;
1148
+ publicBoxKey: string;
1149
+ disabled?: boolean | undefined;
1150
+ iconClassName?: string | undefined;
1151
+ publicRole?: import("../data").GroupMemberRole | undefined;
1152
+ };
1153
+ kind: "group-approval";
1154
+ membership: {
1155
+ role: import("../data").GroupMemberRole;
1156
+ signature: string;
1157
+ groupId: string;
1158
+ userId: string;
1159
+ groupMemberId: string;
1160
+ deleted?: boolean | undefined;
1161
+ };
1162
+ seed: {
1163
+ users: {
1164
+ name: string;
1165
+ publicKey: string;
1166
+ publicBoxKey: string;
1167
+ userId: string;
1168
+ signature?: string | undefined;
1169
+ }[];
1170
+ devices: {
1171
+ publicKey: string;
1172
+ publicBoxKey: string;
1173
+ userId: string;
1174
+ deviceId: string;
1175
+ deviceName?: string | undefined;
1176
+ userName?: string | undefined;
1177
+ }[];
1178
+ groupMembers: {
1179
+ role: import("../data").GroupMemberRole;
1180
+ signature: string;
1181
+ groupId: string;
1182
+ userId: string;
1183
+ groupMemberId: string;
1184
+ deleted?: boolean | undefined;
1185
+ }[];
1186
+ };
1187
+ approver: {
1188
+ publicKey: string;
1189
+ publicBoxKey: string;
1190
+ userId: string;
1191
+ displayName?: string | undefined;
1192
+ };
1193
+ approverDeviceId: string;
1194
+ boxedSecret: {
1195
+ nonce: string;
1196
+ contents: string;
1197
+ fromPublicKey: string;
1198
+ };
1199
+ inviteNonce?: string | undefined;
1200
+ }>, z.ZodObject<{
1201
+ kind: z.ZodLiteral<"invite-decline">;
1202
+ inviteNonce: z.ZodString;
1203
+ groupId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1204
+ by: z.ZodObject<{
1205
+ userId: z.ZodEffects<z.ZodString, string, string>;
1206
+ publicKey: z.ZodString;
1207
+ publicBoxKey: z.ZodString;
1208
+ displayName: z.ZodOptional<z.ZodString>;
1209
+ }, "strict", z.ZodTypeAny, {
1210
+ publicKey: string;
1211
+ publicBoxKey: string;
1212
+ userId: string;
1213
+ displayName?: string | undefined;
1214
+ }, {
1215
+ publicKey: string;
1216
+ publicBoxKey: string;
1217
+ userId: string;
1218
+ displayName?: string | undefined;
1219
+ }>;
1220
+ reason: z.ZodOptional<z.ZodString>;
1221
+ }, "strict", z.ZodTypeAny, {
1222
+ kind: "invite-decline";
1223
+ inviteNonce: string;
1224
+ by: {
1225
+ publicKey: string;
1226
+ publicBoxKey: string;
1227
+ userId: string;
1228
+ displayName?: string | undefined;
1229
+ };
1230
+ reason?: string | undefined;
1231
+ groupId?: string | undefined;
1232
+ }, {
1233
+ kind: "invite-decline";
1234
+ inviteNonce: string;
1235
+ by: {
1236
+ publicKey: string;
1237
+ publicBoxKey: string;
1238
+ userId: string;
1239
+ displayName?: string | undefined;
1240
+ };
1241
+ reason?: string | undefined;
1242
+ groupId?: string | undefined;
1243
+ }>, z.ZodObject<{
1244
+ kind: z.ZodLiteral<"invite-accepted">;
1245
+ inviteNonce: z.ZodString;
1246
+ groupId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1247
+ by: z.ZodObject<{
1248
+ userId: z.ZodEffects<z.ZodString, string, string>;
1249
+ publicKey: z.ZodString;
1250
+ publicBoxKey: z.ZodString;
1251
+ displayName: z.ZodOptional<z.ZodString>;
1252
+ }, "strict", z.ZodTypeAny, {
1253
+ publicKey: string;
1254
+ publicBoxKey: string;
1255
+ userId: string;
1256
+ displayName?: string | undefined;
1257
+ }, {
1258
+ publicKey: string;
1259
+ publicBoxKey: string;
1260
+ userId: string;
1261
+ displayName?: string | undefined;
1262
+ }>;
1263
+ byDeviceId: z.ZodEffects<z.ZodString, string, string>;
1264
+ }, "strict", z.ZodTypeAny, {
1265
+ kind: "invite-accepted";
1266
+ inviteNonce: string;
1267
+ by: {
1268
+ publicKey: string;
1269
+ publicBoxKey: string;
1270
+ userId: string;
1271
+ displayName?: string | undefined;
1272
+ };
1273
+ byDeviceId: string;
1274
+ groupId?: string | undefined;
1275
+ }, {
1276
+ kind: "invite-accepted";
1277
+ inviteNonce: string;
1278
+ by: {
1279
+ publicKey: string;
1280
+ publicBoxKey: string;
1281
+ userId: string;
1282
+ displayName?: string | undefined;
1283
+ };
1284
+ byDeviceId: string;
1285
+ groupId?: string | undefined;
1286
+ }>]>;
1287
+ /** Any message that travels inside an invite envelope. */
1288
+ export type InviteMessage = z.infer<typeof inviteMessageSchema>;
1289
+ /**
1290
+ * Wire format for invite traffic over the mesh (`dataContextId: "invite"`) and the mailbox.
1291
+ * The message is signed by the sender's user key, then boxed to the recipient's user box key,
1292
+ * so any of the recipient's devices can open it and the relay learns only the recipient id.
1293
+ */
1294
+ export declare const inviteEnvelopeSchema: z.ZodObject<{
1295
+ v: z.ZodLiteral<1>;
1296
+ to: z.ZodEffects<z.ZodString, string, string>;
1297
+ box: z.ZodObject<{
1298
+ contents: z.ZodString;
1299
+ nonce: z.ZodString;
1300
+ fromPublicKey: z.ZodString;
1301
+ }, "strict", z.ZodTypeAny, {
1302
+ nonce: string;
1303
+ contents: string;
1304
+ fromPublicKey: string;
1305
+ }, {
1306
+ nonce: string;
1307
+ contents: string;
1308
+ fromPublicKey: string;
1309
+ }>;
1310
+ }, "strict", z.ZodTypeAny, {
1311
+ v: 1;
1312
+ to: string;
1313
+ box: {
1314
+ nonce: string;
1315
+ contents: string;
1316
+ fromPublicKey: string;
1317
+ };
1318
+ }, {
1319
+ v: 1;
1320
+ to: string;
1321
+ box: {
1322
+ nonce: string;
1323
+ contents: string;
1324
+ fromPublicKey: string;
1325
+ };
1326
+ }>;
1327
+ /** Signed-then-boxed invite message addressed to one user. */
1328
+ export type InviteEnvelope = z.infer<typeof inviteEnvelopeSchema>;
1329
+ /** Opened envelope with the verified sender identity keys. */
1330
+ export interface OpenedInviteEnvelope {
1331
+ message: InviteMessage;
1332
+ senderPublicKey: string;
1333
+ senderPublicBoxKey: string;
1334
+ }
1335
+ /** Signs a message with the sender's user key and boxes it to the recipient's user box key. */
1336
+ export declare function sealInviteEnvelope(message: InviteMessage, senderKeys: IPublicPrivateKeys, recipient: {
1337
+ userId: string;
1338
+ publicBoxKey: string;
1339
+ }): InviteEnvelope;
1340
+ /**
1341
+ * Opens an envelope addressed to this user and verifies the inner signature.
1342
+ *
1343
+ * @throws when the box cannot be opened, the signature is invalid, or the message is malformed
1344
+ */
1345
+ export declare function openInviteEnvelope(envelope: unknown, recipient: {
1346
+ userId: string;
1347
+ secretKey: string;
1348
+ }): OpenedInviteEnvelope;
1349
+ /** Returns the identity a message claims for its sender, for cross-checking against the envelope. */
1350
+ export declare function inviteMessageSender(message: InviteMessage): {
1351
+ publicKey: string;
1352
+ publicBoxKey: string;
1353
+ userId: string;
1354
+ };