@xmtp/wasm-bindings 1.9.0-rc2 → 1.9.0-rc4

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.
@@ -1,38 +1,62 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): void;
4
- export function applySignatureRequest(host: string, gatewayHost: string | null | undefined, signatureRequest: SignatureRequestHandle): Promise<void>;
5
- export function revokeInstallationsSignatureRequest(host: string, gatewayHost: string | null | undefined, recoveryIdentifier: Identifier, inboxId: string, installationIds: Uint8Array[]): SignatureRequestHandle;
6
- export function metadataFieldName(field: MetadataField): string;
7
3
  export function encodeAttachment(attachment: Attachment): EncodedContent;
8
4
  export function contentTypeAttachment(): ContentTypeId;
9
- export function contentTypeGroupUpdated(): ContentTypeId;
10
- export function contentTypeLeaveRequest(): ContentTypeId;
5
+ export function contentTypeReadReceipt(): ContentTypeId;
6
+ export function encodeReadReceipt(read_receipt: ReadReceipt): EncodedContent;
7
+ export function contentTypeTransactionReference(): ContentTypeId;
8
+ export function encodeTransactionReference(transaction_reference: TransactionReference): EncodedContent;
11
9
  export function contentTypeMultiRemoteAttachment(): ContentTypeId;
12
10
  export function encodeMultiRemoteAttachment(multi_remote_attachment: MultiRemoteAttachment): EncodedContent;
13
- export function contentTypeText(): ContentTypeId;
14
11
  export function encodeText(text: string): EncodedContent;
15
- export function contentTypeIntent(): ContentTypeId;
16
- export function encodeIntent(intent: Intent): EncodedContent;
12
+ export function contentTypeText(): ContentTypeId;
13
+ export function contentTypeReply(): ContentTypeId;
17
14
  export function contentTypeMarkdown(): ContentTypeId;
18
15
  export function encodeMarkdown(text: string): EncodedContent;
19
- export function encodeReaction(reaction: Reaction): EncodedContent;
20
- export function contentTypeReaction(): ContentTypeId;
16
+ export function applySignatureRequest(host: string, gatewayHost: string | null | undefined, signatureRequest: SignatureRequestHandle): Promise<void>;
17
+ export function revokeInstallationsSignatureRequest(host: string, gatewayHost: string | null | undefined, recoveryIdentifier: Identifier, inboxId: string, installationIds: Uint8Array[]): SignatureRequestHandle;
18
+ export function verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): void;
19
+ export function inboxStateFromInboxIds(host: string, gatewayHost: string | null | undefined, inboxIds: string[]): Promise<InboxState[]>;
20
+ export function contentTypeGroupUpdated(): ContentTypeId;
21
+ export function contentTypeLeaveRequest(): ContentTypeId;
22
+ export function encodeRemoteAttachment(remote_attachment: RemoteAttachment): EncodedContent;
23
+ export function contentTypeRemoteAttachment(): ContentTypeId;
21
24
  /**
22
- * Delete a specific database file from OPFS.
23
- * Returns true if the file was deleted, false if it didn't exist.
24
- * Note: The database must be closed before calling this function.
25
+ * Decrypts an encrypted payload from a remote attachment.
25
26
  */
26
- export function opfsDeleteFile(filename: string): Promise<boolean>;
27
+ export function decryptAttachment(encryptedBytes: Uint8Array, remoteAttachment: RemoteAttachment): Attachment;
27
28
  /**
28
- * Initialize the OPFS SQLite VFS if not already initialized.
29
- * This must be called before using other OPFS functions.
29
+ * Encrypts an attachment for storage as a remote attachment.
30
30
  */
31
- export function opfsInit(): Promise<void>;
31
+ export function encryptAttachment(attachment: Attachment): EncryptedAttachment;
32
+ export function encodeWalletSendCalls(wallet_send_calls: WalletSendCalls): EncodedContent;
33
+ export function contentTypeWalletSendCalls(): ContentTypeId;
34
+ export function contentTypeIntent(): ContentTypeId;
35
+ export function encodeIntent(intent: Intent): EncodedContent;
36
+ export function contentTypeActions(): ContentTypeId;
37
+ export function encodeActions(actions: Actions): EncodedContent;
38
+ export function contentTypeReaction(): ContentTypeId;
39
+ export function encodeReaction(reaction: Reaction): EncodedContent;
40
+ export function createClient(host: string, inboxId: string, accountIdentifier: Identifier, dbPath?: string | null, encryptionKey?: Uint8Array | null, deviceSyncServerUrl?: string | null, deviceSyncWorkerMode?: DeviceSyncWorkerMode | null, logOptions?: LogOptions | null, allowOffline?: boolean | null, appVersion?: string | null, gatewayHost?: string | null, nonce?: bigint | null, authCallback?: any | null, authHandle?: AuthHandle | null, clientMode?: ClientMode | null): Promise<Client>;
41
+ export function getInboxIdForIdentifier(host: string, gatewayHost: string | null | undefined, isSecure: boolean, accountIdentifier: Identifier): Promise<string | undefined>;
42
+ export function generateInboxId(accountIdentifier: Identifier, nonce?: bigint | null): string;
43
+ export function metadataFieldName(field: MetadataField): string;
32
44
  /**
33
45
  * Check if a database file exists in OPFS.
34
46
  */
35
47
  export function opfsFileExists(filename: string): Promise<boolean>;
48
+ /**
49
+ * Import a database from a byte array into OPFS.
50
+ * This will overwrite any existing database with the same name.
51
+ * The byte array must contain a valid SQLite database.
52
+ * Note: Any existing database with the same name must be closed before importing.
53
+ */
54
+ export function opfsImportDb(filename: string, data: Uint8Array): Promise<void>;
55
+ /**
56
+ * List all database files stored in OPFS.
57
+ * Returns an array of file names.
58
+ */
59
+ export function opfsListFiles(): Promise<string[]>;
36
60
  /**
37
61
  * Get the number of database files stored in OPFS.
38
62
  */
@@ -42,10 +66,6 @@ export function opfsFileCount(): Promise<number>;
42
66
  * Note: All databases must be closed before calling this function.
43
67
  */
44
68
  export function opfsClearAll(): Promise<void>;
45
- /**
46
- * Get the current capacity of the OPFS file pool.
47
- */
48
- export function opfsPoolCapacity(): Promise<number>;
49
69
  /**
50
70
  * Export a database file from OPFS as a byte array.
51
71
  * This can be used to backup or transfer a database.
@@ -53,40 +73,20 @@ export function opfsPoolCapacity(): Promise<number>;
53
73
  */
54
74
  export function opfsExportDb(filename: string): Promise<Uint8Array>;
55
75
  /**
56
- * List all database files stored in OPFS.
57
- * Returns an array of file names.
58
- */
59
- export function opfsListFiles(): Promise<string[]>;
60
- /**
61
- * Import a database from a byte array into OPFS.
62
- * This will overwrite any existing database with the same name.
63
- * The byte array must contain a valid SQLite database.
64
- * Note: Any existing database with the same name must be closed before importing.
76
+ * Delete a specific database file from OPFS.
77
+ * Returns true if the file was deleted, false if it didn't exist.
78
+ * Note: The database must be closed before calling this function.
65
79
  */
66
- export function opfsImportDb(filename: string, data: Uint8Array): Promise<void>;
67
- export function getInboxIdForIdentifier(host: string, gatewayHost: string | null | undefined, isSecure: boolean, accountIdentifier: Identifier): Promise<string | undefined>;
68
- export function generateInboxId(accountIdentifier: Identifier, nonce?: bigint | null): string;
69
- export function inboxStateFromInboxIds(host: string, gatewayHost: string | null | undefined, inboxIds: string[]): Promise<InboxState[]>;
70
- export function createClient(host: string, inboxId: string, accountIdentifier: Identifier, dbPath?: string | null, encryptionKey?: Uint8Array | null, deviceSyncServerUrl?: string | null, deviceSyncWorkerMode?: DeviceSyncWorkerMode | null, logOptions?: LogOptions | null, allowOffline?: boolean | null, appVersion?: string | null, gatewayHost?: string | null, nonce?: bigint | null, authCallback?: any | null, authHandle?: AuthHandle | null, clientMode?: ClientMode | null): Promise<Client>;
71
- export function encodeReadReceipt(read_receipt: ReadReceipt): EncodedContent;
72
- export function contentTypeReadReceipt(): ContentTypeId;
73
- export function encodeRemoteAttachment(remote_attachment: RemoteAttachment): EncodedContent;
80
+ export function opfsDeleteFile(filename: string): Promise<boolean>;
74
81
  /**
75
- * Decrypts an encrypted payload from a remote attachment.
82
+ * Initialize the OPFS SQLite VFS if not already initialized.
83
+ * This must be called before using other OPFS functions.
76
84
  */
77
- export function decryptAttachment(encryptedBytes: Uint8Array, remoteAttachment: RemoteAttachment): Attachment;
78
- export function contentTypeRemoteAttachment(): ContentTypeId;
85
+ export function opfsInit(): Promise<void>;
79
86
  /**
80
- * Encrypts an attachment for storage as a remote attachment.
87
+ * Get the current capacity of the OPFS file pool.
81
88
  */
82
- export function encryptAttachment(attachment: Attachment): EncryptedAttachment;
83
- export function encodeWalletSendCalls(wallet_send_calls: WalletSendCalls): EncodedContent;
84
- export function contentTypeWalletSendCalls(): ContentTypeId;
85
- export function contentTypeTransactionReference(): ContentTypeId;
86
- export function encodeTransactionReference(transaction_reference: TransactionReference): EncodedContent;
87
- export function contentTypeReply(): ContentTypeId;
88
- export function encodeActions(actions: Actions): EncodedContent;
89
- export function contentTypeActions(): ContentTypeId;
89
+ export function opfsPoolCapacity(): Promise<number>;
90
90
  /**
91
91
  * Entry point invoked by JavaScript in a worker.
92
92
  */
@@ -231,6 +231,76 @@ export enum SortDirection {
231
231
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
232
232
  */
233
233
  type ReadableStreamType = "bytes";
234
+ export interface Attachment {
235
+ filename?: string;
236
+ mimeType: string;
237
+ content: Uint8Array;
238
+ }
239
+
240
+ export type ReadReceipt = Record<string, never>;
241
+
242
+ export interface TransactionMetadata {
243
+ transactionType: string;
244
+ currency: string;
245
+ amount: number;
246
+ decimals: number;
247
+ fromAddress: string;
248
+ toAddress: string;
249
+ }
250
+
251
+ export interface TransactionReference {
252
+ namespace?: string;
253
+ networkId: string;
254
+ reference: string;
255
+ metadata?: TransactionMetadata;
256
+ }
257
+
258
+ export type DecodedMessageContent = { type: "actions"; content: Actions | undefined } | { type: "attachment"; content: Attachment } | { type: "custom"; content: EncodedContent } | { type: "groupUpdated"; content: GroupUpdated } | { type: "intent"; content: Intent | undefined } | { type: "leaveRequest"; content: LeaveRequest } | { type: "markdown"; content: string } | { type: "multiRemoteAttachment"; content: MultiRemoteAttachment } | { type: "reaction"; content: Reaction } | { type: "readReceipt"; content: ReadReceipt } | { type: "remoteAttachment"; content: RemoteAttachment } | { type: "reply"; content: EnrichedReply } | { type: "text"; content: string } | { type: "transactionReference"; content: TransactionReference } | { type: "walletSendCalls"; content: WalletSendCalls } | { type: "deletedMessage"; content: DeletedMessage };
259
+
260
+ export interface RemoteAttachmentInfo {
261
+ secret: Uint8Array;
262
+ contentDigest: string;
263
+ nonce: Uint8Array;
264
+ scheme: string;
265
+ url: string;
266
+ salt: Uint8Array;
267
+ contentLength?: number;
268
+ filename?: string;
269
+ }
270
+
271
+ export interface MultiRemoteAttachment {
272
+ attachments: RemoteAttachmentInfo[];
273
+ }
274
+
275
+ export interface EnrichedReply {
276
+ referenceId: string;
277
+ content: DecodedMessageContent;
278
+ inReplyTo?: DecodedMessage;
279
+ }
280
+
281
+ export interface Reply {
282
+ content: EncodedContent;
283
+ reference: string;
284
+ referenceInboxId?: string;
285
+ }
286
+
287
+ export interface EncodedContent {
288
+ type?: ContentTypeId;
289
+ parameters: Record<string, string>;
290
+ fallback?: string;
291
+ compression?: number;
292
+ content: Uint8Array;
293
+ }
294
+
295
+ export interface ContentTypeId {
296
+ authorityId: string;
297
+ typeId: string;
298
+ versionMajor: number;
299
+ versionMinor: number;
300
+ }
301
+
302
+ export type UserPreferenceUpdate = { type: "ConsentUpdate"; consent: Consent } | { type: "HmacKeyUpdate"; key: number[] };
303
+
234
304
  export interface PasskeySignature {
235
305
  publicKey: Uint8Array;
236
306
  signature: Uint8Array;
@@ -238,26 +308,27 @@ export interface PasskeySignature {
238
308
  clientDataJson: Uint8Array;
239
309
  }
240
310
 
241
- export interface PermissionPolicySet {
242
- addMemberPolicy: PermissionPolicy;
243
- removeMemberPolicy: PermissionPolicy;
244
- addAdminPolicy: PermissionPolicy;
245
- removeAdminPolicy: PermissionPolicy;
246
- updateGroupNamePolicy: PermissionPolicy;
247
- updateGroupDescriptionPolicy: PermissionPolicy;
248
- updateGroupImageUrlSquarePolicy: PermissionPolicy;
249
- updateMessageDisappearingPolicy: PermissionPolicy;
250
- updateAppDataPolicy: PermissionPolicy;
311
+ export interface Lifetime {
312
+ notBefore: bigint;
313
+ notAfter: bigint;
251
314
  }
252
315
 
253
- export interface GroupPermissions {
254
- policyType: GroupPermissionsOptions;
255
- policySet: PermissionPolicySet;
316
+ export interface InboxState {
317
+ inboxId: string;
318
+ recoveryIdentifier: Identifier;
319
+ installations: Installation[];
320
+ accountIdentifiers: Identifier[];
256
321
  }
257
322
 
258
- export interface SendMessageOpts {
259
- shouldPush: boolean;
260
- optimistic?: boolean;
323
+ export interface Installation {
324
+ bytes: Uint8Array;
325
+ id: string;
326
+ clientTimestampNs?: bigint;
327
+ }
328
+
329
+ export interface KeyPackageStatus {
330
+ lifetime?: Lifetime;
331
+ validationError?: string;
261
332
  }
262
333
 
263
334
  export interface GroupMember {
@@ -273,18 +344,17 @@ export interface GroupMetadata {
273
344
  conversationType: ConversationType;
274
345
  }
275
346
 
347
+ export interface SendMessageOpts {
348
+ shouldPush: boolean;
349
+ optimistic?: boolean;
350
+ }
351
+
276
352
  export interface Consent {
277
353
  entityType: ConsentEntityType;
278
354
  state: ConsentState;
279
355
  entity: string;
280
356
  }
281
357
 
282
- export interface Attachment {
283
- filename?: string;
284
- mimeType: string;
285
- content: Uint8Array;
286
- }
287
-
288
358
  export interface MetadataFieldChange {
289
359
  fieldName: string;
290
360
  oldValue?: string;
@@ -311,27 +381,88 @@ export interface LeaveRequest {
311
381
  authenticatedNote?: Uint8Array;
312
382
  }
313
383
 
314
- export interface MultiRemoteAttachment {
315
- attachments: RemoteAttachmentInfo[];
316
- }
317
-
318
- export interface RemoteAttachmentInfo {
319
- secret: Uint8Array;
384
+ export interface RemoteAttachment {
385
+ url: string;
320
386
  contentDigest: string;
387
+ secret: Uint8Array;
388
+ salt: Uint8Array;
321
389
  nonce: Uint8Array;
322
390
  scheme: string;
323
- url: string;
391
+ contentLength: number;
392
+ filename?: string;
393
+ }
394
+
395
+ /**
396
+ * Result of encrypting an attachment for remote storage.
397
+ */
398
+ export interface EncryptedAttachment {
399
+ /**
400
+ * The encrypted bytes to upload to the remote server
401
+ */
402
+ payload: Uint8Array;
403
+ /**
404
+ * SHA-256 digest of the encrypted bytes (hex-encoded)
405
+ */
406
+ contentDigest: string;
407
+ /**
408
+ * The 32-byte secret key needed for decryption
409
+ */
410
+ secret: Uint8Array;
411
+ /**
412
+ * The 32-byte salt used in key derivation
413
+ */
324
414
  salt: Uint8Array;
325
- contentLength?: number;
415
+ /**
416
+ * The 12-byte nonce used in encryption
417
+ */
418
+ nonce: Uint8Array;
419
+ /**
420
+ * The length of the encrypted content
421
+ */
422
+ contentLength: number;
423
+ /**
424
+ * The filename of the attachment
425
+ */
326
426
  filename?: string;
327
427
  }
328
428
 
429
+ export interface WalletSendCalls {
430
+ version: string;
431
+ chainId: string;
432
+ from: string;
433
+ calls: WalletCall[];
434
+ capabilities?: Record<string, string>;
435
+ }
436
+
437
+ export interface WalletCall {
438
+ to?: string;
439
+ data?: string;
440
+ value?: string;
441
+ gas?: string;
442
+ metadata?: Record<string, string>;
443
+ }
444
+
329
445
  export interface Intent {
330
446
  id: string;
331
447
  actionId: string;
332
448
  metadata?: Record<string, string | number | boolean | null>;
333
449
  }
334
450
 
451
+ export interface Actions {
452
+ id: string;
453
+ description: string;
454
+ actions: Action[];
455
+ expiresAtNs?: bigint;
456
+ }
457
+
458
+ export interface Action {
459
+ id: string;
460
+ label: string;
461
+ imageUrl?: string;
462
+ style?: ActionStyle;
463
+ expiresAtNs?: bigint;
464
+ }
465
+
335
466
  export interface Reaction {
336
467
  reference: string;
337
468
  referenceInboxId: string;
@@ -340,31 +471,16 @@ export interface Reaction {
340
471
  schema: ReactionSchema;
341
472
  }
342
473
 
343
- export interface ConversationDebugInfo {
344
- epoch: bigint;
345
- maybeForked: boolean;
346
- forkDetails: string;
347
- isCommitLogForked?: boolean;
348
- localCommitLog: string;
349
- remoteCommitLog: string;
350
- cursor: Cursor[];
351
- }
352
-
353
- export interface CreateGroupOptions {
354
- permissions?: GroupPermissionsOptions;
355
- groupName?: string;
356
- groupImageUrlSquare?: string;
357
- groupDescription?: string;
358
- customPermissionPolicySet?: PermissionPolicySet;
359
- messageDisappearingSettings?: MessageDisappearingSettings;
360
- appData?: string;
361
- }
362
-
363
474
  export interface HmacKey {
364
475
  key: Uint8Array;
365
476
  epoch: bigint;
366
477
  }
367
478
 
479
+ export interface Cursor {
480
+ originatorId: number;
481
+ sequenceId: bigint;
482
+ }
483
+
368
484
  export interface ListConversationsOptions {
369
485
  consentStates?: ConsentState[];
370
486
  conversationType?: ConversationType;
@@ -375,11 +491,6 @@ export interface ListConversationsOptions {
375
491
  limit?: bigint;
376
492
  }
377
493
 
378
- export interface Cursor {
379
- originatorId: number;
380
- sequenceId: bigint;
381
- }
382
-
383
494
  export interface CreateDmOptions {
384
495
  messageDisappearingSettings?: MessageDisappearingSettings;
385
496
  }
@@ -389,247 +500,136 @@ export interface MessageDisappearingSettings {
389
500
  inNs: bigint;
390
501
  }
391
502
 
392
- export interface IdentityStats {
393
- publishIdentityUpdate: bigint;
394
- getIdentityUpdatesV2: bigint;
395
- getInboxIds: bigint;
396
- verifySmartContractWalletSignature: bigint;
397
- }
398
-
399
- export interface Identifier {
400
- identifier: string;
401
- identifierKind: IdentifierKind;
402
- }
403
-
404
- export interface ApiStats {
405
- uploadKeyPackage: bigint;
406
- fetchKeyPackage: bigint;
407
- sendGroupMessages: bigint;
408
- sendWelcomeMessages: bigint;
409
- queryGroupMessages: bigint;
410
- queryWelcomeMessages: bigint;
411
- subscribeMessages: bigint;
412
- subscribeWelcomes: bigint;
503
+ export interface ConversationDebugInfo {
504
+ epoch: bigint;
505
+ maybeForked: boolean;
506
+ forkDetails: string;
507
+ isCommitLogForked?: boolean;
508
+ localCommitLog: string;
509
+ remoteCommitLog: string;
510
+ cursor: Cursor[];
413
511
  }
414
512
 
415
- export interface ListMessagesOptions {
416
- contentTypes?: ContentType[];
417
- excludeContentTypes?: ContentType[];
418
- sentBeforeNs?: bigint;
419
- sentAfterNs?: bigint;
420
- limit?: bigint;
421
- deliveryStatus?: DeliveryStatus;
422
- direction?: SortDirection;
423
- kind?: GroupMessageKind;
424
- excludeSenderInboxIds?: string[];
425
- sortBy?: MessageSortBy;
426
- insertedAfterNs?: bigint;
427
- insertedBeforeNs?: bigint;
513
+ export interface CreateGroupOptions {
514
+ permissions?: GroupPermissionsOptions;
515
+ groupName?: string;
516
+ groupImageUrlSquare?: string;
517
+ groupDescription?: string;
518
+ customPermissionPolicySet?: PermissionPolicySet;
519
+ messageDisappearingSettings?: MessageDisappearingSettings;
520
+ appData?: string;
428
521
  }
429
522
 
430
- export interface Message {
523
+ export interface DecodedMessage {
431
524
  id: string;
432
525
  sentAtNs: bigint;
433
- convoId: string;
434
- senderInboxId: string;
435
- content: EncodedContent;
436
526
  kind: GroupMessageKind;
437
- deliveryStatus: DeliveryStatus;
438
- }
439
-
440
- export interface Lifetime {
441
- notBefore: bigint;
442
- notAfter: bigint;
443
- }
444
-
445
- export interface InboxState {
446
- inboxId: string;
447
- recoveryIdentifier: Identifier;
448
- installations: Installation[];
449
- accountIdentifiers: Identifier[];
450
- }
451
-
452
- export interface KeyPackageStatus {
453
- lifetime?: Lifetime;
454
- validationError?: string;
455
- }
456
-
457
- export interface Installation {
458
- bytes: Uint8Array;
459
- id: string;
460
- clientTimestampNs?: bigint;
461
- }
462
-
463
- export interface Credential {
464
- name?: string;
465
- value: string;
466
- expiresAtSeconds: bigint;
467
- }
468
-
469
- /**
470
- * Specify options for the logger
471
- */
472
- export interface LogOptions {
473
- /**
474
- * enable structured JSON logging to stdout. Useful for third-party log viewers
475
- */
476
- structured?: boolean;
477
- /**
478
- * enable performance metrics for libxmtp in the `performance` tab
479
- */
480
- performance?: boolean;
481
- /**
482
- * filter for logs
483
- */
484
- level?: LogLevel;
485
- }
486
-
487
- export interface GroupSyncSummary {
488
- numEligible: number;
489
- numSynced: number;
490
- }
491
-
492
- export type ReadReceipt = Record<string, never>;
493
-
494
- /**
495
- * Result of encrypting an attachment for remote storage.
496
- */
497
- export interface EncryptedAttachment {
498
- /**
499
- * The encrypted bytes to upload to the remote server
500
- */
501
- payload: Uint8Array;
502
- /**
503
- * SHA-256 digest of the encrypted bytes (hex-encoded)
504
- */
505
- contentDigest: string;
506
- /**
507
- * The 32-byte secret key needed for decryption
508
- */
509
- secret: Uint8Array;
510
- /**
511
- * The 32-byte salt used in key derivation
512
- */
513
- salt: Uint8Array;
514
- /**
515
- * The 12-byte nonce used in encryption
516
- */
517
- nonce: Uint8Array;
518
- /**
519
- * The length of the encrypted content
520
- */
521
- contentLength: number;
522
- /**
523
- * The filename of the attachment
524
- */
525
- filename?: string;
526
- }
527
-
528
- export interface RemoteAttachment {
529
- url: string;
530
- contentDigest: string;
531
- secret: Uint8Array;
532
- salt: Uint8Array;
533
- nonce: Uint8Array;
534
- scheme: string;
535
- contentLength: number;
536
- filename?: string;
537
- }
538
-
539
- export interface WalletCall {
540
- to?: string;
541
- data?: string;
542
- value?: string;
543
- gas?: string;
544
- metadata?: Record<string, string>;
527
+ senderInstallationId: string;
528
+ senderInboxId: string;
529
+ contentType: ContentTypeId;
530
+ conversationId: string;
531
+ content: DecodedMessageContent;
532
+ fallback?: string;
533
+ reactions: DecodedMessage[];
534
+ deliveryStatus: DeliveryStatus;
535
+ numReplies: bigint;
536
+ expiresAtNs: bigint | undefined;
545
537
  }
546
538
 
547
- export interface WalletSendCalls {
548
- version: string;
549
- chainId: string;
550
- from: string;
551
- calls: WalletCall[];
552
- capabilities?: Record<string, string>;
539
+ export interface GroupSyncSummary {
540
+ numEligible: number;
541
+ numSynced: number;
553
542
  }
554
543
 
555
- export interface TransactionMetadata {
556
- transactionType: string;
557
- currency: string;
558
- amount: number;
559
- decimals: number;
560
- fromAddress: string;
561
- toAddress: string;
544
+ /**
545
+ * Specify options for the logger
546
+ */
547
+ export interface LogOptions {
548
+ /**
549
+ * enable structured JSON logging to stdout. Useful for third-party log viewers
550
+ */
551
+ structured?: boolean;
552
+ /**
553
+ * enable performance metrics for libxmtp in the `performance` tab
554
+ */
555
+ performance?: boolean;
556
+ /**
557
+ * filter for logs
558
+ */
559
+ level?: LogLevel;
562
560
  }
563
561
 
564
- export interface TransactionReference {
565
- namespace?: string;
566
- networkId: string;
567
- reference: string;
568
- metadata?: TransactionMetadata;
562
+ export interface GroupPermissions {
563
+ policyType: GroupPermissionsOptions;
564
+ policySet: PermissionPolicySet;
569
565
  }
570
566
 
571
- export type DecodedMessageContent = { type: "actions"; content: Actions | undefined } | { type: "attachment"; content: Attachment } | { type: "custom"; content: EncodedContent } | { type: "groupUpdated"; content: GroupUpdated } | { type: "intent"; content: Intent | undefined } | { type: "leaveRequest"; content: LeaveRequest } | { type: "markdown"; content: string } | { type: "multiRemoteAttachment"; content: MultiRemoteAttachment } | { type: "reaction"; content: Reaction } | { type: "readReceipt"; content: ReadReceipt } | { type: "remoteAttachment"; content: RemoteAttachment } | { type: "reply"; content: EnrichedReply } | { type: "text"; content: string } | { type: "transactionReference"; content: TransactionReference } | { type: "walletSendCalls"; content: WalletSendCalls } | { type: "deletedMessage"; content: DeletedMessage };
572
-
573
- export interface EnrichedReply {
574
- referenceId: string;
575
- content: DecodedMessageContent;
576
- inReplyTo?: DecodedMessage;
567
+ export interface PermissionPolicySet {
568
+ addMemberPolicy: PermissionPolicy;
569
+ removeMemberPolicy: PermissionPolicy;
570
+ addAdminPolicy: PermissionPolicy;
571
+ removeAdminPolicy: PermissionPolicy;
572
+ updateGroupNamePolicy: PermissionPolicy;
573
+ updateGroupDescriptionPolicy: PermissionPolicy;
574
+ updateGroupImageUrlSquarePolicy: PermissionPolicy;
575
+ updateMessageDisappearingPolicy: PermissionPolicy;
576
+ updateAppDataPolicy: PermissionPolicy;
577
577
  }
578
578
 
579
- export interface Reply {
580
- content: EncodedContent;
581
- reference: string;
582
- referenceInboxId?: string;
579
+ export interface Credential {
580
+ name?: string;
581
+ value: string;
582
+ expiresAtSeconds: bigint;
583
583
  }
584
584
 
585
- export interface Action {
586
- id: string;
587
- label: string;
588
- imageUrl?: string;
589
- style?: ActionStyle;
590
- expiresAtNs?: bigint;
585
+ export interface Identifier {
586
+ identifier: string;
587
+ identifierKind: IdentifierKind;
591
588
  }
592
589
 
593
- export interface Actions {
594
- id: string;
595
- description: string;
596
- actions: Action[];
597
- expiresAtNs?: bigint;
590
+ export interface ApiStats {
591
+ uploadKeyPackage: bigint;
592
+ fetchKeyPackage: bigint;
593
+ sendGroupMessages: bigint;
594
+ sendWelcomeMessages: bigint;
595
+ queryGroupMessages: bigint;
596
+ queryWelcomeMessages: bigint;
597
+ subscribeMessages: bigint;
598
+ subscribeWelcomes: bigint;
598
599
  }
599
600
 
600
- export interface EncodedContent {
601
- type?: ContentTypeId;
602
- parameters: Record<string, string>;
603
- fallback?: string;
604
- compression?: number;
605
- content: Uint8Array;
601
+ export interface IdentityStats {
602
+ publishIdentityUpdate: bigint;
603
+ getIdentityUpdatesV2: bigint;
604
+ getInboxIds: bigint;
605
+ verifySmartContractWalletSignature: bigint;
606
606
  }
607
607
 
608
- export interface ContentTypeId {
609
- authorityId: string;
610
- typeId: string;
611
- versionMajor: number;
612
- versionMinor: number;
608
+ export interface ListMessagesOptions {
609
+ contentTypes?: ContentType[];
610
+ excludeContentTypes?: ContentType[];
611
+ sentBeforeNs?: bigint;
612
+ sentAfterNs?: bigint;
613
+ limit?: bigint;
614
+ deliveryStatus?: DeliveryStatus;
615
+ direction?: SortDirection;
616
+ kind?: GroupMessageKind;
617
+ excludeSenderInboxIds?: string[];
618
+ sortBy?: MessageSortBy;
619
+ insertedAfterNs?: bigint;
620
+ insertedBeforeNs?: bigint;
613
621
  }
614
622
 
615
- export interface DecodedMessage {
623
+ export interface Message {
616
624
  id: string;
617
625
  sentAtNs: bigint;
618
- kind: GroupMessageKind;
619
- senderInstallationId: string;
626
+ convoId: string;
620
627
  senderInboxId: string;
621
- contentType: ContentTypeId;
622
- conversationId: string;
623
- content: DecodedMessageContent;
624
- fallback?: string;
625
- reactions: DecodedMessage[];
628
+ content: EncodedContent;
629
+ kind: GroupMessageKind;
626
630
  deliveryStatus: DeliveryStatus;
627
- numReplies: bigint;
628
- expiresAtNs: bigint | undefined;
629
631
  }
630
632
 
631
- export type UserPreferenceUpdate = { type: "ConsentUpdate"; consent: Consent } | { type: "HmacKeyUpdate"; key: number[] };
632
-
633
633
  export class AuthHandle {
634
634
  free(): void;
635
635
  [Symbol.dispose](): void;
@@ -651,8 +651,6 @@ export class Client {
651
651
  revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle>;
652
652
  changeRecoveryIdentifierSignatureRequest(newRecoveryIdentifier: Identifier): Promise<SignatureRequestHandle>;
653
653
  revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle | undefined>;
654
- getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>;
655
- setConsentStates(records: Consent[]): Promise<void>;
656
654
  /**
657
655
  *
658
656
  * * Get the client's inbox state.
@@ -671,6 +669,8 @@ export class Client {
671
669
  *
672
670
  */
673
671
  getKeyPackageStatusesForInstallationIds(installationIds: string[]): Promise<any>;
672
+ getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>;
673
+ setConsentStates(records: Consent[]): Promise<void>;
674
674
  /**
675
675
  * Output booleans should be zipped with the index of input identifiers
676
676
  */
@@ -877,6 +877,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
877
877
 
878
878
  export interface InitOutput {
879
879
  readonly memory: WebAssembly.Memory;
880
+ readonly contentTypeAttachment: () => any;
881
+ readonly contentTypeMarkdown: () => any;
882
+ readonly contentTypeMultiRemoteAttachment: () => any;
883
+ readonly contentTypeReadReceipt: () => any;
884
+ readonly contentTypeReply: () => any;
885
+ readonly contentTypeText: () => any;
886
+ readonly contentTypeTransactionReference: () => any;
887
+ readonly encodeAttachment: (a: any) => [number, number, number];
888
+ readonly encodeMarkdown: (a: number, b: number) => [number, number, number];
889
+ readonly encodeMultiRemoteAttachment: (a: any) => [number, number, number];
890
+ readonly encodeReadReceipt: (a: any) => [number, number, number];
891
+ readonly encodeText: (a: number, b: number) => [number, number, number];
892
+ readonly encodeTransactionReference: (a: any) => [number, number, number];
893
+ readonly __wbg_client_free: (a: number, b: number) => void;
880
894
  readonly __wbg_conversation_free: (a: number, b: number) => void;
881
895
  readonly __wbg_conversationlistitem_free: (a: number, b: number) => void;
882
896
  readonly __wbg_conversations_free: (a: number, b: number) => void;
@@ -894,26 +908,45 @@ export interface InitOutput {
894
908
  readonly __wbg_signaturerequesthandle_free: (a: number, b: number) => void;
895
909
  readonly __wbg_streamcloser_free: (a: number, b: number) => void;
896
910
  readonly applySignatureRequest: (a: number, b: number, c: number, d: number, e: number) => any;
911
+ readonly client_accountIdentifier: (a: number) => any;
897
912
  readonly client_addWalletSignatureRequest: (a: number, b: any) => any;
913
+ readonly client_apiAggregateStatistics: (a: number) => [number, number];
914
+ readonly client_apiIdentityStatistics: (a: number) => any;
915
+ readonly client_apiStatistics: (a: number) => any;
916
+ readonly client_appVersion: (a: number) => [number, number];
898
917
  readonly client_applySignatureRequest: (a: number, b: number) => any;
918
+ readonly client_canMessage: (a: number, b: number, c: number) => any;
899
919
  readonly client_changeRecoveryIdentifierSignatureRequest: (a: number, b: any) => any;
920
+ readonly client_clearAllStatistics: (a: number) => void;
921
+ readonly client_conversations: (a: number) => number;
900
922
  readonly client_createInboxSignatureRequest: (a: number) => [number, number, number];
923
+ readonly client_findInboxIdByIdentifier: (a: number, b: any) => any;
901
924
  readonly client_getConsentState: (a: number, b: number, c: number, d: number) => any;
925
+ readonly client_getKeyPackageStatusesForInstallationIds: (a: number, b: number, c: number) => any;
926
+ readonly client_getLatestInboxState: (a: number, b: number, c: number) => any;
927
+ readonly client_inboxId: (a: number) => [number, number];
928
+ readonly client_inboxState: (a: number, b: number) => any;
929
+ readonly client_inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
930
+ readonly client_installationId: (a: number) => [number, number];
931
+ readonly client_installationIdBytes: (a: number) => any;
932
+ readonly client_isRegistered: (a: number) => number;
933
+ readonly client_libxmtpVersion: (a: number) => [number, number];
902
934
  readonly client_registerIdentity: (a: number, b: number) => any;
903
935
  readonly client_revokeAllOtherInstallationsSignatureRequest: (a: number) => any;
904
936
  readonly client_revokeInstallationsSignatureRequest: (a: number, b: number, c: number) => any;
905
937
  readonly client_revokeWalletSignatureRequest: (a: number, b: any) => any;
938
+ readonly client_sendSyncRequest: (a: number) => any;
906
939
  readonly client_setConsentStates: (a: number, b: number, c: number) => any;
907
940
  readonly client_signWithInstallationKey: (a: number, b: number, c: number) => [number, number, number];
941
+ readonly client_syncPreferences: (a: number) => any;
908
942
  readonly client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
909
- readonly contentTypeAttachment: () => any;
943
+ readonly contentTypeActions: () => any;
910
944
  readonly contentTypeGroupUpdated: () => any;
911
945
  readonly contentTypeIntent: () => any;
912
946
  readonly contentTypeLeaveRequest: () => any;
913
- readonly contentTypeMarkdown: () => any;
914
- readonly contentTypeMultiRemoteAttachment: () => any;
915
947
  readonly contentTypeReaction: () => any;
916
- readonly contentTypeText: () => any;
948
+ readonly contentTypeRemoteAttachment: () => any;
949
+ readonly contentTypeWalletSendCalls: () => any;
917
950
  readonly conversation_addAdmin: (a: number, b: number, c: number) => any;
918
951
  readonly conversation_addMembers: (a: number, b: number, c: number) => any;
919
952
  readonly conversation_addMembersByInboxId: (a: number, b: number, c: number) => any;
@@ -999,24 +1032,17 @@ export interface InitOutput {
999
1032
  readonly conversations_streamPreferences: (a: number, b: any) => [number, number, number];
1000
1033
  readonly conversations_sync: (a: number) => any;
1001
1034
  readonly conversations_syncAllConversations: (a: number, b: number, c: number) => any;
1002
- readonly encodeAttachment: (a: any) => [number, number, number];
1035
+ readonly createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: bigint, t: number, u: number, v: number) => any;
1036
+ readonly decryptAttachment: (a: number, b: number, c: any) => [number, number, number];
1037
+ readonly encodeActions: (a: any) => [number, number, number];
1003
1038
  readonly encodeIntent: (a: any) => [number, number, number];
1004
- readonly encodeMarkdown: (a: number, b: number) => [number, number, number];
1005
- readonly encodeMultiRemoteAttachment: (a: any) => [number, number, number];
1006
1039
  readonly encodeReaction: (a: any) => [number, number, number];
1007
- readonly encodeText: (a: number, b: number) => [number, number, number];
1040
+ readonly encodeRemoteAttachment: (a: any) => [number, number, number];
1041
+ readonly encodeWalletSendCalls: (a: any) => [number, number, number];
1042
+ readonly encryptAttachment: (a: any) => [number, number, number];
1008
1043
  readonly generateInboxId: (a: any, b: number, c: bigint) => [number, number, number, number];
1009
1044
  readonly getInboxIdForIdentifier: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
1010
- readonly metadataFieldName: (a: number) => [number, number];
1011
- readonly opfsClearAll: () => any;
1012
- readonly opfsDeleteFile: (a: number, b: number) => any;
1013
- readonly opfsExportDb: (a: number, b: number) => any;
1014
- readonly opfsFileCount: () => any;
1015
- readonly opfsFileExists: (a: number, b: number) => any;
1016
- readonly opfsImportDb: (a: number, b: number, c: any) => any;
1017
- readonly opfsInit: () => any;
1018
- readonly opfsListFiles: () => any;
1019
- readonly opfsPoolCapacity: () => any;
1045
+ readonly inboxStateFromInboxIds: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
1020
1046
  readonly revokeInstallationsSignatureRequest: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number) => [number, number, number];
1021
1047
  readonly signaturerequesthandle_addEcdsaSignature: (a: number, b: any) => any;
1022
1048
  readonly signaturerequesthandle_addPasskeySignature: (a: number, b: any) => any;
@@ -1031,42 +1057,16 @@ export interface InitOutput {
1031
1057
  readonly authhandle_id: (a: number) => number;
1032
1058
  readonly authhandle_new: () => number;
1033
1059
  readonly authhandle_set: (a: number, b: any) => any;
1034
- readonly client_getKeyPackageStatusesForInstallationIds: (a: number, b: number, c: number) => any;
1035
- readonly client_getLatestInboxState: (a: number, b: number, c: number) => any;
1036
- readonly client_inboxState: (a: number, b: number) => any;
1037
- readonly inboxStateFromInboxIds: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
1038
- readonly __wbg_client_free: (a: number, b: number) => void;
1039
- readonly client_accountIdentifier: (a: number) => any;
1040
- readonly client_apiAggregateStatistics: (a: number) => [number, number];
1041
- readonly client_apiIdentityStatistics: (a: number) => any;
1042
- readonly client_apiStatistics: (a: number) => any;
1043
- readonly client_appVersion: (a: number) => [number, number];
1044
- readonly client_canMessage: (a: number, b: number, c: number) => any;
1045
- readonly client_clearAllStatistics: (a: number) => void;
1046
- readonly client_conversations: (a: number) => number;
1047
- readonly client_findInboxIdByIdentifier: (a: number, b: any) => any;
1048
- readonly client_inboxId: (a: number) => [number, number];
1049
- readonly client_inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
1050
- readonly client_installationId: (a: number) => [number, number];
1051
- readonly client_installationIdBytes: (a: number) => any;
1052
- readonly client_isRegistered: (a: number) => number;
1053
- readonly client_libxmtpVersion: (a: number) => [number, number];
1054
- readonly client_sendSyncRequest: (a: number) => any;
1055
- readonly client_syncPreferences: (a: number) => any;
1056
- readonly createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: bigint, t: number, u: number, v: number) => any;
1057
- readonly contentTypeActions: () => any;
1058
- readonly contentTypeReadReceipt: () => any;
1059
- readonly contentTypeRemoteAttachment: () => any;
1060
- readonly contentTypeReply: () => any;
1061
- readonly contentTypeTransactionReference: () => any;
1062
- readonly contentTypeWalletSendCalls: () => any;
1063
- readonly decryptAttachment: (a: number, b: number, c: any) => [number, number, number];
1064
- readonly encodeActions: (a: any) => [number, number, number];
1065
- readonly encodeReadReceipt: (a: any) => [number, number, number];
1066
- readonly encodeRemoteAttachment: (a: any) => [number, number, number];
1067
- readonly encodeTransactionReference: (a: any) => [number, number, number];
1068
- readonly encodeWalletSendCalls: (a: any) => [number, number, number];
1069
- readonly encryptAttachment: (a: any) => [number, number, number];
1060
+ readonly metadataFieldName: (a: number) => [number, number];
1061
+ readonly opfsClearAll: () => any;
1062
+ readonly opfsDeleteFile: (a: number, b: number) => any;
1063
+ readonly opfsExportDb: (a: number, b: number) => any;
1064
+ readonly opfsFileCount: () => any;
1065
+ readonly opfsFileExists: (a: number, b: number) => any;
1066
+ readonly opfsImportDb: (a: number, b: number, c: any) => any;
1067
+ readonly opfsInit: () => any;
1068
+ readonly opfsListFiles: () => any;
1069
+ readonly opfsPoolCapacity: () => any;
1070
1070
  readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
1071
1071
  readonly rust_zstd_wasm_shim_free: (a: number) => void;
1072
1072
  readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
@@ -1089,25 +1089,25 @@ export interface InitOutput {
1089
1089
  readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
1090
1090
  readonly intounderlyingsource_cancel: (a: number) => void;
1091
1091
  readonly intounderlyingsource_pull: (a: number, b: any) => any;
1092
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
1093
- readonly intounderlyingsink_abort: (a: number, b: any) => any;
1094
- readonly intounderlyingsink_close: (a: number) => any;
1095
- readonly intounderlyingsink_write: (a: number, b: any) => any;
1096
1092
  readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
1097
1093
  readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
1098
1094
  readonly intounderlyingbytesource_cancel: (a: number) => void;
1099
1095
  readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
1100
1096
  readonly intounderlyingbytesource_start: (a: number, b: any) => void;
1101
1097
  readonly intounderlyingbytesource_type: (a: number) => number;
1102
- readonly wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005: (a: number, b: number) => void;
1103
- readonly wasm_bindgen__closure__destroy__h3c5639ee43c80f22: (a: number, b: number) => void;
1104
- readonly wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040: (a: number, b: number) => void;
1105
- readonly wasm_bindgen__closure__destroy__hfbd660e60d498df9: (a: number, b: number) => void;
1106
- readonly wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6: (a: number, b: number, c: any) => void;
1107
- readonly wasm_bindgen__closure__destroy__hed8af60076250245: (a: number, b: number) => void;
1108
- readonly wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1: (a: number, b: number) => void;
1109
- readonly wasm_bindgen__closure__destroy__he7b712e0eb1b5ac1: (a: number, b: number) => void;
1110
- readonly wasm_bindgen__convert__closures_____invoke__h47a8fb56fc48c5fb: (a: number, b: number, c: any, d: any) => void;
1098
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
1099
+ readonly intounderlyingsink_abort: (a: number, b: any) => any;
1100
+ readonly intounderlyingsink_close: (a: number) => any;
1101
+ readonly intounderlyingsink_write: (a: number, b: any) => any;
1102
+ readonly wasm_bindgen__convert__closures_____invoke__hb3ea4cec5b2a99b4: (a: number, b: number) => void;
1103
+ readonly wasm_bindgen__closure__destroy__h3dd912ac8e2d6083: (a: number, b: number) => void;
1104
+ readonly wasm_bindgen__convert__closures_____invoke__ha66b59b58c7b6e14: (a: number, b: number) => void;
1105
+ readonly wasm_bindgen__closure__destroy__h43bd69f6f2f23fdf: (a: number, b: number) => void;
1106
+ readonly wasm_bindgen__convert__closures_____invoke__h57fa53c0b5bdcaf1: (a: number, b: number) => void;
1107
+ readonly wasm_bindgen__closure__destroy__hdc965c5deda6531b: (a: number, b: number) => void;
1108
+ readonly wasm_bindgen__convert__closures_____invoke__h989c99c207fff0d8: (a: number, b: number, c: any) => void;
1109
+ readonly wasm_bindgen__closure__destroy__hab695a3e04b8e88a: (a: number, b: number) => void;
1110
+ readonly wasm_bindgen__convert__closures_____invoke__h09c21df9c40da302: (a: number, b: number, c: any, d: any) => void;
1111
1111
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1112
1112
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1113
1113
  readonly __wbindgen_exn_store: (a: number) => void;