@wireapp/core-crypto 9.3.4 → 10.0.0-pre.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3875 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { UniffiAbstractObject, UniffiGcObject, UniffiHandle, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol, variantOrdinalSymbol } from '@ubjs/core';
4
+
5
+ /**
6
+ * Returns build metadata for CoreCrypto.
7
+ */
8
+ export declare function buildMetadata(): BuildMetadata;
9
+ /**
10
+ * Get an instance of the default cipher suite.
11
+ */
12
+ export declare function cipherSuiteDefault(): CipherSuite;
13
+ /**
14
+ * Construct a cipher suite enum instance from its discriminant.
15
+ */
16
+ export declare function cipherSuiteFromU16(discriminant: number): CipherSuite;
17
+ /**
18
+ * Updates the key of the CoreCrypto database.
19
+ *
20
+ * This function is intended to be called only once, when migrating from CoreCrypto 5.x to 6.x.
21
+ */
22
+ export declare function migrateDatabaseKeyTypeToBytes(path: string, oldKey: string, newKey: DatabaseKeyLike, asyncOpts_?: {
23
+ signal: AbortSignal;
24
+ }): Promise<void>;
25
+ /**
26
+ * Returns the Proteus last resort prekey ID.
27
+ *
28
+ * The last resort prekey is a special prekey retained after all other prekeys have been consumed,
29
+ * ensuring a session can always be established. Its ID is always `u16::MAX` (65535).
30
+ */
31
+ declare function proteusLastResortPrekeyIdFfi(): number;
32
+ /**
33
+ * Initializes the logger.
34
+ */
35
+ export declare function setLogger(logger: CoreCryptoLogger): void;
36
+ /**
37
+ * Sets the maximum log level forwarded to the logger.
38
+ */
39
+ export declare function setMaxLogLevel(level: CoreCryptoLogLevel): void;
40
+ /**
41
+ * The version of `core-crypto`.
42
+ */
43
+ export declare function version(): string;
44
+ type UuidLike = Uuid;
45
+ /**
46
+ * A Uuid.
47
+ */
48
+ export declare class Uuid extends UniffiAbstractObject {
49
+ readonly [uniffiTypeNameSymbol] = "Uuid";
50
+ readonly [destructorGuardSymbol]: UniffiGcObject;
51
+ readonly [pointerLiteralSymbol]: UniffiHandle;
52
+ /**
53
+ * Parse a `Uuid` from a string.
54
+ */
55
+ constructor(uuid: string);
56
+ equals(other: Uuid): boolean;
57
+ hashCode(): bigint;
58
+ uniffiDestroy(): void;
59
+ static instanceOf(obj_: any): obj_ is Uuid;
60
+ }
61
+ type DeviceIdLike = DeviceId;
62
+ /**
63
+ * A Device ID.
64
+ */
65
+ export declare class DeviceId extends UniffiAbstractObject {
66
+ readonly [uniffiTypeNameSymbol] = "DeviceId";
67
+ readonly [destructorGuardSymbol]: UniffiGcObject;
68
+ readonly [pointerLiteralSymbol]: UniffiHandle;
69
+ /**
70
+ * New device id from an unsigned 64-bit integer.
71
+ */
72
+ constructor(id: bigint);
73
+ /**
74
+ * Construct a `DeviceId` from 8 bytes encoded as a hex string.
75
+ */
76
+ static fromHexString(hexString: string): DeviceIdLike;
77
+ /**
78
+ * Encode the `DeviceId` as a 16-character lowercase hex string, with leading 0s.
79
+ */
80
+ toHexString(): string;
81
+ /**
82
+ * Get the number corresponding to this `DeviceId`.
83
+ */
84
+ toU64(): bigint;
85
+ equals(other: DeviceId): boolean;
86
+ hashCode(): bigint;
87
+ uniffiDestroy(): void;
88
+ static instanceOf(obj_: any): obj_ is DeviceId;
89
+ }
90
+ /**
91
+ * This directly represents a `ClientId` of the `<userid>-<device-id>@<domain>` format.
92
+ * Instantiate via [ClientId::deserialize].
93
+ */
94
+ export type DeserializedClientId = {
95
+ /**
96
+ * The client id this was deserialized from
97
+ */
98
+ clientId: ClientIdLike;
99
+ /**
100
+ * The user id component
101
+ */
102
+ userId: UuidLike;
103
+ /**
104
+ * The device id component
105
+ */
106
+ deviceId: DeviceIdLike;
107
+ /**
108
+ * The domain
109
+ */
110
+ domain: string;
111
+ };
112
+ /**
113
+ * Generated factory for {@link DeserializedClientId} record objects.
114
+ */
115
+ export declare const DeserializedClientId: Readonly<{
116
+ create: (partial: Partial<DeserializedClientId> & Required<Omit<DeserializedClientId, never>>) => DeserializedClientId;
117
+ new: (partial: Partial<DeserializedClientId> & Required<Omit<DeserializedClientId, never>>) => DeserializedClientId;
118
+ defaults: () => Partial<DeserializedClientId>;
119
+ }>;
120
+ type ClientIdLike = ClientId;
121
+ /**
122
+ * A unique identifier for an MLS client.
123
+ *
124
+ * Each app instance a user is running, such as desktop or mobile, is a separate client
125
+ * with its own client id. A single user may therefore have multiple clients.
126
+ * More information: <https://messaginglayersecurity.rocks/mls-architecture/draft-ietf-mls-architecture.html#name-group-members-and-clients>
127
+ */
128
+ export declare class ClientId extends UniffiAbstractObject {
129
+ readonly [uniffiTypeNameSymbol] = "ClientId";
130
+ readonly [destructorGuardSymbol]: UniffiGcObject;
131
+ readonly [pointerLiteralSymbol]: UniffiHandle;
132
+ /**
133
+ * Create a new client id.
134
+ */
135
+ constructor(userId: UuidLike, deviceId: DeviceIdLike, domain: string);
136
+ /**
137
+ * Copy the wrapped data into a new byte array.
138
+ */
139
+ copyBytes(): Uint8Array;
140
+ /**
141
+ * Copy the wrapped data into a direct representation of the `<user-id>:<device-id>@<domain>` format.
142
+ */
143
+ deserialize(): DeserializedClientId;
144
+ equals(other: ClientId): boolean;
145
+ hashCode(): bigint;
146
+ uniffiDestroy(): void;
147
+ static instanceOf(obj_: any): obj_ is ClientId;
148
+ }
149
+ /**
150
+ * The standalone status of a device credential in an MLS group at a given moment.
151
+ *
152
+ * This does not represent states where a device is not using MLS or end-to-end identity.
153
+ */
154
+ export declare enum DeviceStatus {
155
+ /**
156
+ * The device credential is valid.
157
+ */
158
+ Valid = 1,
159
+ /**
160
+ * The device credential's certificate has expired.
161
+ */
162
+ Expired = 2,
163
+ /**
164
+ * The device credential's certificate has been revoked.
165
+ *
166
+ * Note: revocation is not yet implemented.
167
+ */
168
+ Revoked = 3
169
+ }
170
+ /**
171
+ * The type of credential used to authenticate an MLS client's identity.
172
+ */
173
+ export declare enum CredentialType {
174
+ /**
175
+ * A basic credential backed by a raw key pair, without any certificate infrastructure.
176
+ */
177
+ Basic = 1,
178
+ /**
179
+ * An X509 certificate credential, typically obtained through the end-to-end identity enrollment process.
180
+ */
181
+ X509 = 2
182
+ }
183
+ /**
184
+ * Typealias from the type name used in the UDL file to the builtin type. This
185
+ * is needed because the UDL type name is used in function/method signatures.
186
+ */
187
+ export type Timestamp = Date;
188
+ /**
189
+ * Fields from a `WireIdentity` that are specific to X509 credentials.
190
+ */
191
+ export type X509Identity = {
192
+ /**
193
+ * User handle e.g. `john_wire`
194
+ */
195
+ handle: string;
196
+ /**
197
+ * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
198
+ */
199
+ displayName: string;
200
+ /**
201
+ * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
202
+ */
203
+ domain: string;
204
+ /**
205
+ * PEM-encoded X509 certificate identifying this client in the MLS group.
206
+ */
207
+ certificate: string;
208
+ /**
209
+ * X509 certificate serial number
210
+ */
211
+ serialNumber: string;
212
+ /**
213
+ * Certificate validity start time (the X509 notBefore field).
214
+ */
215
+ notBefore: Timestamp;
216
+ /**
217
+ * Certificate validity end time (the X509 notAfter field).
218
+ */
219
+ notAfter: Timestamp;
220
+ };
221
+ /**
222
+ * Generated factory for {@link X509Identity} record objects.
223
+ */
224
+ export declare const X509Identity: Readonly<{
225
+ create: (partial: Partial<X509Identity> & Required<Omit<X509Identity, never>>) => X509Identity;
226
+ new: (partial: Partial<X509Identity> & Required<Omit<X509Identity, never>>) => X509Identity;
227
+ defaults: () => Partial<X509Identity>;
228
+ }>;
229
+ /**
230
+ * The identity claims identifying a client.
231
+ *
232
+ * Those claims are verifiable by any member in the group.
233
+ */
234
+ export type WireIdentity = {
235
+ /**
236
+ * Unique client identifier e.g. `T4Coy4vdRzianwfOgXpn6A:6add501bacd1d90e@whitehouse.gov`
237
+ */
238
+ clientId?: ClientIdLike;
239
+ /**
240
+ * Status of the credential at the moment this object is created.
241
+ */
242
+ status: DeviceStatus;
243
+ /**
244
+ * MLS thumbprint
245
+ */
246
+ thumbprint: string;
247
+ /**
248
+ * Indicates whether the credential is Basic or X509.
249
+ */
250
+ credentialType: CredentialType;
251
+ /**
252
+ * The X509 certificate details; populated only when `credential_type` is X509.
253
+ */
254
+ x509Identity?: X509Identity;
255
+ };
256
+ /**
257
+ * Generated factory for {@link WireIdentity} record objects.
258
+ */
259
+ export declare const WireIdentity: Readonly<{
260
+ create: (partial: Partial<WireIdentity> & Required<Omit<WireIdentity, "clientId" | "x509Identity">>) => WireIdentity;
261
+ new: (partial: Partial<WireIdentity> & Required<Omit<WireIdentity, "clientId" | "x509Identity">>) => WireIdentity;
262
+ defaults: () => Partial<WireIdentity>;
263
+ }>;
264
+ /**
265
+ * A decrypted message that was buffered due to out-of-order delivery by the distribution service.
266
+ *
267
+ * These are returned in the `buffered_messages` field of a `DecryptedMessage` when a commit is
268
+ * processed. They represent messages for the new epoch that arrived before the commit that created it.
269
+ */
270
+ export type BufferedDecryptedMessage = {
271
+ /**
272
+ * Decrypted plaintext
273
+ */
274
+ message?: Uint8Array;
275
+ /**
276
+ * False if processing this message caused the client to be removed from the group, i.e. due to a Remove commit.
277
+ */
278
+ isActive: boolean;
279
+ /**
280
+ * Commit delay in seconds.
281
+ *
282
+ * When set, clients must delay this long before processing a commit.
283
+ * This reduces load on the backend, which otherwise would receive epoch change notifications from all clients
284
+ * simultaneously.
285
+ */
286
+ commitDelay?: bigint;
287
+ /**
288
+ * `ClientId` of the sender of the message being decrypted. Only present for application messages.
289
+ */
290
+ senderClientId?: ClientIdLike;
291
+ /**
292
+ * Identity claims present in the sender credential.
293
+ */
294
+ identity: WireIdentity;
295
+ };
296
+ /**
297
+ * Generated factory for {@link BufferedDecryptedMessage} record objects.
298
+ */
299
+ export declare const BufferedDecryptedMessage: Readonly<{
300
+ create: (partial: Partial<BufferedDecryptedMessage> & Required<Omit<BufferedDecryptedMessage, "message" | "commitDelay" | "senderClientId">>) => BufferedDecryptedMessage;
301
+ new: (partial: Partial<BufferedDecryptedMessage> & Required<Omit<BufferedDecryptedMessage, "message" | "commitDelay" | "senderClientId">>) => BufferedDecryptedMessage;
302
+ defaults: () => Partial<BufferedDecryptedMessage>;
303
+ }>;
304
+ /**
305
+ * Metadata describing the conditions of the build of this software.
306
+ */
307
+ export type BuildMetadata = {
308
+ /**
309
+ * Build timestamp
310
+ */
311
+ timestamp: string;
312
+ /**
313
+ * Whether this build was in Debug mode (true) or Release mode (false).
314
+ */
315
+ cargoDebug: string;
316
+ /**
317
+ * Features enabled for this build.
318
+ */
319
+ cargoFeatures: string;
320
+ /**
321
+ * Optimization level
322
+ */
323
+ optLevel: string;
324
+ /**
325
+ * Build target triple
326
+ */
327
+ targetTriple: string;
328
+ /**
329
+ * Git branch
330
+ */
331
+ gitBranch: string;
332
+ /**
333
+ * Output of `git describe`
334
+ */
335
+ gitDescribe: string;
336
+ /**
337
+ * Hash of current git commit
338
+ */
339
+ gitSha: string;
340
+ /**
341
+ * `true` when the source code differed from the commit at the most recent git hash.
342
+ */
343
+ gitDirty: string;
344
+ };
345
+ /**
346
+ * Generated factory for {@link BuildMetadata} record objects.
347
+ */
348
+ export declare const BuildMetadata: Readonly<{
349
+ create: (partial: Partial<BuildMetadata> & Required<Omit<BuildMetadata, never>>) => BuildMetadata;
350
+ new: (partial: Partial<BuildMetadata> & Required<Omit<BuildMetadata, never>>) => BuildMetadata;
351
+ defaults: () => Partial<BuildMetadata>;
352
+ }>;
353
+ export declare enum MlsError_Tags {
354
+ ConversationAlreadyExists = "ConversationAlreadyExists",
355
+ DuplicateMessage = "DuplicateMessage",
356
+ BufferedFutureMessage = "BufferedFutureMessage",
357
+ WrongEpoch = "WrongEpoch",
358
+ BufferedCommit = "BufferedCommit",
359
+ MessageEpochTooOld = "MessageEpochTooOld",
360
+ SelfCommitIgnored = "SelfCommitIgnored",
361
+ UnmergedPendingGroup = "UnmergedPendingGroup",
362
+ StaleProposal = "StaleProposal",
363
+ StaleCommit = "StaleCommit",
364
+ OrphanWelcome = "OrphanWelcome",
365
+ MessageRejected = "MessageRejected",
366
+ Other = "Other"
367
+ }
368
+ /**
369
+ * Errors produced by the MLS layer.
370
+ */
371
+ export declare const MlsError: Readonly<{
372
+ instanceOf: (obj: any) => obj is MlsError;
373
+ ConversationAlreadyExists: {
374
+ new (inner: {
375
+ conversationId: Uint8Array;
376
+ }): {
377
+ readonly tag: MlsError_Tags.ConversationAlreadyExists;
378
+ readonly inner: Readonly<{
379
+ conversationId: Uint8Array;
380
+ }>;
381
+ /**
382
+ * @private
383
+ * This field is private and should not be used, use `tag` instead.
384
+ */
385
+ readonly [uniffiTypeNameSymbol]: "MlsError";
386
+ name: string;
387
+ message: string;
388
+ stack?: string;
389
+ cause?: unknown;
390
+ };
391
+ "new"(inner: {
392
+ conversationId: Uint8Array;
393
+ }): {
394
+ readonly tag: MlsError_Tags.ConversationAlreadyExists;
395
+ readonly inner: Readonly<{
396
+ conversationId: Uint8Array;
397
+ }>;
398
+ /**
399
+ * @private
400
+ * This field is private and should not be used, use `tag` instead.
401
+ */
402
+ readonly [uniffiTypeNameSymbol]: "MlsError";
403
+ name: string;
404
+ message: string;
405
+ stack?: string;
406
+ cause?: unknown;
407
+ };
408
+ instanceOf(obj: any): obj is {
409
+ readonly tag: MlsError_Tags.ConversationAlreadyExists;
410
+ readonly inner: Readonly<{
411
+ conversationId: Uint8Array;
412
+ }>;
413
+ /**
414
+ * @private
415
+ * This field is private and should not be used, use `tag` instead.
416
+ */
417
+ readonly [uniffiTypeNameSymbol]: "MlsError";
418
+ name: string;
419
+ message: string;
420
+ stack?: string;
421
+ cause?: unknown;
422
+ };
423
+ hasInner(obj: any): obj is {
424
+ readonly tag: MlsError_Tags.ConversationAlreadyExists;
425
+ readonly inner: Readonly<{
426
+ conversationId: Uint8Array;
427
+ }>;
428
+ /**
429
+ * @private
430
+ * This field is private and should not be used, use `tag` instead.
431
+ */
432
+ readonly [uniffiTypeNameSymbol]: "MlsError";
433
+ name: string;
434
+ message: string;
435
+ stack?: string;
436
+ cause?: unknown;
437
+ };
438
+ getInner(obj: {
439
+ readonly tag: MlsError_Tags.ConversationAlreadyExists;
440
+ readonly inner: Readonly<{
441
+ conversationId: Uint8Array;
442
+ }>;
443
+ /**
444
+ * @private
445
+ * This field is private and should not be used, use `tag` instead.
446
+ */
447
+ readonly [uniffiTypeNameSymbol]: "MlsError";
448
+ name: string;
449
+ message: string;
450
+ stack?: string;
451
+ cause?: unknown;
452
+ }): Readonly<{
453
+ conversationId: Uint8Array;
454
+ }>;
455
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
456
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
457
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
458
+ stackTraceLimit: number;
459
+ isError(value: unknown): value is Error;
460
+ };
461
+ DuplicateMessage: {
462
+ new (): {
463
+ readonly tag: MlsError_Tags.DuplicateMessage;
464
+ /**
465
+ * @private
466
+ * This field is private and should not be used, use `tag` instead.
467
+ */
468
+ readonly [uniffiTypeNameSymbol]: "MlsError";
469
+ name: string;
470
+ message: string;
471
+ stack?: string;
472
+ cause?: unknown;
473
+ };
474
+ "new"(): {
475
+ readonly tag: MlsError_Tags.DuplicateMessage;
476
+ /**
477
+ * @private
478
+ * This field is private and should not be used, use `tag` instead.
479
+ */
480
+ readonly [uniffiTypeNameSymbol]: "MlsError";
481
+ name: string;
482
+ message: string;
483
+ stack?: string;
484
+ cause?: unknown;
485
+ };
486
+ instanceOf(obj: any): obj is {
487
+ readonly tag: MlsError_Tags.DuplicateMessage;
488
+ /**
489
+ * @private
490
+ * This field is private and should not be used, use `tag` instead.
491
+ */
492
+ readonly [uniffiTypeNameSymbol]: "MlsError";
493
+ name: string;
494
+ message: string;
495
+ stack?: string;
496
+ cause?: unknown;
497
+ };
498
+ hasInner(obj: any): obj is {
499
+ readonly tag: MlsError_Tags.DuplicateMessage;
500
+ /**
501
+ * @private
502
+ * This field is private and should not be used, use `tag` instead.
503
+ */
504
+ readonly [uniffiTypeNameSymbol]: "MlsError";
505
+ name: string;
506
+ message: string;
507
+ stack?: string;
508
+ cause?: unknown;
509
+ };
510
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
511
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
512
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
513
+ stackTraceLimit: number;
514
+ isError(value: unknown): value is Error;
515
+ };
516
+ BufferedFutureMessage: {
517
+ new (): {
518
+ readonly tag: MlsError_Tags.BufferedFutureMessage;
519
+ /**
520
+ * @private
521
+ * This field is private and should not be used, use `tag` instead.
522
+ */
523
+ readonly [uniffiTypeNameSymbol]: "MlsError";
524
+ name: string;
525
+ message: string;
526
+ stack?: string;
527
+ cause?: unknown;
528
+ };
529
+ "new"(): {
530
+ readonly tag: MlsError_Tags.BufferedFutureMessage;
531
+ /**
532
+ * @private
533
+ * This field is private and should not be used, use `tag` instead.
534
+ */
535
+ readonly [uniffiTypeNameSymbol]: "MlsError";
536
+ name: string;
537
+ message: string;
538
+ stack?: string;
539
+ cause?: unknown;
540
+ };
541
+ instanceOf(obj: any): obj is {
542
+ readonly tag: MlsError_Tags.BufferedFutureMessage;
543
+ /**
544
+ * @private
545
+ * This field is private and should not be used, use `tag` instead.
546
+ */
547
+ readonly [uniffiTypeNameSymbol]: "MlsError";
548
+ name: string;
549
+ message: string;
550
+ stack?: string;
551
+ cause?: unknown;
552
+ };
553
+ hasInner(obj: any): obj is {
554
+ readonly tag: MlsError_Tags.BufferedFutureMessage;
555
+ /**
556
+ * @private
557
+ * This field is private and should not be used, use `tag` instead.
558
+ */
559
+ readonly [uniffiTypeNameSymbol]: "MlsError";
560
+ name: string;
561
+ message: string;
562
+ stack?: string;
563
+ cause?: unknown;
564
+ };
565
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
566
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
567
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
568
+ stackTraceLimit: number;
569
+ isError(value: unknown): value is Error;
570
+ };
571
+ WrongEpoch: {
572
+ new (): {
573
+ readonly tag: MlsError_Tags.WrongEpoch;
574
+ /**
575
+ * @private
576
+ * This field is private and should not be used, use `tag` instead.
577
+ */
578
+ readonly [uniffiTypeNameSymbol]: "MlsError";
579
+ name: string;
580
+ message: string;
581
+ stack?: string;
582
+ cause?: unknown;
583
+ };
584
+ "new"(): {
585
+ readonly tag: MlsError_Tags.WrongEpoch;
586
+ /**
587
+ * @private
588
+ * This field is private and should not be used, use `tag` instead.
589
+ */
590
+ readonly [uniffiTypeNameSymbol]: "MlsError";
591
+ name: string;
592
+ message: string;
593
+ stack?: string;
594
+ cause?: unknown;
595
+ };
596
+ instanceOf(obj: any): obj is {
597
+ readonly tag: MlsError_Tags.WrongEpoch;
598
+ /**
599
+ * @private
600
+ * This field is private and should not be used, use `tag` instead.
601
+ */
602
+ readonly [uniffiTypeNameSymbol]: "MlsError";
603
+ name: string;
604
+ message: string;
605
+ stack?: string;
606
+ cause?: unknown;
607
+ };
608
+ hasInner(obj: any): obj is {
609
+ readonly tag: MlsError_Tags.WrongEpoch;
610
+ /**
611
+ * @private
612
+ * This field is private and should not be used, use `tag` instead.
613
+ */
614
+ readonly [uniffiTypeNameSymbol]: "MlsError";
615
+ name: string;
616
+ message: string;
617
+ stack?: string;
618
+ cause?: unknown;
619
+ };
620
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
621
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
622
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
623
+ stackTraceLimit: number;
624
+ isError(value: unknown): value is Error;
625
+ };
626
+ BufferedCommit: {
627
+ new (): {
628
+ readonly tag: MlsError_Tags.BufferedCommit;
629
+ /**
630
+ * @private
631
+ * This field is private and should not be used, use `tag` instead.
632
+ */
633
+ readonly [uniffiTypeNameSymbol]: "MlsError";
634
+ name: string;
635
+ message: string;
636
+ stack?: string;
637
+ cause?: unknown;
638
+ };
639
+ "new"(): {
640
+ readonly tag: MlsError_Tags.BufferedCommit;
641
+ /**
642
+ * @private
643
+ * This field is private and should not be used, use `tag` instead.
644
+ */
645
+ readonly [uniffiTypeNameSymbol]: "MlsError";
646
+ name: string;
647
+ message: string;
648
+ stack?: string;
649
+ cause?: unknown;
650
+ };
651
+ instanceOf(obj: any): obj is {
652
+ readonly tag: MlsError_Tags.BufferedCommit;
653
+ /**
654
+ * @private
655
+ * This field is private and should not be used, use `tag` instead.
656
+ */
657
+ readonly [uniffiTypeNameSymbol]: "MlsError";
658
+ name: string;
659
+ message: string;
660
+ stack?: string;
661
+ cause?: unknown;
662
+ };
663
+ hasInner(obj: any): obj is {
664
+ readonly tag: MlsError_Tags.BufferedCommit;
665
+ /**
666
+ * @private
667
+ * This field is private and should not be used, use `tag` instead.
668
+ */
669
+ readonly [uniffiTypeNameSymbol]: "MlsError";
670
+ name: string;
671
+ message: string;
672
+ stack?: string;
673
+ cause?: unknown;
674
+ };
675
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
676
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
677
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
678
+ stackTraceLimit: number;
679
+ isError(value: unknown): value is Error;
680
+ };
681
+ MessageEpochTooOld: {
682
+ new (): {
683
+ readonly tag: MlsError_Tags.MessageEpochTooOld;
684
+ /**
685
+ * @private
686
+ * This field is private and should not be used, use `tag` instead.
687
+ */
688
+ readonly [uniffiTypeNameSymbol]: "MlsError";
689
+ name: string;
690
+ message: string;
691
+ stack?: string;
692
+ cause?: unknown;
693
+ };
694
+ "new"(): {
695
+ readonly tag: MlsError_Tags.MessageEpochTooOld;
696
+ /**
697
+ * @private
698
+ * This field is private and should not be used, use `tag` instead.
699
+ */
700
+ readonly [uniffiTypeNameSymbol]: "MlsError";
701
+ name: string;
702
+ message: string;
703
+ stack?: string;
704
+ cause?: unknown;
705
+ };
706
+ instanceOf(obj: any): obj is {
707
+ readonly tag: MlsError_Tags.MessageEpochTooOld;
708
+ /**
709
+ * @private
710
+ * This field is private and should not be used, use `tag` instead.
711
+ */
712
+ readonly [uniffiTypeNameSymbol]: "MlsError";
713
+ name: string;
714
+ message: string;
715
+ stack?: string;
716
+ cause?: unknown;
717
+ };
718
+ hasInner(obj: any): obj is {
719
+ readonly tag: MlsError_Tags.MessageEpochTooOld;
720
+ /**
721
+ * @private
722
+ * This field is private and should not be used, use `tag` instead.
723
+ */
724
+ readonly [uniffiTypeNameSymbol]: "MlsError";
725
+ name: string;
726
+ message: string;
727
+ stack?: string;
728
+ cause?: unknown;
729
+ };
730
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
731
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
732
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
733
+ stackTraceLimit: number;
734
+ isError(value: unknown): value is Error;
735
+ };
736
+ SelfCommitIgnored: {
737
+ new (): {
738
+ readonly tag: MlsError_Tags.SelfCommitIgnored;
739
+ /**
740
+ * @private
741
+ * This field is private and should not be used, use `tag` instead.
742
+ */
743
+ readonly [uniffiTypeNameSymbol]: "MlsError";
744
+ name: string;
745
+ message: string;
746
+ stack?: string;
747
+ cause?: unknown;
748
+ };
749
+ "new"(): {
750
+ readonly tag: MlsError_Tags.SelfCommitIgnored;
751
+ /**
752
+ * @private
753
+ * This field is private and should not be used, use `tag` instead.
754
+ */
755
+ readonly [uniffiTypeNameSymbol]: "MlsError";
756
+ name: string;
757
+ message: string;
758
+ stack?: string;
759
+ cause?: unknown;
760
+ };
761
+ instanceOf(obj: any): obj is {
762
+ readonly tag: MlsError_Tags.SelfCommitIgnored;
763
+ /**
764
+ * @private
765
+ * This field is private and should not be used, use `tag` instead.
766
+ */
767
+ readonly [uniffiTypeNameSymbol]: "MlsError";
768
+ name: string;
769
+ message: string;
770
+ stack?: string;
771
+ cause?: unknown;
772
+ };
773
+ hasInner(obj: any): obj is {
774
+ readonly tag: MlsError_Tags.SelfCommitIgnored;
775
+ /**
776
+ * @private
777
+ * This field is private and should not be used, use `tag` instead.
778
+ */
779
+ readonly [uniffiTypeNameSymbol]: "MlsError";
780
+ name: string;
781
+ message: string;
782
+ stack?: string;
783
+ cause?: unknown;
784
+ };
785
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
786
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
787
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
788
+ stackTraceLimit: number;
789
+ isError(value: unknown): value is Error;
790
+ };
791
+ UnmergedPendingGroup: {
792
+ new (): {
793
+ readonly tag: MlsError_Tags.UnmergedPendingGroup;
794
+ /**
795
+ * @private
796
+ * This field is private and should not be used, use `tag` instead.
797
+ */
798
+ readonly [uniffiTypeNameSymbol]: "MlsError";
799
+ name: string;
800
+ message: string;
801
+ stack?: string;
802
+ cause?: unknown;
803
+ };
804
+ "new"(): {
805
+ readonly tag: MlsError_Tags.UnmergedPendingGroup;
806
+ /**
807
+ * @private
808
+ * This field is private and should not be used, use `tag` instead.
809
+ */
810
+ readonly [uniffiTypeNameSymbol]: "MlsError";
811
+ name: string;
812
+ message: string;
813
+ stack?: string;
814
+ cause?: unknown;
815
+ };
816
+ instanceOf(obj: any): obj is {
817
+ readonly tag: MlsError_Tags.UnmergedPendingGroup;
818
+ /**
819
+ * @private
820
+ * This field is private and should not be used, use `tag` instead.
821
+ */
822
+ readonly [uniffiTypeNameSymbol]: "MlsError";
823
+ name: string;
824
+ message: string;
825
+ stack?: string;
826
+ cause?: unknown;
827
+ };
828
+ hasInner(obj: any): obj is {
829
+ readonly tag: MlsError_Tags.UnmergedPendingGroup;
830
+ /**
831
+ * @private
832
+ * This field is private and should not be used, use `tag` instead.
833
+ */
834
+ readonly [uniffiTypeNameSymbol]: "MlsError";
835
+ name: string;
836
+ message: string;
837
+ stack?: string;
838
+ cause?: unknown;
839
+ };
840
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
841
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
842
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
843
+ stackTraceLimit: number;
844
+ isError(value: unknown): value is Error;
845
+ };
846
+ StaleProposal: {
847
+ new (): {
848
+ readonly tag: MlsError_Tags.StaleProposal;
849
+ /**
850
+ * @private
851
+ * This field is private and should not be used, use `tag` instead.
852
+ */
853
+ readonly [uniffiTypeNameSymbol]: "MlsError";
854
+ name: string;
855
+ message: string;
856
+ stack?: string;
857
+ cause?: unknown;
858
+ };
859
+ "new"(): {
860
+ readonly tag: MlsError_Tags.StaleProposal;
861
+ /**
862
+ * @private
863
+ * This field is private and should not be used, use `tag` instead.
864
+ */
865
+ readonly [uniffiTypeNameSymbol]: "MlsError";
866
+ name: string;
867
+ message: string;
868
+ stack?: string;
869
+ cause?: unknown;
870
+ };
871
+ instanceOf(obj: any): obj is {
872
+ readonly tag: MlsError_Tags.StaleProposal;
873
+ /**
874
+ * @private
875
+ * This field is private and should not be used, use `tag` instead.
876
+ */
877
+ readonly [uniffiTypeNameSymbol]: "MlsError";
878
+ name: string;
879
+ message: string;
880
+ stack?: string;
881
+ cause?: unknown;
882
+ };
883
+ hasInner(obj: any): obj is {
884
+ readonly tag: MlsError_Tags.StaleProposal;
885
+ /**
886
+ * @private
887
+ * This field is private and should not be used, use `tag` instead.
888
+ */
889
+ readonly [uniffiTypeNameSymbol]: "MlsError";
890
+ name: string;
891
+ message: string;
892
+ stack?: string;
893
+ cause?: unknown;
894
+ };
895
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
896
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
897
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
898
+ stackTraceLimit: number;
899
+ isError(value: unknown): value is Error;
900
+ };
901
+ StaleCommit: {
902
+ new (): {
903
+ readonly tag: MlsError_Tags.StaleCommit;
904
+ /**
905
+ * @private
906
+ * This field is private and should not be used, use `tag` instead.
907
+ */
908
+ readonly [uniffiTypeNameSymbol]: "MlsError";
909
+ name: string;
910
+ message: string;
911
+ stack?: string;
912
+ cause?: unknown;
913
+ };
914
+ "new"(): {
915
+ readonly tag: MlsError_Tags.StaleCommit;
916
+ /**
917
+ * @private
918
+ * This field is private and should not be used, use `tag` instead.
919
+ */
920
+ readonly [uniffiTypeNameSymbol]: "MlsError";
921
+ name: string;
922
+ message: string;
923
+ stack?: string;
924
+ cause?: unknown;
925
+ };
926
+ instanceOf(obj: any): obj is {
927
+ readonly tag: MlsError_Tags.StaleCommit;
928
+ /**
929
+ * @private
930
+ * This field is private and should not be used, use `tag` instead.
931
+ */
932
+ readonly [uniffiTypeNameSymbol]: "MlsError";
933
+ name: string;
934
+ message: string;
935
+ stack?: string;
936
+ cause?: unknown;
937
+ };
938
+ hasInner(obj: any): obj is {
939
+ readonly tag: MlsError_Tags.StaleCommit;
940
+ /**
941
+ * @private
942
+ * This field is private and should not be used, use `tag` instead.
943
+ */
944
+ readonly [uniffiTypeNameSymbol]: "MlsError";
945
+ name: string;
946
+ message: string;
947
+ stack?: string;
948
+ cause?: unknown;
949
+ };
950
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
951
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
952
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
953
+ stackTraceLimit: number;
954
+ isError(value: unknown): value is Error;
955
+ };
956
+ OrphanWelcome: {
957
+ new (): {
958
+ readonly tag: MlsError_Tags.OrphanWelcome;
959
+ /**
960
+ * @private
961
+ * This field is private and should not be used, use `tag` instead.
962
+ */
963
+ readonly [uniffiTypeNameSymbol]: "MlsError";
964
+ name: string;
965
+ message: string;
966
+ stack?: string;
967
+ cause?: unknown;
968
+ };
969
+ "new"(): {
970
+ readonly tag: MlsError_Tags.OrphanWelcome;
971
+ /**
972
+ * @private
973
+ * This field is private and should not be used, use `tag` instead.
974
+ */
975
+ readonly [uniffiTypeNameSymbol]: "MlsError";
976
+ name: string;
977
+ message: string;
978
+ stack?: string;
979
+ cause?: unknown;
980
+ };
981
+ instanceOf(obj: any): obj is {
982
+ readonly tag: MlsError_Tags.OrphanWelcome;
983
+ /**
984
+ * @private
985
+ * This field is private and should not be used, use `tag` instead.
986
+ */
987
+ readonly [uniffiTypeNameSymbol]: "MlsError";
988
+ name: string;
989
+ message: string;
990
+ stack?: string;
991
+ cause?: unknown;
992
+ };
993
+ hasInner(obj: any): obj is {
994
+ readonly tag: MlsError_Tags.OrphanWelcome;
995
+ /**
996
+ * @private
997
+ * This field is private and should not be used, use `tag` instead.
998
+ */
999
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1000
+ name: string;
1001
+ message: string;
1002
+ stack?: string;
1003
+ cause?: unknown;
1004
+ };
1005
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1006
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1007
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1008
+ stackTraceLimit: number;
1009
+ isError(value: unknown): value is Error;
1010
+ };
1011
+ MessageRejected: {
1012
+ new (inner: {
1013
+ reason: string;
1014
+ }): {
1015
+ readonly tag: MlsError_Tags.MessageRejected;
1016
+ readonly inner: Readonly<{
1017
+ reason: string;
1018
+ }>;
1019
+ /**
1020
+ * @private
1021
+ * This field is private and should not be used, use `tag` instead.
1022
+ */
1023
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1024
+ name: string;
1025
+ message: string;
1026
+ stack?: string;
1027
+ cause?: unknown;
1028
+ };
1029
+ "new"(inner: {
1030
+ reason: string;
1031
+ }): {
1032
+ readonly tag: MlsError_Tags.MessageRejected;
1033
+ readonly inner: Readonly<{
1034
+ reason: string;
1035
+ }>;
1036
+ /**
1037
+ * @private
1038
+ * This field is private and should not be used, use `tag` instead.
1039
+ */
1040
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1041
+ name: string;
1042
+ message: string;
1043
+ stack?: string;
1044
+ cause?: unknown;
1045
+ };
1046
+ instanceOf(obj: any): obj is {
1047
+ readonly tag: MlsError_Tags.MessageRejected;
1048
+ readonly inner: Readonly<{
1049
+ reason: string;
1050
+ }>;
1051
+ /**
1052
+ * @private
1053
+ * This field is private and should not be used, use `tag` instead.
1054
+ */
1055
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1056
+ name: string;
1057
+ message: string;
1058
+ stack?: string;
1059
+ cause?: unknown;
1060
+ };
1061
+ hasInner(obj: any): obj is {
1062
+ readonly tag: MlsError_Tags.MessageRejected;
1063
+ readonly inner: Readonly<{
1064
+ reason: string;
1065
+ }>;
1066
+ /**
1067
+ * @private
1068
+ * This field is private and should not be used, use `tag` instead.
1069
+ */
1070
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1071
+ name: string;
1072
+ message: string;
1073
+ stack?: string;
1074
+ cause?: unknown;
1075
+ };
1076
+ getInner(obj: {
1077
+ readonly tag: MlsError_Tags.MessageRejected;
1078
+ readonly inner: Readonly<{
1079
+ reason: string;
1080
+ }>;
1081
+ /**
1082
+ * @private
1083
+ * This field is private and should not be used, use `tag` instead.
1084
+ */
1085
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1086
+ name: string;
1087
+ message: string;
1088
+ stack?: string;
1089
+ cause?: unknown;
1090
+ }): Readonly<{
1091
+ reason: string;
1092
+ }>;
1093
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1094
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1095
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1096
+ stackTraceLimit: number;
1097
+ isError(value: unknown): value is Error;
1098
+ };
1099
+ Other: {
1100
+ new (inner: {
1101
+ msg: string;
1102
+ }): {
1103
+ readonly tag: MlsError_Tags.Other;
1104
+ readonly inner: Readonly<{
1105
+ msg: string;
1106
+ }>;
1107
+ /**
1108
+ * @private
1109
+ * This field is private and should not be used, use `tag` instead.
1110
+ */
1111
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1112
+ name: string;
1113
+ message: string;
1114
+ stack?: string;
1115
+ cause?: unknown;
1116
+ };
1117
+ "new"(inner: {
1118
+ msg: string;
1119
+ }): {
1120
+ readonly tag: MlsError_Tags.Other;
1121
+ readonly inner: Readonly<{
1122
+ msg: string;
1123
+ }>;
1124
+ /**
1125
+ * @private
1126
+ * This field is private and should not be used, use `tag` instead.
1127
+ */
1128
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1129
+ name: string;
1130
+ message: string;
1131
+ stack?: string;
1132
+ cause?: unknown;
1133
+ };
1134
+ instanceOf(obj: any): obj is {
1135
+ readonly tag: MlsError_Tags.Other;
1136
+ readonly inner: Readonly<{
1137
+ msg: string;
1138
+ }>;
1139
+ /**
1140
+ * @private
1141
+ * This field is private and should not be used, use `tag` instead.
1142
+ */
1143
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1144
+ name: string;
1145
+ message: string;
1146
+ stack?: string;
1147
+ cause?: unknown;
1148
+ };
1149
+ hasInner(obj: any): obj is {
1150
+ readonly tag: MlsError_Tags.Other;
1151
+ readonly inner: Readonly<{
1152
+ msg: string;
1153
+ }>;
1154
+ /**
1155
+ * @private
1156
+ * This field is private and should not be used, use `tag` instead.
1157
+ */
1158
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1159
+ name: string;
1160
+ message: string;
1161
+ stack?: string;
1162
+ cause?: unknown;
1163
+ };
1164
+ getInner(obj: {
1165
+ readonly tag: MlsError_Tags.Other;
1166
+ readonly inner: Readonly<{
1167
+ msg: string;
1168
+ }>;
1169
+ /**
1170
+ * @private
1171
+ * This field is private and should not be used, use `tag` instead.
1172
+ */
1173
+ readonly [uniffiTypeNameSymbol]: "MlsError";
1174
+ name: string;
1175
+ message: string;
1176
+ stack?: string;
1177
+ cause?: unknown;
1178
+ }): Readonly<{
1179
+ msg: string;
1180
+ }>;
1181
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1182
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1183
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1184
+ stackTraceLimit: number;
1185
+ isError(value: unknown): value is Error;
1186
+ };
1187
+ }>;
1188
+ /**
1189
+ * Errors produced by the MLS layer.
1190
+ */
1191
+ export type MlsError = InstanceType<(typeof MlsError)["ConversationAlreadyExists" | "DuplicateMessage" | "BufferedFutureMessage" | "WrongEpoch" | "BufferedCommit" | "MessageEpochTooOld" | "SelfCommitIgnored" | "UnmergedPendingGroup" | "StaleProposal" | "StaleCommit" | "OrphanWelcome" | "MessageRejected" | "Other"]>;
1192
+ export declare enum ProteusError_Tags {
1193
+ SessionNotFound = "SessionNotFound",
1194
+ DuplicateMessage = "DuplicateMessage",
1195
+ RemoteIdentityChanged = "RemoteIdentityChanged",
1196
+ Other = "Other"
1197
+ }
1198
+ /**
1199
+ * Errors produced by the Proteus layer.
1200
+ */
1201
+ export declare const ProteusError: Readonly<{
1202
+ instanceOf: (obj: any) => obj is ProteusError;
1203
+ SessionNotFound: {
1204
+ new (): {
1205
+ readonly tag: ProteusError_Tags.SessionNotFound;
1206
+ /**
1207
+ * @private
1208
+ * This field is private and should not be used, use `tag` instead.
1209
+ */
1210
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1211
+ name: string;
1212
+ message: string;
1213
+ stack?: string;
1214
+ cause?: unknown;
1215
+ };
1216
+ "new"(): {
1217
+ readonly tag: ProteusError_Tags.SessionNotFound;
1218
+ /**
1219
+ * @private
1220
+ * This field is private and should not be used, use `tag` instead.
1221
+ */
1222
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1223
+ name: string;
1224
+ message: string;
1225
+ stack?: string;
1226
+ cause?: unknown;
1227
+ };
1228
+ instanceOf(obj: any): obj is {
1229
+ readonly tag: ProteusError_Tags.SessionNotFound;
1230
+ /**
1231
+ * @private
1232
+ * This field is private and should not be used, use `tag` instead.
1233
+ */
1234
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1235
+ name: string;
1236
+ message: string;
1237
+ stack?: string;
1238
+ cause?: unknown;
1239
+ };
1240
+ hasInner(obj: any): obj is {
1241
+ readonly tag: ProteusError_Tags.SessionNotFound;
1242
+ /**
1243
+ * @private
1244
+ * This field is private and should not be used, use `tag` instead.
1245
+ */
1246
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1247
+ name: string;
1248
+ message: string;
1249
+ stack?: string;
1250
+ cause?: unknown;
1251
+ };
1252
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1253
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1254
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1255
+ stackTraceLimit: number;
1256
+ isError(value: unknown): value is Error;
1257
+ };
1258
+ DuplicateMessage: {
1259
+ new (): {
1260
+ readonly tag: ProteusError_Tags.DuplicateMessage;
1261
+ /**
1262
+ * @private
1263
+ * This field is private and should not be used, use `tag` instead.
1264
+ */
1265
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1266
+ name: string;
1267
+ message: string;
1268
+ stack?: string;
1269
+ cause?: unknown;
1270
+ };
1271
+ "new"(): {
1272
+ readonly tag: ProteusError_Tags.DuplicateMessage;
1273
+ /**
1274
+ * @private
1275
+ * This field is private and should not be used, use `tag` instead.
1276
+ */
1277
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1278
+ name: string;
1279
+ message: string;
1280
+ stack?: string;
1281
+ cause?: unknown;
1282
+ };
1283
+ instanceOf(obj: any): obj is {
1284
+ readonly tag: ProteusError_Tags.DuplicateMessage;
1285
+ /**
1286
+ * @private
1287
+ * This field is private and should not be used, use `tag` instead.
1288
+ */
1289
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1290
+ name: string;
1291
+ message: string;
1292
+ stack?: string;
1293
+ cause?: unknown;
1294
+ };
1295
+ hasInner(obj: any): obj is {
1296
+ readonly tag: ProteusError_Tags.DuplicateMessage;
1297
+ /**
1298
+ * @private
1299
+ * This field is private and should not be used, use `tag` instead.
1300
+ */
1301
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1302
+ name: string;
1303
+ message: string;
1304
+ stack?: string;
1305
+ cause?: unknown;
1306
+ };
1307
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1308
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1309
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1310
+ stackTraceLimit: number;
1311
+ isError(value: unknown): value is Error;
1312
+ };
1313
+ RemoteIdentityChanged: {
1314
+ new (): {
1315
+ readonly tag: ProteusError_Tags.RemoteIdentityChanged;
1316
+ /**
1317
+ * @private
1318
+ * This field is private and should not be used, use `tag` instead.
1319
+ */
1320
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1321
+ name: string;
1322
+ message: string;
1323
+ stack?: string;
1324
+ cause?: unknown;
1325
+ };
1326
+ "new"(): {
1327
+ readonly tag: ProteusError_Tags.RemoteIdentityChanged;
1328
+ /**
1329
+ * @private
1330
+ * This field is private and should not be used, use `tag` instead.
1331
+ */
1332
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1333
+ name: string;
1334
+ message: string;
1335
+ stack?: string;
1336
+ cause?: unknown;
1337
+ };
1338
+ instanceOf(obj: any): obj is {
1339
+ readonly tag: ProteusError_Tags.RemoteIdentityChanged;
1340
+ /**
1341
+ * @private
1342
+ * This field is private and should not be used, use `tag` instead.
1343
+ */
1344
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1345
+ name: string;
1346
+ message: string;
1347
+ stack?: string;
1348
+ cause?: unknown;
1349
+ };
1350
+ hasInner(obj: any): obj is {
1351
+ readonly tag: ProteusError_Tags.RemoteIdentityChanged;
1352
+ /**
1353
+ * @private
1354
+ * This field is private and should not be used, use `tag` instead.
1355
+ */
1356
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1357
+ name: string;
1358
+ message: string;
1359
+ stack?: string;
1360
+ cause?: unknown;
1361
+ };
1362
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1363
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1364
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1365
+ stackTraceLimit: number;
1366
+ isError(value: unknown): value is Error;
1367
+ };
1368
+ Other: {
1369
+ new (inner: {
1370
+ errorCode: number;
1371
+ }): {
1372
+ readonly tag: ProteusError_Tags.Other;
1373
+ readonly inner: Readonly<{
1374
+ errorCode: number;
1375
+ }>;
1376
+ /**
1377
+ * @private
1378
+ * This field is private and should not be used, use `tag` instead.
1379
+ */
1380
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1381
+ name: string;
1382
+ message: string;
1383
+ stack?: string;
1384
+ cause?: unknown;
1385
+ };
1386
+ "new"(inner: {
1387
+ errorCode: number;
1388
+ }): {
1389
+ readonly tag: ProteusError_Tags.Other;
1390
+ readonly inner: Readonly<{
1391
+ errorCode: number;
1392
+ }>;
1393
+ /**
1394
+ * @private
1395
+ * This field is private and should not be used, use `tag` instead.
1396
+ */
1397
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1398
+ name: string;
1399
+ message: string;
1400
+ stack?: string;
1401
+ cause?: unknown;
1402
+ };
1403
+ instanceOf(obj: any): obj is {
1404
+ readonly tag: ProteusError_Tags.Other;
1405
+ readonly inner: Readonly<{
1406
+ errorCode: number;
1407
+ }>;
1408
+ /**
1409
+ * @private
1410
+ * This field is private and should not be used, use `tag` instead.
1411
+ */
1412
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1413
+ name: string;
1414
+ message: string;
1415
+ stack?: string;
1416
+ cause?: unknown;
1417
+ };
1418
+ hasInner(obj: any): obj is {
1419
+ readonly tag: ProteusError_Tags.Other;
1420
+ readonly inner: Readonly<{
1421
+ errorCode: number;
1422
+ }>;
1423
+ /**
1424
+ * @private
1425
+ * This field is private and should not be used, use `tag` instead.
1426
+ */
1427
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1428
+ name: string;
1429
+ message: string;
1430
+ stack?: string;
1431
+ cause?: unknown;
1432
+ };
1433
+ getInner(obj: {
1434
+ readonly tag: ProteusError_Tags.Other;
1435
+ readonly inner: Readonly<{
1436
+ errorCode: number;
1437
+ }>;
1438
+ /**
1439
+ * @private
1440
+ * This field is private and should not be used, use `tag` instead.
1441
+ */
1442
+ readonly [uniffiTypeNameSymbol]: "ProteusError";
1443
+ name: string;
1444
+ message: string;
1445
+ stack?: string;
1446
+ cause?: unknown;
1447
+ }): Readonly<{
1448
+ errorCode: number;
1449
+ }>;
1450
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1451
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1452
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1453
+ stackTraceLimit: number;
1454
+ isError(value: unknown): value is Error;
1455
+ };
1456
+ }>;
1457
+ /**
1458
+ * Errors produced by the Proteus layer.
1459
+ */
1460
+ export type ProteusError = InstanceType<(typeof ProteusError)["SessionNotFound" | "DuplicateMessage" | "RemoteIdentityChanged" | "Other"]>;
1461
+ export declare enum CoreCryptoError_Tags {
1462
+ Mls = "Mls",
1463
+ Proteus = "Proteus",
1464
+ E2ei = "E2ei",
1465
+ TransactionFailed = "TransactionFailed",
1466
+ Other = "Other"
1467
+ }
1468
+ /**
1469
+ * The primary error type returned across the CoreCrypto FFI boundary.
1470
+ */
1471
+ export declare const CoreCryptoError: Readonly<{
1472
+ instanceOf: (obj: any) => obj is CoreCryptoError;
1473
+ Mls: {
1474
+ new (inner: {
1475
+ mlsError: MlsError;
1476
+ }): {
1477
+ readonly tag: CoreCryptoError_Tags.Mls;
1478
+ readonly inner: Readonly<{
1479
+ mlsError: MlsError;
1480
+ }>;
1481
+ /**
1482
+ * @private
1483
+ * This field is private and should not be used, use `tag` instead.
1484
+ */
1485
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1486
+ name: string;
1487
+ message: string;
1488
+ stack?: string;
1489
+ cause?: unknown;
1490
+ };
1491
+ "new"(inner: {
1492
+ mlsError: MlsError;
1493
+ }): {
1494
+ readonly tag: CoreCryptoError_Tags.Mls;
1495
+ readonly inner: Readonly<{
1496
+ mlsError: MlsError;
1497
+ }>;
1498
+ /**
1499
+ * @private
1500
+ * This field is private and should not be used, use `tag` instead.
1501
+ */
1502
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1503
+ name: string;
1504
+ message: string;
1505
+ stack?: string;
1506
+ cause?: unknown;
1507
+ };
1508
+ instanceOf(obj: any): obj is {
1509
+ readonly tag: CoreCryptoError_Tags.Mls;
1510
+ readonly inner: Readonly<{
1511
+ mlsError: MlsError;
1512
+ }>;
1513
+ /**
1514
+ * @private
1515
+ * This field is private and should not be used, use `tag` instead.
1516
+ */
1517
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1518
+ name: string;
1519
+ message: string;
1520
+ stack?: string;
1521
+ cause?: unknown;
1522
+ };
1523
+ hasInner(obj: any): obj is {
1524
+ readonly tag: CoreCryptoError_Tags.Mls;
1525
+ readonly inner: Readonly<{
1526
+ mlsError: MlsError;
1527
+ }>;
1528
+ /**
1529
+ * @private
1530
+ * This field is private and should not be used, use `tag` instead.
1531
+ */
1532
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1533
+ name: string;
1534
+ message: string;
1535
+ stack?: string;
1536
+ cause?: unknown;
1537
+ };
1538
+ getInner(obj: {
1539
+ readonly tag: CoreCryptoError_Tags.Mls;
1540
+ readonly inner: Readonly<{
1541
+ mlsError: MlsError;
1542
+ }>;
1543
+ /**
1544
+ * @private
1545
+ * This field is private and should not be used, use `tag` instead.
1546
+ */
1547
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1548
+ name: string;
1549
+ message: string;
1550
+ stack?: string;
1551
+ cause?: unknown;
1552
+ }): Readonly<{
1553
+ mlsError: MlsError;
1554
+ }>;
1555
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1556
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1557
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1558
+ stackTraceLimit: number;
1559
+ isError(value: unknown): value is Error;
1560
+ };
1561
+ Proteus: {
1562
+ new (inner: {
1563
+ exception: ProteusError;
1564
+ }): {
1565
+ readonly tag: CoreCryptoError_Tags.Proteus;
1566
+ readonly inner: Readonly<{
1567
+ exception: ProteusError;
1568
+ }>;
1569
+ /**
1570
+ * @private
1571
+ * This field is private and should not be used, use `tag` instead.
1572
+ */
1573
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1574
+ name: string;
1575
+ message: string;
1576
+ stack?: string;
1577
+ cause?: unknown;
1578
+ };
1579
+ "new"(inner: {
1580
+ exception: ProteusError;
1581
+ }): {
1582
+ readonly tag: CoreCryptoError_Tags.Proteus;
1583
+ readonly inner: Readonly<{
1584
+ exception: ProteusError;
1585
+ }>;
1586
+ /**
1587
+ * @private
1588
+ * This field is private and should not be used, use `tag` instead.
1589
+ */
1590
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1591
+ name: string;
1592
+ message: string;
1593
+ stack?: string;
1594
+ cause?: unknown;
1595
+ };
1596
+ instanceOf(obj: any): obj is {
1597
+ readonly tag: CoreCryptoError_Tags.Proteus;
1598
+ readonly inner: Readonly<{
1599
+ exception: ProteusError;
1600
+ }>;
1601
+ /**
1602
+ * @private
1603
+ * This field is private and should not be used, use `tag` instead.
1604
+ */
1605
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1606
+ name: string;
1607
+ message: string;
1608
+ stack?: string;
1609
+ cause?: unknown;
1610
+ };
1611
+ hasInner(obj: any): obj is {
1612
+ readonly tag: CoreCryptoError_Tags.Proteus;
1613
+ readonly inner: Readonly<{
1614
+ exception: ProteusError;
1615
+ }>;
1616
+ /**
1617
+ * @private
1618
+ * This field is private and should not be used, use `tag` instead.
1619
+ */
1620
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1621
+ name: string;
1622
+ message: string;
1623
+ stack?: string;
1624
+ cause?: unknown;
1625
+ };
1626
+ getInner(obj: {
1627
+ readonly tag: CoreCryptoError_Tags.Proteus;
1628
+ readonly inner: Readonly<{
1629
+ exception: ProteusError;
1630
+ }>;
1631
+ /**
1632
+ * @private
1633
+ * This field is private and should not be used, use `tag` instead.
1634
+ */
1635
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1636
+ name: string;
1637
+ message: string;
1638
+ stack?: string;
1639
+ cause?: unknown;
1640
+ }): Readonly<{
1641
+ exception: ProteusError;
1642
+ }>;
1643
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1644
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1645
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1646
+ stackTraceLimit: number;
1647
+ isError(value: unknown): value is Error;
1648
+ };
1649
+ E2ei: {
1650
+ new (inner: {
1651
+ e2eiError: string;
1652
+ }): {
1653
+ readonly tag: CoreCryptoError_Tags.E2ei;
1654
+ readonly inner: Readonly<{
1655
+ e2eiError: string;
1656
+ }>;
1657
+ /**
1658
+ * @private
1659
+ * This field is private and should not be used, use `tag` instead.
1660
+ */
1661
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1662
+ name: string;
1663
+ message: string;
1664
+ stack?: string;
1665
+ cause?: unknown;
1666
+ };
1667
+ "new"(inner: {
1668
+ e2eiError: string;
1669
+ }): {
1670
+ readonly tag: CoreCryptoError_Tags.E2ei;
1671
+ readonly inner: Readonly<{
1672
+ e2eiError: string;
1673
+ }>;
1674
+ /**
1675
+ * @private
1676
+ * This field is private and should not be used, use `tag` instead.
1677
+ */
1678
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1679
+ name: string;
1680
+ message: string;
1681
+ stack?: string;
1682
+ cause?: unknown;
1683
+ };
1684
+ instanceOf(obj: any): obj is {
1685
+ readonly tag: CoreCryptoError_Tags.E2ei;
1686
+ readonly inner: Readonly<{
1687
+ e2eiError: string;
1688
+ }>;
1689
+ /**
1690
+ * @private
1691
+ * This field is private and should not be used, use `tag` instead.
1692
+ */
1693
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1694
+ name: string;
1695
+ message: string;
1696
+ stack?: string;
1697
+ cause?: unknown;
1698
+ };
1699
+ hasInner(obj: any): obj is {
1700
+ readonly tag: CoreCryptoError_Tags.E2ei;
1701
+ readonly inner: Readonly<{
1702
+ e2eiError: string;
1703
+ }>;
1704
+ /**
1705
+ * @private
1706
+ * This field is private and should not be used, use `tag` instead.
1707
+ */
1708
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1709
+ name: string;
1710
+ message: string;
1711
+ stack?: string;
1712
+ cause?: unknown;
1713
+ };
1714
+ getInner(obj: {
1715
+ readonly tag: CoreCryptoError_Tags.E2ei;
1716
+ readonly inner: Readonly<{
1717
+ e2eiError: string;
1718
+ }>;
1719
+ /**
1720
+ * @private
1721
+ * This field is private and should not be used, use `tag` instead.
1722
+ */
1723
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1724
+ name: string;
1725
+ message: string;
1726
+ stack?: string;
1727
+ cause?: unknown;
1728
+ }): Readonly<{
1729
+ e2eiError: string;
1730
+ }>;
1731
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1732
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1733
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1734
+ stackTraceLimit: number;
1735
+ isError(value: unknown): value is Error;
1736
+ };
1737
+ TransactionFailed: {
1738
+ new (inner: {
1739
+ error: string;
1740
+ }): {
1741
+ readonly tag: CoreCryptoError_Tags.TransactionFailed;
1742
+ readonly inner: Readonly<{
1743
+ error: string;
1744
+ }>;
1745
+ /**
1746
+ * @private
1747
+ * This field is private and should not be used, use `tag` instead.
1748
+ */
1749
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1750
+ name: string;
1751
+ message: string;
1752
+ stack?: string;
1753
+ cause?: unknown;
1754
+ };
1755
+ "new"(inner: {
1756
+ error: string;
1757
+ }): {
1758
+ readonly tag: CoreCryptoError_Tags.TransactionFailed;
1759
+ readonly inner: Readonly<{
1760
+ error: string;
1761
+ }>;
1762
+ /**
1763
+ * @private
1764
+ * This field is private and should not be used, use `tag` instead.
1765
+ */
1766
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1767
+ name: string;
1768
+ message: string;
1769
+ stack?: string;
1770
+ cause?: unknown;
1771
+ };
1772
+ instanceOf(obj: any): obj is {
1773
+ readonly tag: CoreCryptoError_Tags.TransactionFailed;
1774
+ readonly inner: Readonly<{
1775
+ error: string;
1776
+ }>;
1777
+ /**
1778
+ * @private
1779
+ * This field is private and should not be used, use `tag` instead.
1780
+ */
1781
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1782
+ name: string;
1783
+ message: string;
1784
+ stack?: string;
1785
+ cause?: unknown;
1786
+ };
1787
+ hasInner(obj: any): obj is {
1788
+ readonly tag: CoreCryptoError_Tags.TransactionFailed;
1789
+ readonly inner: Readonly<{
1790
+ error: string;
1791
+ }>;
1792
+ /**
1793
+ * @private
1794
+ * This field is private and should not be used, use `tag` instead.
1795
+ */
1796
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1797
+ name: string;
1798
+ message: string;
1799
+ stack?: string;
1800
+ cause?: unknown;
1801
+ };
1802
+ getInner(obj: {
1803
+ readonly tag: CoreCryptoError_Tags.TransactionFailed;
1804
+ readonly inner: Readonly<{
1805
+ error: string;
1806
+ }>;
1807
+ /**
1808
+ * @private
1809
+ * This field is private and should not be used, use `tag` instead.
1810
+ */
1811
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1812
+ name: string;
1813
+ message: string;
1814
+ stack?: string;
1815
+ cause?: unknown;
1816
+ }): Readonly<{
1817
+ error: string;
1818
+ }>;
1819
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1820
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1821
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1822
+ stackTraceLimit: number;
1823
+ isError(value: unknown): value is Error;
1824
+ };
1825
+ Other: {
1826
+ new (inner: {
1827
+ msg: string;
1828
+ }): {
1829
+ readonly tag: CoreCryptoError_Tags.Other;
1830
+ readonly inner: Readonly<{
1831
+ msg: string;
1832
+ }>;
1833
+ /**
1834
+ * @private
1835
+ * This field is private and should not be used, use `tag` instead.
1836
+ */
1837
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1838
+ name: string;
1839
+ message: string;
1840
+ stack?: string;
1841
+ cause?: unknown;
1842
+ };
1843
+ "new"(inner: {
1844
+ msg: string;
1845
+ }): {
1846
+ readonly tag: CoreCryptoError_Tags.Other;
1847
+ readonly inner: Readonly<{
1848
+ msg: string;
1849
+ }>;
1850
+ /**
1851
+ * @private
1852
+ * This field is private and should not be used, use `tag` instead.
1853
+ */
1854
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1855
+ name: string;
1856
+ message: string;
1857
+ stack?: string;
1858
+ cause?: unknown;
1859
+ };
1860
+ instanceOf(obj: any): obj is {
1861
+ readonly tag: CoreCryptoError_Tags.Other;
1862
+ readonly inner: Readonly<{
1863
+ msg: string;
1864
+ }>;
1865
+ /**
1866
+ * @private
1867
+ * This field is private and should not be used, use `tag` instead.
1868
+ */
1869
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1870
+ name: string;
1871
+ message: string;
1872
+ stack?: string;
1873
+ cause?: unknown;
1874
+ };
1875
+ hasInner(obj: any): obj is {
1876
+ readonly tag: CoreCryptoError_Tags.Other;
1877
+ readonly inner: Readonly<{
1878
+ msg: string;
1879
+ }>;
1880
+ /**
1881
+ * @private
1882
+ * This field is private and should not be used, use `tag` instead.
1883
+ */
1884
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1885
+ name: string;
1886
+ message: string;
1887
+ stack?: string;
1888
+ cause?: unknown;
1889
+ };
1890
+ getInner(obj: {
1891
+ readonly tag: CoreCryptoError_Tags.Other;
1892
+ readonly inner: Readonly<{
1893
+ msg: string;
1894
+ }>;
1895
+ /**
1896
+ * @private
1897
+ * This field is private and should not be used, use `tag` instead.
1898
+ */
1899
+ readonly [uniffiTypeNameSymbol]: "CoreCryptoError";
1900
+ name: string;
1901
+ message: string;
1902
+ stack?: string;
1903
+ cause?: unknown;
1904
+ }): Readonly<{
1905
+ msg: string;
1906
+ }>;
1907
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1908
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1909
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1910
+ stackTraceLimit: number;
1911
+ isError(value: unknown): value is Error;
1912
+ };
1913
+ }>;
1914
+ /**
1915
+ * The primary error type returned across the CoreCrypto FFI boundary.
1916
+ */
1917
+ export type CoreCryptoError = InstanceType<(typeof CoreCryptoError)["Mls" | "Proteus" | "E2ei" | "TransactionFailed" | "Other"]>;
1918
+ type WelcomeLike = Welcome;
1919
+ /**
1920
+ * A TLS-serialized Welcome message.
1921
+ *
1922
+ * This structure is defined in RFC 9420:
1923
+ * <https://www.rfc-editor.org/rfc/rfc9420.html#joining-via-welcome-message>.
1924
+ */
1925
+ export declare class Welcome extends UniffiAbstractObject {
1926
+ readonly [uniffiTypeNameSymbol] = "Welcome";
1927
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1928
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1929
+ /**
1930
+ * Fallibly instantiate an instance from a byte array.
1931
+ */
1932
+ constructor(bytes: Uint8Array);
1933
+ /**
1934
+ * TLS-serialize this message
1935
+ */
1936
+ serialize(): Uint8Array;
1937
+ uniffiDestroy(): void;
1938
+ static instanceOf(obj_: any): obj_ is Welcome;
1939
+ }
1940
+ /**
1941
+ * How a `GroupInfo` is encrypted in a commit bundle.
1942
+ */
1943
+ declare enum MlsGroupInfoEncryptionType {
1944
+ /**
1945
+ * Unencrypted `GroupInfo`
1946
+ */
1947
+ Plaintext = 1,
1948
+ /**
1949
+ * `GroupInfo` encrypted in a JWE
1950
+ */
1951
+ JweEncrypted = 2
1952
+ }
1953
+ /**
1954
+ * How the ratchet tree is represented in a `GroupInfo`.
1955
+ */
1956
+ declare enum MlsRatchetTreeType {
1957
+ /**
1958
+ * The full ratchet tree is included.
1959
+ */
1960
+ Full = 1,
1961
+ /**
1962
+ * Only changes since the previous epoch are included.
1963
+ *
1964
+ * Not yet implemented. See the draft proposal:
1965
+ * <https://github.com/rohan-wire/ietf-drafts/blob/main/mahy-mls-ratchet-tree-delta/draft-mahy-mls-ratchet-tree-delta.md>
1966
+ */
1967
+ Delta = 2,
1968
+ /**
1969
+ * The ratchet tree is identified by an external reference rather than included inline.
1970
+ */
1971
+ ByRef = 3
1972
+ }
1973
+ /**
1974
+ * A `GroupInfo` with associated metadata.
1975
+ */
1976
+ export type GroupInfoBundle = {
1977
+ /**
1978
+ * How the group info is encrypted.
1979
+ */
1980
+ encryptionType: MlsGroupInfoEncryptionType;
1981
+ /**
1982
+ * What kind of ratchet tree is used.
1983
+ */
1984
+ ratchetTreeType: MlsRatchetTreeType;
1985
+ /**
1986
+ * The group info payload.
1987
+ */
1988
+ payload: Uint8Array;
1989
+ };
1990
+ /**
1991
+ * Generated factory for {@link GroupInfoBundle} record objects.
1992
+ */
1993
+ export declare const GroupInfoBundle: Readonly<{
1994
+ create: (partial: Partial<GroupInfoBundle> & Required<Omit<GroupInfoBundle, never>>) => GroupInfoBundle;
1995
+ new: (partial: Partial<GroupInfoBundle> & Required<Omit<GroupInfoBundle, never>>) => GroupInfoBundle;
1996
+ defaults: () => Partial<GroupInfoBundle>;
1997
+ }>;
1998
+ /**
1999
+ * Information returned when a commit is created.
2000
+ */
2001
+ export type CommitBundle = {
2002
+ /**
2003
+ * A welcome message, present when there are pending Add proposals.
2004
+ */
2005
+ welcome?: WelcomeLike;
2006
+ /**
2007
+ * The MLS commit message.
2008
+ */
2009
+ commit: Uint8Array;
2010
+ /**
2011
+ * The `GroupInfo` associated with this commit.
2012
+ */
2013
+ groupInfo: GroupInfoBundle;
2014
+ /**
2015
+ * An encrypted message to fan out to all other conversation members in the new epoch.
2016
+ */
2017
+ encryptedMessage?: Uint8Array;
2018
+ };
2019
+ /**
2020
+ * Generated factory for {@link CommitBundle} record objects.
2021
+ */
2022
+ export declare const CommitBundle: Readonly<{
2023
+ create: (partial: Partial<CommitBundle> & Required<Omit<CommitBundle, "welcome" | "encryptedMessage">>) => CommitBundle;
2024
+ new: (partial: Partial<CommitBundle> & Required<Omit<CommitBundle, "welcome" | "encryptedMessage">>) => CommitBundle;
2025
+ defaults: () => Partial<CommitBundle>;
2026
+ }>;
2027
+ /**
2028
+ * A decrypted message and various associated metadata.
2029
+ */
2030
+ export type DecryptedMessage = {
2031
+ /**
2032
+ * Decrypted plaintext
2033
+ */
2034
+ message?: Uint8Array;
2035
+ /**
2036
+ * False if processing this message caused the client to be removed from the group, i.e. due to a Remove commit.
2037
+ */
2038
+ isActive: boolean;
2039
+ /**
2040
+ * Commit delay in seconds.
2041
+ *
2042
+ * When set, clients must delay this long before processing a commit.
2043
+ * This reduces load on the backend, which otherwise would receive epoch change notifications from all clients
2044
+ * simultaneously.
2045
+ */
2046
+ commitDelay?: bigint;
2047
+ /**
2048
+ * `ClientId` of the sender of the message being decrypted. Only present for application messages.
2049
+ */
2050
+ senderClientId?: ClientIdLike;
2051
+ /**
2052
+ * Identity claims present in the sender credential.
2053
+ */
2054
+ identity: WireIdentity;
2055
+ /**
2056
+ * Only set when the decrypted message is a commit.
2057
+ *
2058
+ * Contains buffered messages for next epoch which were received before the commit creating the epoch
2059
+ * because the DS did not fan them out in order.
2060
+ */
2061
+ bufferedMessages?: Array<BufferedDecryptedMessage>;
2062
+ };
2063
+ /**
2064
+ * Generated factory for {@link DecryptedMessage} record objects.
2065
+ */
2066
+ export declare const DecryptedMessage: Readonly<{
2067
+ create: (partial: Partial<DecryptedMessage> & Required<Omit<DecryptedMessage, "message" | "commitDelay" | "senderClientId" | "bufferedMessages">>) => DecryptedMessage;
2068
+ new: (partial: Partial<DecryptedMessage> & Required<Omit<DecryptedMessage, "message" | "commitDelay" | "senderClientId" | "bufferedMessages">>) => DecryptedMessage;
2069
+ defaults: () => Partial<DecryptedMessage>;
2070
+ }>;
2071
+ /**
2072
+ * A `HistorySecret` encodes sufficient client state that it can be used to instantiate an
2073
+ * ephemeral client.
2074
+ */
2075
+ export type HistorySecret = {
2076
+ /**
2077
+ * Client id of the associated history client.
2078
+ */
2079
+ clientId: ClientIdLike;
2080
+ /**
2081
+ * Opaque secret data sufficient to reconstruct a history client.
2082
+ */
2083
+ data: Uint8Array;
2084
+ };
2085
+ /**
2086
+ * Generated factory for {@link HistorySecret} record objects.
2087
+ */
2088
+ export declare const HistorySecret: Readonly<{
2089
+ create: (partial: Partial<HistorySecret> & Required<Omit<HistorySecret, never>>) => HistorySecret;
2090
+ new: (partial: Partial<HistorySecret> & Required<Omit<HistorySecret, never>>) => HistorySecret;
2091
+ defaults: () => Partial<HistorySecret>;
2092
+ }>;
2093
+ /**
2094
+ * An HttpHeader used for PKI hooks.
2095
+ */
2096
+ export type HttpHeader = {
2097
+ /**
2098
+ * Header name
2099
+ */
2100
+ name: string;
2101
+ /**
2102
+ * Header value
2103
+ */
2104
+ value: string;
2105
+ };
2106
+ /**
2107
+ * Generated factory for {@link HttpHeader} record objects.
2108
+ */
2109
+ export declare const HttpHeader: Readonly<{
2110
+ create: (partial: Partial<HttpHeader> & Required<Omit<HttpHeader, never>>) => HttpHeader;
2111
+ new: (partial: Partial<HttpHeader> & Required<Omit<HttpHeader, never>>) => HttpHeader;
2112
+ defaults: () => Partial<HttpHeader>;
2113
+ }>;
2114
+ /**
2115
+ * An HttpResponse used for PKI hooks.
2116
+ */
2117
+ export type HttpResponse = {
2118
+ /**
2119
+ * HTTP status code
2120
+ */
2121
+ status: number;
2122
+ /**
2123
+ * List of header fields
2124
+ */
2125
+ headers: Array<HttpHeader>;
2126
+ /**
2127
+ * HTTP body
2128
+ */
2129
+ body: Uint8Array;
2130
+ };
2131
+ /**
2132
+ * Generated factory for {@link HttpResponse} record objects.
2133
+ */
2134
+ export declare const HttpResponse: Readonly<{
2135
+ create: (partial: Partial<HttpResponse> & Required<Omit<HttpResponse, never>>) => HttpResponse;
2136
+ new: (partial: Partial<HttpResponse> & Required<Omit<HttpResponse, never>>) => HttpResponse;
2137
+ defaults: () => Partial<HttpResponse>;
2138
+ }>;
2139
+ /**
2140
+ * Encapsulates a prekey id and a CBOR-serialized prekey.
2141
+ */
2142
+ export type ProteusAutoPrekeyBundle = {
2143
+ /**
2144
+ * Prekey id (automatically incremented)
2145
+ */
2146
+ id: number;
2147
+ /**
2148
+ * CBOR serialization of prekey
2149
+ */
2150
+ pkb: Uint8Array;
2151
+ };
2152
+ /**
2153
+ * Generated factory for {@link ProteusAutoPrekeyBundle} record objects.
2154
+ */
2155
+ export declare const ProteusAutoPrekeyBundle: Readonly<{
2156
+ create: (partial: Partial<ProteusAutoPrekeyBundle> & Required<Omit<ProteusAutoPrekeyBundle, never>>) => ProteusAutoPrekeyBundle;
2157
+ new: (partial: Partial<ProteusAutoPrekeyBundle> & Required<Omit<ProteusAutoPrekeyBundle, never>>) => ProteusAutoPrekeyBundle;
2158
+ defaults: () => Partial<ProteusAutoPrekeyBundle>;
2159
+ }>;
2160
+ /**
2161
+ * MLS cipher suites
2162
+ */
2163
+ export declare enum CipherSuite {
2164
+ /**
2165
+ * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
2166
+ */
2167
+ Mls128Dhkemx25519Aes128gcmSha256Ed25519 = 1,
2168
+ /**
2169
+ * DH KEM P256 | AES-GCM 128 | SHA2-256 | EcDSA P256
2170
+ */
2171
+ Mls128Dhkemp256Aes128gcmSha256P256 = 2,
2172
+ /**
2173
+ * DH KEM x25519 | Chacha20Poly1305 | SHA2-256 | Ed25519
2174
+ */
2175
+ Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519 = 3,
2176
+ /**
2177
+ * DH KEM x448 | AES-GCM 256 | SHA2-512 | Ed448
2178
+ */
2179
+ Mls256Dhkemx448Aes256gcmSha512Ed448 = 4,
2180
+ /**
2181
+ * DH KEM P521 | AES-GCM 256 | SHA2-512 | EcDSA P521
2182
+ */
2183
+ Mls256Dhkemp521Aes256gcmSha512P521 = 5,
2184
+ /**
2185
+ * DH KEM x448 | Chacha20Poly1305 | SHA2-512 | Ed448
2186
+ */
2187
+ Mls256Dhkemx448Chacha20poly1305Sha512Ed448 = 6,
2188
+ /**
2189
+ * DH KEM P384 | AES-GCM 256 | SHA2-384 | EcDSA P384
2190
+ */
2191
+ Mls256Dhkemp384Aes256gcmSha384P384 = 7
2192
+ }
2193
+ /**
2194
+ * Configuration for an X509 credential acquisition flow.
2195
+ */
2196
+ export type X509CredentialAcquisitionConfiguration = {
2197
+ /**
2198
+ * ACME directory URL.
2199
+ */
2200
+ acmeDirectoryUrl: string;
2201
+ /**
2202
+ * Ciphersuite of the acquired credential.
2203
+ */
2204
+ cipherSuite: CipherSuite;
2205
+ /**
2206
+ * User-visible display name.
2207
+ */
2208
+ displayName: string;
2209
+ /**
2210
+ * Wire client id for the device acquiring the credential.
2211
+ */
2212
+ clientId: ClientIdLike;
2213
+ /**
2214
+ * Wire handle without the domain suffix.
2215
+ */
2216
+ handle: string;
2217
+ /**
2218
+ * Wire domain.
2219
+ */
2220
+ domain: string;
2221
+ /**
2222
+ * Optional Wire team id.
2223
+ */
2224
+ team?: string;
2225
+ /**
2226
+ * Certificate validity period in seconds.
2227
+ */
2228
+ validityPeriodSecs: bigint;
2229
+ };
2230
+ /**
2231
+ * Generated factory for {@link X509CredentialAcquisitionConfiguration} record objects.
2232
+ */
2233
+ export declare const X509CredentialAcquisitionConfiguration: Readonly<{
2234
+ create: (partial: Partial<X509CredentialAcquisitionConfiguration> & Required<Omit<X509CredentialAcquisitionConfiguration, "team">>) => X509CredentialAcquisitionConfiguration;
2235
+ new: (partial: Partial<X509CredentialAcquisitionConfiguration> & Required<Omit<X509CredentialAcquisitionConfiguration, "team">>) => X509CredentialAcquisitionConfiguration;
2236
+ defaults: () => Partial<X509CredentialAcquisitionConfiguration>;
2237
+ }>;
2238
+ /**
2239
+ * Defines the log level for CoreCrypto.
2240
+ */
2241
+ export declare enum CoreCryptoLogLevel {
2242
+ Off = 1,
2243
+ Trace = 2,
2244
+ Debug = 3,
2245
+ Info = 4,
2246
+ Warn = 5,
2247
+ Error = 6
2248
+ }
2249
+ /**
2250
+ * The end-to-end identity verification state of a conversation.
2251
+ *
2252
+ * Note: this does not check pending state (pending commit, pending proposals), so it does not
2253
+ * consider members about to be added or removed.
2254
+ */
2255
+ export declare enum E2eiConversationState {
2256
+ /**
2257
+ * All clients have a valid E2EI certificate.
2258
+ */
2259
+ Verified = 1,
2260
+ /**
2261
+ * Some clients are either still using Basic credentials or their certificate has expired.
2262
+ */
2263
+ NotVerified = 2,
2264
+ /**
2265
+ * All clients are still using Basic credentials.
2266
+ *
2267
+ * Note: if all clients have expired certificates, `NotVerified` is returned instead.
2268
+ */
2269
+ NotEnabled = 3
2270
+ }
2271
+ export declare enum EpochChangedReportingError_Tags {
2272
+ Ffi = "Ffi"
2273
+ }
2274
+ /**
2275
+ * An error returned by an `EpochObserver` callback implementation.
2276
+ */
2277
+ export declare const EpochChangedReportingError: {
2278
+ Ffi: {
2279
+ new (message: string): {
2280
+ readonly tag: EpochChangedReportingError_Tags.Ffi;
2281
+ /**
2282
+ * @private
2283
+ * This field is private and should not be used.
2284
+ */
2285
+ readonly [uniffiTypeNameSymbol]: string;
2286
+ /**
2287
+ * @private
2288
+ * This field is private and should not be used.
2289
+ */
2290
+ readonly [variantOrdinalSymbol]: 1;
2291
+ name: string;
2292
+ message: string;
2293
+ stack?: string;
2294
+ cause?: unknown;
2295
+ };
2296
+ instanceOf(e: any): e is {
2297
+ readonly tag: EpochChangedReportingError_Tags.Ffi;
2298
+ /**
2299
+ * @private
2300
+ * This field is private and should not be used.
2301
+ */
2302
+ readonly [uniffiTypeNameSymbol]: string;
2303
+ /**
2304
+ * @private
2305
+ * This field is private and should not be used.
2306
+ */
2307
+ readonly [variantOrdinalSymbol]: 1;
2308
+ name: string;
2309
+ message: string;
2310
+ stack?: string;
2311
+ cause?: unknown;
2312
+ };
2313
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2314
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2315
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
2316
+ stackTraceLimit: number;
2317
+ isError(value: unknown): value is Error;
2318
+ };
2319
+ instanceOf: (e: any) => e is EpochChangedReportingError;
2320
+ };
2321
+ /**
2322
+ * An error returned by an `EpochObserver` callback implementation.
2323
+ */
2324
+ export type EpochChangedReportingError = InstanceType<(typeof EpochChangedReportingError)["Ffi"]>;
2325
+ /**
2326
+ * HttpMethod used for PKI hooks.
2327
+ */
2328
+ export declare enum HttpMethod {
2329
+ /**
2330
+ * GET
2331
+ */
2332
+ Get = 0,
2333
+ /**
2334
+ * POST
2335
+ */
2336
+ Post = 1,
2337
+ /**
2338
+ * PUT
2339
+ */
2340
+ Put = 2,
2341
+ /**
2342
+ * DELETE
2343
+ */
2344
+ Delete = 3,
2345
+ /**
2346
+ * PATCH
2347
+ */
2348
+ Patch = 4,
2349
+ /**
2350
+ * HEAD
2351
+ */
2352
+ Head = 5
2353
+ }
2354
+ export declare enum LoggingError_Tags {
2355
+ Ffi = "Ffi"
2356
+ }
2357
+ /**
2358
+ * An error returned by a `CoreCryptoLogger` callback implementation.
2359
+ */
2360
+ export declare const LoggingError: {
2361
+ Ffi: {
2362
+ new (message: string): {
2363
+ readonly tag: LoggingError_Tags.Ffi;
2364
+ /**
2365
+ * @private
2366
+ * This field is private and should not be used.
2367
+ */
2368
+ readonly [uniffiTypeNameSymbol]: string;
2369
+ /**
2370
+ * @private
2371
+ * This field is private and should not be used.
2372
+ */
2373
+ readonly [variantOrdinalSymbol]: 1;
2374
+ name: string;
2375
+ message: string;
2376
+ stack?: string;
2377
+ cause?: unknown;
2378
+ };
2379
+ instanceOf(e: any): e is {
2380
+ readonly tag: LoggingError_Tags.Ffi;
2381
+ /**
2382
+ * @private
2383
+ * This field is private and should not be used.
2384
+ */
2385
+ readonly [uniffiTypeNameSymbol]: string;
2386
+ /**
2387
+ * @private
2388
+ * This field is private and should not be used.
2389
+ */
2390
+ readonly [variantOrdinalSymbol]: 1;
2391
+ name: string;
2392
+ message: string;
2393
+ stack?: string;
2394
+ cause?: unknown;
2395
+ };
2396
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2397
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2398
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
2399
+ stackTraceLimit: number;
2400
+ isError(value: unknown): value is Error;
2401
+ };
2402
+ instanceOf: (e: any) => e is LoggingError;
2403
+ };
2404
+ /**
2405
+ * An error returned by a `CoreCryptoLogger` callback implementation.
2406
+ */
2407
+ export type LoggingError = InstanceType<(typeof LoggingError)["Ffi"]>;
2408
+ declare enum MlsTransportError_Tags {
2409
+ MessageRejected = "MessageRejected"
2410
+ }
2411
+ /**
2412
+ * Errors returned by MLS transport callbacks exposed through FFI.
2413
+ */
2414
+ export declare const MlsTransportError: Readonly<{
2415
+ instanceOf: (obj: any) => obj is MlsTransportError;
2416
+ MessageRejected: {
2417
+ new (inner: {
2418
+ reason: string;
2419
+ }): {
2420
+ readonly tag: MlsTransportError_Tags.MessageRejected;
2421
+ readonly inner: Readonly<{
2422
+ reason: string;
2423
+ }>;
2424
+ /**
2425
+ * @private
2426
+ * This field is private and should not be used, use `tag` instead.
2427
+ */
2428
+ readonly [uniffiTypeNameSymbol]: "MlsTransportError";
2429
+ name: string;
2430
+ message: string;
2431
+ stack?: string;
2432
+ cause?: unknown;
2433
+ };
2434
+ "new"(inner: {
2435
+ reason: string;
2436
+ }): {
2437
+ readonly tag: MlsTransportError_Tags.MessageRejected;
2438
+ readonly inner: Readonly<{
2439
+ reason: string;
2440
+ }>;
2441
+ /**
2442
+ * @private
2443
+ * This field is private and should not be used, use `tag` instead.
2444
+ */
2445
+ readonly [uniffiTypeNameSymbol]: "MlsTransportError";
2446
+ name: string;
2447
+ message: string;
2448
+ stack?: string;
2449
+ cause?: unknown;
2450
+ };
2451
+ instanceOf(obj: any): obj is {
2452
+ readonly tag: MlsTransportError_Tags.MessageRejected;
2453
+ readonly inner: Readonly<{
2454
+ reason: string;
2455
+ }>;
2456
+ /**
2457
+ * @private
2458
+ * This field is private and should not be used, use `tag` instead.
2459
+ */
2460
+ readonly [uniffiTypeNameSymbol]: "MlsTransportError";
2461
+ name: string;
2462
+ message: string;
2463
+ stack?: string;
2464
+ cause?: unknown;
2465
+ };
2466
+ hasInner(obj: any): obj is {
2467
+ readonly tag: MlsTransportError_Tags.MessageRejected;
2468
+ readonly inner: Readonly<{
2469
+ reason: string;
2470
+ }>;
2471
+ /**
2472
+ * @private
2473
+ * This field is private and should not be used, use `tag` instead.
2474
+ */
2475
+ readonly [uniffiTypeNameSymbol]: "MlsTransportError";
2476
+ name: string;
2477
+ message: string;
2478
+ stack?: string;
2479
+ cause?: unknown;
2480
+ };
2481
+ getInner(obj: {
2482
+ readonly tag: MlsTransportError_Tags.MessageRejected;
2483
+ readonly inner: Readonly<{
2484
+ reason: string;
2485
+ }>;
2486
+ /**
2487
+ * @private
2488
+ * This field is private and should not be used, use `tag` instead.
2489
+ */
2490
+ readonly [uniffiTypeNameSymbol]: "MlsTransportError";
2491
+ name: string;
2492
+ message: string;
2493
+ stack?: string;
2494
+ cause?: unknown;
2495
+ }): Readonly<{
2496
+ reason: string;
2497
+ }>;
2498
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2499
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2500
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
2501
+ stackTraceLimit: number;
2502
+ isError(value: unknown): value is Error;
2503
+ };
2504
+ }>;
2505
+ /**
2506
+ * Errors returned by MLS transport callbacks exposed through FFI.
2507
+ */
2508
+ export type MlsTransportError = InstanceType<(typeof MlsTransportError)["MessageRejected"]>;
2509
+ declare enum NewHistoryClientReportingError_Tags {
2510
+ Ffi = "Ffi"
2511
+ }
2512
+ /**
2513
+ * An error returned by a `HistoryObserver` callback implementation.
2514
+ */
2515
+ export declare const NewHistoryClientReportingError: {
2516
+ Ffi: {
2517
+ new (message: string): {
2518
+ readonly tag: NewHistoryClientReportingError_Tags.Ffi;
2519
+ /**
2520
+ * @private
2521
+ * This field is private and should not be used.
2522
+ */
2523
+ readonly [uniffiTypeNameSymbol]: string;
2524
+ /**
2525
+ * @private
2526
+ * This field is private and should not be used.
2527
+ */
2528
+ readonly [variantOrdinalSymbol]: 1;
2529
+ name: string;
2530
+ message: string;
2531
+ stack?: string;
2532
+ cause?: unknown;
2533
+ };
2534
+ instanceOf(e: any): e is {
2535
+ readonly tag: NewHistoryClientReportingError_Tags.Ffi;
2536
+ /**
2537
+ * @private
2538
+ * This field is private and should not be used.
2539
+ */
2540
+ readonly [uniffiTypeNameSymbol]: string;
2541
+ /**
2542
+ * @private
2543
+ * This field is private and should not be used.
2544
+ */
2545
+ readonly [variantOrdinalSymbol]: 1;
2546
+ name: string;
2547
+ message: string;
2548
+ stack?: string;
2549
+ cause?: unknown;
2550
+ };
2551
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2552
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2553
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
2554
+ stackTraceLimit: number;
2555
+ isError(value: unknown): value is Error;
2556
+ };
2557
+ instanceOf: (e: any) => e is NewHistoryClientReportingError;
2558
+ };
2559
+ /**
2560
+ * An error returned by a `HistoryObserver` callback implementation.
2561
+ */
2562
+ export type NewHistoryClientReportingError = InstanceType<(typeof NewHistoryClientReportingError)["Ffi"]>;
2563
+ declare enum PkiEnvironmentHooksError_Tags {
2564
+ Error = "Error"
2565
+ }
2566
+ /**
2567
+ * An error returned by a `PkiEnvironmentHooks` callback implementation.
2568
+ */
2569
+ export declare const PkiEnvironmentHooksError: Readonly<{
2570
+ instanceOf: (obj: any) => obj is PkiEnvironmentHooksError;
2571
+ Error: {
2572
+ new (inner: {
2573
+ reason: string;
2574
+ }): {
2575
+ readonly tag: PkiEnvironmentHooksError_Tags.Error;
2576
+ readonly inner: Readonly<{
2577
+ reason: string;
2578
+ }>;
2579
+ /**
2580
+ * @private
2581
+ * This field is private and should not be used, use `tag` instead.
2582
+ */
2583
+ readonly [uniffiTypeNameSymbol]: "PkiEnvironmentHooksError";
2584
+ name: string;
2585
+ message: string;
2586
+ stack?: string;
2587
+ cause?: unknown;
2588
+ };
2589
+ "new"(inner: {
2590
+ reason: string;
2591
+ }): {
2592
+ readonly tag: PkiEnvironmentHooksError_Tags.Error;
2593
+ readonly inner: Readonly<{
2594
+ reason: string;
2595
+ }>;
2596
+ /**
2597
+ * @private
2598
+ * This field is private and should not be used, use `tag` instead.
2599
+ */
2600
+ readonly [uniffiTypeNameSymbol]: "PkiEnvironmentHooksError";
2601
+ name: string;
2602
+ message: string;
2603
+ stack?: string;
2604
+ cause?: unknown;
2605
+ };
2606
+ instanceOf(obj: any): obj is {
2607
+ readonly tag: PkiEnvironmentHooksError_Tags.Error;
2608
+ readonly inner: Readonly<{
2609
+ reason: string;
2610
+ }>;
2611
+ /**
2612
+ * @private
2613
+ * This field is private and should not be used, use `tag` instead.
2614
+ */
2615
+ readonly [uniffiTypeNameSymbol]: "PkiEnvironmentHooksError";
2616
+ name: string;
2617
+ message: string;
2618
+ stack?: string;
2619
+ cause?: unknown;
2620
+ };
2621
+ hasInner(obj: any): obj is {
2622
+ readonly tag: PkiEnvironmentHooksError_Tags.Error;
2623
+ readonly inner: Readonly<{
2624
+ reason: string;
2625
+ }>;
2626
+ /**
2627
+ * @private
2628
+ * This field is private and should not be used, use `tag` instead.
2629
+ */
2630
+ readonly [uniffiTypeNameSymbol]: "PkiEnvironmentHooksError";
2631
+ name: string;
2632
+ message: string;
2633
+ stack?: string;
2634
+ cause?: unknown;
2635
+ };
2636
+ getInner(obj: {
2637
+ readonly tag: PkiEnvironmentHooksError_Tags.Error;
2638
+ readonly inner: Readonly<{
2639
+ reason: string;
2640
+ }>;
2641
+ /**
2642
+ * @private
2643
+ * This field is private and should not be used, use `tag` instead.
2644
+ */
2645
+ readonly [uniffiTypeNameSymbol]: "PkiEnvironmentHooksError";
2646
+ name: string;
2647
+ message: string;
2648
+ stack?: string;
2649
+ cause?: unknown;
2650
+ }): Readonly<{
2651
+ reason: string;
2652
+ }>;
2653
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2654
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2655
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
2656
+ stackTraceLimit: number;
2657
+ isError(value: unknown): value is Error;
2658
+ };
2659
+ }>;
2660
+ /**
2661
+ * An error returned by a `PkiEnvironmentHooks` callback implementation.
2662
+ */
2663
+ export type PkiEnvironmentHooksError = InstanceType<(typeof PkiEnvironmentHooksError)["Error"]>;
2664
+ /**
2665
+ * Signature schemes supported by MLS, as defined in RFC 9420.
2666
+ */
2667
+ export declare enum SignatureScheme {
2668
+ /**
2669
+ * ECDSA with secp256r1 (P-256) and SHA-256
2670
+ */
2671
+ EcdsaSecp256r1Sha256 = 1027,
2672
+ /**
2673
+ * ECDSA with secp384r1 (P-384) and SHA-384
2674
+ */
2675
+ EcdsaSecp384r1Sha384 = 1283,
2676
+ /**
2677
+ * ECDSA with secp521r1 (P-521) and SHA-512
2678
+ */
2679
+ EcdsaSecp521r1Sha512 = 1539,
2680
+ /**
2681
+ * Deterministic EdDSA with Curve25519 (Ed25519)
2682
+ */
2683
+ Ed25519 = 2055,
2684
+ /**
2685
+ * Deterministic EdDSA with Curve448 (Ed448)
2686
+ */
2687
+ Ed448 = 2056
2688
+ }
2689
+ /**
2690
+ * Typealias from the type name used in the UDL file to the builtin type. This
2691
+ * is needed because the UDL type name is used in function/method signatures.
2692
+ */
2693
+ export type MlsTransportData = Uint8Array;
2694
+ type ConversationIdLike = ConversationId;
2695
+ /**
2696
+ * A unique identifier for a single conversation.
2697
+ *
2698
+ * The backend provides an opaque string identifying a new conversation.
2699
+ * Construct an instance of this newtype to pass that identifier to Rust.
2700
+ */
2701
+ export declare class ConversationId extends UniffiAbstractObject {
2702
+ readonly [uniffiTypeNameSymbol] = "ConversationId";
2703
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2704
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2705
+ /**
2706
+ * Infallibly instantiate an instance from a byte array.
2707
+ */
2708
+ constructor(bytes: Uint8Array);
2709
+ /**
2710
+ * Copy the wrapped data into a new byte array.
2711
+ */
2712
+ copyBytes(): Uint8Array;
2713
+ toString(): string;
2714
+ toDebugString(): string;
2715
+ equals(other: ConversationId): boolean;
2716
+ hashCode(): bigint;
2717
+ uniffiDestroy(): void;
2718
+ static instanceOf(obj_: any): obj_ is ConversationId;
2719
+ }
2720
+ type KeyPackageRefLike = KeyPackageRef;
2721
+ /**
2722
+ * A lightweight distinct reference to a `KeyPackage`, sufficient to uniquely identify it.
2723
+ *
2724
+ * This contains some metadata to assist in sorting and filtering refs without needing to perform the
2725
+ * relatively heavy operation of converting to a full keypackage.
2726
+ */
2727
+ export declare class KeyPackageRef extends UniffiAbstractObject {
2728
+ readonly [uniffiTypeNameSymbol] = "KeyPackageRef";
2729
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2730
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2731
+ private constructor();
2732
+ /**
2733
+ * Get the cipher_suite associated with this key package ref.
2734
+ */
2735
+ cipherSuite(): CipherSuite;
2736
+ /**
2737
+ * Get the credential type associated with this key package ref.
2738
+ */
2739
+ credentialType(): CredentialType;
2740
+ /**
2741
+ * Get the bytes of the hash reference to a keypackage.
2742
+ */
2743
+ hashRef(): Uint8Array;
2744
+ /**
2745
+ * Returns true if this keypackage's lifetime has not expired, or if no lifetime is present.
2746
+ */
2747
+ isValid(): boolean;
2748
+ /**
2749
+ * Get the signature scheme associated with this key package ref.
2750
+ */
2751
+ signatureScheme(): SignatureScheme;
2752
+ uniffiDestroy(): void;
2753
+ static instanceOf(obj_: any): obj_ is KeyPackageRef;
2754
+ }
2755
+ type KeyPackageLike = KeyPackage;
2756
+ /**
2757
+ * A signed object describing a client's identity and capabilities.
2758
+ *
2759
+ * Includes a public key that can be used to encrypt to that client.
2760
+ * Other clients can use a client's KeyPackage to introduce that client to a new group.
2761
+ */
2762
+ export declare class KeyPackage extends UniffiAbstractObject {
2763
+ readonly [uniffiTypeNameSymbol] = "KeyPackage";
2764
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2765
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2766
+ /**
2767
+ * Construct a new `Keypackage` from a byte array.
2768
+ */
2769
+ constructor(bytes: Uint8Array);
2770
+ /**
2771
+ * Convert this to a reference.
2772
+ */
2773
+ ref(): KeyPackageRefLike;
2774
+ /**
2775
+ * Serialize this to a byte vector.
2776
+ */
2777
+ serialize(): Uint8Array;
2778
+ uniffiDestroy(): void;
2779
+ static instanceOf(obj_: any): obj_ is KeyPackage;
2780
+ }
2781
+ type CredentialLike = Credential$1;
2782
+ /**
2783
+ * A cryptographic credential.
2784
+ *
2785
+ * This is tied to a particular client via either its client id or certificate bundle,
2786
+ * depending on its credential type, but is independent of any client instance or storage.
2787
+ *
2788
+ * To attach a credential to a client instance and store it, call `add_credential` on a `CoreCryptoContext`.
2789
+ */
2790
+ declare class Credential$1 extends UniffiAbstractObject {
2791
+ readonly [uniffiTypeNameSymbol] = "Credential";
2792
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2793
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2794
+ private constructor();
2795
+ /**
2796
+ * Generate a basic credential.
2797
+ *
2798
+ * The result is independent of any client instance and the database; it lives in memory only.
2799
+ */
2800
+ static basic(cipherSuite: CipherSuite, clientId: ClientIdLike): CredentialLike;
2801
+ /**
2802
+ * Get the earliest possible validity of this credential, expressed as seconds after the unix epoch.
2803
+ *
2804
+ * Basic credentials have no defined earliest validity and will always return 0.
2805
+ */
2806
+ earliestValidity(): bigint;
2807
+ /**
2808
+ * Export a PEM string containing the public portion of this credential.
2809
+ *
2810
+ * - Basic credentials export their public key.
2811
+ * - x509 credentials export the full certificate chain. This enables external tools such as `openssl` to validate
2812
+ * the certificate chain.
2813
+ */
2814
+ exportPem(): string;
2815
+ /**
2816
+ * Get the signature scheme of this credential.
2817
+ */
2818
+ signatureScheme(): SignatureScheme;
2819
+ /**
2820
+ * Get the type of this credential.
2821
+ */
2822
+ type(): CredentialType;
2823
+ uniffiDestroy(): void;
2824
+ static instanceOf(obj_: any): obj_ is Credential$1;
2825
+ }
2826
+ type CredentialRefLike = CredentialRef;
2827
+ /**
2828
+ * A compact reference to a credential that has been persisted in CoreCrypto.
2829
+ *
2830
+ * Credentials can be quite large; this type avoids passing them back and forth across the FFI
2831
+ * boundary more than strictly required.
2832
+ *
2833
+ * Created by calling `add_credential` on a `CoreCryptoContext`.
2834
+ *
2835
+ * This reference is not a literal in-memory reference.
2836
+ * It is instead the key from which a credential can be retrieved,
2837
+ * and is stable over time and across the FFI boundary.
2838
+ */
2839
+ export declare class CredentialRef extends UniffiAbstractObject {
2840
+ readonly [uniffiTypeNameSymbol] = "CredentialRef";
2841
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2842
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2843
+ private constructor();
2844
+ /**
2845
+ * Get the cipher suite of this credential ref.
2846
+ */
2847
+ cipherSuite(): CipherSuite;
2848
+ /**
2849
+ * Get the client id associated with this credential ref.
2850
+ */
2851
+ clientId(): ClientIdLike;
2852
+ /**
2853
+ * Get the earliest possible validity of this credential, expressed as seconds after the unix epoch.
2854
+ *
2855
+ * Basic credentials have no defined earliest validity and will always return 0.
2856
+ */
2857
+ earliestValidity(): bigint;
2858
+ /**
2859
+ * Get the SHA256 hash of the public key associated with this credential ref.
2860
+ */
2861
+ publicKeyHash(): Uint8Array;
2862
+ /**
2863
+ * Get the signature scheme of this credential ref.
2864
+ */
2865
+ signatureScheme(): SignatureScheme;
2866
+ /**
2867
+ * Get the type of this credential ref.
2868
+ */
2869
+ type(): CredentialType;
2870
+ toDebugString(): string;
2871
+ toString(): string;
2872
+ uniffiDestroy(): void;
2873
+ static instanceOf(obj_: any): obj_ is CredentialRef;
2874
+ }
2875
+ type ExternalSenderLike = ExternalSender;
2876
+ /**
2877
+ * A RFC 9420 External Sender
2878
+ *
2879
+ * This can be used to initialize a subconversation.
2880
+ */
2881
+ export declare class ExternalSender extends UniffiAbstractObject {
2882
+ readonly [uniffiTypeNameSymbol] = "ExternalSender";
2883
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2884
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2885
+ private constructor();
2886
+ /**
2887
+ * Parse an external sender.
2888
+ *
2889
+ * This first attempts to parse this as a JWK per `parse_jwk`,
2890
+ * and falls back to `parse_public_key` if the former method fails.
2891
+ */
2892
+ static parse(key: Uint8Array, signatureScheme: SignatureScheme): ExternalSenderLike;
2893
+ /**
2894
+ * Parse an external sender given a JWK.
2895
+ *
2896
+ * This expects a raw json serialized JWK. It works with any Signature scheme.
2897
+ */
2898
+ static parseJwk(jwk: Uint8Array): ExternalSenderLike;
2899
+ /**
2900
+ * Parse an external sender given a raw public key.
2901
+ *
2902
+ * This supports the legacy behaviour where the server was providing the external sender public key
2903
+ * raw.
2904
+ */
2905
+ static parsePublicKey(key: Uint8Array, signatureScheme: SignatureScheme): ExternalSenderLike;
2906
+ /**
2907
+ * Serialize this external sender into a byte vector.
2908
+ *
2909
+ * This produces the public key and matches `parse_public_key`.
2910
+ */
2911
+ serialize(): Uint8Array;
2912
+ equals(other: ExternalSender): boolean;
2913
+ uniffiDestroy(): void;
2914
+ static instanceOf(obj_: any): obj_ is ExternalSender;
2915
+ }
2916
+ type SecretKeyLike = SecretKey;
2917
+ /**
2918
+ * A secret key derived from the group secret.
2919
+ *
2920
+ * This is intended to be used for AVS.
2921
+ */
2922
+ export declare class SecretKey extends UniffiAbstractObject {
2923
+ readonly [uniffiTypeNameSymbol] = "SecretKey";
2924
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2925
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2926
+ /**
2927
+ * Infallibly instantiate an instance from a byte array.
2928
+ */
2929
+ constructor(bytes: Uint8Array);
2930
+ /**
2931
+ * Copy the wrapped data into a new byte array.
2932
+ */
2933
+ copyBytes(): Uint8Array;
2934
+ toString(): string;
2935
+ equals(other: SecretKey): boolean;
2936
+ hashCode(): bigint;
2937
+ uniffiDestroy(): void;
2938
+ static instanceOf(obj_: any): obj_ is SecretKey;
2939
+ }
2940
+ type GroupInfoLike = GroupInfo;
2941
+ /**
2942
+ * MLS Group Information
2943
+ *
2944
+ * This is used when joining by external commit.
2945
+ * It can be found within the `GroupInfoBundle` within a `CommitBundle`.
2946
+ */
2947
+ export declare class GroupInfo extends UniffiAbstractObject {
2948
+ readonly [uniffiTypeNameSymbol] = "GroupInfo";
2949
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2950
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2951
+ /**
2952
+ * Fallibly instantiate an instance from a TLS-serialized byte array.
2953
+ */
2954
+ constructor(bytes: Uint8Array);
2955
+ uniffiDestroy(): void;
2956
+ static instanceOf(obj_: any): obj_ is GroupInfo;
2957
+ }
2958
+ /**
2959
+ * Used by CoreCrypto to send commits or application messages to the delivery service.
2960
+ *
2961
+ * This trait must be implemented before calling any functions that produce commits.
2962
+ */
2963
+ export interface MlsTransport {
2964
+ /**
2965
+ * Send a commit bundle to the corresponding endpoint.
2966
+ */
2967
+ sendCommitBundle(commitBundle: CommitBundle, asyncOpts_?: {
2968
+ signal: AbortSignal;
2969
+ }): Promise<void>;
2970
+ /**
2971
+ * Prepare a history secret before transmission.
2972
+ */
2973
+ prepareForTransport(historySecret: HistorySecret, asyncOpts_?: {
2974
+ signal: AbortSignal;
2975
+ }): Promise<MlsTransportData>;
2976
+ }
2977
+ type CoreCryptoContextLike = CoreCryptoContext;
2978
+ declare class CoreCryptoContext extends UniffiAbstractObject {
2979
+ readonly [uniffiTypeNameSymbol] = "CoreCryptoContext";
2980
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2981
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2982
+ /**
2983
+ * This is only needed to allow TS inheritance and should be hidden from library consumers.
2984
+ */
2985
+ constructor(instance: CoreCryptoContextLike);
2986
+ /**
2987
+ * Adds members to the conversation using their key packages, sending the resulting commit via the transport.
2988
+ */
2989
+ addClientsToConversation(conversationId: ConversationIdLike, keyPackages: Array<KeyPackageLike>, asyncOpts_?: {
2990
+ signal: AbortSignal;
2991
+ }): Promise<void>;
2992
+ /**
2993
+ * Adds a `Credential` to this client.
2994
+ *
2995
+ * Note that while an arbitrary number of credentials can be generated,
2996
+ * those which are added to a CoreCrypto instance must be distinct in credential type,
2997
+ * signature scheme, and the timestamp of creation. This timestamp has only
2998
+ * 1 second of resolution, limiting the number of credentials which
2999
+ * can be added. This is a known limitation and will be relaxed in the future.
3000
+ */
3001
+ addCredential(credential: CredentialLike, asyncOpts_?: {
3002
+ signal: AbortSignal;
3003
+ }): Promise<CredentialRefLike>;
3004
+ /**
3005
+ * Check all X509 credentials for expiration and revocation
3006
+ *
3007
+ * This function must be called at least once every 24 hours. It is recommended to do this during an idle period,
3008
+ * because in case x509 credentials are used, HTTP requests are done to fetch new certificate revocation lists.
3009
+ */
3010
+ checkCredentials(asyncOpts_?: {
3011
+ signal: AbortSignal;
3012
+ }): Promise<void>;
3013
+ /**
3014
+ * Commits all pending proposals in the conversation, sending the resulting commit via the transport.
3015
+ */
3016
+ commitPendingProposals(conversationId: ConversationIdLike, asyncOpts_?: {
3017
+ signal: AbortSignal;
3018
+ }): Promise<void>;
3019
+ /**
3020
+ * Returns the cipher suite in use for the given conversation.
3021
+ */
3022
+ conversationCipherSuite(conversationId: ConversationIdLike, asyncOpts_?: {
3023
+ signal: AbortSignal;
3024
+ }): Promise<CipherSuite>;
3025
+ /**
3026
+ * Get the credential ref for the given conversation.
3027
+ */
3028
+ conversationCredential(conversationId: ConversationIdLike, asyncOpts_?: {
3029
+ signal: AbortSignal;
3030
+ }): Promise<CredentialRefLike>;
3031
+ /**
3032
+ * Returns the current MLS epoch of the given conversation.
3033
+ */
3034
+ conversationEpoch(conversationId: ConversationIdLike, asyncOpts_?: {
3035
+ signal: AbortSignal;
3036
+ }): Promise<bigint>;
3037
+ /**
3038
+ * Returns true if a conversation with the given id exists in the local state.
3039
+ */
3040
+ conversationExists(conversationId: ConversationIdLike, asyncOpts_?: {
3041
+ signal: AbortSignal;
3042
+ }): Promise<boolean>;
3043
+ /**
3044
+ * Creates a new MLS group with the given conversation ID, using the specified credential.
3045
+ */
3046
+ createConversation(conversationId: ConversationIdLike, credentialRef: CredentialRefLike, externalSender?: ExternalSenderLike | undefined, asyncOpts_?: {
3047
+ signal: AbortSignal;
3048
+ }): Promise<void>;
3049
+ /**
3050
+ * Decrypts an MLS message received in the given conversation.
3051
+ * **Note**: this will discard any local pending operations.
3052
+ */
3053
+ decryptMessage(conversationId: ConversationIdLike, payload: Uint8Array, asyncOpts_?: {
3054
+ signal: AbortSignal;
3055
+ }): Promise<DecryptedMessage>;
3056
+ /**
3057
+ * Disables history sharing for the given conversation.
3058
+ */
3059
+ disableHistorySharing(conversationId: ConversationIdLike, asyncOpts_?: {
3060
+ signal: AbortSignal;
3061
+ }): Promise<void>;
3062
+ /**
3063
+ * Returns the end-to-end identity verification state of the given conversation.
3064
+ */
3065
+ e2eiConversationState(conversationId: ConversationIdLike, asyncOpts_?: {
3066
+ signal: AbortSignal;
3067
+ }): Promise<E2eiConversationState>;
3068
+ /**
3069
+ * Returns true if end-to-end identity is enabled for the given cipher_suite.
3070
+ */
3071
+ e2eiIsEnabled(cipherSuite: CipherSuite, asyncOpts_?: {
3072
+ signal: AbortSignal;
3073
+ }): Promise<boolean>;
3074
+ /**
3075
+ * Enables history sharing for the given conversation.
3076
+ */
3077
+ enableHistorySharing(conversationId: ConversationIdLike, asyncOpts_?: {
3078
+ signal: AbortSignal;
3079
+ }): Promise<void>;
3080
+ /**
3081
+ * Encrypts a plaintext message for all members of the given conversation.
3082
+ */
3083
+ encryptMessage(conversationId: ConversationIdLike, message: Uint8Array, asyncOpts_?: {
3084
+ signal: AbortSignal;
3085
+ }): Promise<Uint8Array>;
3086
+ /**
3087
+ * Derives and exports a secret of `key_length` bytes for the given conversation.
3088
+ *
3089
+ * The secret is derived from the MLS key schedule's exporter mechanism (RFC 9420 §8.5),
3090
+ * which produces output bound to the current group state and epoch. The exported value
3091
+ * changes whenever the epoch advances.
3092
+ */
3093
+ exportSecretKey(conversationId: ConversationIdLike, keyLength: number, asyncOpts_?: {
3094
+ signal: AbortSignal;
3095
+ }): Promise<SecretKeyLike>;
3096
+ /**
3097
+ * Generate a `KeyPackage` from the referenced credential.
3098
+ *
3099
+ * Makes no attempt to look up or prune existing keypackages.
3100
+ *
3101
+ * If `lifetime` is set, the keypackages will expire that span into the future.
3102
+ * If it is unset, a default lifetime of approximately 3 months is used.
3103
+ */
3104
+ generateKeyPackage(credentialRef: CredentialRefLike, lifetime?: number | undefined, asyncOpts_?: {
3105
+ signal: AbortSignal;
3106
+ }): Promise<KeyPackageLike>;
3107
+ /**
3108
+ * Returns the client ids of all members of the given conversation.
3109
+ */
3110
+ getClientIds(conversationId: ConversationIdLike, asyncOpts_?: {
3111
+ signal: AbortSignal;
3112
+ }): Promise<Array<ClientIdLike>>;
3113
+ /**
3114
+ * Returns data previously stored by `set_data`, or `None` if no data has been stored.
3115
+ */
3116
+ getData(asyncOpts_?: {
3117
+ signal: AbortSignal;
3118
+ }): Promise<Uint8Array | undefined>;
3119
+ /**
3120
+ * Returns the E2EI identity claims for the specified devices in the given conversation.
3121
+ */
3122
+ getDeviceIdentities(conversationId: ConversationIdLike, deviceIds: Array<ClientIdLike>, asyncOpts_?: {
3123
+ signal: AbortSignal;
3124
+ }): Promise<Array<WireIdentity>>;
3125
+ /**
3126
+ * Returns the serialized public key of the external sender for the given conversation.
3127
+ */
3128
+ getExternalSender(conversationId: ConversationIdLike, asyncOpts_?: {
3129
+ signal: AbortSignal;
3130
+ }): Promise<ExternalSenderLike>;
3131
+ /**
3132
+ * Get a reference to each `KeyPackage` in the database.
3133
+ */
3134
+ getKeyPackages(asyncOpts_?: {
3135
+ signal: AbortSignal;
3136
+ }): Promise<Array<KeyPackageRefLike>>;
3137
+ /**
3138
+ * Returns the E2EI identity claims for the specified users in the given conversation, grouped by user ID.
3139
+ */
3140
+ getUserIdentities(conversationId: ConversationIdLike, userIds: Array<UuidLike>, asyncOpts_?: {
3141
+ signal: AbortSignal;
3142
+ }): Promise<Map<UuidLike, Array<WireIdentity>>>;
3143
+ /**
3144
+ * Joins an existing conversation by constructing an external commit from the given group info.
3145
+ */
3146
+ joinByExternalCommit(groupInfo: GroupInfoLike, credentialRef: CredentialRefLike, asyncOpts_?: {
3147
+ signal: AbortSignal;
3148
+ }): Promise<ConversationIdLike>;
3149
+ /**
3150
+ * Initializes the MLS client with the given client ID and message transport.
3151
+ *
3152
+ * In general this method should be called at most once per core-crypto instance.
3153
+ * Calling it multiple times with the same parameters should silently succeed, but this is not
3154
+ * a supported or tested mode of operation.
3155
+ * Calling it multiple times with varying parameters might succeed, but this is not a supported or tested mode of
3156
+ * operation.
3157
+ */
3158
+ mlsInit(clientId: ClientIdLike, transport: MlsTransport, asyncOpts_?: {
3159
+ signal: AbortSignal;
3160
+ }): Promise<void>;
3161
+ /**
3162
+ * Joins a conversation by processing an MLS Welcome message, returning the new conversation's ID.
3163
+ */
3164
+ processWelcomeMessage(welcomeMessage: WelcomeLike, asyncOpts_?: {
3165
+ signal: AbortSignal;
3166
+ }): Promise<ConversationIdLike>;
3167
+ /**
3168
+ * Decrypts a Proteus ciphertext in the given session, returning the plaintext.
3169
+ */
3170
+ proteusDecrypt(sessionId: string, ciphertext: Uint8Array, asyncOpts_?: {
3171
+ signal: AbortSignal;
3172
+ }): Promise<Uint8Array>;
3173
+ /**
3174
+ * Decrypt a message whether or not the proteus session already exists, and saves the session.
3175
+ *
3176
+ * This is intended to replace simple usages of `proteusDecrypt`.
3177
+ *
3178
+ * However, when decrypting large numbers of messages in a single session, the existing methods
3179
+ * may be more efficient.
3180
+ */
3181
+ proteusDecryptSafe(sessionId: string, ciphertext: Uint8Array, asyncOpts_?: {
3182
+ signal: AbortSignal;
3183
+ }): Promise<Uint8Array>;
3184
+ /**
3185
+ * Encrypts a plaintext message in the given Proteus session.
3186
+ */
3187
+ proteusEncrypt(sessionId: string, plaintext: Uint8Array, asyncOpts_?: {
3188
+ signal: AbortSignal;
3189
+ }): Promise<Uint8Array>;
3190
+ /**
3191
+ * Encrypts a plaintext message in multiple Proteus sessions, returning a map from session ID to ciphertext.
3192
+ */
3193
+ proteusEncryptBatched(sessions: Array<string>, plaintext: Uint8Array, asyncOpts_?: {
3194
+ signal: AbortSignal;
3195
+ }): Promise<Map<string, Uint8Array>>;
3196
+ /**
3197
+ * Returns the hex-encoded public key fingerprint of this device's Proteus identity.
3198
+ */
3199
+ proteusFingerprint(asyncOpts_?: {
3200
+ signal: AbortSignal;
3201
+ }): Promise<string>;
3202
+ /**
3203
+ * Returns the hex-encoded local public key fingerprint for the Proteus session with the given ID.
3204
+ */
3205
+ proteusFingerprintLocal(sessionId: string, asyncOpts_?: {
3206
+ signal: AbortSignal;
3207
+ }): Promise<string>;
3208
+ /**
3209
+ * Returns the hex-encoded remote public key fingerprint for the Proteus session with the given ID.
3210
+ */
3211
+ proteusFingerprintRemote(sessionId: string, asyncOpts_?: {
3212
+ signal: AbortSignal;
3213
+ }): Promise<string>;
3214
+ /**
3215
+ * Initializes the Proteus client.
3216
+ *
3217
+ * In general this method should be called at most once per core-crypto instance.
3218
+ * Calling it multiple times with the same parameters should silently succeed, but this is not
3219
+ * a supported or tested mode of operation.
3220
+ * Calling it multiple times with varying parameters might succeed, but this is not a supported or tested mode of
3221
+ * operation.
3222
+ */
3223
+ proteusInit(asyncOpts_?: {
3224
+ signal: AbortSignal;
3225
+ }): Promise<void>;
3226
+ /**
3227
+ * Returns the CBOR-serialized last resort prekey bundle, creating it if it does not yet exist.
3228
+ */
3229
+ proteusLastResortPrekey(asyncOpts_?: {
3230
+ signal: AbortSignal;
3231
+ }): Promise<Uint8Array>;
3232
+ /**
3233
+ * Creates a new Proteus prekey with the given ID and returns its CBOR-serialized bundle.
3234
+ *
3235
+ * Warning: the Proteus client must be initialized with `proteus_init` first or an error will be returned.
3236
+ */
3237
+ proteusNewPrekey(prekeyId: number, asyncOpts_?: {
3238
+ signal: AbortSignal;
3239
+ }): Promise<Uint8Array>;
3240
+ /**
3241
+ * Creates a new Proteus prekey with an automatically assigned ID and returns its CBOR-serialized bundle.
3242
+ *
3243
+ * Warning: the Proteus client must be initialized with `proteus_init` first or an error will be returned.
3244
+ */
3245
+ proteusNewPrekeyAuto(asyncOpts_?: {
3246
+ signal: AbortSignal;
3247
+ }): Promise<ProteusAutoPrekeyBundle>;
3248
+ /**
3249
+ * Deletes the Proteus session with the given ID from local storage.
3250
+ */
3251
+ proteusSessionDelete(sessionId: string, asyncOpts_?: {
3252
+ signal: AbortSignal;
3253
+ }): Promise<void>;
3254
+ /**
3255
+ * Returns true if a Proteus session with the given ID exists in local storage.
3256
+ */
3257
+ proteusSessionExists(sessionId: string, asyncOpts_?: {
3258
+ signal: AbortSignal;
3259
+ }): Promise<boolean>;
3260
+ /**
3261
+ * Creates a new Proteus session from an incoming encrypted message, returning the decrypted message payload.
3262
+ */
3263
+ proteusSessionFromMessage(sessionId: string, envelope: Uint8Array, asyncOpts_?: {
3264
+ signal: AbortSignal;
3265
+ }): Promise<Uint8Array>;
3266
+ /**
3267
+ * Creates a new Proteus session from the given prekey bundle bytes, stored under the given session ID.
3268
+ */
3269
+ proteusSessionFromPrekey(sessionId: string, prekey: Uint8Array, asyncOpts_?: {
3270
+ signal: AbortSignal;
3271
+ }): Promise<void>;
3272
+ /**
3273
+ * Saves the Proteus session with the given ID to the keystore.
3274
+ *
3275
+ * Note: this is not usually needed, as sessions are persisted automatically when
3276
+ * decrypting or encrypting messages and when initializing sessions.
3277
+ */
3278
+ proteusSessionSave(sessionId: string, asyncOpts_?: {
3279
+ signal: AbortSignal;
3280
+ }): Promise<void>;
3281
+ /**
3282
+ * Generates `len` random bytes from the cryptographically secure RNG.
3283
+ */
3284
+ randomBytes(len: number, asyncOpts_?: {
3285
+ signal: AbortSignal;
3286
+ }): Promise<Uint8Array>;
3287
+ /**
3288
+ * Removes the specified clients from the conversation, sending the resulting commit via the transport.
3289
+ */
3290
+ removeClientsFromConversation(conversationId: ConversationIdLike, clients: Array<ClientIdLike>, asyncOpts_?: {
3291
+ signal: AbortSignal;
3292
+ }): Promise<void>;
3293
+ /**
3294
+ * Removes a `Credential` from this client.
3295
+ */
3296
+ removeCredential(credentialRef: CredentialRefLike, asyncOpts_?: {
3297
+ signal: AbortSignal;
3298
+ }): Promise<void>;
3299
+ /**
3300
+ * Remove a `KeyPackage` from the database.
3301
+ */
3302
+ removeKeyPackage(kpRef: KeyPackageRefLike, asyncOpts_?: {
3303
+ signal: AbortSignal;
3304
+ }): Promise<void>;
3305
+ /**
3306
+ * Remove all `KeyPackage`s associated with this credential ref.
3307
+ */
3308
+ removeKeyPackagesFor(credentialRef: CredentialRefLike, asyncOpts_?: {
3309
+ signal: AbortSignal;
3310
+ }): Promise<void>;
3311
+ /**
3312
+ * Set the credential ref for the given conversation.
3313
+ */
3314
+ setConversationCredential(conversationId: ConversationIdLike, credentialRef: CredentialRefLike, asyncOpts_?: {
3315
+ signal: AbortSignal;
3316
+ }): Promise<void>;
3317
+ /**
3318
+ * Stores arbitrary data to be used as a transaction checkpoint.
3319
+ *
3320
+ * The stored data can be retrieved via `get_data`. Keep the data size reasonable;
3321
+ * this is not a general-purpose key-value store.
3322
+ */
3323
+ setData(data: Uint8Array, asyncOpts_?: {
3324
+ signal: AbortSignal;
3325
+ }): Promise<void>;
3326
+ /**
3327
+ * Updates this client's key material in the conversation by sending an update commit.
3328
+ */
3329
+ updateKeyingMaterial(conversationId: ConversationIdLike, asyncOpts_?: {
3330
+ signal: AbortSignal;
3331
+ }): Promise<void>;
3332
+ /**
3333
+ * Destroys the local state of the given conversation; it can no longer be used locally after this call.
3334
+ */
3335
+ wipeConversation(conversationId: ConversationIdLike, asyncOpts_?: {
3336
+ signal: AbortSignal;
3337
+ }): Promise<void>;
3338
+ uniffiDestroy(): void;
3339
+ static instanceOf(obj_: any): obj_ is CoreCryptoContext;
3340
+ }
3341
+ interface CoreCryptoCommand {
3342
+ /**
3343
+ * Will be called inside a transaction in CoreCrypto
3344
+ */
3345
+ execute(context: CoreCryptoContextLike, asyncOpts_?: {
3346
+ signal: AbortSignal;
3347
+ }): Promise<void>;
3348
+ }
3349
+ type PkiEnvironmentLike = PkiEnvironment;
3350
+ /**
3351
+ * The PKI environment used for certificate management during X509 credential acquisition.
3352
+ */
3353
+ export declare class PkiEnvironment extends UniffiAbstractObject {
3354
+ readonly [uniffiTypeNameSymbol] = "PkiEnvironment";
3355
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3356
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3357
+ private constructor();
3358
+ /**
3359
+ * Create a new PKI environment.
3360
+ */
3361
+ static create(hooks: PkiEnvironmentHooks, database: DatabaseLike, asyncOpts_?: {
3362
+ signal: AbortSignal;
3363
+ }): Promise<PkiEnvironmentLike>;
3364
+ /**
3365
+ * Add a PEM-encoded certificate as an intermediate certificate.
3366
+ */
3367
+ addIntermediateCert(certPem: string, asyncOpts_?: {
3368
+ signal: AbortSignal;
3369
+ }): Promise<void>;
3370
+ /**
3371
+ * Add a PEM-encoded certificate as a trust anchor.
3372
+ *
3373
+ * NOTE: currently we only support storing a single trust anchor, calling this method multiple
3374
+ * times will overwrite any previously added trust anchor.
3375
+ */
3376
+ addTrustAnchor(certPem: string, asyncOpts_?: {
3377
+ signal: AbortSignal;
3378
+ }): Promise<void>;
3379
+ uniffiDestroy(): void;
3380
+ static instanceOf(obj_: any): obj_ is PkiEnvironment;
3381
+ }
3382
+ /**
3383
+ * An `EpochObserver` is notified whenever a conversation's epoch changes.
3384
+ */
3385
+ export interface EpochObserver {
3386
+ /**
3387
+ * This function will be called every time a conversation's epoch changes.
3388
+ *
3389
+ * The `epoch` parameter contains the new epoch number.
3390
+ *
3391
+ * Warning: this function must not block. Foreign implementors can spawn a task,
3392
+ * send on a channel, or take any other non-blocking approach, as long as the
3393
+ * operation completes quickly.
3394
+ *
3395
+ * Though the signature includes an error type, that error is only present because
3396
+ * it is required by `uniffi` in order to handle panics. This function should suppress
3397
+ * and ignore internal errors instead of propagating them, to the maximum extent possible.
3398
+ */
3399
+ epochChanged(conversationId: ConversationIdLike, epoch: bigint, asyncOpts_?: {
3400
+ signal: AbortSignal;
3401
+ }): Promise<void>;
3402
+ }
3403
+ /**
3404
+ * A `HistoryObserver` is notified whenever a new history client is created.
3405
+ */
3406
+ export interface HistoryObserver {
3407
+ /**
3408
+ * This function will be called every time a new history client is created.
3409
+ *
3410
+ * The `secret` parameter is the secret associated with the new history client.
3411
+ *
3412
+ * Warning: this function must not block. Foreign implementors can spawn a task,
3413
+ * send on a channel, or take any other non-blocking approach, as long as the
3414
+ * operation completes quickly.
3415
+ *
3416
+ * Though the signature includes an error type, that error is only present because
3417
+ * it is required by `uniffi` in order to handle panics. This function should suppress
3418
+ * and ignore internal errors instead of propagating them, to the maximum extent possible.
3419
+ */
3420
+ historyClientCreated(conversationId: ConversationIdLike, secret: HistorySecret, asyncOpts_?: {
3421
+ signal: AbortSignal;
3422
+ }): Promise<void>;
3423
+ }
3424
+ type CoreCryptoFfiLike = CoreCryptoFfi;
3425
+ declare class CoreCryptoFfi extends UniffiAbstractObject {
3426
+ readonly [uniffiTypeNameSymbol] = "CoreCryptoFfi";
3427
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3428
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3429
+ /**
3430
+ * This is only needed to allow TS inheritance and should be hidden from library consumers.
3431
+ */
3432
+ constructor(instance: CoreCryptoFfiLike);
3433
+ /**
3434
+ * Returns the cipher_suite in use for the given conversation.
3435
+ */
3436
+ conversationCipherSuite(conversationId: ConversationIdLike, asyncOpts_?: {
3437
+ signal: AbortSignal;
3438
+ }): Promise<CipherSuite>;
3439
+ /**
3440
+ * Get the credential ref for the given conversation.
3441
+ */
3442
+ conversationCredential(conversationId: ConversationIdLike, asyncOpts_?: {
3443
+ signal: AbortSignal;
3444
+ }): Promise<CredentialRefLike>;
3445
+ /**
3446
+ * Returns the current MLS epoch of the given conversation.
3447
+ */
3448
+ conversationEpoch(conversationId: ConversationIdLike, asyncOpts_?: {
3449
+ signal: AbortSignal;
3450
+ }): Promise<bigint>;
3451
+ /**
3452
+ * Returns true if a conversation with the given id exists in the local state.
3453
+ */
3454
+ conversationExists(conversationId: ConversationIdLike, asyncOpts_?: {
3455
+ signal: AbortSignal;
3456
+ }): Promise<boolean>;
3457
+ /**
3458
+ * Returns the end-to-end identity verification state of the given conversation.
3459
+ */
3460
+ e2eiConversationState(conversationId: ConversationIdLike, asyncOpts_?: {
3461
+ signal: AbortSignal;
3462
+ }): Promise<E2eiConversationState>;
3463
+ /**
3464
+ * Returns true if end-to-end identity is enabled for the given cipher_suite.
3465
+ */
3466
+ e2eiIsEnabled(cipherSuite: CipherSuite, asyncOpts_?: {
3467
+ signal: AbortSignal;
3468
+ }): Promise<boolean>;
3469
+ /**
3470
+ * Returns true if the PKI environment has been set up and its provider is configured.
3471
+ */
3472
+ e2eiIsPkiEnvSetup(asyncOpts_?: {
3473
+ signal: AbortSignal;
3474
+ }): Promise<boolean>;
3475
+ /**
3476
+ * Derives and exports a secret of `key_length` bytes for the given conversation.
3477
+ *
3478
+ * The secret is derived from the MLS key schedule's exporter mechanism (RFC 9420 §8.5),
3479
+ * which produces output bound to the current group state and epoch. The exported value
3480
+ * changes whenever the epoch advances.
3481
+ */
3482
+ exportSecretKey(conversationId: ConversationIdLike, keyLength: number, asyncOpts_?: {
3483
+ signal: AbortSignal;
3484
+ }): Promise<SecretKeyLike>;
3485
+ /**
3486
+ * Get all credentials from this client which match the provided parameters.
3487
+ *
3488
+ * Parameters which are unset or `None` match anything. Those with a particular value find only credentials
3489
+ * matching that value.
3490
+ */
3491
+ findCredentialsFfi(clientId?: ClientIdLike | undefined, publicKey?: Uint8Array | undefined, cipherSuite?: CipherSuite | undefined, credentialType?: CredentialType | undefined, earliestValidity?: bigint | undefined, asyncOpts_?: {
3492
+ signal: AbortSignal;
3493
+ }): Promise<Array<CredentialRefLike>>;
3494
+ /**
3495
+ * Returns the client ids of all members of the given conversation.
3496
+ */
3497
+ getClientIds(conversationId: ConversationIdLike, asyncOpts_?: {
3498
+ signal: AbortSignal;
3499
+ }): Promise<Array<ClientIdLike>>;
3500
+ /**
3501
+ * Get all credentials from this client.
3502
+ */
3503
+ getCredentials(asyncOpts_?: {
3504
+ signal: AbortSignal;
3505
+ }): Promise<Array<CredentialRefLike>>;
3506
+ /**
3507
+ * Returns the E2EI identity claims for the specified devices in the given conversation.
3508
+ */
3509
+ getDeviceIdentities(conversationId: ConversationIdLike, deviceIds: Array<ClientIdLike>, asyncOpts_?: {
3510
+ signal: AbortSignal;
3511
+ }): Promise<Array<WireIdentity>>;
3512
+ /**
3513
+ * Returns the external sender for the given conversation.
3514
+ */
3515
+ getExternalSender(conversationId: ConversationIdLike, asyncOpts_?: {
3516
+ signal: AbortSignal;
3517
+ }): Promise<ExternalSenderLike>;
3518
+ /**
3519
+ * Get the PKI environment of the CoreCrypto instance.
3520
+ *
3521
+ * Returns null if it is not set.
3522
+ */
3523
+ getPkiEnvironment(asyncOpts_?: {
3524
+ signal: AbortSignal;
3525
+ }): Promise<PkiEnvironmentLike | undefined>;
3526
+ /**
3527
+ * Returns the E2EI identity claims for the specified users in the given conversation, grouped by user ID.
3528
+ */
3529
+ getUserIdentities(conversationId: ConversationIdLike, userIds: Array<UuidLike>, asyncOpts_?: {
3530
+ signal: AbortSignal;
3531
+ }): Promise<Map<UuidLike, Array<WireIdentity>>>;
3532
+ /**
3533
+ * Returns true if history sharing is currently enabled for the given conversation.
3534
+ */
3535
+ isHistorySharingEnabled(conversationId: ConversationIdLike, asyncOpts_?: {
3536
+ signal: AbortSignal;
3537
+ }): Promise<boolean>;
3538
+ /**
3539
+ * Returns the hex-encoded public key fingerprint of this device's Proteus identity.
3540
+ */
3541
+ proteusFingerprint(asyncOpts_?: {
3542
+ signal: AbortSignal;
3543
+ }): Promise<string>;
3544
+ /**
3545
+ * Returns the hex-encoded local public key fingerprint for the Proteus session with the given ID.
3546
+ */
3547
+ proteusFingerprintLocal(sessionId: string, asyncOpts_?: {
3548
+ signal: AbortSignal;
3549
+ }): Promise<string>;
3550
+ /**
3551
+ * Returns the hex-encoded remote public key fingerprint for the Proteus session with the given ID.
3552
+ */
3553
+ proteusFingerprintRemote(sessionId: string, asyncOpts_?: {
3554
+ signal: AbortSignal;
3555
+ }): Promise<string>;
3556
+ /**
3557
+ * Returns true if a Proteus session with the given ID exists in local storage.
3558
+ */
3559
+ proteusSessionExists(sessionId: string, asyncOpts_?: {
3560
+ signal: AbortSignal;
3561
+ }): Promise<boolean>;
3562
+ /**
3563
+ * Get the public key associated with this credential
3564
+ */
3565
+ publicKey(credentialRef: CredentialRefLike, asyncOpts_?: {
3566
+ signal: AbortSignal;
3567
+ }): Promise<Uint8Array>;
3568
+ /**
3569
+ * Generate `len` random bytes from the MLS session's cryptographically secure RNG.
3570
+ */
3571
+ randomBytes(len: number, asyncOpts_?: {
3572
+ signal: AbortSignal;
3573
+ }): Promise<Uint8Array>;
3574
+ /**
3575
+ * Add an epoch observer to this client.
3576
+ *
3577
+ * This function should be called 0 or 1 times in a session's lifetime. If called
3578
+ * when an epoch observer already exists, this will return an error.
3579
+ */
3580
+ registerEpochObserver(epochObserver: EpochObserver, asyncOpts_?: {
3581
+ signal: AbortSignal;
3582
+ }): Promise<void>;
3583
+ /**
3584
+ * Add a history observer to this client.
3585
+ *
3586
+ * This function should be called 0 or 1 times in a session's lifetime. If called
3587
+ * when a history observer already exists, this will return an error.
3588
+ */
3589
+ registerHistoryObserver(historyObserver: HistoryObserver, asyncOpts_?: {
3590
+ signal: AbortSignal;
3591
+ }): Promise<void>;
3592
+ /**
3593
+ * Re-seed the MLS session's CSPRNG with the provided entropy seed.
3594
+ */
3595
+ reseed(seed: Uint8Array, asyncOpts_?: {
3596
+ signal: AbortSignal;
3597
+ }): Promise<void>;
3598
+ /**
3599
+ * Set the PKI environment of the CoreCrypto instance.
3600
+ */
3601
+ setPkiEnvironment(pkiEnvironment: PkiEnvironmentLike | undefined, asyncOpts_?: {
3602
+ signal: AbortSignal;
3603
+ }): Promise<void>;
3604
+ /**
3605
+ * Starts a new transaction in Core Crypto. If the callback succeeds, it will be committed,
3606
+ * otherwise, every operation performed with the context will be discarded.
3607
+ *
3608
+ * When calling this function from within Rust, async functions accepting a context
3609
+ * implement `CoreCryptoCommand`, so operations can be defined inline as follows:
3610
+ *
3611
+ * ```ignore
3612
+ * core_crypto.transaction(Arc::new(async |context| {
3613
+ * // your implementation here
3614
+ * Ok(())
3615
+ * }))?;
3616
+ * ```
3617
+ */
3618
+ transactionFfi(command: CoreCryptoCommand, asyncOpts_?: {
3619
+ signal: AbortSignal;
3620
+ }): Promise<void>;
3621
+ uniffiDestroy(): void;
3622
+ static instanceOf(obj_: any): obj_ is CoreCryptoFfi;
3623
+ }
3624
+ /**
3625
+ * A callback interface for forwarding CoreCrypto log messages to the platform's logging system.
3626
+ */
3627
+ export interface CoreCryptoLogger {
3628
+ /**
3629
+ * CoreCrypto will call this method whenever it needs to log a message.
3630
+ *
3631
+ * This function catches panics and other unexpected errors. In those cases, it writes to `stderr`.
3632
+ */
3633
+ log(level: CoreCryptoLogLevel, message: string, context: string | undefined): void;
3634
+ }
3635
+ type DatabaseKeyLike = DatabaseKey;
3636
+ /**
3637
+ * A unique identifier for an MLS client.
3638
+ *
3639
+ * Each app instance a user is running, such as desktop or mobile, is a separate client
3640
+ * with its own client id. A single user may therefore have multiple clients.
3641
+ * More information: <https://messaginglayersecurity.rocks/mls-architecture/draft-ietf-mls-architecture.html#name-group-members-and-clients>
3642
+ */
3643
+ export declare class DatabaseKey extends UniffiAbstractObject {
3644
+ readonly [uniffiTypeNameSymbol] = "DatabaseKey";
3645
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3646
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3647
+ /**
3648
+ * Fallibly instantiate an instance from a byte array.
3649
+ */
3650
+ constructor(bytes: Uint8Array);
3651
+ toDebugString(): string;
3652
+ toString(): string;
3653
+ equals(other: DatabaseKey): boolean;
3654
+ uniffiDestroy(): void;
3655
+ static instanceOf(obj_: any): obj_ is DatabaseKey;
3656
+ }
3657
+ type DatabaseLike = Database;
3658
+ /**
3659
+ * The database acting as a core crypto keystore.
3660
+ */
3661
+ export declare class Database extends UniffiAbstractObject {
3662
+ readonly [uniffiTypeNameSymbol] = "Database";
3663
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3664
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3665
+ private constructor();
3666
+ /**
3667
+ * Create an in-memory database whose data will be lost when the instance is dropped.
3668
+ */
3669
+ static inMemory(key: DatabaseKeyLike, asyncOpts_?: {
3670
+ signal: AbortSignal;
3671
+ }): Promise<DatabaseLike>;
3672
+ /**
3673
+ * Open or create a database.
3674
+ */
3675
+ static open(location: string, key: DatabaseKeyLike, asyncOpts_?: {
3676
+ signal: AbortSignal;
3677
+ }): Promise<DatabaseLike>;
3678
+ /**
3679
+ * Close the database.
3680
+ *
3681
+ * Closing the database makes any `PkiEnvironment` and `CoreCrypto` instance created with it unusable.
3682
+ */
3683
+ close(asyncOpts_?: {
3684
+ signal: AbortSignal;
3685
+ }): Promise<void>;
3686
+ /**
3687
+ * Get the location of the database.
3688
+ *
3689
+ * Returns null if the database is in-memory.
3690
+ */
3691
+ getLocation(asyncOpts_?: {
3692
+ signal: AbortSignal;
3693
+ }): Promise<string | undefined>;
3694
+ /**
3695
+ * Updates the key of the database.
3696
+ *
3697
+ * This reencrypts it with the new key.
3698
+ */
3699
+ updateKey(key: DatabaseKeyLike, asyncOpts_?: {
3700
+ signal: AbortSignal;
3701
+ }): Promise<void>;
3702
+ uniffiDestroy(): void;
3703
+ static instanceOf(obj_: any): obj_ is Database;
3704
+ }
3705
+ /**
3706
+ * Callbacks for external calls made by CoreCrypto during X509 credential acquisition.
3707
+ *
3708
+ * When communicating with the Identity Provider (IDP) and Wire server,
3709
+ * CoreCrypto delegates to the client app by calling the relevant methods.
3710
+ *
3711
+ * Client App CoreCrypto Acme IDP
3712
+ * | | | |
3713
+ * | X509CredentialAcquisition().finalize() | |
3714
+ * |-------------------------->| | |
3715
+ * | | GET acme/root.pem | |
3716
+ * | |------------------------> | |
3717
+ * | | 200 OK | |
3718
+ * | |<------------------------ | |
3719
+ * | authenticate() | | |
3720
+ * |<--------------------------| | |
3721
+ * | | Authentication flow | |
3722
+ * | ----------------------------------------------------------------------------> |
3723
+ * |<----------------------------------------------------------------------------- |
3724
+ * | return Success [PKiEnvironmentHooks.authenticate()] | |
3725
+ * |<--------------------------| | |
3726
+ * | | (excluded several calls for brevity) |
3727
+ * | return Success(Credential) [X509CredentialAcquisition().finalize()] |
3728
+ * |<--------------------------| | |
3729
+ */
3730
+ export interface PkiEnvironmentHooks {
3731
+ /**
3732
+ * Make an HTTP request.
3733
+ *
3734
+ * Used for requests to ACME servers, CRL distributors, etc.
3735
+ */
3736
+ httpRequest(method: HttpMethod, url: string, headers: Array<HttpHeader>, body: Uint8Array, asyncOpts_?: {
3737
+ signal: AbortSignal;
3738
+ }): Promise<HttpResponse>;
3739
+ /**
3740
+ * Authenticate with the user's identity provider (IdP)
3741
+ *
3742
+ * The implementation should perform authentication using the authorization code flow
3743
+ * (<https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth>) with the PKCE
3744
+ * (<https://www.rfc-editor.org/rfc/rfc7636>) extension. As part of the authorization
3745
+ * request, the implementation should specify `key_auth` and `acme_aud` claims, along with
3746
+ * their values, in the `claims` parameter. This is to instruct the IdP to add the `key_auth`
3747
+ * and `acme_aud` claims to the ID token that will be returned as part of the access token.
3748
+ *
3749
+ * Once the authentication is completed successfully, the implementation should request
3750
+ * an access token from the IdP, extract the ID token from it and return it to the caller.
3751
+ */
3752
+ authenticate(idp: string, keyAuth: string, acmeAud: string, acquisitionSnapshot: Uint8Array, asyncOpts_?: {
3753
+ signal: AbortSignal;
3754
+ }): Promise<string>;
3755
+ /**
3756
+ * Get a nonce from the backend.
3757
+ */
3758
+ getBackendNonce(asyncOpts_?: {
3759
+ signal: AbortSignal;
3760
+ }): Promise<string>;
3761
+ /**
3762
+ * Fetch an access token to be used for the DPoP challenge (`wire-dpop-01`)
3763
+ *
3764
+ * The implementation should take the provided DPoP token (`dpop`) and make a request to the
3765
+ * backend to obtain an access token, which should be returned to the caller.
3766
+ */
3767
+ fetchBackendAccessToken(dpop: string, asyncOpts_?: {
3768
+ signal: AbortSignal;
3769
+ }): Promise<string>;
3770
+ }
3771
+ type X509CredentialAcquisitionLike = X509CredentialAcquisition;
3772
+ declare class X509CredentialAcquisition extends UniffiAbstractObject {
3773
+ readonly [uniffiTypeNameSymbol] = "X509CredentialAcquisition";
3774
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3775
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3776
+ /**
3777
+ * Create a new credential acquisition
3778
+ */
3779
+ constructor(pkiEnvironment: PkiEnvironmentLike, config: X509CredentialAcquisitionConfiguration);
3780
+ /**
3781
+ * Deserialize a credential acquisition flow.
3782
+ */
3783
+ static fromBytes(pkiEnvironment: PkiEnvironmentLike, bytes: Uint8Array): X509CredentialAcquisitionLike;
3784
+ /**
3785
+ * Create a new credential acquisition from an existing credential. This API is temporary until our system
3786
+ * decouples client identities from a client's public signature key.
3787
+ * See <https://wearezeta.atlassian.net/wiki/x/RABtrQ>.
3788
+ *
3789
+ * Provide `core_crypto_database` if you're using distinct DB instances for `PkiEnvironment` and `CoreCrypto`.
3790
+ * Otherwise, the `PkiEnvironment`'s DB will be used to load the full credential.
3791
+ */
3792
+ static newFromCredentialRef(pkiEnvironment: PkiEnvironmentLike, config: X509CredentialAcquisitionConfiguration, credentialRef: CredentialRefLike, coreCryptoDatabase: DatabaseLike | undefined, asyncOpts_?: {
3793
+ signal: AbortSignal;
3794
+ }): Promise<X509CredentialAcquisitionLike>;
3795
+ /**
3796
+ * Complete the DPoP and OIDC challenges and return the acquired X509 credential.
3797
+ */
3798
+ finalize(asyncOpts_?: {
3799
+ signal: AbortSignal;
3800
+ }): Promise<CredentialLike>;
3801
+ uniffiDestroy(): void;
3802
+ static instanceOf(obj_: any): obj_ is X509CredentialAcquisition;
3803
+ }
3804
+ declare class CoreCryptoContext$1 extends CoreCryptoContext {
3805
+ }
3806
+ export interface CredentialFindFilters {
3807
+ clientId?: ClientId;
3808
+ publicKey?: Uint8Array;
3809
+ cipherSuite?: CipherSuite;
3810
+ credentialType?: CredentialType;
3811
+ earliestValidity?: bigint;
3812
+ }
3813
+ /**
3814
+ * Wrapper for the WASM-compiled version of CoreCrypto
3815
+ */
3816
+ export declare class CoreCrypto extends CoreCryptoFfi {
3817
+ private constructor();
3818
+ /**
3819
+ * Construct a new {@link CoreCrypto} instance.
3820
+ * MLS or proteus can be initialized with {@link CoreCryptoContext.mlsInit} or
3821
+ * {@link CoreCryptoContext.proteusInit}, respectively.
3822
+ */
3823
+ static new(database: Database): CoreCrypto;
3824
+ /**
3825
+ * Instantiate a history client.
3826
+ *
3827
+ * This client exposes the full interface of {@link CoreCrypto}, but it should only be used to decrypt messages.
3828
+ * Other use is a logic error.
3829
+ */
3830
+ static historyClient(historySecret: HistorySecret): Promise<CoreCrypto>;
3831
+ /**
3832
+ * Starts a new transaction in Core Crypto. If the callback succeeds, it will be committed,
3833
+ * otherwise, every operation performed with the context will be discarded.
3834
+ *
3835
+ * @param callback - The callback to execute within the transaction
3836
+ *
3837
+ * @returns the result of the callback will be returned from this call
3838
+ */
3839
+ transaction<R>(callback: (ctx: CoreCryptoContext$1) => Promise<R>): Promise<R>;
3840
+ /**
3841
+ * Get those credentials known to this instance which match the provided filters
3842
+ *
3843
+ * @param findFilters a set of filters defining which credentials are of interest.
3844
+ */
3845
+ findCredentials(findFilters: CredentialFindFilters): Promise<CredentialRef[]>;
3846
+ }
3847
+ declare class X509CredentialAcquisition$1 extends X509CredentialAcquisition {
3848
+ /**
3849
+ * Create a new credential acquisition from an existing credential.
3850
+ * This API is temporary until our system decouples client identities from a client's public signature key.
3851
+ * See <https://wearezeta.atlassian.net/wiki/x/RABtrQ>.
3852
+ *
3853
+ * Provide `coreCryptoDatabase` if you're using distinct DB instances for `PkiEnvironment` and `CoreCrypto`.
3854
+ * Otherwise, the `PkiEnvironment`'s DB will be used to load the full credential.
3855
+ */
3856
+ static newFromCredentialRef(pkiEnvironment: PkiEnvironmentLike, config: X509CredentialAcquisitionConfiguration, credentialRef: CredentialRefLike, coreCryptoDatabase?: DatabaseLike): Promise<X509CredentialAcquisition$1>;
3857
+ }
3858
+ /**
3859
+ * Initialises the wasm module necessary for running core crypto.
3860
+ *
3861
+ * @param location path where the wasm module is located.
3862
+ * If omitted the module is assumed be located at the root of the core crypto module.
3863
+ */
3864
+ export declare function initWasmModule(location?: string | undefined): Promise<void>;
3865
+
3866
+ export {
3867
+ CoreCryptoContext$1 as CoreCryptoContext,
3868
+ Credential$1 as Credential,
3869
+ MlsGroupInfoEncryptionType as GroupInfoEncryptionType,
3870
+ MlsRatchetTreeType as RatchetTreeType,
3871
+ X509CredentialAcquisition$1 as X509CredentialAcquisition,
3872
+ proteusLastResortPrekeyIdFfi as proteusLastResortPrekeyId,
3873
+ };
3874
+
3875
+ export {};