@xmtp/node-sdk 2.0.0 → 2.0.1
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/README.md +29 -6
- package/dist/index.d.ts +730 -23
- package/dist/index.js +727 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -111,9 +111,29 @@ declare class AsyncStream<T> {
|
|
|
111
111
|
|
|
112
112
|
type MessageKind = "application" | "membership_change";
|
|
113
113
|
type MessageDeliveryStatus = "unpublished" | "published" | "failed";
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Represents a decoded XMTP message
|
|
116
|
+
*
|
|
117
|
+
* This class transforms network messages into a structured format with
|
|
118
|
+
* content decoding.
|
|
119
|
+
*
|
|
120
|
+
* @class
|
|
121
|
+
* @property {any} content - The decoded content of the message
|
|
122
|
+
* @property {ContentTypeId} contentType - The content type of the message content
|
|
123
|
+
* @property {string} conversationId - Unique identifier for the conversation
|
|
124
|
+
* @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
|
|
125
|
+
* @property {string} [fallback] - Optional fallback text for the message
|
|
126
|
+
* @property {number} [compression] - Optional compression level applied to the message
|
|
127
|
+
* @property {string} id - Unique identifier for the message
|
|
128
|
+
* @property {MessageKind} kind - Type of message ("application" | "membership_change")
|
|
129
|
+
* @property {Record<string, string>} parameters - Additional parameters associated with the message
|
|
130
|
+
* @property {string} senderInboxId - Identifier for the sender's inbox
|
|
131
|
+
* @property {Date} sentAt - Timestamp when the message was sent
|
|
132
|
+
* @property {number} sentAtNs - Timestamp when the message was sent (in nanoseconds)
|
|
133
|
+
*/
|
|
134
|
+
declare class DecodedMessage<T = unknown> {
|
|
115
135
|
#private;
|
|
116
|
-
content: T;
|
|
136
|
+
content: T | undefined;
|
|
117
137
|
contentType: ContentTypeId | undefined;
|
|
118
138
|
conversationId: string;
|
|
119
139
|
deliveryStatus: MessageDeliveryStatus;
|
|
@@ -128,91 +148,455 @@ declare class DecodedMessage<T = any> {
|
|
|
128
148
|
constructor(client: Client, message: Message);
|
|
129
149
|
}
|
|
130
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Represents a conversation
|
|
153
|
+
*
|
|
154
|
+
* This class is not intended to be initialized directly.
|
|
155
|
+
*/
|
|
131
156
|
declare class Conversation {
|
|
132
157
|
#private;
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new conversation instance
|
|
160
|
+
*
|
|
161
|
+
* @param client - The client instance managing the conversation
|
|
162
|
+
* @param conversation - The underlying conversation instance
|
|
163
|
+
* @param lastMessage - Optional last message in the conversation
|
|
164
|
+
*/
|
|
133
165
|
constructor(client: Client, conversation: Conversation$1, lastMessage?: Message | null);
|
|
166
|
+
/**
|
|
167
|
+
* Gets the unique identifier for this conversation
|
|
168
|
+
*/
|
|
134
169
|
get id(): string;
|
|
170
|
+
/**
|
|
171
|
+
* Gets whether this conversation is currently active
|
|
172
|
+
*/
|
|
135
173
|
get isActive(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Gets the inbox ID that added this client's inbox to the conversation
|
|
176
|
+
*/
|
|
136
177
|
get addedByInboxId(): string;
|
|
178
|
+
/**
|
|
179
|
+
* Gets the timestamp when the conversation was created in nanoseconds
|
|
180
|
+
*/
|
|
137
181
|
get createdAtNs(): number;
|
|
182
|
+
/**
|
|
183
|
+
* Gets the date when the conversation was created
|
|
184
|
+
*/
|
|
138
185
|
get createdAt(): Date;
|
|
186
|
+
/**
|
|
187
|
+
* Gets the metadata for this conversation
|
|
188
|
+
*
|
|
189
|
+
* @returns Promise that resolves with the conversation metadata
|
|
190
|
+
*/
|
|
139
191
|
metadata(): Promise<{
|
|
140
192
|
creatorInboxId: string;
|
|
141
193
|
conversationType: string;
|
|
142
194
|
}>;
|
|
195
|
+
/**
|
|
196
|
+
* Gets the members of this conversation
|
|
197
|
+
*
|
|
198
|
+
* @returns Promise that resolves with the conversation members
|
|
199
|
+
*/
|
|
143
200
|
members(): Promise<_xmtp_node_bindings.GroupMember[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Synchronizes conversation data from the network
|
|
203
|
+
*
|
|
204
|
+
* @returns Promise that resolves when synchronization is complete
|
|
205
|
+
*/
|
|
144
206
|
sync(): Promise<void>;
|
|
145
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Creates a stream for new messages in this conversation
|
|
209
|
+
*
|
|
210
|
+
* @param callback - Optional callback function for handling new stream values
|
|
211
|
+
* @returns Stream instance for new messages
|
|
212
|
+
*/
|
|
213
|
+
stream(callback?: StreamCallback<DecodedMessage>): AsyncStream<DecodedMessage<unknown>>;
|
|
214
|
+
/**
|
|
215
|
+
* Publishes pending messages that were sent optimistically
|
|
216
|
+
*
|
|
217
|
+
* @returns Promise that resolves when publishing is complete
|
|
218
|
+
*/
|
|
146
219
|
publishMessages(): Promise<void>;
|
|
147
|
-
|
|
148
|
-
|
|
220
|
+
/**
|
|
221
|
+
* Prepares a message to be published
|
|
222
|
+
*
|
|
223
|
+
* @param content - The content to send
|
|
224
|
+
* @param contentType - Optional content type of the message content
|
|
225
|
+
* @returns Promise that resolves with the message ID
|
|
226
|
+
* @throws {MissingContentTypeError} if content type is required but not provided
|
|
227
|
+
*/
|
|
228
|
+
sendOptimistic(content: unknown, contentType?: ContentTypeId): string;
|
|
229
|
+
/**
|
|
230
|
+
* Publishes a new message
|
|
231
|
+
*
|
|
232
|
+
* @param content - The content to send
|
|
233
|
+
* @param contentType - Optional content type of the message content
|
|
234
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
235
|
+
* @throws {MissingContentTypeError} if content type is required but not provided
|
|
236
|
+
*/
|
|
237
|
+
send(content: unknown, contentType?: ContentTypeId): Promise<string>;
|
|
238
|
+
/**
|
|
239
|
+
* Lists messages in this conversation
|
|
240
|
+
*
|
|
241
|
+
* @param options - Optional filtering and pagination options
|
|
242
|
+
* @returns Promise that resolves with an array of decoded messages
|
|
243
|
+
*/
|
|
149
244
|
messages(options?: ListMessagesOptions): Promise<DecodedMessage[]>;
|
|
150
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Gets the last message in this conversation
|
|
247
|
+
*
|
|
248
|
+
* @returns Promise that resolves with the last message or undefined if none exists
|
|
249
|
+
*/
|
|
250
|
+
lastMessage(): Promise<DecodedMessage<unknown>>;
|
|
251
|
+
/**
|
|
252
|
+
* Gets the consent state for this conversation
|
|
253
|
+
*/
|
|
151
254
|
get consentState(): ConsentState;
|
|
255
|
+
/**
|
|
256
|
+
* Updates the consent state for this conversation
|
|
257
|
+
*
|
|
258
|
+
* @param consentState - The new consent state to set
|
|
259
|
+
*/
|
|
152
260
|
updateConsentState(consentState: ConsentState): void;
|
|
261
|
+
/**
|
|
262
|
+
* Gets the message disappearing settings for this conversation
|
|
263
|
+
*
|
|
264
|
+
* @returns The current message disappearing settings or undefined if not set
|
|
265
|
+
*/
|
|
153
266
|
messageDisappearingSettings(): _xmtp_node_bindings.MessageDisappearingSettings | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Updates message disappearing settings for this conversation
|
|
269
|
+
*
|
|
270
|
+
* @param fromNs - The timestamp from which messages should start disappearing
|
|
271
|
+
* @param inNs - The duration after which messages should disappear
|
|
272
|
+
* @returns Promise that resolves when the update is complete
|
|
273
|
+
*/
|
|
154
274
|
updateMessageDisappearingSettings(fromNs: number, inNs: number): Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Removes message disappearing settings from this conversation
|
|
277
|
+
*
|
|
278
|
+
* @returns Promise that resolves when the settings are removed
|
|
279
|
+
*/
|
|
155
280
|
removeMessageDisappearingSettings(): Promise<void>;
|
|
281
|
+
/**
|
|
282
|
+
* Checks if message disappearing is enabled for this conversation
|
|
283
|
+
*
|
|
284
|
+
* @returns Whether message disappearing is enabled
|
|
285
|
+
*/
|
|
156
286
|
isMessageDisappearingEnabled(): boolean;
|
|
157
287
|
pausedForVersion(): string | undefined;
|
|
288
|
+
/**
|
|
289
|
+
* Retrieves HMAC keys for this conversation
|
|
290
|
+
*
|
|
291
|
+
* @returns The HMAC keys for this conversation
|
|
292
|
+
*/
|
|
158
293
|
getHmacKeys(): _xmtp_node_bindings.HmacKey[];
|
|
159
294
|
}
|
|
160
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Represents a direct message conversation between two inboxes
|
|
298
|
+
*
|
|
299
|
+
* This class is not intended to be initialized directly.
|
|
300
|
+
*/
|
|
161
301
|
declare class Dm extends Conversation {
|
|
162
302
|
#private;
|
|
303
|
+
/**
|
|
304
|
+
* Creates a new direct message conversation instance
|
|
305
|
+
*
|
|
306
|
+
* @param client - The client instance managing this direct message conversation
|
|
307
|
+
* @param conversation - The underlying conversation instance
|
|
308
|
+
* @param lastMessage - Optional last message in the conversation
|
|
309
|
+
*/
|
|
163
310
|
constructor(client: Client, conversation: Conversation$1, lastMessage?: Message | null);
|
|
311
|
+
/**
|
|
312
|
+
* Retrieves the inbox ID of the other participant in the DM
|
|
313
|
+
*
|
|
314
|
+
* @returns Promise that resolves with the peer's inbox ID
|
|
315
|
+
*/
|
|
164
316
|
get peerInboxId(): string;
|
|
165
317
|
}
|
|
166
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Represents a group conversation between multiple inboxes
|
|
321
|
+
*
|
|
322
|
+
* This class is not intended to be initialized directly.
|
|
323
|
+
*/
|
|
167
324
|
declare class Group extends Conversation {
|
|
168
325
|
#private;
|
|
326
|
+
/**
|
|
327
|
+
* Creates a new group conversation instance
|
|
328
|
+
*
|
|
329
|
+
* @param client - The client instance managing this group conversation
|
|
330
|
+
* @param conversation - The underlying conversation object
|
|
331
|
+
* @param lastMessage - Optional last message in the conversation
|
|
332
|
+
*/
|
|
169
333
|
constructor(client: Client, conversation: Conversation$1, lastMessage?: Message | null);
|
|
334
|
+
/**
|
|
335
|
+
* The name of the group
|
|
336
|
+
*/
|
|
170
337
|
get name(): string;
|
|
338
|
+
/**
|
|
339
|
+
* Updates the group's name
|
|
340
|
+
*
|
|
341
|
+
* @param name The new name for the group
|
|
342
|
+
*/
|
|
171
343
|
updateName(name: string): Promise<void>;
|
|
344
|
+
/**
|
|
345
|
+
* The image URL of the group
|
|
346
|
+
*/
|
|
172
347
|
get imageUrl(): string;
|
|
348
|
+
/**
|
|
349
|
+
* Updates the group's image URL
|
|
350
|
+
*
|
|
351
|
+
* @param imageUrl The new image URL for the group
|
|
352
|
+
*/
|
|
173
353
|
updateImageUrl(imageUrl: string): Promise<void>;
|
|
354
|
+
/**
|
|
355
|
+
* The description of the group
|
|
356
|
+
*/
|
|
174
357
|
get description(): string;
|
|
358
|
+
/**
|
|
359
|
+
* Updates the group's description
|
|
360
|
+
*
|
|
361
|
+
* @param description The new description for the group
|
|
362
|
+
*/
|
|
175
363
|
updateDescription(description: string): Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* The permissions of the group
|
|
366
|
+
*/
|
|
176
367
|
get permissions(): {
|
|
177
368
|
policyType: _xmtp_node_bindings.GroupPermissionsOptions;
|
|
178
369
|
policySet: _xmtp_node_bindings.PermissionPolicySet;
|
|
179
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* Updates a specific permission policy for the group
|
|
373
|
+
*
|
|
374
|
+
* @param permissionType The type of permission to update
|
|
375
|
+
* @param policy The new permission policy
|
|
376
|
+
* @param metadataField Optional metadata field for the permission
|
|
377
|
+
*/
|
|
180
378
|
updatePermission(permissionType: PermissionUpdateType, policy: PermissionPolicy, metadataField?: MetadataField): Promise<void>;
|
|
379
|
+
/**
|
|
380
|
+
* The list of admins of the group
|
|
381
|
+
*/
|
|
181
382
|
get admins(): string[];
|
|
383
|
+
/**
|
|
384
|
+
* The list of super admins of the group
|
|
385
|
+
*/
|
|
182
386
|
get superAdmins(): string[];
|
|
387
|
+
/**
|
|
388
|
+
* Checks if an inbox is an admin of the group
|
|
389
|
+
*
|
|
390
|
+
* @param inboxId The inbox ID to check
|
|
391
|
+
* @returns Boolean indicating if the inbox is an admin
|
|
392
|
+
*/
|
|
183
393
|
isAdmin(inboxId: string): boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Checks if an inbox is a super admin of the group
|
|
396
|
+
*
|
|
397
|
+
* @param inboxId The inbox ID to check
|
|
398
|
+
* @returns Boolean indicating if the inbox is a super admin
|
|
399
|
+
*/
|
|
184
400
|
isSuperAdmin(inboxId: string): boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Adds members to the group using identifiers
|
|
403
|
+
*
|
|
404
|
+
* @param identifiers Array of member identifiers to add
|
|
405
|
+
*/
|
|
185
406
|
addMembersByIdentifiers(identifiers: Identifier[]): Promise<void>;
|
|
407
|
+
/**
|
|
408
|
+
* Adds members to the group using inbox IDs
|
|
409
|
+
*
|
|
410
|
+
* @param inboxIds Array of inbox IDs to add
|
|
411
|
+
*/
|
|
186
412
|
addMembers(inboxIds: string[]): Promise<void>;
|
|
413
|
+
/**
|
|
414
|
+
* Removes members from the group using identifiers
|
|
415
|
+
*
|
|
416
|
+
* @param identifiers Array of member identifiers to remove
|
|
417
|
+
*/
|
|
187
418
|
removeMembersByIdentifiers(identifiers: Identifier[]): Promise<void>;
|
|
419
|
+
/**
|
|
420
|
+
* Removes members from the group using inbox IDs
|
|
421
|
+
*
|
|
422
|
+
* @param inboxIds Array of inbox IDs to remove
|
|
423
|
+
*/
|
|
188
424
|
removeMembers(inboxIds: string[]): Promise<void>;
|
|
425
|
+
/**
|
|
426
|
+
* Promotes a group member to admin status
|
|
427
|
+
*
|
|
428
|
+
* @param inboxId The inbox ID of the member to promote
|
|
429
|
+
*/
|
|
189
430
|
addAdmin(inboxId: string): Promise<void>;
|
|
431
|
+
/**
|
|
432
|
+
* Removes admin status from a group member
|
|
433
|
+
*
|
|
434
|
+
* @param inboxId The inbox ID of the admin to demote
|
|
435
|
+
*/
|
|
190
436
|
removeAdmin(inboxId: string): Promise<void>;
|
|
437
|
+
/**
|
|
438
|
+
* Promotes a group member to super admin status
|
|
439
|
+
*
|
|
440
|
+
* @param inboxId The inbox ID of the member to promote
|
|
441
|
+
*/
|
|
191
442
|
addSuperAdmin(inboxId: string): Promise<void>;
|
|
443
|
+
/**
|
|
444
|
+
* Removes super admin status from a group member
|
|
445
|
+
*
|
|
446
|
+
* @param inboxId The inbox ID of the super admin to demote
|
|
447
|
+
*/
|
|
192
448
|
removeSuperAdmin(inboxId: string): Promise<void>;
|
|
193
449
|
}
|
|
194
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Manages conversations
|
|
453
|
+
*
|
|
454
|
+
* This class is not intended to be initialized directly.
|
|
455
|
+
*/
|
|
195
456
|
declare class Conversations {
|
|
196
457
|
#private;
|
|
458
|
+
/**
|
|
459
|
+
* Creates a new conversations instance
|
|
460
|
+
*
|
|
461
|
+
* @param client - The client instance managing the conversations
|
|
462
|
+
* @param conversations - The underlying conversations instance
|
|
463
|
+
*/
|
|
197
464
|
constructor(client: Client, conversations: Conversations$1);
|
|
465
|
+
/**
|
|
466
|
+
* Retrieves a conversation by its ID
|
|
467
|
+
*
|
|
468
|
+
* @param id - The conversation ID to look up
|
|
469
|
+
* @returns The conversation if found, undefined otherwise
|
|
470
|
+
*/
|
|
198
471
|
getConversationById(id: string): Promise<Dm | Group | undefined>;
|
|
472
|
+
/**
|
|
473
|
+
* Retrieves a DM by inbox ID
|
|
474
|
+
*
|
|
475
|
+
* @param inboxId - The inbox ID to look up
|
|
476
|
+
* @returns The DM if found, undefined otherwise
|
|
477
|
+
*/
|
|
199
478
|
getDmByInboxId(inboxId: string): Dm | undefined;
|
|
200
|
-
|
|
479
|
+
/**
|
|
480
|
+
* Retrieves a message by its ID
|
|
481
|
+
*
|
|
482
|
+
* @param id - The message ID to look up
|
|
483
|
+
* @returns The decoded message if found, undefined otherwise
|
|
484
|
+
*/
|
|
485
|
+
getMessageById<T = unknown>(id: string): DecodedMessage<T> | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* Creates a new group conversation with the specified identifiers
|
|
488
|
+
*
|
|
489
|
+
* @param identifiers - Array of identifiers for group members
|
|
490
|
+
* @param options - Optional group creation options
|
|
491
|
+
* @returns The new group
|
|
492
|
+
*/
|
|
201
493
|
newGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group>;
|
|
494
|
+
/**
|
|
495
|
+
* Creates a new group conversation with the specified inbox IDs
|
|
496
|
+
*
|
|
497
|
+
* @param inboxIds - Array of inbox IDs for group members
|
|
498
|
+
* @param options - Optional group creation options
|
|
499
|
+
* @returns The new group
|
|
500
|
+
*/
|
|
202
501
|
newGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group>;
|
|
502
|
+
/**
|
|
503
|
+
* Creates a new DM conversation with the specified identifier
|
|
504
|
+
*
|
|
505
|
+
* @param identifier - Identifier for the DM recipient
|
|
506
|
+
* @param options - Optional DM creation options
|
|
507
|
+
* @returns The new DM
|
|
508
|
+
*/
|
|
203
509
|
newDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm>;
|
|
510
|
+
/**
|
|
511
|
+
* Creates a new DM conversation with the specified inbox ID
|
|
512
|
+
*
|
|
513
|
+
* @param inboxId - Inbox ID for the DM recipient
|
|
514
|
+
* @param options - Optional DM creation options
|
|
515
|
+
* @returns The new DM
|
|
516
|
+
*/
|
|
204
517
|
newDm(inboxId: string, options?: CreateDmOptions): Promise<Dm>;
|
|
518
|
+
/**
|
|
519
|
+
* Lists all conversations with optional filtering
|
|
520
|
+
*
|
|
521
|
+
* @param options - Optional filtering and pagination options
|
|
522
|
+
* @returns Array of conversations
|
|
523
|
+
*/
|
|
205
524
|
list(options?: ListConversationsOptions): Promise<(Dm | Group)[]>;
|
|
525
|
+
/**
|
|
526
|
+
* Lists all groups with optional filtering
|
|
527
|
+
*
|
|
528
|
+
* @param options - Optional filtering and pagination options
|
|
529
|
+
* @returns Array of groups
|
|
530
|
+
*/
|
|
206
531
|
listGroups(options?: Omit<ListConversationsOptions, "conversationType">): Group[];
|
|
532
|
+
/**
|
|
533
|
+
* Lists all DMs with optional filtering
|
|
534
|
+
*
|
|
535
|
+
* @param options - Optional filtering and pagination options
|
|
536
|
+
* @returns Array of DMs
|
|
537
|
+
*/
|
|
207
538
|
listDms(options?: Omit<ListConversationsOptions, "conversationType">): Dm[];
|
|
539
|
+
/**
|
|
540
|
+
* Synchronizes conversations for the current client from the network
|
|
541
|
+
*
|
|
542
|
+
* @returns Promise that resolves when sync is complete
|
|
543
|
+
*/
|
|
208
544
|
sync(): Promise<void>;
|
|
545
|
+
/**
|
|
546
|
+
* Synchronizes all conversations and messages from the network with optional
|
|
547
|
+
* consent state filtering
|
|
548
|
+
*
|
|
549
|
+
* @param consentStates - Optional array of consent states to filter by
|
|
550
|
+
* @returns Promise that resolves when sync is complete
|
|
551
|
+
*/
|
|
209
552
|
syncAll(consentStates?: ConsentState[]): Promise<bigint>;
|
|
553
|
+
/**
|
|
554
|
+
* Creates a stream for new conversations
|
|
555
|
+
*
|
|
556
|
+
* @param callback - Optional callback function for handling new stream value
|
|
557
|
+
* @returns Stream instance for new conversations
|
|
558
|
+
*/
|
|
210
559
|
stream(callback?: StreamCallback<Group | Dm>): AsyncStream<Dm | Group>;
|
|
560
|
+
/**
|
|
561
|
+
* Creates a stream for new group conversations
|
|
562
|
+
*
|
|
563
|
+
* @param callback - Optional callback function for handling new stream value
|
|
564
|
+
* @returns Stream instance for new group conversations
|
|
565
|
+
*/
|
|
211
566
|
streamGroups(callback?: StreamCallback<Group>): AsyncStream<Group>;
|
|
567
|
+
/**
|
|
568
|
+
* Creates a stream for new DM conversations
|
|
569
|
+
*
|
|
570
|
+
* @param callback - Optional callback function for handling new stream value
|
|
571
|
+
* @returns Stream instance for new DM conversations
|
|
572
|
+
*/
|
|
212
573
|
streamDms(callback?: StreamCallback<Dm>): AsyncStream<Dm>;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
574
|
+
/**
|
|
575
|
+
* Creates a stream for all new messages
|
|
576
|
+
*
|
|
577
|
+
* @param callback - Optional callback function for handling new stream value
|
|
578
|
+
* @returns Stream instance for new messages
|
|
579
|
+
*/
|
|
580
|
+
streamAllMessages(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage<unknown>>>;
|
|
581
|
+
/**
|
|
582
|
+
* Creates a stream for all new group messages
|
|
583
|
+
*
|
|
584
|
+
* @param callback - Optional callback function for handling new stream value
|
|
585
|
+
* @returns Stream instance for new group messages
|
|
586
|
+
*/
|
|
587
|
+
streamAllGroupMessages(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage<unknown>>>;
|
|
588
|
+
/**
|
|
589
|
+
* Creates a stream for all new DM messages
|
|
590
|
+
*
|
|
591
|
+
* @param callback - Optional callback function for handling new stream value
|
|
592
|
+
* @returns Stream instance for new DM messages
|
|
593
|
+
*/
|
|
594
|
+
streamAllDmMessages(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage<unknown>>>;
|
|
595
|
+
/**
|
|
596
|
+
* Retrieves HMAC keys for all conversations
|
|
597
|
+
*
|
|
598
|
+
* @returns The HMAC keys for all conversations
|
|
599
|
+
*/
|
|
216
600
|
hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
|
|
217
601
|
}
|
|
218
602
|
|
|
@@ -222,15 +606,70 @@ type PreferenceUpdate = {
|
|
|
222
606
|
key: Uint8Array;
|
|
223
607
|
};
|
|
224
608
|
};
|
|
609
|
+
/**
|
|
610
|
+
* Manages user preferences and consent states
|
|
611
|
+
*
|
|
612
|
+
* This class is not intended to be initialized directly.
|
|
613
|
+
*/
|
|
225
614
|
declare class Preferences {
|
|
226
615
|
#private;
|
|
616
|
+
/**
|
|
617
|
+
* Creates a new preferences instance
|
|
618
|
+
*
|
|
619
|
+
* @param client - The client instance managing preferences
|
|
620
|
+
* @param conversations - The underlying conversations instance
|
|
621
|
+
*/
|
|
227
622
|
constructor(client: Client$1, conversations: Conversations$1);
|
|
623
|
+
/**
|
|
624
|
+
* Retrieves the current inbox state
|
|
625
|
+
*
|
|
626
|
+
* @param refreshFromNetwork - Optional flag to force refresh from network
|
|
627
|
+
* @returns Promise that resolves with the inbox state
|
|
628
|
+
*/
|
|
228
629
|
inboxState(refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.InboxState>;
|
|
630
|
+
/**
|
|
631
|
+
* Gets the latest inbox state for a specific inbox
|
|
632
|
+
*
|
|
633
|
+
* @param inboxId - The inbox ID to get state for
|
|
634
|
+
* @returns Promise that resolves with the latest inbox state
|
|
635
|
+
*/
|
|
229
636
|
getLatestInboxState(inboxId: string): Promise<_xmtp_node_bindings.InboxState>;
|
|
637
|
+
/**
|
|
638
|
+
* Retrieves inbox state for specific inbox IDs
|
|
639
|
+
*
|
|
640
|
+
* @param inboxIds - Array of inbox IDs to get state for
|
|
641
|
+
* @param refreshFromNetwork - Optional flag to force refresh from network
|
|
642
|
+
* @returns Promise that resolves with the inbox state for the inbox IDs
|
|
643
|
+
*/
|
|
230
644
|
inboxStateFromInboxIds(inboxIds: string[], refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.InboxState[]>;
|
|
645
|
+
/**
|
|
646
|
+
* Updates consent states for multiple records
|
|
647
|
+
*
|
|
648
|
+
* @param consentStates - Array of consent records to update
|
|
649
|
+
* @returns Promise that resolves when consent states are updated
|
|
650
|
+
*/
|
|
231
651
|
setConsentStates(consentStates: Consent[]): Promise<void>;
|
|
652
|
+
/**
|
|
653
|
+
* Retrieves consent state for a specific entity
|
|
654
|
+
*
|
|
655
|
+
* @param entityType - Type of entity to get consent for
|
|
656
|
+
* @param entity - Entity identifier
|
|
657
|
+
* @returns Promise that resolves with the consent state
|
|
658
|
+
*/
|
|
232
659
|
getConsentState(entityType: ConsentEntityType, entity: string): Promise<_xmtp_node_bindings.ConsentState>;
|
|
660
|
+
/**
|
|
661
|
+
* Creates a stream of consent state updates
|
|
662
|
+
*
|
|
663
|
+
* @param callback - Optional callback function for handling stream updates
|
|
664
|
+
* @returns Stream instance for consent updates
|
|
665
|
+
*/
|
|
233
666
|
streamConsent(callback?: StreamCallback<Consent[]>): AsyncStream<Consent[]>;
|
|
667
|
+
/**
|
|
668
|
+
* Creates a stream of user preference updates
|
|
669
|
+
*
|
|
670
|
+
* @param callback - Optional callback function for handling stream updates
|
|
671
|
+
* @returns Stream instance for preference updates
|
|
672
|
+
*/
|
|
234
673
|
streamPreferences(callback?: StreamCallback<PreferenceUpdate>): AsyncStream<PreferenceUpdate>;
|
|
235
674
|
}
|
|
236
675
|
|
|
@@ -250,119 +689,387 @@ type Signer = {
|
|
|
250
689
|
getChainId: GetChainId;
|
|
251
690
|
};
|
|
252
691
|
|
|
692
|
+
/**
|
|
693
|
+
* Client for interacting with the XMTP network
|
|
694
|
+
*/
|
|
253
695
|
declare class Client {
|
|
254
696
|
#private;
|
|
697
|
+
/**
|
|
698
|
+
* Creates a new XMTP client instance
|
|
699
|
+
*
|
|
700
|
+
* This class is not intended to be initialized directly.
|
|
701
|
+
* Use `Client.create` or `Client.build` instead.
|
|
702
|
+
*
|
|
703
|
+
* @param options - Optional configuration for the client
|
|
704
|
+
*/
|
|
255
705
|
constructor(options?: ClientOptions);
|
|
706
|
+
/**
|
|
707
|
+
* Initializes the client with the provided identifier
|
|
708
|
+
*
|
|
709
|
+
* This is not meant to be called directly.
|
|
710
|
+
* Use `Client.create` or `Client.build` instead.
|
|
711
|
+
*
|
|
712
|
+
* @param identifier - The identifier to initialize the client with
|
|
713
|
+
*/
|
|
256
714
|
init(identifier: Identifier): Promise<void>;
|
|
715
|
+
/**
|
|
716
|
+
* Creates a new client instance with a signer
|
|
717
|
+
*
|
|
718
|
+
* @param signer - The signer to use for authentication
|
|
719
|
+
* @param options - Optional configuration for the client
|
|
720
|
+
* @returns A new client instance
|
|
721
|
+
*/
|
|
257
722
|
static create(signer: Signer, options?: ClientOptions): Promise<Client>;
|
|
723
|
+
/**
|
|
724
|
+
* Creates a new client instance with an identifier
|
|
725
|
+
*
|
|
726
|
+
* Clients created with this method must already be registered.
|
|
727
|
+
* Any methods called that require a signer will throw an error.
|
|
728
|
+
*
|
|
729
|
+
* @param identifier - The identifier to use
|
|
730
|
+
* @param options - Optional configuration for the client
|
|
731
|
+
* @returns A new client instance
|
|
732
|
+
*/
|
|
258
733
|
static build(identifier: Identifier, options?: ClientOptions): Promise<Client>;
|
|
734
|
+
/**
|
|
735
|
+
* Gets the client options
|
|
736
|
+
*/
|
|
259
737
|
get options(): ClientOptions | undefined;
|
|
738
|
+
/**
|
|
739
|
+
* Gets the signer associated with this client
|
|
740
|
+
*/
|
|
260
741
|
get signer(): Signer | undefined;
|
|
742
|
+
/**
|
|
743
|
+
* Gets the account identifier for this client
|
|
744
|
+
*/
|
|
261
745
|
get accountIdentifier(): Identifier | undefined;
|
|
746
|
+
/**
|
|
747
|
+
* Gets the inbox ID associated with this client
|
|
748
|
+
*/
|
|
262
749
|
get inboxId(): string;
|
|
750
|
+
/**
|
|
751
|
+
* Gets the installation ID for this client
|
|
752
|
+
*/
|
|
263
753
|
get installationId(): string;
|
|
754
|
+
/**
|
|
755
|
+
* Gets the installation ID bytes for this client
|
|
756
|
+
*/
|
|
264
757
|
get installationIdBytes(): Uint8Array<ArrayBufferLike>;
|
|
758
|
+
/**
|
|
759
|
+
* Gets whether the client is registered with the XMTP network
|
|
760
|
+
*
|
|
761
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
762
|
+
*/
|
|
265
763
|
get isRegistered(): boolean;
|
|
764
|
+
/**
|
|
765
|
+
* Gets the conversations manager for this client
|
|
766
|
+
*
|
|
767
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
768
|
+
*/
|
|
266
769
|
get conversations(): Conversations;
|
|
770
|
+
/**
|
|
771
|
+
* Gets the preferences manager for this client
|
|
772
|
+
*
|
|
773
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
774
|
+
*/
|
|
267
775
|
get preferences(): Preferences;
|
|
268
776
|
/**
|
|
777
|
+
* Creates signature text for creating a new inbox
|
|
778
|
+
*
|
|
269
779
|
* WARNING: This function should be used with caution. It is only provided
|
|
270
780
|
* for use in special cases where the provided workflows do not meet the
|
|
271
781
|
* requirements of an application.
|
|
272
782
|
*
|
|
273
|
-
* It is highly recommended to use the `register`
|
|
783
|
+
* It is highly recommended to use the `register` method instead.
|
|
784
|
+
*
|
|
785
|
+
* @returns The signature text
|
|
786
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
274
787
|
*/
|
|
275
788
|
unsafe_createInboxSignatureText(): Promise<string | null | undefined>;
|
|
276
789
|
/**
|
|
790
|
+
* Creates signature text for adding a new account to the client's inbox
|
|
791
|
+
*
|
|
277
792
|
* WARNING: This function should be used with caution. It is only provided
|
|
278
793
|
* for use in special cases where the provided workflows do not meet the
|
|
279
794
|
* requirements of an application.
|
|
280
795
|
*
|
|
281
|
-
* It is highly recommended to use the `unsafe_addAccount`
|
|
796
|
+
* It is highly recommended to use the `unsafe_addAccount` method instead.
|
|
282
797
|
*
|
|
283
798
|
* The `allowInboxReassign` parameter must be true or this function will
|
|
284
799
|
* throw an error.
|
|
800
|
+
*
|
|
801
|
+
* @param newAccountIdentifier - The identifier of the new account
|
|
802
|
+
* @param allowInboxReassign - Whether to allow inbox reassignment
|
|
803
|
+
* @returns The signature text
|
|
804
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
285
805
|
*/
|
|
286
806
|
unsafe_addAccountSignatureText(newAccountIdentifier: Identifier, allowInboxReassign?: boolean): Promise<string | undefined>;
|
|
287
807
|
/**
|
|
808
|
+
* Creates signature text for removing an account from the client's inbox
|
|
809
|
+
*
|
|
288
810
|
* WARNING: This function should be used with caution. It is only provided
|
|
289
811
|
* for use in special cases where the provided workflows do not meet the
|
|
290
812
|
* requirements of an application.
|
|
291
813
|
*
|
|
292
|
-
* It is highly recommended to use the `removeAccount`
|
|
814
|
+
* It is highly recommended to use the `removeAccount` method instead.
|
|
815
|
+
*
|
|
816
|
+
* @param identifier - The identifier of the account to remove
|
|
817
|
+
* @returns The signature text
|
|
818
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
293
819
|
*/
|
|
294
820
|
unsafe_removeAccountSignatureText(identifier: Identifier): Promise<string | undefined>;
|
|
295
821
|
/**
|
|
822
|
+
* Creates signature text for revoking all other installations of the
|
|
823
|
+
* client's inbox
|
|
824
|
+
*
|
|
296
825
|
* WARNING: This function should be used with caution. It is only provided
|
|
297
826
|
* for use in special cases where the provided workflows do not meet the
|
|
298
827
|
* requirements of an application.
|
|
299
828
|
*
|
|
300
|
-
* It is highly recommended to use the `revokeAllOtherInstallations`
|
|
301
|
-
*
|
|
829
|
+
* It is highly recommended to use the `revokeAllOtherInstallations` method instead.
|
|
830
|
+
*
|
|
831
|
+
* @returns The signature text
|
|
832
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
302
833
|
*/
|
|
303
834
|
unsafe_revokeAllOtherInstallationsSignatureText(): Promise<string | undefined>;
|
|
304
835
|
/**
|
|
836
|
+
* Creates signature text for revoking specific installations of the
|
|
837
|
+
* client's inbox
|
|
838
|
+
*
|
|
305
839
|
* WARNING: This function should be used with caution. It is only provided
|
|
306
840
|
* for use in special cases where the provided workflows do not meet the
|
|
307
841
|
* requirements of an application.
|
|
308
842
|
*
|
|
309
|
-
* It is highly recommended to use the `revokeInstallations`
|
|
843
|
+
* It is highly recommended to use the `revokeInstallations` method instead.
|
|
844
|
+
*
|
|
845
|
+
* @param installationIds - The installation IDs to revoke
|
|
846
|
+
* @returns The signature text
|
|
847
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
310
848
|
*/
|
|
311
849
|
unsafe_revokeInstallationsSignatureText(installationIds: Uint8Array[]): Promise<string | undefined>;
|
|
312
850
|
/**
|
|
851
|
+
* Creates signature text for changing the recovery identifier for this
|
|
852
|
+
* client's inbox
|
|
853
|
+
*
|
|
313
854
|
* WARNING: This function should be used with caution. It is only provided
|
|
314
855
|
* for use in special cases where the provided workflows do not meet the
|
|
315
856
|
* requirements of an application.
|
|
316
857
|
*
|
|
317
|
-
* It is highly recommended to use the `
|
|
858
|
+
* It is highly recommended to use the `changeRecoveryIdentifier` method instead.
|
|
859
|
+
*
|
|
860
|
+
* @param identifier - The new recovery identifier
|
|
861
|
+
* @returns The signature text
|
|
862
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
318
863
|
*/
|
|
319
864
|
unsafe_changeRecoveryIdentifierSignatureText(identifier: Identifier): Promise<string | undefined>;
|
|
320
865
|
/**
|
|
866
|
+
* Adds a signature for a specific request type
|
|
867
|
+
*
|
|
321
868
|
* WARNING: This function should be used with caution. It is only provided
|
|
322
869
|
* for use in special cases where the provided workflows do not meet the
|
|
323
870
|
* requirements of an application.
|
|
324
871
|
*
|
|
325
872
|
* It is highly recommended to use the `register`, `unsafe_addAccount`,
|
|
326
873
|
* `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
|
|
327
|
-
*
|
|
874
|
+
* methods instead.
|
|
875
|
+
*
|
|
876
|
+
* @param signatureType - The type of signature request
|
|
877
|
+
* @param signatureText - The text to sign
|
|
878
|
+
* @param signer - The signer to use
|
|
879
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
328
880
|
*/
|
|
329
881
|
unsafe_addSignature(signatureType: SignatureRequestType, signatureText: string, signer: Signer): Promise<void>;
|
|
330
882
|
/**
|
|
883
|
+
* Applies all pending signatures
|
|
884
|
+
*
|
|
331
885
|
* WARNING: This function should be used with caution. It is only provided
|
|
332
886
|
* for use in special cases where the provided workflows do not meet the
|
|
333
887
|
* requirements of an application.
|
|
334
888
|
*
|
|
335
889
|
* It is highly recommended to use the `register`, `unsafe_addAccount`,
|
|
336
890
|
* `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
|
|
337
|
-
*
|
|
891
|
+
* methods instead.
|
|
892
|
+
*
|
|
893
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
338
894
|
*/
|
|
339
895
|
unsafe_applySignatures(): Promise<void>;
|
|
896
|
+
/**
|
|
897
|
+
* Registers the client with the XMTP network
|
|
898
|
+
*
|
|
899
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
900
|
+
*
|
|
901
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
902
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
903
|
+
*/
|
|
340
904
|
register(): Promise<void>;
|
|
341
905
|
/**
|
|
906
|
+
* Adds a new account to the client inbox
|
|
907
|
+
*
|
|
342
908
|
* WARNING: This function should be used with caution. Adding a wallet already
|
|
343
|
-
* associated with an
|
|
909
|
+
* associated with an inbox ID will cause the wallet to lose access to
|
|
344
910
|
* that inbox.
|
|
345
911
|
*
|
|
346
912
|
* The `allowInboxReassign` parameter must be true to reassign an inbox
|
|
347
913
|
* already associated with a different account.
|
|
914
|
+
*
|
|
915
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
916
|
+
*
|
|
917
|
+
* @param newAccountSigner - The signer for the new account
|
|
918
|
+
* @param allowInboxReassign - Whether to allow inbox reassignment
|
|
919
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
920
|
+
* @throws {AccountAlreadyAssociatedError} if the account is already associated with an inbox ID
|
|
921
|
+
* @throws {GenerateSignatureError} if the signature cannot be generated
|
|
922
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
348
923
|
*/
|
|
349
924
|
unsafe_addAccount(newAccountSigner: Signer, allowInboxReassign?: boolean): Promise<void>;
|
|
925
|
+
/**
|
|
926
|
+
* Removes an account from the client's inbox
|
|
927
|
+
*
|
|
928
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
929
|
+
*
|
|
930
|
+
* @param identifier - The identifier of the account to remove
|
|
931
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
932
|
+
* @throws {GenerateSignatureError} if the signature cannot be generated
|
|
933
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
934
|
+
*/
|
|
350
935
|
removeAccount(identifier: Identifier): Promise<void>;
|
|
936
|
+
/**
|
|
937
|
+
* Revokes all other installations of the client's inbox
|
|
938
|
+
*
|
|
939
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
940
|
+
*
|
|
941
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
942
|
+
* @throws {GenerateSignatureError} if the signature cannot be generated
|
|
943
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
944
|
+
*/
|
|
351
945
|
revokeAllOtherInstallations(): Promise<void>;
|
|
946
|
+
/**
|
|
947
|
+
* Revokes specific installations of the client's inbox
|
|
948
|
+
*
|
|
949
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
950
|
+
*
|
|
951
|
+
* @param installationIds - The installation IDs to revoke
|
|
952
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
953
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
954
|
+
* @throws {GenerateSignatureError} if the signature cannot be generated
|
|
955
|
+
*/
|
|
352
956
|
revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
|
|
957
|
+
/**
|
|
958
|
+
* Changes the recovery identifier for the client's inbox
|
|
959
|
+
*
|
|
960
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
961
|
+
*
|
|
962
|
+
* @param identifier - The new recovery identifier
|
|
963
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
964
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
965
|
+
* @throws {GenerateSignatureError} if the signature cannot be generated
|
|
966
|
+
*/
|
|
353
967
|
changeRecoveryIdentifier(identifier: Identifier): Promise<void>;
|
|
968
|
+
/**
|
|
969
|
+
* Checks if the client can message the specified identifiers
|
|
970
|
+
*
|
|
971
|
+
* @param identifiers - The identifiers to check
|
|
972
|
+
* @returns Whether the client can message the identifiers
|
|
973
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
974
|
+
*/
|
|
354
975
|
canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
|
|
976
|
+
/**
|
|
977
|
+
* Checks if the specified identifiers can be messaged
|
|
978
|
+
*
|
|
979
|
+
* @param identifiers - The identifiers to check
|
|
980
|
+
* @param env - Optional XMTP environment
|
|
981
|
+
* @returns Map of identifiers to whether they can be messaged
|
|
982
|
+
*/
|
|
355
983
|
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
984
|
+
/**
|
|
985
|
+
* Gets the key package statuses for the specified installation IDs
|
|
986
|
+
*
|
|
987
|
+
* @param installationIds - The installation IDs to check
|
|
988
|
+
* @returns The key package statuses
|
|
989
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
990
|
+
*/
|
|
356
991
|
getKeyPackageStatusesForInstallationIds(installationIds: string[]): Promise<Record<string, _xmtp_node_bindings.KeyPackageStatus>>;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
992
|
+
/**
|
|
993
|
+
* Gets the codec for a given content type
|
|
994
|
+
*
|
|
995
|
+
* @param contentType - The content type to get the codec for
|
|
996
|
+
* @returns The codec, if found
|
|
997
|
+
*/
|
|
998
|
+
codecFor<T = unknown>(contentType: ContentTypeId): ContentCodec<T> | undefined;
|
|
999
|
+
/**
|
|
1000
|
+
* Encodes content for a given content type
|
|
1001
|
+
*
|
|
1002
|
+
* @param content - The content to encode
|
|
1003
|
+
* @param contentType - The content type to encode for
|
|
1004
|
+
* @returns The encoded content
|
|
1005
|
+
* @throws {CodecNotFoundError} if no codec is found for the content type
|
|
1006
|
+
*/
|
|
1007
|
+
encodeContent(content: unknown, contentType: ContentTypeId): EncodedContent<Record<string, string>>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Decodes a message for a given content type
|
|
1010
|
+
*
|
|
1011
|
+
* @param message - The message to decode
|
|
1012
|
+
* @param contentType - The content type to decode for
|
|
1013
|
+
* @returns The decoded content
|
|
1014
|
+
* @throws {CodecNotFoundError} if no codec is found for the content type
|
|
1015
|
+
* @throws {InvalidGroupMembershipChangeError} if the message is an invalid group membership change
|
|
1016
|
+
*/
|
|
1017
|
+
decodeContent<T = unknown>(message: Message, contentType: ContentTypeId): T;
|
|
1018
|
+
/**
|
|
1019
|
+
* Finds the inbox ID for a given identifier
|
|
1020
|
+
*
|
|
1021
|
+
* @param identifier - The identifier to look up
|
|
1022
|
+
* @returns The inbox ID, if found
|
|
1023
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1024
|
+
*/
|
|
360
1025
|
getInboxIdByIdentifier(identifier: Identifier): Promise<string | null>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Signs a message with the installation key
|
|
1028
|
+
*
|
|
1029
|
+
* @param signatureText - The text to sign
|
|
1030
|
+
* @returns The signature
|
|
1031
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1032
|
+
*/
|
|
361
1033
|
signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Verifies a signature was made with the installation key
|
|
1036
|
+
*
|
|
1037
|
+
* @param signatureText - The text that was signed
|
|
1038
|
+
* @param signatureBytes - The signature bytes to verify
|
|
1039
|
+
* @returns Whether the signature is valid
|
|
1040
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1041
|
+
*/
|
|
362
1042
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* Verifies a signature was made with a public key
|
|
1045
|
+
*
|
|
1046
|
+
* @param signatureText - The text that was signed
|
|
1047
|
+
* @param signatureBytes - The signature bytes to verify
|
|
1048
|
+
* @param publicKey - The public key to verify against
|
|
1049
|
+
* @returns Whether the signature is valid
|
|
1050
|
+
*/
|
|
363
1051
|
static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
1052
|
+
/**
|
|
1053
|
+
* Checks if an address is authorized for an inbox
|
|
1054
|
+
*
|
|
1055
|
+
* @param inboxId - The inbox ID to check
|
|
1056
|
+
* @param address - The address to check
|
|
1057
|
+
* @param options - Optional network options
|
|
1058
|
+
* @returns Whether the address is authorized
|
|
1059
|
+
*/
|
|
364
1060
|
static isAddressAuthorized(inboxId: string, address: string, options?: NetworkOptions): Promise<boolean>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Checks if an installation is authorized for an inbox
|
|
1063
|
+
*
|
|
1064
|
+
* @param inboxId - The inbox ID to check
|
|
1065
|
+
* @param installation - The installation to check
|
|
1066
|
+
* @param options - Optional network options
|
|
1067
|
+
* @returns Whether the installation is authorized
|
|
1068
|
+
*/
|
|
365
1069
|
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, options?: NetworkOptions): Promise<boolean>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Gets the version of the Node bindings
|
|
1072
|
+
*/
|
|
366
1073
|
static get version(): string;
|
|
367
1074
|
}
|
|
368
1075
|
|