@xmtp/browser-sdk 1.1.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ContentCodec, ContentTypeId as ContentTypeId$1, EncodedContent as EncodedContent$1 } from '@xmtp/content-type-primitives';
2
2
  import * as _xmtp_wasm_bindings from '@xmtp/wasm-bindings';
3
- import { Identifier, SignatureRequestType, ConsentState, ConsentEntityType, ConversationType, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, Message, Conversation as Conversation$1, Client as Client$1, Consent, UserPreference, EncodedContent, MessageDisappearingSettings, GroupPermissionsOptions, DeliveryStatus, GroupMessageKind, ContentType, SortDirection, PermissionLevel, ContentTypeId, ListMessagesOptions, ListConversationsOptions, PermissionPolicySet, CreateGroupOptions, CreateDMOptions, HmacKey, Installation, InboxState, GroupMember } from '@xmtp/wasm-bindings';
4
- export { Consent, ConsentEntityType, ConsentState, ContentType, ContentTypeId, ConversationListItem, ConversationType, CreateDMOptions, CreateGroupOptions, DeliveryStatus, EncodedContent, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, HmacKey, Identifier, IdentifierKind, InboxState, Installation, ListConversationsOptions, ListMessagesOptions, LogOptions, Message, MessageDisappearingSettings, MetadataField, Opfs, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, SignatureRequestType, SortDirection, UserPreference } from '@xmtp/wasm-bindings';
3
+ import { Identifier, SignatureRequestType, ConsentState, ConsentEntityType, ConversationType, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, Message, Conversation as Conversation$1, Client as Client$1, Consent, UserPreference, KeyPackageStatus, EncodedContent, MessageDisappearingSettings, HmacKey, GroupPermissionsOptions, DeliveryStatus, GroupMessageKind, ContentType, SortDirection, PermissionLevel, ContentTypeId, ListMessagesOptions, ListConversationsOptions, PermissionPolicySet, CreateGroupOptions, CreateDMOptions, Installation, InboxState, GroupMember } from '@xmtp/wasm-bindings';
4
+ export { Consent, ConsentEntityType, ConsentState, ContentType, ContentTypeId, ConversationListItem, ConversationType, CreateDMOptions, CreateGroupOptions, DeliveryStatus, EncodedContent, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, HmacKey, Identifier, IdentifierKind, InboxState, Installation, ListConversationsOptions, ListMessagesOptions, LogOptions, Message, MessageDisappearingSettings, MetadataField, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, SignatureRequestType, SortDirection, UserPreference } from '@xmtp/wasm-bindings';
5
5
 
6
6
  type ResolveValue<T> = {
7
7
  value: T | undefined;
@@ -22,11 +22,27 @@ declare class AsyncStream<T> {
22
22
  [Symbol.asyncIterator](): this;
23
23
  }
24
24
 
25
+ /**
26
+ * Pre-configured URLs for the XMTP network based on the environment
27
+ *
28
+ * @constant
29
+ * @property {string} local - The local URL for the XMTP network
30
+ * @property {string} dev - The development URL for the XMTP network
31
+ * @property {string} production - The production URL for the XMTP network
32
+ */
25
33
  declare const ApiUrls: {
26
34
  readonly local: "http://localhost:5555";
27
35
  readonly dev: "https://dev.xmtp.network";
28
36
  readonly production: "https://production.xmtp.network";
29
37
  };
38
+ /**
39
+ * Pre-configured URLs for the XMTP history sync service based on the environment
40
+ *
41
+ * @constant
42
+ * @property {string} local - The local URL for the XMTP history sync service
43
+ * @property {string} dev - The development URL for the XMTP history sync service
44
+ * @property {string} production - The production URL for the XMTP history sync service
45
+ */
30
46
  declare const HistorySyncUrls: {
31
47
  readonly local: "http://localhost:5558";
32
48
  readonly dev: "https://message-history.dev.ephemera.network";
@@ -66,7 +82,11 @@ type StorageOptions = {
66
82
  /**
67
83
  * Path to the local DB
68
84
  */
69
- dbPath?: string;
85
+ dbPath?: string | null;
86
+ /**
87
+ * Encryption key for the local DB
88
+ */
89
+ dbEncryptionKey?: Uint8Array;
70
90
  };
71
91
  type OtherOptions = {
72
92
  /**
@@ -113,7 +133,6 @@ type ClientEvents =
113
133
  };
114
134
  data: {
115
135
  identifier: Identifier;
116
- encryptionKey: Uint8Array;
117
136
  options?: ClientOptions;
118
137
  };
119
138
  } | {
@@ -147,6 +166,13 @@ type ClientEvents =
147
166
  data: {
148
167
  installationIds: Uint8Array[];
149
168
  };
169
+ } | {
170
+ action: "changeRecoveryIdentifierSignatureText";
171
+ id: string;
172
+ result: string | undefined;
173
+ data: {
174
+ identifier: Identifier;
175
+ };
150
176
  } | {
151
177
  action: "addEcdsaSignature";
152
178
  id: string;
@@ -255,6 +281,13 @@ type ClientEvents =
255
281
  signatureBytes: Uint8Array;
256
282
  publicKey: Uint8Array;
257
283
  };
284
+ } | {
285
+ action: "getKeyPackageStatusesForInstallationIds";
286
+ id: string;
287
+ result: Map<string, SafeKeyPackageStatus>;
288
+ data: {
289
+ installationIds: string[];
290
+ };
258
291
  }
259
292
  /**
260
293
  * Conversations actions
@@ -629,6 +662,13 @@ type ClientEvents =
629
662
  data: {
630
663
  id: string;
631
664
  };
665
+ } | {
666
+ action: "getGroupHmacKeys";
667
+ id: string;
668
+ result: SafeHmacKey[];
669
+ data: {
670
+ id: string;
671
+ };
632
672
  };
633
673
  type ClientEventsActions = ClientEvents["action"];
634
674
  type ClientEventsClientMessageData = EventsClientMessageData<ClientEvents>;
@@ -640,12 +680,18 @@ type ClientEventsClientPostMessageData<A extends ClientEventsActions> = EventsCl
640
680
  type ClientEventsErrorData = EventsErrorData<ClientEvents>;
641
681
 
642
682
  type UtilsEvents = {
683
+ action: "init";
684
+ id: string;
685
+ result: undefined;
686
+ data: {
687
+ enableLogging: boolean;
688
+ };
689
+ } | {
643
690
  action: "generateInboxId";
644
691
  id: string;
645
692
  result: string;
646
693
  data: {
647
694
  identifier: Identifier;
648
- enableLogging: boolean;
649
695
  };
650
696
  } | {
651
697
  action: "getInboxIdForIdentifier";
@@ -654,7 +700,6 @@ type UtilsEvents = {
654
700
  data: {
655
701
  identifier: Identifier;
656
702
  env?: XmtpEnv;
657
- enableLogging: boolean;
658
703
  };
659
704
  };
660
705
  type UtilsEventsActions = UtilsEvents["action"];
@@ -758,7 +803,7 @@ declare class WorkerPreferences {
758
803
  declare class WorkerClient {
759
804
  #private;
760
805
  constructor(client: Client$1);
761
- static create(identifier: Identifier, encryptionKey: Uint8Array, options?: Omit<ClientOptions, "codecs">): Promise<WorkerClient>;
806
+ static create(identifier: Identifier, options?: Omit<ClientOptions, "codecs">): Promise<WorkerClient>;
762
807
  get accountIdentifier(): Identifier;
763
808
  get inboxId(): string;
764
809
  get installationId(): string;
@@ -771,6 +816,7 @@ declare class WorkerClient {
771
816
  removeAccountSignatureText(identifier: Identifier): Promise<string | undefined>;
772
817
  revokeAllAOtherInstallationsSignatureText(): Promise<string | undefined>;
773
818
  revokeInstallationsSignatureText(installationIds: Uint8Array[]): Promise<string | undefined>;
819
+ changeRecoveryIdentifierSignatureText(identifier: Identifier): Promise<string | undefined>;
774
820
  addEcdsaSignature(type: SignatureRequestType, bytes: Uint8Array): Promise<void>;
775
821
  addScwSignature(type: SignatureRequestType, bytes: Uint8Array, chainId: bigint, blockNumber?: bigint): Promise<void>;
776
822
  applySignatures(): Promise<void>;
@@ -780,6 +826,7 @@ declare class WorkerClient {
780
826
  signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
781
827
  verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
782
828
  verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
829
+ getKeyPackageStatusesForInstallationIds(installationIds: string[]): Promise<Map<string, KeyPackageStatus>>;
783
830
  }
784
831
 
785
832
  declare class WorkerConversation {
@@ -831,6 +878,7 @@ declare class WorkerConversation {
831
878
  isMessageDisappearingEnabled(): boolean;
832
879
  stream(callback?: StreamCallback<Message>): _xmtp_wasm_bindings.StreamCloser;
833
880
  pausedForVersion(): string | undefined;
881
+ getHmacKeys(): HmacKey[];
834
882
  }
835
883
 
836
884
  declare const toContentTypeId: (contentTypeId: ContentTypeId) => ContentTypeId$1;
@@ -981,6 +1029,14 @@ type SafeMessageDisappearingSettings = {
981
1029
  };
982
1030
  declare const toSafeMessageDisappearingSettings: (settings: MessageDisappearingSettings) => SafeMessageDisappearingSettings;
983
1031
  declare const fromSafeMessageDisappearingSettings: (settings: SafeMessageDisappearingSettings) => MessageDisappearingSettings;
1032
+ type SafeKeyPackageStatus = {
1033
+ lifetime?: {
1034
+ notBefore: bigint;
1035
+ notAfter: bigint;
1036
+ };
1037
+ validationError?: string;
1038
+ };
1039
+ declare const toSafeKeyPackageStatus: (status: KeyPackageStatus) => SafeKeyPackageStatus;
984
1040
 
985
1041
  type ClientStreamEvents = {
986
1042
  type: "message";
@@ -1011,6 +1067,26 @@ declare class ClientWorkerClass {
1011
1067
 
1012
1068
  type MessageKind = "application" | "membership_change";
1013
1069
  type MessageDeliveryStatus = "unpublished" | "published" | "failed";
1070
+ /**
1071
+ * Represents a decoded XMTP message
1072
+ *
1073
+ * This class transforms network messages into a structured format with
1074
+ * content decoding.
1075
+ *
1076
+ * @class
1077
+ * @property {any} content - The decoded content of the message
1078
+ * @property {ContentTypeId} contentType - The content type of the message content
1079
+ * @property {string} conversationId - Unique identifier for the conversation
1080
+ * @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
1081
+ * @property {string} [fallback] - Optional fallback text for the message
1082
+ * @property {number} [compression] - Optional compression level applied to the message
1083
+ * @property {string} id - Unique identifier for the message
1084
+ * @property {MessageKind} kind - Type of message ("application" | "membership_change")
1085
+ * @property {Map<string, string>} parameters - Additional parameters associated with the message
1086
+ * @property {SafeMessage["content"]} encodedContent - Raw encoded content of the message
1087
+ * @property {string} senderInboxId - Identifier for the sender's inbox
1088
+ * @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
1089
+ */
1014
1090
  declare class DecodedMessage {
1015
1091
  #private;
1016
1092
  content: any;
@@ -1028,8 +1104,20 @@ declare class DecodedMessage {
1028
1104
  constructor(client: Client, message: SafeMessage);
1029
1105
  }
1030
1106
 
1107
+ /**
1108
+ * Represents a conversation
1109
+ *
1110
+ * This class is not intended to be initialized directly.
1111
+ */
1031
1112
  declare class Conversation {
1032
1113
  #private;
1114
+ /**
1115
+ * Creates a new conversation instance
1116
+ *
1117
+ * @param client - The client instance managing the conversation
1118
+ * @param id - The unique identifier for this conversation
1119
+ * @param data - Optional conversation data to initialize with
1120
+ */
1033
1121
  constructor(client: Client, id: string, data?: SafeConversation);
1034
1122
  get id(): string;
1035
1123
  get isActive(): boolean | undefined;
@@ -1040,42 +1128,203 @@ declare class Conversation {
1040
1128
  creatorInboxId: string;
1041
1129
  conversationType: string;
1042
1130
  } | undefined;
1131
+ /**
1132
+ * Gets the conversation members
1133
+ *
1134
+ * @returns Promise that resolves with the conversation members
1135
+ */
1043
1136
  members(): Promise<SafeGroupMember[]>;
1137
+ /**
1138
+ * Synchronizes conversation data from the network
1139
+ *
1140
+ * @returns Promise that resolves with the updated conversation data
1141
+ */
1044
1142
  sync(): Promise<SafeConversation>;
1143
+ /**
1144
+ * Publishes pending messages that were sent optimistically
1145
+ *
1146
+ * @returns Promise that resolves when publishing is complete
1147
+ */
1045
1148
  publishMessages(): Promise<undefined>;
1149
+ /**
1150
+ * Sends a message optimistically
1151
+ *
1152
+ * @param content - The content to send
1153
+ * @param contentType - Optional content type of the message content
1154
+ * @returns Promise that resolves with the message ID
1155
+ * @throws {MissingContentTypeError} When content type is required but not provided
1156
+ */
1046
1157
  sendOptimistic(content: any, contentType?: ContentTypeId$1): Promise<string>;
1158
+ /**
1159
+ * Sends a message
1160
+ *
1161
+ * @param content - The content to send
1162
+ * @param contentType - Optional content type of the message content
1163
+ * @returns Promise that resolves with the message ID after it has been sent
1164
+ * @throws {MissingContentTypeError} When content type is required but not provided
1165
+ */
1047
1166
  send(content: any, contentType?: ContentTypeId$1): Promise<string>;
1167
+ /**
1168
+ * Lists messages in this conversation
1169
+ *
1170
+ * @param options - Optional filtering and pagination options
1171
+ * @returns Promise that resolves with an array of decoded messages
1172
+ */
1048
1173
  messages(options?: SafeListMessagesOptions): Promise<DecodedMessage[]>;
1174
+ /**
1175
+ * Gets the consent state for this conversation
1176
+ *
1177
+ * @returns Promise that resolves with the current consent state
1178
+ */
1049
1179
  consentState(): Promise<ConsentState>;
1180
+ /**
1181
+ * Updates the consent state for this conversation
1182
+ *
1183
+ * @param state - The new consent state to set
1184
+ * @returns Promise that resolves when the update is complete
1185
+ */
1050
1186
  updateConsentState(state: ConsentState): Promise<undefined>;
1187
+ /**
1188
+ * Gets the message disappearing settings for this conversation
1189
+ *
1190
+ * @returns Promise that resolves with the current message disappearing settings
1191
+ */
1051
1192
  messageDisappearingSettings(): Promise<SafeMessageDisappearingSettings | undefined>;
1193
+ /**
1194
+ * Updates message disappearing settings for this conversation
1195
+ *
1196
+ * @param fromNs - The timestamp from which messages should start disappearing
1197
+ * @param inNs - The duration after which messages should disappear
1198
+ * @returns Promise that resolves when the update is complete
1199
+ */
1052
1200
  updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint): Promise<undefined>;
1201
+ /**
1202
+ * Removes message disappearing settings from this conversation
1203
+ *
1204
+ * @returns Promise that resolves when the settings are removed
1205
+ */
1053
1206
  removeMessageDisappearingSettings(): Promise<undefined>;
1207
+ /**
1208
+ * Checks if message disappearing is enabled for this conversation
1209
+ *
1210
+ * @returns Promise that resolves with whether message disappearing is enabled
1211
+ */
1054
1212
  isMessageDisappearingEnabled(): Promise<boolean>;
1213
+ /**
1214
+ * Creates a stream for new messages in this conversation
1215
+ *
1216
+ * @param callback - Optional callback function for handling new stream values
1217
+ * @returns AsyncStream instance for new messages
1218
+ */
1055
1219
  stream(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage>>;
1056
1220
  pausedForVersion(): Promise<string | undefined>;
1221
+ /**
1222
+ * Retrieves HMAC keys for this conversation
1223
+ *
1224
+ * @returns Promise that resolves with the HMAC keys
1225
+ */
1226
+ getHmacKeys(): Promise<SafeHmacKey[]>;
1057
1227
  }
1058
1228
 
1229
+ /**
1230
+ * Represents a direct message conversation between two inboxes
1231
+ *
1232
+ * This class is not intended to be initialized directly.
1233
+ */
1059
1234
  declare class Dm extends Conversation {
1060
1235
  #private;
1236
+ /**
1237
+ * Creates a new direct message conversation instance
1238
+ *
1239
+ * @param client - The client instance managing this direct message conversation
1240
+ * @param id - Identifier for the direct message conversation
1241
+ * @param data - Optional conversation data to initialize with
1242
+ */
1061
1243
  constructor(client: Client, id: string, data?: SafeConversation);
1244
+ /**
1245
+ * Retrieves the inbox ID of the other participant in the DM
1246
+ *
1247
+ * @returns Promise that resolves with the peer's inbox ID
1248
+ */
1062
1249
  peerInboxId(): Promise<string>;
1063
1250
  }
1064
1251
 
1252
+ /**
1253
+ * Represents a group conversation between multiple inboxes
1254
+ *
1255
+ * This class is not intended to be initialized directly.
1256
+ */
1065
1257
  declare class Group extends Conversation {
1066
1258
  #private;
1259
+ /**
1260
+ * Creates a new group conversation instance
1261
+ *
1262
+ * @param client - The client instance managing this group conversation
1263
+ * @param id - Identifier for the group conversation
1264
+ * @param data - Optional conversation data to initialize with
1265
+ */
1067
1266
  constructor(client: Client, id: string, data?: SafeConversation);
1267
+ /**
1268
+ * Synchronizes the group's data with the network
1269
+ *
1270
+ * @returns Updated group data
1271
+ */
1068
1272
  sync(): Promise<SafeConversation>;
1273
+ /**
1274
+ * The name of the group
1275
+ */
1069
1276
  get name(): string | undefined;
1277
+ /**
1278
+ * Updates the group's name
1279
+ *
1280
+ * @param name The new name for the group
1281
+ */
1070
1282
  updateName(name: string): Promise<void>;
1283
+ /**
1284
+ * The image URL of the group
1285
+ */
1071
1286
  get imageUrl(): string | undefined;
1287
+ /**
1288
+ * Updates the group's image URL
1289
+ *
1290
+ * @param imageUrl The new image URL for the group
1291
+ */
1072
1292
  updateImageUrl(imageUrl: string): Promise<void>;
1293
+ /**
1294
+ * The description of the group
1295
+ */
1073
1296
  get description(): string | undefined;
1297
+ /**
1298
+ * Updates the group's description
1299
+ *
1300
+ * @param description The new description for the group
1301
+ */
1074
1302
  updateDescription(description: string): Promise<void>;
1303
+ /**
1304
+ * The list of admins of the group by inbox ID
1305
+ */
1075
1306
  get admins(): string[];
1307
+ /**
1308
+ * The list of super admins of the group by inbox ID
1309
+ */
1076
1310
  get superAdmins(): string[];
1311
+ /**
1312
+ * Fetches and updates the list of group admins from the server
1313
+ *
1314
+ * @returns Array of admin inbox IDs
1315
+ */
1077
1316
  listAdmins(): Promise<string[]>;
1317
+ /**
1318
+ * Fetches and updates the list of group super admins from the server
1319
+ *
1320
+ * @returns Array of super admin inbox IDs
1321
+ */
1078
1322
  listSuperAdmins(): Promise<string[]>;
1323
+ /**
1324
+ * Retrieves the group's permissions
1325
+ *
1326
+ * @returns The group's permissions
1327
+ */
1079
1328
  permissions(): Promise<{
1080
1329
  policyType: _xmtp_wasm_bindings.GroupPermissionsOptions;
1081
1330
  policySet: {
@@ -1089,52 +1338,295 @@ declare class Group extends Conversation {
1089
1338
  updateMessageDisappearingPolicy: PermissionPolicy;
1090
1339
  };
1091
1340
  }>;
1341
+ /**
1342
+ * Updates a specific permission policy for the group
1343
+ *
1344
+ * @param permissionType The type of permission to update
1345
+ * @param policy The new permission policy
1346
+ * @param metadataField Optional metadata field for the permission
1347
+ */
1092
1348
  updatePermission(permissionType: PermissionUpdateType, policy: PermissionPolicy, metadataField?: MetadataField): Promise<undefined>;
1349
+ /**
1350
+ * Checks if an inbox is an admin of the group
1351
+ *
1352
+ * @param inboxId The inbox ID to check
1353
+ * @returns Boolean indicating if the inbox is an admin
1354
+ */
1093
1355
  isAdmin(inboxId: string): Promise<boolean>;
1356
+ /**
1357
+ * Checks if an inbox is a super admin of the group
1358
+ *
1359
+ * @param inboxId The inbox ID to check
1360
+ * @returns Boolean indicating if the inbox is a super admin
1361
+ */
1094
1362
  isSuperAdmin(inboxId: string): Promise<boolean>;
1363
+ /**
1364
+ * Adds members to the group using identifiers
1365
+ *
1366
+ * @param identifiers Array of member identifiers to add
1367
+ */
1095
1368
  addMembersByIdentifiers(identifiers: Identifier[]): Promise<undefined>;
1369
+ /**
1370
+ * Adds members to the group using inbox IDs
1371
+ *
1372
+ * @param inboxIds Array of inbox IDs to add
1373
+ */
1096
1374
  addMembers(inboxIds: string[]): Promise<undefined>;
1375
+ /**
1376
+ * Removes members from the group using identifiers
1377
+ *
1378
+ * @param identifiers Array of member identifiers to remove
1379
+ */
1097
1380
  removeMembersByIdentifiers(identifiers: Identifier[]): Promise<undefined>;
1381
+ /**
1382
+ * Removes members from the group using inbox IDs
1383
+ *
1384
+ * @param inboxIds Array of inbox IDs to remove
1385
+ */
1098
1386
  removeMembers(inboxIds: string[]): Promise<undefined>;
1387
+ /**
1388
+ * Promotes a group member to admin status
1389
+ *
1390
+ * @param inboxId The inbox ID of the member to promote
1391
+ */
1099
1392
  addAdmin(inboxId: string): Promise<undefined>;
1393
+ /**
1394
+ * Removes admin status from a group member
1395
+ *
1396
+ * @param inboxId The inbox ID of the admin to demote
1397
+ */
1100
1398
  removeAdmin(inboxId: string): Promise<undefined>;
1399
+ /**
1400
+ * Promotes a group member to super admin status
1401
+ *
1402
+ * @param inboxId The inbox ID of the member to promote
1403
+ */
1101
1404
  addSuperAdmin(inboxId: string): Promise<undefined>;
1405
+ /**
1406
+ * Removes super admin status from a group member
1407
+ *
1408
+ * @param inboxId The inbox ID of the super admin to demote
1409
+ */
1102
1410
  removeSuperAdmin(inboxId: string): Promise<undefined>;
1103
1411
  }
1104
1412
 
1413
+ /**
1414
+ * Manages conversations
1415
+ *
1416
+ * This class is not intended to be initialized directly.
1417
+ */
1105
1418
  declare class Conversations {
1106
1419
  #private;
1420
+ /**
1421
+ * Creates a new conversations instance
1422
+ *
1423
+ * @param client - The client instance managing the conversations
1424
+ */
1107
1425
  constructor(client: Client);
1426
+ /**
1427
+ * Synchronizes conversations for the current client from the network
1428
+ *
1429
+ * @returns Promise that resolves when sync is complete
1430
+ */
1108
1431
  sync(): Promise<undefined>;
1432
+ /**
1433
+ * Synchronizes all conversations and messages from the network with optional
1434
+ * consent state filtering, then uploads conversation and message history to
1435
+ * the history sync server
1436
+ *
1437
+ * @param consentStates - Optional array of consent states to filter by
1438
+ * @returns Promise that resolves when sync is complete
1439
+ */
1109
1440
  syncAll(consentStates?: ConsentState[]): Promise<undefined>;
1441
+ /**
1442
+ * Retrieves a conversation by its ID
1443
+ *
1444
+ * @param id - The conversation ID to look up
1445
+ * @returns Promise that resolves with the conversation, if found
1446
+ */
1110
1447
  getConversationById(id: string): Promise<Dm | Group | undefined>;
1448
+ /**
1449
+ * Retrieves a message by its ID
1450
+ *
1451
+ * @param id - The message ID to look up
1452
+ * @returns Promise that resolves with the decoded message, if found
1453
+ */
1111
1454
  getMessageById(id: string): Promise<DecodedMessage | undefined>;
1455
+ /**
1456
+ * Retrieves a DM by inbox ID
1457
+ *
1458
+ * @param inboxId - The inbox ID to look up
1459
+ * @returns Promise that resolves with the DM, if found
1460
+ */
1112
1461
  getDmByInboxId(inboxId: string): Promise<Dm | undefined>;
1462
+ /**
1463
+ * Lists all conversations with optional filtering
1464
+ *
1465
+ * @param options - Optional filtering and pagination options
1466
+ * @returns Promise that resolves with an array of conversations
1467
+ */
1113
1468
  list(options?: SafeListConversationsOptions): Promise<(Dm | Group)[]>;
1469
+ /**
1470
+ * Lists all group conversations with optional filtering
1471
+ *
1472
+ * @param options - Optional filtering and pagination options
1473
+ * @returns Promise that resolves with an array of groups
1474
+ */
1114
1475
  listGroups(options?: Omit<SafeListConversationsOptions, "conversation_type">): Promise<Group[]>;
1476
+ /**
1477
+ * Lists all DM conversations with optional filtering
1478
+ *
1479
+ * @param options - Optional filtering and pagination options
1480
+ * @returns Promise that resolves with an array of DMs
1481
+ */
1115
1482
  listDms(options?: Omit<SafeListConversationsOptions, "conversation_type">): Promise<Dm[]>;
1483
+ /**
1484
+ * Creates a new group conversation with the specified identifiers
1485
+ *
1486
+ * @param identifiers - Array of identifiers for group members
1487
+ * @param options - Optional group creation options
1488
+ * @returns Promise that resolves with the new group
1489
+ */
1116
1490
  newGroupWithIdentifiers(identifiers: Identifier[], options?: SafeCreateGroupOptions): Promise<Group>;
1491
+ /**
1492
+ * Creates a new group conversation with the specified inbox IDs
1493
+ *
1494
+ * @param inboxIds - Array of inbox IDs for group members
1495
+ * @param options - Optional group creation options
1496
+ * @returns Promise that resolves with the new group
1497
+ */
1117
1498
  newGroup(inboxIds: string[], options?: SafeCreateGroupOptions): Promise<Group>;
1499
+ /**
1500
+ * Creates a new DM conversation with the specified identifier
1501
+ *
1502
+ * @param identifier - Identifier for the DM recipient
1503
+ * @param options - Optional DM creation options
1504
+ * @returns Promise that resolves with the new DM
1505
+ */
1118
1506
  newDmWithIdentifier(identifier: Identifier, options?: SafeCreateDmOptions): Promise<Dm>;
1507
+ /**
1508
+ * Creates a new DM conversation with the specified inbox ID
1509
+ *
1510
+ * @param inboxId - Inbox ID for the DM recipient
1511
+ * @param options - Optional DM creation options
1512
+ * @returns Promise that resolves with the new DM
1513
+ */
1119
1514
  newDm(inboxId: string, options?: SafeCreateDmOptions): Promise<Dm>;
1515
+ /**
1516
+ * Retrieves HMAC keys for all conversations
1517
+ *
1518
+ * @returns Promise that resolves with the HMAC keys for all conversations
1519
+ */
1120
1520
  getHmacKeys(): Promise<SafeHmacKeys>;
1521
+ /**
1522
+ * Creates a stream for new conversations
1523
+ *
1524
+ * @param callback - Optional callback function for handling new stream value
1525
+ * @param conversationType - Optional type to filter conversations
1526
+ * @returns AsyncStream instance for new conversations
1527
+ */
1121
1528
  stream<T extends Group | Dm = Group | Dm>(callback?: StreamCallback<T>, conversationType?: ConversationType): Promise<AsyncStream<T>>;
1529
+ /**
1530
+ * Creates a stream for new group conversations
1531
+ *
1532
+ * @param callback - Optional callback function for handling new stream value
1533
+ * @returns AsyncStream instance for new group conversations
1534
+ */
1122
1535
  streamGroups(callback?: StreamCallback<Group>): Promise<AsyncStream<Group>>;
1536
+ /**
1537
+ * Creates a stream for new DM conversations
1538
+ *
1539
+ * @param callback - Optional callback function for handling new stream value
1540
+ * @returns AsyncStream instance for new DM conversations
1541
+ */
1123
1542
  streamDms(callback?: StreamCallback<Dm>): Promise<AsyncStream<Dm>>;
1543
+ /**
1544
+ * Creates a stream for all new messages
1545
+ *
1546
+ * @param callback - Optional callback function for handling new stream value
1547
+ * @param conversationType - Optional conversation type to filter messages
1548
+ * @returns AsyncStream instance for new messages
1549
+ */
1124
1550
  streamAllMessages(callback?: StreamCallback<DecodedMessage>, conversationType?: ConversationType): Promise<AsyncStream<DecodedMessage>>;
1551
+ /**
1552
+ * Creates a stream for all new group messages
1553
+ *
1554
+ * @param callback - Optional callback function for handling new stream value
1555
+ * @returns AsyncStream instance for new group messages
1556
+ */
1125
1557
  streamAllGroupMessages(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage>>;
1558
+ /**
1559
+ * Creates a stream for all new DM messages
1560
+ *
1561
+ * @param callback - Optional callback function for handling new stream value
1562
+ * @returns AsyncStream instance for new DM messages
1563
+ */
1126
1564
  streamAllDmMessages(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage>>;
1127
1565
  }
1128
1566
 
1567
+ /**
1568
+ * Manages user preferences and consent states
1569
+ *
1570
+ * This class is not intended to be initialized directly.
1571
+ */
1129
1572
  declare class Preferences {
1130
1573
  #private;
1574
+ /**
1575
+ * Creates a new preferences instance
1576
+ *
1577
+ * @param client - The client instance managing preferences
1578
+ */
1131
1579
  constructor(client: Client);
1580
+ /**
1581
+ * Retrieves the current inbox state
1582
+ *
1583
+ * @param refreshFromNetwork - Optional flag to force refresh from network
1584
+ * @returns Promise that resolves with the inbox state
1585
+ */
1132
1586
  inboxState(refreshFromNetwork?: boolean): Promise<SafeInboxState>;
1587
+ /**
1588
+ * Retrieves inbox state for specific inbox IDs
1589
+ *
1590
+ * @param inboxIds - Array of inbox IDs to get state for
1591
+ * @param refreshFromNetwork - Optional flag to force refresh from network
1592
+ * @returns Promise that resolves with the inbox state for the inbox IDs
1593
+ */
1133
1594
  inboxStateFromInboxIds(inboxIds: string[], refreshFromNetwork?: boolean): Promise<SafeInboxState[]>;
1595
+ /**
1596
+ * Gets the latest inbox state for a specific inbox
1597
+ *
1598
+ * @param inboxId - The inbox ID to get state for
1599
+ * @returns Promise that resolves with the latest inbox state
1600
+ */
1134
1601
  getLatestInboxState(inboxId: string): Promise<SafeInboxState>;
1602
+ /**
1603
+ * Updates consent states for multiple records
1604
+ *
1605
+ * @param records - Array of consent records to update
1606
+ * @returns Promise that resolves when consent states are updated
1607
+ */
1135
1608
  setConsentStates(records: SafeConsent[]): Promise<undefined>;
1609
+ /**
1610
+ * Retrieves consent state for a specific entity
1611
+ *
1612
+ * @param entityType - Type of entity to get consent for
1613
+ * @param entity - Entity identifier
1614
+ * @returns Promise that resolves with the consent state
1615
+ */
1136
1616
  getConsentState(entityType: ConsentEntityType, entity: string): Promise<_xmtp_wasm_bindings.ConsentState>;
1617
+ /**
1618
+ * Creates a stream of consent state updates
1619
+ *
1620
+ * @param callback - Optional callback function for handling stream updates
1621
+ * @returns AsyncStream instance for consent updates
1622
+ */
1137
1623
  streamConsent(callback?: StreamCallback<SafeConsent[]>): Promise<AsyncStream<SafeConsent[]>>;
1624
+ /**
1625
+ * Creates a stream of user preference updates
1626
+ *
1627
+ * @param callback - Optional callback function for handling stream updates
1628
+ * @returns AsyncStream instance for preference updates
1629
+ */
1138
1630
  streamPreferences(callback?: StreamCallback<UserPreference[]>): Promise<AsyncStream<UserPreference[]>>;
1139
1631
  }
1140
1632
 
@@ -1154,121 +1646,376 @@ type Signer = {
1154
1646
  getChainId: GetChainId;
1155
1647
  };
1156
1648
 
1649
+ /**
1650
+ * Client for interacting with the XMTP network
1651
+ */
1157
1652
  declare class Client extends ClientWorkerClass {
1158
1653
  #private;
1159
- options?: ClientOptions;
1160
- constructor(signer: Signer, encryptionKey: Uint8Array, options?: ClientOptions);
1161
- init(): Promise<void>;
1162
- static create(signer: Signer, encryptionKey: Uint8Array, options?: ClientOptions): Promise<Client>;
1654
+ /**
1655
+ * Creates a new XMTP client instance
1656
+ *
1657
+ * This class is not intended to be initialized directly.
1658
+ * Use `Client.create` or `Client.build` instead.
1659
+ *
1660
+ * @param options - Optional configuration for the client
1661
+ */
1662
+ constructor(options?: ClientOptions);
1663
+ /**
1664
+ * Initializes the client with the provided identifier
1665
+ *
1666
+ * This is not meant to be called directly.
1667
+ * Use `Client.create` or `Client.build` instead.
1668
+ *
1669
+ * @param identifier - The identifier to initialize the client with
1670
+ */
1671
+ init(identifier: Identifier): Promise<void>;
1672
+ /**
1673
+ * Creates a new client instance with a signer
1674
+ *
1675
+ * @param signer - The signer to use for authentication
1676
+ * @param options - Optional configuration for the client
1677
+ * @returns A new client instance
1678
+ */
1679
+ static create(signer: Signer, options?: ClientOptions): Promise<Client>;
1680
+ /**
1681
+ * Creates a new client instance with an identifier
1682
+ *
1683
+ * Clients created with this method must already be registered.
1684
+ * Any methods called that require a signer will throw an error.
1685
+ *
1686
+ * @param identifier - The identifier to use
1687
+ * @param options - Optional configuration for the client
1688
+ * @returns A new client instance
1689
+ */
1690
+ static build(identifier: Identifier, options?: ClientOptions): Promise<Client>;
1691
+ /**
1692
+ * Gets the client options
1693
+ */
1694
+ get options(): ClientOptions | undefined;
1695
+ /**
1696
+ * Gets whether the client has been initialized
1697
+ */
1163
1698
  get isReady(): boolean;
1699
+ /**
1700
+ * Gets the inbox ID associated with this client
1701
+ */
1164
1702
  get inboxId(): string | undefined;
1165
- accountIdentifier(): Promise<Identifier>;
1703
+ /**
1704
+ * Gets the account identifier for this client
1705
+ */
1706
+ get accountIdentifier(): Identifier | undefined;
1707
+ /**
1708
+ * Gets the installation ID for this client
1709
+ */
1166
1710
  get installationId(): string | undefined;
1711
+ /**
1712
+ * Gets the installation ID bytes for this client
1713
+ */
1167
1714
  get installationIdBytes(): Uint8Array<ArrayBufferLike> | undefined;
1715
+ /**
1716
+ * Gets the conversations manager for this client
1717
+ */
1168
1718
  get conversations(): Conversations;
1719
+ /**
1720
+ * Gets the preferences manager for this client
1721
+ */
1169
1722
  get preferences(): Preferences;
1170
1723
  /**
1724
+ * Creates signature text for creating a new inbox
1725
+ *
1171
1726
  * WARNING: This function should be used with caution. It is only provided
1172
1727
  * for use in special cases where the provided workflows do not meet the
1173
1728
  * requirements of an application.
1174
1729
  *
1175
- * It is highly recommended to use the `register` function instead.
1730
+ * It is highly recommended to use the `register` method instead.
1731
+ *
1732
+ * @returns The signature text
1176
1733
  */
1177
1734
  unsafe_createInboxSignatureText(): Promise<string | undefined>;
1178
1735
  /**
1736
+ * Creates signature text for adding a new account to the client's inbox
1737
+ *
1179
1738
  * WARNING: This function should be used with caution. It is only provided
1180
1739
  * for use in special cases where the provided workflows do not meet the
1181
1740
  * requirements of an application.
1182
1741
  *
1183
- * It is highly recommended to use the `unsafe_addAccount` function instead.
1742
+ * It is highly recommended to use the `unsafe_addAccount` method instead.
1184
1743
  *
1185
- * The `allowInboxReassign` parameter must be true or this function will
1186
- * throw an error.
1744
+ * @param newIdentifier - The identifier of the new account
1745
+ * @param allowInboxReassign - Whether to allow inbox reassignment
1746
+ * @returns The signature text
1187
1747
  */
1188
1748
  unsafe_addAccountSignatureText(newIdentifier: Identifier, allowInboxReassign?: boolean): Promise<string | undefined>;
1189
1749
  /**
1750
+ * Creates signature text for removing an account from the client's inbox
1751
+ *
1190
1752
  * WARNING: This function should be used with caution. It is only provided
1191
1753
  * for use in special cases where the provided workflows do not meet the
1192
1754
  * requirements of an application.
1193
1755
  *
1194
- * It is highly recommended to use the `removeAccount` function instead.
1756
+ * It is highly recommended to use the `removeAccount` method instead.
1757
+ *
1758
+ * @param identifier - The identifier of the account to remove
1759
+ * @returns The signature text
1195
1760
  */
1196
1761
  unsafe_removeAccountSignatureText(identifier: Identifier): Promise<string | undefined>;
1197
1762
  /**
1763
+ * Creates signature text for revoking all other installations of the
1764
+ * client's inbox
1765
+ *
1198
1766
  * WARNING: This function should be used with caution. It is only provided
1199
1767
  * for use in special cases where the provided workflows do not meet the
1200
1768
  * requirements of an application.
1201
1769
  *
1202
- * It is highly recommended to use the `revokeAllOtherInstallations` function
1203
- * instead.
1770
+ * It is highly recommended to use the `revokeAllOtherInstallations` method instead.
1771
+ *
1772
+ * @returns The signature text
1204
1773
  */
1205
1774
  unsafe_revokeAllOtherInstallationsSignatureText(): Promise<string | undefined>;
1206
1775
  /**
1776
+ * Creates signature text for revoking specific installations of the
1777
+ * client's inbox
1778
+ *
1207
1779
  * WARNING: This function should be used with caution. It is only provided
1208
1780
  * for use in special cases where the provided workflows do not meet the
1209
1781
  * requirements of an application.
1210
1782
  *
1211
- * It is highly recommended to use the `revokeInstallations` function instead.
1783
+ * It is highly recommended to use the `revokeInstallations` method instead.
1784
+ *
1785
+ * @param installationIds - The installation IDs to revoke
1786
+ * @returns The signature text
1212
1787
  */
1213
1788
  unsafe_revokeInstallationsSignatureText(installationIds: Uint8Array[]): Promise<string | undefined>;
1214
1789
  /**
1790
+ * Creates signature text for changing the recovery identifier for this
1791
+ * client's inbox
1792
+ *
1215
1793
  * WARNING: This function should be used with caution. It is only provided
1216
1794
  * for use in special cases where the provided workflows do not meet the
1217
1795
  * requirements of an application.
1218
1796
  *
1219
- * It is highly recommended to use the `register`, `addAccount`,
1797
+ * It is highly recommended to use the `changeRecoveryIdentifier` method instead.
1798
+ *
1799
+ * @param identifier - The new recovery identifier
1800
+ * @returns The signature text
1801
+ */
1802
+ unsafe_changeRecoveryIdentifierSignatureText(identifier: Identifier): Promise<string | undefined>;
1803
+ /**
1804
+ * Adds a signature for a specific request type
1805
+ *
1806
+ * WARNING: This function should be used with caution. It is only provided
1807
+ * for use in special cases where the provided workflows do not meet the
1808
+ * requirements of an application.
1809
+ *
1810
+ * It is highly recommended to use the `register`, `unsafe_addAccount`,
1220
1811
  * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
1221
- * functions instead.
1812
+ * methods instead.
1813
+ *
1814
+ * @param signatureType - The type of signature request
1815
+ * @param signatureText - The text to sign
1816
+ * @param signer - The signer to use
1817
+ * @warning This is an unsafe operation and should be used with caution
1222
1818
  */
1223
1819
  unsafe_addSignature(signatureType: SignatureRequestType, signatureText: string, signer: Signer): Promise<void>;
1224
1820
  /**
1821
+ * Applies all pending signatures
1822
+ *
1225
1823
  * WARNING: This function should be used with caution. It is only provided
1226
1824
  * for use in special cases where the provided workflows do not meet the
1227
1825
  * requirements of an application.
1228
1826
  *
1229
- * It is highly recommended to use the `register`, `addAccount`,
1827
+ * It is highly recommended to use the `register`, `unsafe_addAccount`,
1230
1828
  * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
1231
- * functions instead.
1829
+ * methods instead.
1232
1830
  */
1233
1831
  unsafe_applySignatures(): Promise<undefined>;
1832
+ /**
1833
+ * Registers the client with the XMTP network
1834
+ *
1835
+ * Requires a signer, use `Client.create` to create a client with a signer.
1836
+ *
1837
+ * @throws {SignerUnavailableError} if no signer is available
1838
+ */
1234
1839
  register(): Promise<undefined>;
1235
1840
  /**
1841
+ * Adds a new account to the client inbox
1842
+ *
1236
1843
  * WARNING: This function should be used with caution. Adding a wallet already
1237
- * associated with an inboxId will cause the wallet to lose access to
1844
+ * associated with an inbox ID will cause the wallet to lose access to
1238
1845
  * that inbox.
1239
1846
  *
1240
1847
  * The `allowInboxReassign` parameter must be true to reassign an inbox
1241
1848
  * already associated with a different account.
1849
+ *
1850
+ * Requires a signer, use `Client.create` to create a client with a signer.
1851
+ *
1852
+ * @param newAccountSigner - The signer for the new account
1853
+ * @param allowInboxReassign - Whether to allow inbox reassignment
1854
+ * @throws {AccountAlreadyAssociatedError} if the account is already associated with an inbox ID
1855
+ * @throws {GenerateSignatureError} if the signature cannot be generated
1856
+ * @throws {SignerUnavailableError} if no signer is available
1242
1857
  */
1243
1858
  unsafe_addAccount(newAccountSigner: Signer, allowInboxReassign?: boolean): Promise<void>;
1859
+ /**
1860
+ * Removes an account from the client's inbox
1861
+ *
1862
+ * Requires a signer, use `Client.create` to create a client with a signer.
1863
+ *
1864
+ * @param accountIdentifier - The identifier of the account to remove
1865
+ * @throws {GenerateSignatureError} if the signature cannot be generated
1866
+ * @throws {SignerUnavailableError} if no signer is available
1867
+ */
1244
1868
  removeAccount(accountIdentifier: Identifier): Promise<void>;
1869
+ /**
1870
+ * Revokes all other installations of the client's inbox
1871
+ *
1872
+ * Requires a signer, use `Client.create` to create a client with a signer.
1873
+ *
1874
+ * @throws {GenerateSignatureError} if the signature cannot be generated
1875
+ * @throws {SignerUnavailableError} if no signer is available
1876
+ */
1245
1877
  revokeAllOtherInstallations(): Promise<void>;
1878
+ /**
1879
+ * Revokes specific installations of the client's inbox
1880
+ *
1881
+ * Requires a signer, use `Client.create` to create a client with a signer.
1882
+ *
1883
+ * @param installationIds - The installation IDs to revoke
1884
+ * @throws {GenerateSignatureError} if the signature cannot be generated
1885
+ * @throws {SignerUnavailableError} if no signer is available
1886
+ */
1246
1887
  revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
1888
+ /**
1889
+ * Changes the recovery identifier for the client's inbox
1890
+ *
1891
+ * Requires a signer, use `Client.create` to create a client with a signer.
1892
+ *
1893
+ * @param identifier - The new recovery identifier
1894
+ * @throws {GenerateSignatureError} if the signature cannot be generated
1895
+ * @throws {SignerUnavailableError} if no signer is available
1896
+ */
1897
+ changeRecoveryIdentifier(identifier: Identifier): Promise<void>;
1898
+ /**
1899
+ * Checks if the client is registered with the XMTP network
1900
+ *
1901
+ * @returns Whether the client is registered
1902
+ */
1247
1903
  isRegistered(): Promise<boolean>;
1904
+ /**
1905
+ * Checks if the client can message the specified identifiers
1906
+ *
1907
+ * @param identifiers - The identifiers to check
1908
+ * @returns Whether the client can message the identifiers
1909
+ */
1248
1910
  canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
1911
+ /**
1912
+ * Checks if the specified identifiers can be messaged
1913
+ *
1914
+ * @param identifiers - The identifiers to check
1915
+ * @param env - Optional XMTP environment
1916
+ * @returns Map of identifiers to whether they can be messaged
1917
+ */
1249
1918
  static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
1919
+ /**
1920
+ * Finds the inbox ID for a given identifier
1921
+ *
1922
+ * @param identifier - The identifier to look up
1923
+ * @returns The inbox ID, if found
1924
+ */
1250
1925
  findInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
1926
+ /**
1927
+ * Gets the codec for a given content type
1928
+ *
1929
+ * @param contentType - The content type to get the codec for
1930
+ * @returns The codec, if found
1931
+ */
1251
1932
  codecFor(contentType: ContentTypeId$1): ContentCodec | undefined;
1933
+ /**
1934
+ * Encodes content for a given content type
1935
+ *
1936
+ * @param content - The content to encode
1937
+ * @param contentType - The content type to encode for
1938
+ * @returns The encoded content
1939
+ * @throws {CodecNotFoundError} if no codec is found for the content type
1940
+ */
1252
1941
  encodeContent(content: any, contentType: ContentTypeId$1): SafeEncodedContent;
1942
+ /**
1943
+ * Decodes a message for a given content type
1944
+ *
1945
+ * @param message - The message to decode
1946
+ * @param contentType - The content type to decode for
1947
+ * @returns The decoded content
1948
+ * @throws {CodecNotFoundError} if no codec is found for the content type
1949
+ * @throws {InvalidGroupMembershipChangeError} if the message is an invalid group membership change
1950
+ */
1253
1951
  decodeContent(message: SafeMessage, contentType: ContentTypeId$1): any;
1952
+ /**
1953
+ * Signs a message with the installation key
1954
+ *
1955
+ * @param signatureText - The text to sign
1956
+ * @returns The signature
1957
+ */
1254
1958
  signWithInstallationKey(signatureText: string): Promise<Uint8Array<ArrayBufferLike>>;
1959
+ /**
1960
+ * Verifies a signature was made with the installation key
1961
+ *
1962
+ * @param signatureText - The text that was signed
1963
+ * @param signatureBytes - The signature bytes to verify
1964
+ * @returns Whether the signature is valid
1965
+ */
1255
1966
  verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): Promise<boolean>;
1967
+ /**
1968
+ * Verifies a signature was made with a public key
1969
+ *
1970
+ * @param signatureText - The text that was signed
1971
+ * @param signatureBytes - The signature bytes to verify
1972
+ * @param publicKey - The public key to verify against
1973
+ * @returns Whether the signature is valid
1974
+ */
1256
1975
  verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): Promise<boolean>;
1976
+ /**
1977
+ * Gets the key package statuses for the specified installation IDs
1978
+ *
1979
+ * @param installationIds - The installation IDs to check
1980
+ * @returns The key package statuses
1981
+ */
1982
+ getKeyPackageStatusesForInstallationIds(installationIds: string[]): Promise<Map<string, SafeKeyPackageStatus>>;
1257
1983
  }
1258
1984
 
1259
1985
  declare class UtilsWorkerClass {
1260
1986
  #private;
1261
1987
  constructor(worker: Worker, enableLogging: boolean);
1988
+ init(enableLogging: boolean): Promise<undefined>;
1262
1989
  sendMessage<A extends UtilsEventsActions>(action: A, data: UtilsSendMessageData<A>): Promise<UtilsEventsResult<A>>;
1263
1990
  handleMessage: (event: MessageEvent<UtilsEventsWorkerMessageData | UtilsEventsErrorData>) => void;
1264
1991
  close(): void;
1265
1992
  }
1266
1993
 
1994
+ /**
1995
+ * Utility class that provides helper functions for XMTP inbox IDs
1996
+ */
1267
1997
  declare class Utils extends UtilsWorkerClass {
1268
- #private;
1998
+ /**
1999
+ * Creates a new Utils instance
2000
+ *
2001
+ * @param enableLogging - Optional flag to enable logging
2002
+ */
1269
2003
  constructor(enableLogging?: boolean);
2004
+ /**
2005
+ * Generates an inbox ID for a given identifier
2006
+ *
2007
+ * @param identifier - The identifier to generate an inbox ID for
2008
+ * @returns Promise that resolves with the generated inbox ID
2009
+ */
1270
2010
  generateInboxId(identifier: Identifier): Promise<string>;
2011
+ /**
2012
+ * Gets the inbox ID for a specific identifier and optional environment
2013
+ *
2014
+ * @param identifier - The identifier to get the inbox ID for
2015
+ * @param env - Optional XMTP environment configuration (default: "dev")
2016
+ * @returns Promise that resolves with the inbox ID for the identifier
2017
+ */
1271
2018
  getInboxIdForIdentifier(identifier: Identifier, env?: XmtpEnv): Promise<string | undefined>;
1272
2019
  }
1273
2020
 
1274
- export { ApiUrls, Client, type ClientEvents, type ClientEventsActions, type ClientEventsClientMessageData, type ClientEventsClientPostMessageData, type ClientEventsErrorData, type ClientEventsResult, type ClientEventsWorkerMessageData, type ClientEventsWorkerPostMessageData, type ClientOptions, type ClientSendMessageData, type ContentOptions, Conversation, Conversations, DecodedMessage, Dm, type EventsClientMessageData, type EventsClientPostMessageData, type EventsErrorData, type EventsResult, type EventsWorkerMessageData, type EventsWorkerPostMessageData, type GenericEvent, type GenericStreamEvent, Group, HistorySyncUrls, type HmacKeys, type MessageDeliveryStatus, type MessageKind, type NetworkOptions, type OtherOptions, type SafeConsent, type SafeContentTypeId, type SafeConversation, type SafeCreateDmOptions, type SafeCreateGroupOptions, type SafeEncodedContent, type SafeGroupMember, type SafeHmacKey, type SafeHmacKeys, type SafeInboxState, type SafeInstallation, type SafeListConversationsOptions, type SafeListMessagesOptions, type SafeMessage, type SafeMessageDisappearingSettings, type SafePermissionPolicySet, type SendMessageData, type Signer, type StorageOptions, type StreamEventsClientMessageData, type StreamEventsClientPostMessageData, type StreamEventsErrorData, type StreamEventsResult, Utils, type UtilsEvents, type UtilsEventsActions, type UtilsEventsClientMessageData, type UtilsEventsClientPostMessageData, type UtilsEventsErrorData, type UtilsEventsResult, type UtilsEventsWorkerMessageData, type UtilsEventsWorkerPostMessageData, type UtilsSendMessageData, type XmtpEnv, fromContentTypeId, fromEncodedContent, fromSafeConsent, fromSafeContentTypeId, fromSafeCreateDmOptions, fromSafeCreateGroupOptions, fromSafeEncodedContent, fromSafeGroupMember, fromSafeListConversationsOptions, fromSafeListMessagesOptions, fromSafeMessageDisappearingSettings, fromSafePermissionPolicySet, toContentTypeId, toEncodedContent, toSafeConsent, toSafeContentTypeId, toSafeConversation, toSafeCreateDmOptions, toSafeCreateGroupOptions, toSafeEncodedContent, toSafeGroupMember, toSafeHmacKey, toSafeInboxState, toSafeInstallation, toSafeListConversationsOptions, toSafeListMessagesOptions, toSafeMessage, toSafeMessageDisappearingSettings, toSafePermissionPolicySet };
2021
+ export { ApiUrls, Client, type ClientEvents, type ClientEventsActions, type ClientEventsClientMessageData, type ClientEventsClientPostMessageData, type ClientEventsErrorData, type ClientEventsResult, type ClientEventsWorkerMessageData, type ClientEventsWorkerPostMessageData, type ClientOptions, type ClientSendMessageData, type ContentOptions, Conversation, Conversations, DecodedMessage, Dm, type EventsClientMessageData, type EventsClientPostMessageData, type EventsErrorData, type EventsResult, type EventsWorkerMessageData, type EventsWorkerPostMessageData, type GenericEvent, type GenericStreamEvent, Group, HistorySyncUrls, type HmacKeys, type MessageDeliveryStatus, type MessageKind, type NetworkOptions, type OtherOptions, type SafeConsent, type SafeContentTypeId, type SafeConversation, type SafeCreateDmOptions, type SafeCreateGroupOptions, type SafeEncodedContent, type SafeGroupMember, type SafeHmacKey, type SafeHmacKeys, type SafeInboxState, type SafeInstallation, type SafeKeyPackageStatus, type SafeListConversationsOptions, type SafeListMessagesOptions, type SafeMessage, type SafeMessageDisappearingSettings, type SafePermissionPolicySet, type SendMessageData, type Signer, type StorageOptions, type StreamEventsClientMessageData, type StreamEventsClientPostMessageData, type StreamEventsErrorData, type StreamEventsResult, Utils, type UtilsEvents, type UtilsEventsActions, type UtilsEventsClientMessageData, type UtilsEventsClientPostMessageData, type UtilsEventsErrorData, type UtilsEventsResult, type UtilsEventsWorkerMessageData, type UtilsEventsWorkerPostMessageData, type UtilsSendMessageData, type XmtpEnv, fromContentTypeId, fromEncodedContent, fromSafeConsent, fromSafeContentTypeId, fromSafeCreateDmOptions, fromSafeCreateGroupOptions, fromSafeEncodedContent, fromSafeGroupMember, fromSafeListConversationsOptions, fromSafeListMessagesOptions, fromSafeMessageDisappearingSettings, fromSafePermissionPolicySet, toContentTypeId, toEncodedContent, toSafeConsent, toSafeContentTypeId, toSafeConversation, toSafeCreateDmOptions, toSafeCreateGroupOptions, toSafeEncodedContent, toSafeGroupMember, toSafeHmacKey, toSafeInboxState, toSafeInstallation, toSafeKeyPackageStatus, toSafeListConversationsOptions, toSafeListMessagesOptions, toSafeMessage, toSafeMessageDisappearingSettings, toSafePermissionPolicySet };