@xmtp/wasm-bindings 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,16 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createClient(host: string, inbox_id: string, account_identifier: Identifier, db_path?: string | null, encryption_key?: Uint8Array | null, device_sync_server_url?: string | null, device_sync_worker_mode?: DeviceSyncWorkerMode | null, log_options?: LogOptions | null, allow_offline?: boolean | null): Promise<Client>;
4
- export function verifySignedWithPublicKey(signature_text: string, signature_bytes: Uint8Array, public_key: Uint8Array): void;
3
+ export function getInboxIdForIdentifier(host: string, accountIdentifier: Identifier): Promise<string | undefined>;
4
+ export function generateInboxId(accountIdentifier: Identifier): string;
5
5
  export function encodeMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment): Uint8Array;
6
6
  export function decodeMultiRemoteAttachment(bytes: Uint8Array): MultiRemoteAttachment;
7
7
  export function encodeReaction(reaction: Reaction): Uint8Array;
8
8
  export function decodeReaction(bytes: Uint8Array): Reaction;
9
- export function getInboxIdForIdentifier(host: string, accountIdentifier: Identifier): Promise<string | undefined>;
10
- export function generateInboxId(accountIdentifier: Identifier): string;
9
+ export function inboxStateFromInboxIds(host: string, inbox_ids: string[]): Promise<InboxState[]>;
10
+ export function verifySignedWithPublicKey(signature_text: string, signature_bytes: Uint8Array, public_key: Uint8Array): void;
11
+ export function revokeInstallationsSignatureRequest(host: string, recovery_identifier: Identifier, inbox_id: string, installation_ids: Uint8Array[]): Promise<SignatureRequestHandle>;
12
+ export function applySignatureRequest(host: string, signature_request: SignatureRequestHandle): Promise<void>;
13
+ export function createClient(host: string, inbox_id: string, account_identifier: Identifier, db_path?: string | null, encryption_key?: Uint8Array | null, device_sync_server_url?: string | null, device_sync_worker_mode?: DeviceSyncWorkerMode | null, log_options?: LogOptions | null, allow_offline?: boolean | null): Promise<Client>;
11
14
  export enum ConsentEntityType {
12
15
  GroupId = 0,
13
16
  InboxId = 1,
@@ -92,13 +95,6 @@ export enum ReactionSchema {
92
95
  Shortcode = 2,
93
96
  Custom = 3,
94
97
  }
95
- export enum SignatureRequestType {
96
- AddWallet = 0,
97
- CreateInbox = 1,
98
- RevokeWallet = 2,
99
- RevokeInstallations = 3,
100
- ChangeRecoveryIdentifier = 4,
101
- }
102
98
  export enum SortDirection {
103
99
  Ascending = 0,
104
100
  Descending = 1,
@@ -135,33 +131,6 @@ export class ApiStats {
135
131
  export class Client {
136
132
  private constructor();
137
133
  free(): void;
138
- /**
139
- * Output booleans should be zipped with the index of input identifiers
140
- */
141
- canMessage(account_identifiers: Identifier[]): Promise<any>;
142
- registerIdentity(): Promise<void>;
143
- sendSyncRequest(): Promise<void>;
144
- findInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
145
- inboxStateFromInboxIds(inbox_ids: string[], refresh_from_network: boolean): Promise<InboxState[]>;
146
- conversations(): Conversations;
147
- syncPreferences(): Promise<number>;
148
- apiStatistics(): ApiStats;
149
- apiIdentityStatistics(): IdentityStats;
150
- apiAggregateStatistics(): string;
151
- clearAllStatistics(): void;
152
- uploadDebugArchive(server_url: string): Promise<string>;
153
- createInboxSignatureText(): string | undefined;
154
- addWalletSignatureText(new_identifier: Identifier): Promise<string>;
155
- revokeWalletSignatureText(identifier: Identifier): Promise<string>;
156
- revokeAllOtherInstallationsSignatureText(): Promise<string>;
157
- revokeInstallationsSignatureText(installation_ids: Uint8Array[]): Promise<string>;
158
- changeRecoveryIdentifierSignatureText(new_recovery_identifier: Identifier): Promise<string>;
159
- addEcdsaSignature(signature_type: SignatureRequestType, signature_bytes: Uint8Array): Promise<void>;
160
- addPasskeySignature(signature_type: SignatureRequestType, signature: PasskeySignature): Promise<void>;
161
- addScwSignature(signature_type: SignatureRequestType, signature_bytes: Uint8Array, chain_id: bigint, block_number?: bigint | null): Promise<void>;
162
- applySignatureRequests(): Promise<void>;
163
- signWithInstallationKey(signature_text: string): Uint8Array;
164
- verifySignedWithInstallationKey(signature_text: string, signature_bytes: Uint8Array): void;
165
134
  setConsentStates(records: Consent[]): Promise<void>;
166
135
  getConsentState(entity_type: ConsentEntityType, entity: string): Promise<ConsentState>;
167
136
  /**
@@ -182,6 +151,30 @@ export class Client {
182
151
  *
183
152
  */
184
153
  getKeyPackageStatusesForInstallationIds(installation_ids: string[]): Promise<any>;
154
+ createInboxSignatureRequest(): SignatureRequestHandle | undefined;
155
+ addWalletSignatureRequest(new_identifier: Identifier): Promise<SignatureRequestHandle>;
156
+ revokeWalletSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>;
157
+ revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle>;
158
+ revokeInstallationsSignatureRequest(installation_ids: Uint8Array[]): Promise<SignatureRequestHandle>;
159
+ changeRecoveryIdentifierSignatureRequest(new_recovery_identifier: Identifier): Promise<SignatureRequestHandle>;
160
+ applySignatureRequest(signature_request: SignatureRequestHandle): Promise<void>;
161
+ registerIdentity(signature_request: SignatureRequestHandle): Promise<void>;
162
+ signWithInstallationKey(signature_text: string): Uint8Array;
163
+ verifySignedWithInstallationKey(signature_text: string, signature_bytes: Uint8Array): void;
164
+ /**
165
+ * Output booleans should be zipped with the index of input identifiers
166
+ */
167
+ canMessage(account_identifiers: Identifier[]): Promise<any>;
168
+ sendSyncRequest(): Promise<void>;
169
+ findInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
170
+ inboxStateFromInboxIds(inbox_ids: string[], refresh_from_network: boolean): Promise<InboxState[]>;
171
+ conversations(): Conversations;
172
+ syncPreferences(): Promise<number>;
173
+ apiStatistics(): ApiStats;
174
+ apiIdentityStatistics(): IdentityStats;
175
+ apiAggregateStatistics(): string;
176
+ clearAllStatistics(): void;
177
+ uploadDebugArchive(server_url: string): Promise<string>;
185
178
  readonly accountIdentifier: Identifier;
186
179
  readonly inboxId: string;
187
180
  readonly isRegistered: boolean;
@@ -583,6 +576,14 @@ export class RemoteAttachmentInfo {
583
576
  get filename(): string | undefined;
584
577
  set filename(value: string | null | undefined);
585
578
  }
579
+ export class SignatureRequestHandle {
580
+ private constructor();
581
+ free(): void;
582
+ signatureText(): Promise<string>;
583
+ addEcdsaSignature(signature_bytes: Uint8Array): Promise<void>;
584
+ addPasskeySignature(signature: PasskeySignature): Promise<void>;
585
+ addScwSignature(account_identifier: Identifier, signature_bytes: Uint8Array, chain_id: bigint, block_number?: bigint | null): Promise<void>;
586
+ }
586
587
  export class StreamCloser {
587
588
  private constructor();
588
589
  free(): void;
@@ -608,47 +609,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
608
609
 
609
610
  export interface InitOutput {
610
611
  readonly memory: WebAssembly.Memory;
611
- readonly __wbg_client_free: (a: number, b: number) => void;
612
- readonly __wbg_logoptions_free: (a: number, b: number) => void;
613
- readonly __wbg_get_logoptions_structured: (a: number) => number;
614
- readonly __wbg_set_logoptions_structured: (a: number, b: number) => void;
615
- readonly __wbg_get_logoptions_performance: (a: number) => number;
616
- readonly __wbg_set_logoptions_performance: (a: number, b: number) => void;
617
- readonly __wbg_get_logoptions_level: (a: number) => number;
618
- readonly __wbg_set_logoptions_level: (a: number, b: number) => void;
619
- readonly logoptions_new: (a: number, b: number, c: number) => number;
620
- readonly createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => any;
621
- readonly client_accountIdentifier: (a: number) => any;
622
- readonly client_inboxId: (a: number) => [number, number];
623
- readonly client_isRegistered: (a: number) => number;
624
- readonly client_installationId: (a: number) => [number, number];
625
- readonly client_installationIdBytes: (a: number) => any;
626
- readonly client_canMessage: (a: number, b: number, c: number) => any;
627
- readonly client_registerIdentity: (a: number) => any;
628
- readonly client_sendSyncRequest: (a: number) => any;
629
- readonly client_findInboxIdByIdentifier: (a: number, b: any) => any;
630
- readonly client_inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
631
- readonly client_conversations: (a: number) => number;
632
- readonly client_syncPreferences: (a: number) => any;
633
- readonly client_apiStatistics: (a: number) => number;
634
- readonly client_apiIdentityStatistics: (a: number) => number;
635
- readonly client_apiAggregateStatistics: (a: number) => [number, number];
636
- readonly client_clearAllStatistics: (a: number) => void;
637
- readonly client_uploadDebugArchive: (a: number, b: number, c: number) => any;
638
- readonly verifySignedWithPublicKey: (a: number, b: number, c: any, d: any) => [number, number];
639
- readonly __wbg_passkeysignature_free: (a: number, b: number) => void;
640
- readonly client_createInboxSignatureText: (a: number) => [number, number, number, number];
641
- readonly client_addWalletSignatureText: (a: number, b: any) => any;
642
- readonly client_revokeWalletSignatureText: (a: number, b: any) => any;
643
- readonly client_revokeAllOtherInstallationsSignatureText: (a: number) => any;
644
- readonly client_revokeInstallationsSignatureText: (a: number, b: number, c: number) => any;
645
- readonly client_changeRecoveryIdentifierSignatureText: (a: number, b: any) => any;
646
- readonly client_addEcdsaSignature: (a: number, b: number, c: any) => any;
647
- readonly client_addPasskeySignature: (a: number, b: number, c: number) => any;
648
- readonly client_addScwSignature: (a: number, b: number, c: any, d: bigint, e: number, f: bigint) => any;
649
- readonly client_applySignatureRequests: (a: number) => any;
650
- readonly client_signWithInstallationKey: (a: number, b: number, c: number) => [number, number, number];
651
- readonly client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
652
612
  readonly __wbg_apistats_free: (a: number, b: number) => void;
653
613
  readonly __wbg_get_apistats_upload_key_package: (a: number) => bigint;
654
614
  readonly __wbg_set_apistats_upload_key_package: (a: number, b: bigint) => void;
@@ -667,6 +627,8 @@ export interface InitOutput {
667
627
  readonly __wbg_get_apistats_subscribe_welcomes: (a: number) => bigint;
668
628
  readonly __wbg_set_apistats_subscribe_welcomes: (a: number, b: bigint) => void;
669
629
  readonly __wbg_identitystats_free: (a: number, b: number) => void;
630
+ readonly getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
631
+ readonly generateInboxId: (a: any) => [number, number, number, number];
670
632
  readonly __wbg_set_identitystats_publish_identity_update: (a: number, b: bigint) => void;
671
633
  readonly __wbg_set_identitystats_get_identity_updates_v2: (a: number, b: bigint) => void;
672
634
  readonly __wbg_set_identitystats_get_inbox_ids: (a: number, b: bigint) => void;
@@ -856,8 +818,6 @@ export interface InitOutput {
856
818
  readonly __wbg_get_encodedcontent_content: (a: number) => any;
857
819
  readonly __wbg_set_encodedcontent_content: (a: number, b: any) => void;
858
820
  readonly encodedcontent_new: (a: number, b: any, c: number, d: number, e: number, f: any) => number;
859
- readonly getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
860
- readonly generateInboxId: (a: any) => [number, number, number, number];
861
821
  readonly __wbg_installation_free: (a: number, b: number) => void;
862
822
  readonly __wbg_get_installation_bytes: (a: number) => any;
863
823
  readonly __wbg_set_installation_bytes: (a: number, b: any) => void;
@@ -881,6 +841,7 @@ export interface InitOutput {
881
841
  readonly __wbg_lifetime_free: (a: number, b: number) => void;
882
842
  readonly __wbg_get_lifetime_not_after: (a: number) => bigint;
883
843
  readonly __wbg_set_lifetime_not_after: (a: number, b: bigint) => void;
844
+ readonly inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
884
845
  readonly client_inboxState: (a: number, b: number) => any;
885
846
  readonly client_getLatestInboxState: (a: number, b: number, c: number) => any;
886
847
  readonly client_getKeyPackageStatusesForInstallationIds: (a: number, b: number, c: number) => any;
@@ -926,6 +887,25 @@ export interface InitOutput {
926
887
  readonly opfs_getCapacity: () => number;
927
888
  readonly opfs_addCapacity: (a: number) => any;
928
889
  readonly opfs_reduceCapacity: (a: number) => any;
890
+ readonly __wbg_signaturerequesthandle_free: (a: number, b: number) => void;
891
+ readonly verifySignedWithPublicKey: (a: number, b: number, c: any, d: any) => [number, number];
892
+ readonly revokeInstallationsSignatureRequest: (a: number, b: number, c: any, d: number, e: number, f: number, g: number) => any;
893
+ readonly applySignatureRequest: (a: number, b: number, c: number) => any;
894
+ readonly __wbg_passkeysignature_free: (a: number, b: number) => void;
895
+ readonly signaturerequesthandle_signatureText: (a: number) => any;
896
+ readonly signaturerequesthandle_addEcdsaSignature: (a: number, b: any) => any;
897
+ readonly signaturerequesthandle_addPasskeySignature: (a: number, b: number) => any;
898
+ readonly signaturerequesthandle_addScwSignature: (a: number, b: any, c: any, d: bigint, e: number, f: bigint) => any;
899
+ readonly client_createInboxSignatureRequest: (a: number) => [number, number, number];
900
+ readonly client_addWalletSignatureRequest: (a: number, b: any) => any;
901
+ readonly client_revokeWalletSignatureRequest: (a: number, b: any) => any;
902
+ readonly client_revokeAllOtherInstallationsSignatureRequest: (a: number) => any;
903
+ readonly client_revokeInstallationsSignatureRequest: (a: number, b: number, c: number) => any;
904
+ readonly client_changeRecoveryIdentifierSignatureRequest: (a: number, b: any) => any;
905
+ readonly client_applySignatureRequest: (a: number, b: number) => any;
906
+ readonly client_registerIdentity: (a: number, b: number) => any;
907
+ readonly client_signWithInstallationKey: (a: number, b: number, c: number) => [number, number, number];
908
+ readonly client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
929
909
  readonly __wbg_get_listconversationsoptions_createdAfterNs: (a: number) => [number, bigint];
930
910
  readonly __wbg_get_listmessagesoptions_sentBeforeNs: (a: number) => [number, bigint];
931
911
  readonly __wbg_get_listmessagesoptions_sentAfterNs: (a: number) => [number, bigint];
@@ -967,6 +947,32 @@ export interface InitOutput {
967
947
  readonly streamcloser_endAndWait: (a: number) => any;
968
948
  readonly streamcloser_waitForReady: (a: number) => any;
969
949
  readonly streamcloser_isClosed: (a: number) => number;
950
+ readonly __wbg_client_free: (a: number, b: number) => void;
951
+ readonly __wbg_logoptions_free: (a: number, b: number) => void;
952
+ readonly __wbg_get_logoptions_structured: (a: number) => number;
953
+ readonly __wbg_set_logoptions_structured: (a: number, b: number) => void;
954
+ readonly __wbg_get_logoptions_performance: (a: number) => number;
955
+ readonly __wbg_set_logoptions_performance: (a: number, b: number) => void;
956
+ readonly __wbg_get_logoptions_level: (a: number) => number;
957
+ readonly __wbg_set_logoptions_level: (a: number, b: number) => void;
958
+ readonly logoptions_new: (a: number, b: number, c: number) => number;
959
+ readonly createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => any;
960
+ readonly client_accountIdentifier: (a: number) => any;
961
+ readonly client_inboxId: (a: number) => [number, number];
962
+ readonly client_isRegistered: (a: number) => number;
963
+ readonly client_installationId: (a: number) => [number, number];
964
+ readonly client_installationIdBytes: (a: number) => any;
965
+ readonly client_canMessage: (a: number, b: number, c: number) => any;
966
+ readonly client_sendSyncRequest: (a: number) => any;
967
+ readonly client_findInboxIdByIdentifier: (a: number, b: any) => any;
968
+ readonly client_inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
969
+ readonly client_conversations: (a: number) => number;
970
+ readonly client_syncPreferences: (a: number) => any;
971
+ readonly client_apiStatistics: (a: number) => number;
972
+ readonly client_apiIdentityStatistics: (a: number) => number;
973
+ readonly client_apiAggregateStatistics: (a: number) => [number, number];
974
+ readonly client_clearAllStatistics: (a: number) => void;
975
+ readonly client_uploadDebugArchive: (a: number, b: number, c: number) => any;
970
976
  readonly __wbg_permissionpolicyset_free: (a: number, b: number) => void;
971
977
  readonly __wbg_get_permissionpolicyset_addMemberPolicy: (a: number) => number;
972
978
  readonly __wbg_set_permissionpolicyset_addMemberPolicy: (a: number, b: number) => void;
@@ -1031,9 +1037,9 @@ export interface InitOutput {
1031
1037
  readonly __externref_table_dealloc: (a: number) => void;
1032
1038
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc094ec3bdf8c16b7: (a: number, b: number) => void;
1033
1039
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0eb99f8c2f057fcc: (a: number, b: number) => void;
1034
- readonly closure4569_externref_shim: (a: number, b: number, c: any) => void;
1040
+ readonly closure4617_externref_shim: (a: number, b: number, c: any) => void;
1035
1041
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h232599d7dcf89d52: (a: number, b: number) => void;
1036
- readonly closure5545_externref_shim: (a: number, b: number, c: any, d: any) => void;
1042
+ readonly closure5593_externref_shim: (a: number, b: number, c: any, d: any) => void;
1037
1043
  readonly __wbindgen_start: () => void;
1038
1044
  }
1039
1045
 
@@ -215,42 +215,46 @@ function debugString(val) {
215
215
  // TODO we could test for more things here, like `Set`s and `Map`s.
216
216
  return className;
217
217
  }
218
-
219
- function _assertClass(instance, klass) {
220
- if (!(instance instanceof klass)) {
221
- throw new Error(`expected instance of ${klass.name}`);
222
- }
223
- }
224
218
  /**
225
219
  * @param {string} host
226
- * @param {string} inbox_id
227
- * @param {Identifier} account_identifier
228
- * @param {string | null} [db_path]
229
- * @param {Uint8Array | null} [encryption_key]
230
- * @param {string | null} [device_sync_server_url]
231
- * @param {DeviceSyncWorkerMode | null} [device_sync_worker_mode]
232
- * @param {LogOptions | null} [log_options]
233
- * @param {boolean | null} [allow_offline]
234
- * @returns {Promise<Client>}
220
+ * @param {Identifier} accountIdentifier
221
+ * @returns {Promise<string | undefined>}
235
222
  */
236
- export function createClient(host, inbox_id, account_identifier, db_path, encryption_key, device_sync_server_url, device_sync_worker_mode, log_options, allow_offline) {
223
+ export function getInboxIdForIdentifier(host, accountIdentifier) {
237
224
  const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
238
225
  const len0 = WASM_VECTOR_LEN;
239
- const ptr1 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
- const len1 = WASM_VECTOR_LEN;
241
- var ptr2 = isLikeNone(db_path) ? 0 : passStringToWasm0(db_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
242
- var len2 = WASM_VECTOR_LEN;
243
- var ptr3 = isLikeNone(device_sync_server_url) ? 0 : passStringToWasm0(device_sync_server_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
244
- var len3 = WASM_VECTOR_LEN;
245
- let ptr4 = 0;
246
- if (!isLikeNone(log_options)) {
247
- _assertClass(log_options, LogOptions);
248
- ptr4 = log_options.__destroy_into_raw();
249
- }
250
- const ret = wasm.createClient(ptr0, len0, ptr1, len1, account_identifier, ptr2, len2, isLikeNone(encryption_key) ? 0 : addToExternrefTable0(encryption_key), ptr3, len3, isLikeNone(device_sync_worker_mode) ? 3 : ((__wbindgen_enum_DeviceSyncWorkerMode.indexOf(device_sync_worker_mode) + 1 || 3) - 1), ptr4, isLikeNone(allow_offline) ? 0xFFFFFF : allow_offline ? 1 : 0);
226
+ const ret = wasm.getInboxIdForIdentifier(ptr0, len0, accountIdentifier);
251
227
  return ret;
252
228
  }
253
229
 
230
+ function takeFromExternrefTable0(idx) {
231
+ const value = wasm.__wbindgen_export_4.get(idx);
232
+ wasm.__externref_table_dealloc(idx);
233
+ return value;
234
+ }
235
+ /**
236
+ * @param {Identifier} accountIdentifier
237
+ * @returns {string}
238
+ */
239
+ export function generateInboxId(accountIdentifier) {
240
+ let deferred2_0;
241
+ let deferred2_1;
242
+ try {
243
+ const ret = wasm.generateInboxId(accountIdentifier);
244
+ var ptr1 = ret[0];
245
+ var len1 = ret[1];
246
+ if (ret[3]) {
247
+ ptr1 = 0; len1 = 0;
248
+ throw takeFromExternrefTable0(ret[2]);
249
+ }
250
+ deferred2_0 = ptr1;
251
+ deferred2_1 = len1;
252
+ return getStringFromWasm0(ptr1, len1);
253
+ } finally {
254
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
255
+ }
256
+ }
257
+
254
258
  function passArrayJsValueToWasm0(array, malloc) {
255
259
  const ptr = malloc(array.length * 4, 4) >>> 0;
256
260
  for (let i = 0; i < array.length; i++) {
@@ -261,25 +265,11 @@ function passArrayJsValueToWasm0(array, malloc) {
261
265
  return ptr;
262
266
  }
263
267
 
264
- function takeFromExternrefTable0(idx) {
265
- const value = wasm.__wbindgen_export_4.get(idx);
266
- wasm.__externref_table_dealloc(idx);
267
- return value;
268
- }
269
- /**
270
- * @param {string} signature_text
271
- * @param {Uint8Array} signature_bytes
272
- * @param {Uint8Array} public_key
273
- */
274
- export function verifySignedWithPublicKey(signature_text, signature_bytes, public_key) {
275
- const ptr0 = passStringToWasm0(signature_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
- const len0 = WASM_VECTOR_LEN;
277
- const ret = wasm.verifySignedWithPublicKey(ptr0, len0, signature_bytes, public_key);
278
- if (ret[1]) {
279
- throw takeFromExternrefTable0(ret[0]);
268
+ function _assertClass(instance, klass) {
269
+ if (!(instance instanceof klass)) {
270
+ throw new Error(`expected instance of ${klass.name}`);
280
271
  }
281
272
  }
282
-
283
273
  /**
284
274
  * @param {MultiRemoteAttachment} multiRemoteAttachment
285
275
  * @returns {Uint8Array}
@@ -340,37 +330,91 @@ function passArray8ToWasm0(arg, malloc) {
340
330
  }
341
331
  /**
342
332
  * @param {string} host
343
- * @param {Identifier} accountIdentifier
344
- * @returns {Promise<string | undefined>}
333
+ * @param {string[]} inbox_ids
334
+ * @returns {Promise<InboxState[]>}
345
335
  */
346
- export function getInboxIdForIdentifier(host, accountIdentifier) {
336
+ export function inboxStateFromInboxIds(host, inbox_ids) {
347
337
  const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
338
  const len0 = WASM_VECTOR_LEN;
349
- const ret = wasm.getInboxIdForIdentifier(ptr0, len0, accountIdentifier);
339
+ const ptr1 = passArrayJsValueToWasm0(inbox_ids, wasm.__wbindgen_malloc);
340
+ const len1 = WASM_VECTOR_LEN;
341
+ const ret = wasm.inboxStateFromInboxIds(ptr0, len0, ptr1, len1);
350
342
  return ret;
351
343
  }
352
344
 
353
345
  /**
354
- * @param {Identifier} accountIdentifier
355
- * @returns {string}
346
+ * @param {string} signature_text
347
+ * @param {Uint8Array} signature_bytes
348
+ * @param {Uint8Array} public_key
356
349
  */
357
- export function generateInboxId(accountIdentifier) {
358
- let deferred2_0;
359
- let deferred2_1;
360
- try {
361
- const ret = wasm.generateInboxId(accountIdentifier);
362
- var ptr1 = ret[0];
363
- var len1 = ret[1];
364
- if (ret[3]) {
365
- ptr1 = 0; len1 = 0;
366
- throw takeFromExternrefTable0(ret[2]);
367
- }
368
- deferred2_0 = ptr1;
369
- deferred2_1 = len1;
370
- return getStringFromWasm0(ptr1, len1);
371
- } finally {
372
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
350
+ export function verifySignedWithPublicKey(signature_text, signature_bytes, public_key) {
351
+ const ptr0 = passStringToWasm0(signature_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.verifySignedWithPublicKey(ptr0, len0, signature_bytes, public_key);
354
+ if (ret[1]) {
355
+ throw takeFromExternrefTable0(ret[0]);
356
+ }
357
+ }
358
+
359
+ /**
360
+ * @param {string} host
361
+ * @param {Identifier} recovery_identifier
362
+ * @param {string} inbox_id
363
+ * @param {Uint8Array[]} installation_ids
364
+ * @returns {Promise<SignatureRequestHandle>}
365
+ */
366
+ export function revokeInstallationsSignatureRequest(host, recovery_identifier, inbox_id, installation_ids) {
367
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
+ const len0 = WASM_VECTOR_LEN;
369
+ const ptr1 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
370
+ const len1 = WASM_VECTOR_LEN;
371
+ const ptr2 = passArrayJsValueToWasm0(installation_ids, wasm.__wbindgen_malloc);
372
+ const len2 = WASM_VECTOR_LEN;
373
+ const ret = wasm.revokeInstallationsSignatureRequest(ptr0, len0, recovery_identifier, ptr1, len1, ptr2, len2);
374
+ return ret;
375
+ }
376
+
377
+ /**
378
+ * @param {string} host
379
+ * @param {SignatureRequestHandle} signature_request
380
+ * @returns {Promise<void>}
381
+ */
382
+ export function applySignatureRequest(host, signature_request) {
383
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
384
+ const len0 = WASM_VECTOR_LEN;
385
+ _assertClass(signature_request, SignatureRequestHandle);
386
+ const ret = wasm.applySignatureRequest(ptr0, len0, signature_request.__wbg_ptr);
387
+ return ret;
388
+ }
389
+
390
+ /**
391
+ * @param {string} host
392
+ * @param {string} inbox_id
393
+ * @param {Identifier} account_identifier
394
+ * @param {string | null} [db_path]
395
+ * @param {Uint8Array | null} [encryption_key]
396
+ * @param {string | null} [device_sync_server_url]
397
+ * @param {DeviceSyncWorkerMode | null} [device_sync_worker_mode]
398
+ * @param {LogOptions | null} [log_options]
399
+ * @param {boolean | null} [allow_offline]
400
+ * @returns {Promise<Client>}
401
+ */
402
+ export function createClient(host, inbox_id, account_identifier, db_path, encryption_key, device_sync_server_url, device_sync_worker_mode, log_options, allow_offline) {
403
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
404
+ const len0 = WASM_VECTOR_LEN;
405
+ const ptr1 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
406
+ const len1 = WASM_VECTOR_LEN;
407
+ var ptr2 = isLikeNone(db_path) ? 0 : passStringToWasm0(db_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
408
+ var len2 = WASM_VECTOR_LEN;
409
+ var ptr3 = isLikeNone(device_sync_server_url) ? 0 : passStringToWasm0(device_sync_server_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
410
+ var len3 = WASM_VECTOR_LEN;
411
+ let ptr4 = 0;
412
+ if (!isLikeNone(log_options)) {
413
+ _assertClass(log_options, LogOptions);
414
+ ptr4 = log_options.__destroy_into_raw();
373
415
  }
416
+ const ret = wasm.createClient(ptr0, len0, ptr1, len1, account_identifier, ptr2, len2, isLikeNone(encryption_key) ? 0 : addToExternrefTable0(encryption_key), ptr3, len3, isLikeNone(device_sync_worker_mode) ? 3 : ((__wbindgen_enum_DeviceSyncWorkerMode.indexOf(device_sync_worker_mode) + 1 || 3) - 1), ptr4, isLikeNone(allow_offline) ? 0xFFFFFF : allow_offline ? 1 : 0);
417
+ return ret;
374
418
  }
375
419
 
376
420
  function __wbg_adapter_50(arg0, arg1) {
@@ -382,15 +426,15 @@ function __wbg_adapter_53(arg0, arg1) {
382
426
  }
383
427
 
384
428
  function __wbg_adapter_56(arg0, arg1, arg2) {
385
- wasm.closure4569_externref_shim(arg0, arg1, arg2);
429
+ wasm.closure4617_externref_shim(arg0, arg1, arg2);
386
430
  }
387
431
 
388
432
  function __wbg_adapter_59(arg0, arg1) {
389
433
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h232599d7dcf89d52(arg0, arg1);
390
434
  }
391
435
 
392
- function __wbg_adapter_775(arg0, arg1, arg2, arg3) {
393
- wasm.closure5545_externref_shim(arg0, arg1, arg2, arg3);
436
+ function __wbg_adapter_781(arg0, arg1, arg2, arg3) {
437
+ wasm.closure5593_externref_shim(arg0, arg1, arg2, arg3);
394
438
  }
395
439
 
396
440
  /**
@@ -519,16 +563,6 @@ export const ReactionSchema = Object.freeze({
519
563
  Shortcode: 2, "2": "Shortcode",
520
564
  Custom: 3, "3": "Custom",
521
565
  });
522
- /**
523
- * @enum {0 | 1 | 2 | 3 | 4}
524
- */
525
- export const SignatureRequestType = Object.freeze({
526
- AddWallet: 0, "0": "AddWallet",
527
- CreateInbox: 1, "1": "CreateInbox",
528
- RevokeWallet: 2, "2": "RevokeWallet",
529
- RevokeInstallations: 3, "3": "RevokeInstallations",
530
- ChangeRecoveryIdentifier: 4, "4": "ChangeRecoveryIdentifier",
531
- });
532
566
  /**
533
567
  * @enum {0 | 1}
534
568
  */
@@ -703,6 +737,161 @@ export class Client {
703
737
  const ptr = this.__destroy_into_raw();
704
738
  wasm.__wbg_client_free(ptr, 0);
705
739
  }
740
+ /**
741
+ * @param {Consent[]} records
742
+ * @returns {Promise<void>}
743
+ */
744
+ setConsentStates(records) {
745
+ const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
746
+ const len0 = WASM_VECTOR_LEN;
747
+ const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
748
+ return ret;
749
+ }
750
+ /**
751
+ * @param {ConsentEntityType} entity_type
752
+ * @param {string} entity
753
+ * @returns {Promise<ConsentState>}
754
+ */
755
+ getConsentState(entity_type, entity) {
756
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
757
+ const len0 = WASM_VECTOR_LEN;
758
+ const ret = wasm.client_getConsentState(this.__wbg_ptr, entity_type, ptr0, len0);
759
+ return ret;
760
+ }
761
+ /**
762
+ *
763
+ * * Get the client's inbox state.
764
+ * *
765
+ * * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
766
+ * * Otherwise, the state will be read from the local database.
767
+ *
768
+ * @param {boolean} refresh_from_network
769
+ * @returns {Promise<InboxState>}
770
+ */
771
+ inboxState(refresh_from_network) {
772
+ const ret = wasm.client_inboxState(this.__wbg_ptr, refresh_from_network);
773
+ return ret;
774
+ }
775
+ /**
776
+ * @param {string} inbox_id
777
+ * @returns {Promise<InboxState>}
778
+ */
779
+ getLatestInboxState(inbox_id) {
780
+ const ptr0 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
781
+ const len0 = WASM_VECTOR_LEN;
782
+ const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
783
+ return ret;
784
+ }
785
+ /**
786
+ *
787
+ * * Get key package statuses for a list of installation IDs.
788
+ * *
789
+ * * Returns a JavaScript object mapping installation ID strings to KeyPackageStatus objects.
790
+ *
791
+ * @param {string[]} installation_ids
792
+ * @returns {Promise<any>}
793
+ */
794
+ getKeyPackageStatusesForInstallationIds(installation_ids) {
795
+ const ptr0 = passArrayJsValueToWasm0(installation_ids, wasm.__wbindgen_malloc);
796
+ const len0 = WASM_VECTOR_LEN;
797
+ const ret = wasm.client_getKeyPackageStatusesForInstallationIds(this.__wbg_ptr, ptr0, len0);
798
+ return ret;
799
+ }
800
+ /**
801
+ * @returns {SignatureRequestHandle | undefined}
802
+ */
803
+ createInboxSignatureRequest() {
804
+ const ret = wasm.client_createInboxSignatureRequest(this.__wbg_ptr);
805
+ if (ret[2]) {
806
+ throw takeFromExternrefTable0(ret[1]);
807
+ }
808
+ return ret[0] === 0 ? undefined : SignatureRequestHandle.__wrap(ret[0]);
809
+ }
810
+ /**
811
+ * @param {Identifier} new_identifier
812
+ * @returns {Promise<SignatureRequestHandle>}
813
+ */
814
+ addWalletSignatureRequest(new_identifier) {
815
+ const ret = wasm.client_addWalletSignatureRequest(this.__wbg_ptr, new_identifier);
816
+ return ret;
817
+ }
818
+ /**
819
+ * @param {Identifier} identifier
820
+ * @returns {Promise<SignatureRequestHandle>}
821
+ */
822
+ revokeWalletSignatureRequest(identifier) {
823
+ const ret = wasm.client_revokeWalletSignatureRequest(this.__wbg_ptr, identifier);
824
+ return ret;
825
+ }
826
+ /**
827
+ * @returns {Promise<SignatureRequestHandle>}
828
+ */
829
+ revokeAllOtherInstallationsSignatureRequest() {
830
+ const ret = wasm.client_revokeAllOtherInstallationsSignatureRequest(this.__wbg_ptr);
831
+ return ret;
832
+ }
833
+ /**
834
+ * @param {Uint8Array[]} installation_ids
835
+ * @returns {Promise<SignatureRequestHandle>}
836
+ */
837
+ revokeInstallationsSignatureRequest(installation_ids) {
838
+ const ptr0 = passArrayJsValueToWasm0(installation_ids, wasm.__wbindgen_malloc);
839
+ const len0 = WASM_VECTOR_LEN;
840
+ const ret = wasm.client_revokeInstallationsSignatureRequest(this.__wbg_ptr, ptr0, len0);
841
+ return ret;
842
+ }
843
+ /**
844
+ * @param {Identifier} new_recovery_identifier
845
+ * @returns {Promise<SignatureRequestHandle>}
846
+ */
847
+ changeRecoveryIdentifierSignatureRequest(new_recovery_identifier) {
848
+ const ret = wasm.client_changeRecoveryIdentifierSignatureRequest(this.__wbg_ptr, new_recovery_identifier);
849
+ return ret;
850
+ }
851
+ /**
852
+ * @param {SignatureRequestHandle} signature_request
853
+ * @returns {Promise<void>}
854
+ */
855
+ applySignatureRequest(signature_request) {
856
+ _assertClass(signature_request, SignatureRequestHandle);
857
+ const ret = wasm.client_applySignatureRequest(this.__wbg_ptr, signature_request.__wbg_ptr);
858
+ return ret;
859
+ }
860
+ /**
861
+ * @param {SignatureRequestHandle} signature_request
862
+ * @returns {Promise<void>}
863
+ */
864
+ registerIdentity(signature_request) {
865
+ _assertClass(signature_request, SignatureRequestHandle);
866
+ var ptr0 = signature_request.__destroy_into_raw();
867
+ const ret = wasm.client_registerIdentity(this.__wbg_ptr, ptr0);
868
+ return ret;
869
+ }
870
+ /**
871
+ * @param {string} signature_text
872
+ * @returns {Uint8Array}
873
+ */
874
+ signWithInstallationKey(signature_text) {
875
+ const ptr0 = passStringToWasm0(signature_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
876
+ const len0 = WASM_VECTOR_LEN;
877
+ const ret = wasm.client_signWithInstallationKey(this.__wbg_ptr, ptr0, len0);
878
+ if (ret[2]) {
879
+ throw takeFromExternrefTable0(ret[1]);
880
+ }
881
+ return takeFromExternrefTable0(ret[0]);
882
+ }
883
+ /**
884
+ * @param {string} signature_text
885
+ * @param {Uint8Array} signature_bytes
886
+ */
887
+ verifySignedWithInstallationKey(signature_text, signature_bytes) {
888
+ const ptr0 = passStringToWasm0(signature_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
889
+ const len0 = WASM_VECTOR_LEN;
890
+ const ret = wasm.client_verifySignedWithInstallationKey(this.__wbg_ptr, ptr0, len0, signature_bytes);
891
+ if (ret[1]) {
892
+ throw takeFromExternrefTable0(ret[0]);
893
+ }
894
+ }
706
895
  /**
707
896
  * @returns {Identifier}
708
897
  */
@@ -765,13 +954,6 @@ export class Client {
765
954
  const ret = wasm.client_canMessage(this.__wbg_ptr, ptr0, len0);
766
955
  return ret;
767
956
  }
768
- /**
769
- * @returns {Promise<void>}
770
- */
771
- registerIdentity() {
772
- const ret = wasm.client_registerIdentity(this.__wbg_ptr);
773
- return ret;
774
- }
775
957
  /**
776
958
  * @returns {Promise<void>}
777
959
  */
@@ -854,185 +1036,6 @@ export class Client {
854
1036
  const ret = wasm.client_uploadDebugArchive(this.__wbg_ptr, ptr0, len0);
855
1037
  return ret;
856
1038
  }
857
- /**
858
- * @returns {string | undefined}
859
- */
860
- createInboxSignatureText() {
861
- const ret = wasm.client_createInboxSignatureText(this.__wbg_ptr);
862
- if (ret[3]) {
863
- throw takeFromExternrefTable0(ret[2]);
864
- }
865
- let v1;
866
- if (ret[0] !== 0) {
867
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
868
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
869
- }
870
- return v1;
871
- }
872
- /**
873
- * @param {Identifier} new_identifier
874
- * @returns {Promise<string>}
875
- */
876
- addWalletSignatureText(new_identifier) {
877
- const ret = wasm.client_addWalletSignatureText(this.__wbg_ptr, new_identifier);
878
- return ret;
879
- }
880
- /**
881
- * @param {Identifier} identifier
882
- * @returns {Promise<string>}
883
- */
884
- revokeWalletSignatureText(identifier) {
885
- const ret = wasm.client_revokeWalletSignatureText(this.__wbg_ptr, identifier);
886
- return ret;
887
- }
888
- /**
889
- * @returns {Promise<string>}
890
- */
891
- revokeAllOtherInstallationsSignatureText() {
892
- const ret = wasm.client_revokeAllOtherInstallationsSignatureText(this.__wbg_ptr);
893
- return ret;
894
- }
895
- /**
896
- * @param {Uint8Array[]} installation_ids
897
- * @returns {Promise<string>}
898
- */
899
- revokeInstallationsSignatureText(installation_ids) {
900
- const ptr0 = passArrayJsValueToWasm0(installation_ids, wasm.__wbindgen_malloc);
901
- const len0 = WASM_VECTOR_LEN;
902
- const ret = wasm.client_revokeInstallationsSignatureText(this.__wbg_ptr, ptr0, len0);
903
- return ret;
904
- }
905
- /**
906
- * @param {Identifier} new_recovery_identifier
907
- * @returns {Promise<string>}
908
- */
909
- changeRecoveryIdentifierSignatureText(new_recovery_identifier) {
910
- const ret = wasm.client_changeRecoveryIdentifierSignatureText(this.__wbg_ptr, new_recovery_identifier);
911
- return ret;
912
- }
913
- /**
914
- * @param {SignatureRequestType} signature_type
915
- * @param {Uint8Array} signature_bytes
916
- * @returns {Promise<void>}
917
- */
918
- addEcdsaSignature(signature_type, signature_bytes) {
919
- const ret = wasm.client_addEcdsaSignature(this.__wbg_ptr, signature_type, signature_bytes);
920
- return ret;
921
- }
922
- /**
923
- * @param {SignatureRequestType} signature_type
924
- * @param {PasskeySignature} signature
925
- * @returns {Promise<void>}
926
- */
927
- addPasskeySignature(signature_type, signature) {
928
- _assertClass(signature, PasskeySignature);
929
- var ptr0 = signature.__destroy_into_raw();
930
- const ret = wasm.client_addPasskeySignature(this.__wbg_ptr, signature_type, ptr0);
931
- return ret;
932
- }
933
- /**
934
- * @param {SignatureRequestType} signature_type
935
- * @param {Uint8Array} signature_bytes
936
- * @param {bigint} chain_id
937
- * @param {bigint | null} [block_number]
938
- * @returns {Promise<void>}
939
- */
940
- addScwSignature(signature_type, signature_bytes, chain_id, block_number) {
941
- const ret = wasm.client_addScwSignature(this.__wbg_ptr, signature_type, signature_bytes, chain_id, !isLikeNone(block_number), isLikeNone(block_number) ? BigInt(0) : block_number);
942
- return ret;
943
- }
944
- /**
945
- * @returns {Promise<void>}
946
- */
947
- applySignatureRequests() {
948
- const ret = wasm.client_applySignatureRequests(this.__wbg_ptr);
949
- return ret;
950
- }
951
- /**
952
- * @param {string} signature_text
953
- * @returns {Uint8Array}
954
- */
955
- signWithInstallationKey(signature_text) {
956
- const ptr0 = passStringToWasm0(signature_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
957
- const len0 = WASM_VECTOR_LEN;
958
- const ret = wasm.client_signWithInstallationKey(this.__wbg_ptr, ptr0, len0);
959
- if (ret[2]) {
960
- throw takeFromExternrefTable0(ret[1]);
961
- }
962
- return takeFromExternrefTable0(ret[0]);
963
- }
964
- /**
965
- * @param {string} signature_text
966
- * @param {Uint8Array} signature_bytes
967
- */
968
- verifySignedWithInstallationKey(signature_text, signature_bytes) {
969
- const ptr0 = passStringToWasm0(signature_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
970
- const len0 = WASM_VECTOR_LEN;
971
- const ret = wasm.client_verifySignedWithInstallationKey(this.__wbg_ptr, ptr0, len0, signature_bytes);
972
- if (ret[1]) {
973
- throw takeFromExternrefTable0(ret[0]);
974
- }
975
- }
976
- /**
977
- * @param {Consent[]} records
978
- * @returns {Promise<void>}
979
- */
980
- setConsentStates(records) {
981
- const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
982
- const len0 = WASM_VECTOR_LEN;
983
- const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
984
- return ret;
985
- }
986
- /**
987
- * @param {ConsentEntityType} entity_type
988
- * @param {string} entity
989
- * @returns {Promise<ConsentState>}
990
- */
991
- getConsentState(entity_type, entity) {
992
- const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
993
- const len0 = WASM_VECTOR_LEN;
994
- const ret = wasm.client_getConsentState(this.__wbg_ptr, entity_type, ptr0, len0);
995
- return ret;
996
- }
997
- /**
998
- *
999
- * * Get the client's inbox state.
1000
- * *
1001
- * * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
1002
- * * Otherwise, the state will be read from the local database.
1003
- *
1004
- * @param {boolean} refresh_from_network
1005
- * @returns {Promise<InboxState>}
1006
- */
1007
- inboxState(refresh_from_network) {
1008
- const ret = wasm.client_inboxState(this.__wbg_ptr, refresh_from_network);
1009
- return ret;
1010
- }
1011
- /**
1012
- * @param {string} inbox_id
1013
- * @returns {Promise<InboxState>}
1014
- */
1015
- getLatestInboxState(inbox_id) {
1016
- const ptr0 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1017
- const len0 = WASM_VECTOR_LEN;
1018
- const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
1019
- return ret;
1020
- }
1021
- /**
1022
- *
1023
- * * Get key package statuses for a list of installation IDs.
1024
- * *
1025
- * * Returns a JavaScript object mapping installation ID strings to KeyPackageStatus objects.
1026
- *
1027
- * @param {string[]} installation_ids
1028
- * @returns {Promise<any>}
1029
- */
1030
- getKeyPackageStatusesForInstallationIds(installation_ids) {
1031
- const ptr0 = passArrayJsValueToWasm0(installation_ids, wasm.__wbindgen_malloc);
1032
- const len0 = WASM_VECTOR_LEN;
1033
- const ret = wasm.client_getKeyPackageStatusesForInstallationIds(this.__wbg_ptr, ptr0, len0);
1034
- return ret;
1035
- }
1036
1039
  }
1037
1040
 
1038
1041
  const ConsentFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -4645,6 +4648,69 @@ export class RemoteAttachmentInfo {
4645
4648
  }
4646
4649
  }
4647
4650
 
4651
+ const SignatureRequestHandleFinalization = (typeof FinalizationRegistry === 'undefined')
4652
+ ? { register: () => {}, unregister: () => {} }
4653
+ : new FinalizationRegistry(ptr => wasm.__wbg_signaturerequesthandle_free(ptr >>> 0, 1));
4654
+
4655
+ export class SignatureRequestHandle {
4656
+
4657
+ static __wrap(ptr) {
4658
+ ptr = ptr >>> 0;
4659
+ const obj = Object.create(SignatureRequestHandle.prototype);
4660
+ obj.__wbg_ptr = ptr;
4661
+ SignatureRequestHandleFinalization.register(obj, obj.__wbg_ptr, obj);
4662
+ return obj;
4663
+ }
4664
+
4665
+ __destroy_into_raw() {
4666
+ const ptr = this.__wbg_ptr;
4667
+ this.__wbg_ptr = 0;
4668
+ SignatureRequestHandleFinalization.unregister(this);
4669
+ return ptr;
4670
+ }
4671
+
4672
+ free() {
4673
+ const ptr = this.__destroy_into_raw();
4674
+ wasm.__wbg_signaturerequesthandle_free(ptr, 0);
4675
+ }
4676
+ /**
4677
+ * @returns {Promise<string>}
4678
+ */
4679
+ signatureText() {
4680
+ const ret = wasm.signaturerequesthandle_signatureText(this.__wbg_ptr);
4681
+ return ret;
4682
+ }
4683
+ /**
4684
+ * @param {Uint8Array} signature_bytes
4685
+ * @returns {Promise<void>}
4686
+ */
4687
+ addEcdsaSignature(signature_bytes) {
4688
+ const ret = wasm.signaturerequesthandle_addEcdsaSignature(this.__wbg_ptr, signature_bytes);
4689
+ return ret;
4690
+ }
4691
+ /**
4692
+ * @param {PasskeySignature} signature
4693
+ * @returns {Promise<void>}
4694
+ */
4695
+ addPasskeySignature(signature) {
4696
+ _assertClass(signature, PasskeySignature);
4697
+ var ptr0 = signature.__destroy_into_raw();
4698
+ const ret = wasm.signaturerequesthandle_addPasskeySignature(this.__wbg_ptr, ptr0);
4699
+ return ret;
4700
+ }
4701
+ /**
4702
+ * @param {Identifier} account_identifier
4703
+ * @param {Uint8Array} signature_bytes
4704
+ * @param {bigint} chain_id
4705
+ * @param {bigint | null} [block_number]
4706
+ * @returns {Promise<void>}
4707
+ */
4708
+ addScwSignature(account_identifier, signature_bytes, chain_id, block_number) {
4709
+ const ret = wasm.signaturerequesthandle_addScwSignature(this.__wbg_ptr, account_identifier, signature_bytes, chain_id, !isLikeNone(block_number), isLikeNone(block_number) ? BigInt(0) : block_number);
4710
+ return ret;
4711
+ }
4712
+ }
4713
+
4648
4714
  const StreamCloserFinalization = (typeof FinalizationRegistry === 'undefined')
4649
4715
  ? { register: () => {}, unregister: () => {} }
4650
4716
  : new FinalizationRegistry(ptr => wasm.__wbg_streamcloser_free(ptr >>> 0, 1));
@@ -5206,7 +5272,7 @@ function __wbg_get_imports() {
5206
5272
  const a = state0.a;
5207
5273
  state0.a = 0;
5208
5274
  try {
5209
- return __wbg_adapter_775(a, state0.b, arg0, arg1);
5275
+ return __wbg_adapter_781(a, state0.b, arg0, arg1);
5210
5276
  } finally {
5211
5277
  state0.a = a;
5212
5278
  }
@@ -5318,19 +5384,19 @@ function __wbg_get_imports() {
5318
5384
  const ret = arg0.now();
5319
5385
  return ret;
5320
5386
  };
5321
- imports.wbg.__wbg_onconsentupdate_41b7339687cc011c = function(arg0, arg1) {
5387
+ imports.wbg.__wbg_onconsentupdate_bdad0347f9b3b676 = function(arg0, arg1) {
5322
5388
  arg0.on_consent_update(arg1);
5323
5389
  };
5324
- imports.wbg.__wbg_onconversation_7404b2379eb67834 = function(arg0, arg1) {
5390
+ imports.wbg.__wbg_onconversation_1d2a1e90cdf73ceb = function(arg0, arg1) {
5325
5391
  arg0.on_conversation(Conversation.__wrap(arg1));
5326
5392
  };
5327
- imports.wbg.__wbg_onerror_eb2eb9eb1d76fa24 = function(arg0, arg1) {
5393
+ imports.wbg.__wbg_onerror_240a4f4ca7d674b4 = function(arg0, arg1) {
5328
5394
  arg0.on_error(arg1);
5329
5395
  };
5330
- imports.wbg.__wbg_onmessage_1ad7dbda90e7e92d = function(arg0, arg1) {
5396
+ imports.wbg.__wbg_onmessage_a8e6380c450aba32 = function(arg0, arg1) {
5331
5397
  arg0.on_message(Message.__wrap(arg1));
5332
5398
  };
5333
- imports.wbg.__wbg_onuserpreferenceupdate_71b80aff3461dfa2 = function(arg0, arg1, arg2) {
5399
+ imports.wbg.__wbg_onuserpreferenceupdate_4fef83cc66360f3a = function(arg0, arg1, arg2) {
5334
5400
  var v0 = getArrayJsValueFromWasm0(arg1, arg2).slice();
5335
5401
  wasm.__wbindgen_free(arg1, arg2 * 4, 4);
5336
5402
  arg0.on_user_preference_update(v0);
@@ -5480,6 +5546,10 @@ function __wbg_get_imports() {
5480
5546
  const ret = arg0.signal;
5481
5547
  return ret;
5482
5548
  };
5549
+ imports.wbg.__wbg_signaturerequesthandle_new = function(arg0) {
5550
+ const ret = SignatureRequestHandle.__wrap(arg0);
5551
+ return ret;
5552
+ };
5483
5553
  imports.wbg.__wbg_size_f9d54556ad844dc3 = function(arg0) {
5484
5554
  const ret = arg0.size;
5485
5555
  return ret;
@@ -5617,20 +5687,20 @@ function __wbg_get_imports() {
5617
5687
  const ret = false;
5618
5688
  return ret;
5619
5689
  };
5620
- imports.wbg.__wbindgen_closure_wrapper17557 = function(arg0, arg1, arg2) {
5621
- const ret = makeMutClosure(arg0, arg1, 4207, __wbg_adapter_50);
5690
+ imports.wbg.__wbindgen_closure_wrapper17770 = function(arg0, arg1, arg2) {
5691
+ const ret = makeMutClosure(arg0, arg1, 4254, __wbg_adapter_50);
5622
5692
  return ret;
5623
5693
  };
5624
- imports.wbg.__wbindgen_closure_wrapper17717 = function(arg0, arg1, arg2) {
5625
- const ret = makeMutClosure(arg0, arg1, 4265, __wbg_adapter_53);
5694
+ imports.wbg.__wbindgen_closure_wrapper17930 = function(arg0, arg1, arg2) {
5695
+ const ret = makeMutClosure(arg0, arg1, 4312, __wbg_adapter_53);
5626
5696
  return ret;
5627
5697
  };
5628
- imports.wbg.__wbindgen_closure_wrapper20829 = function(arg0, arg1, arg2) {
5629
- const ret = makeMutClosure(arg0, arg1, 4570, __wbg_adapter_56);
5698
+ imports.wbg.__wbindgen_closure_wrapper21038 = function(arg0, arg1, arg2) {
5699
+ const ret = makeMutClosure(arg0, arg1, 4618, __wbg_adapter_56);
5630
5700
  return ret;
5631
5701
  };
5632
- imports.wbg.__wbindgen_closure_wrapper20939 = function(arg0, arg1, arg2) {
5633
- const ret = makeMutClosure(arg0, arg1, 4581, __wbg_adapter_59);
5702
+ imports.wbg.__wbindgen_closure_wrapper21148 = function(arg0, arg1, arg2) {
5703
+ const ret = makeMutClosure(arg0, arg1, 4629, __wbg_adapter_59);
5634
5704
  return ret;
5635
5705
  };
5636
5706
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,47 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_client_free: (a: number, b: number) => void;
5
- export const __wbg_logoptions_free: (a: number, b: number) => void;
6
- export const __wbg_get_logoptions_structured: (a: number) => number;
7
- export const __wbg_set_logoptions_structured: (a: number, b: number) => void;
8
- export const __wbg_get_logoptions_performance: (a: number) => number;
9
- export const __wbg_set_logoptions_performance: (a: number, b: number) => void;
10
- export const __wbg_get_logoptions_level: (a: number) => number;
11
- export const __wbg_set_logoptions_level: (a: number, b: number) => void;
12
- export const logoptions_new: (a: number, b: number, c: number) => number;
13
- export const createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => any;
14
- export const client_accountIdentifier: (a: number) => any;
15
- export const client_inboxId: (a: number) => [number, number];
16
- export const client_isRegistered: (a: number) => number;
17
- export const client_installationId: (a: number) => [number, number];
18
- export const client_installationIdBytes: (a: number) => any;
19
- export const client_canMessage: (a: number, b: number, c: number) => any;
20
- export const client_registerIdentity: (a: number) => any;
21
- export const client_sendSyncRequest: (a: number) => any;
22
- export const client_findInboxIdByIdentifier: (a: number, b: any) => any;
23
- export const client_inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
24
- export const client_conversations: (a: number) => number;
25
- export const client_syncPreferences: (a: number) => any;
26
- export const client_apiStatistics: (a: number) => number;
27
- export const client_apiIdentityStatistics: (a: number) => number;
28
- export const client_apiAggregateStatistics: (a: number) => [number, number];
29
- export const client_clearAllStatistics: (a: number) => void;
30
- export const client_uploadDebugArchive: (a: number, b: number, c: number) => any;
31
- export const verifySignedWithPublicKey: (a: number, b: number, c: any, d: any) => [number, number];
32
- export const __wbg_passkeysignature_free: (a: number, b: number) => void;
33
- export const client_createInboxSignatureText: (a: number) => [number, number, number, number];
34
- export const client_addWalletSignatureText: (a: number, b: any) => any;
35
- export const client_revokeWalletSignatureText: (a: number, b: any) => any;
36
- export const client_revokeAllOtherInstallationsSignatureText: (a: number) => any;
37
- export const client_revokeInstallationsSignatureText: (a: number, b: number, c: number) => any;
38
- export const client_changeRecoveryIdentifierSignatureText: (a: number, b: any) => any;
39
- export const client_addEcdsaSignature: (a: number, b: number, c: any) => any;
40
- export const client_addPasskeySignature: (a: number, b: number, c: number) => any;
41
- export const client_addScwSignature: (a: number, b: number, c: any, d: bigint, e: number, f: bigint) => any;
42
- export const client_applySignatureRequests: (a: number) => any;
43
- export const client_signWithInstallationKey: (a: number, b: number, c: number) => [number, number, number];
44
- export const client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
45
4
  export const __wbg_apistats_free: (a: number, b: number) => void;
46
5
  export const __wbg_get_apistats_upload_key_package: (a: number) => bigint;
47
6
  export const __wbg_set_apistats_upload_key_package: (a: number, b: bigint) => void;
@@ -60,6 +19,8 @@ export const __wbg_set_apistats_subscribe_messages: (a: number, b: bigint) => vo
60
19
  export const __wbg_get_apistats_subscribe_welcomes: (a: number) => bigint;
61
20
  export const __wbg_set_apistats_subscribe_welcomes: (a: number, b: bigint) => void;
62
21
  export const __wbg_identitystats_free: (a: number, b: number) => void;
22
+ export const getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
23
+ export const generateInboxId: (a: any) => [number, number, number, number];
63
24
  export const __wbg_set_identitystats_publish_identity_update: (a: number, b: bigint) => void;
64
25
  export const __wbg_set_identitystats_get_identity_updates_v2: (a: number, b: bigint) => void;
65
26
  export const __wbg_set_identitystats_get_inbox_ids: (a: number, b: bigint) => void;
@@ -249,8 +210,6 @@ export const __wbg_set_encodedcontent_compression: (a: number, b: number) => voi
249
210
  export const __wbg_get_encodedcontent_content: (a: number) => any;
250
211
  export const __wbg_set_encodedcontent_content: (a: number, b: any) => void;
251
212
  export const encodedcontent_new: (a: number, b: any, c: number, d: number, e: number, f: any) => number;
252
- export const getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
253
- export const generateInboxId: (a: any) => [number, number, number, number];
254
213
  export const __wbg_installation_free: (a: number, b: number) => void;
255
214
  export const __wbg_get_installation_bytes: (a: number) => any;
256
215
  export const __wbg_set_installation_bytes: (a: number, b: any) => void;
@@ -274,6 +233,7 @@ export const __wbg_set_keypackagestatus_validationError: (a: number, b: number,
274
233
  export const __wbg_lifetime_free: (a: number, b: number) => void;
275
234
  export const __wbg_get_lifetime_not_after: (a: number) => bigint;
276
235
  export const __wbg_set_lifetime_not_after: (a: number, b: bigint) => void;
236
+ export const inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
277
237
  export const client_inboxState: (a: number, b: number) => any;
278
238
  export const client_getLatestInboxState: (a: number, b: number, c: number) => any;
279
239
  export const client_getKeyPackageStatusesForInstallationIds: (a: number, b: number, c: number) => any;
@@ -319,6 +279,25 @@ export const opfs_getFileCount: () => number;
319
279
  export const opfs_getCapacity: () => number;
320
280
  export const opfs_addCapacity: (a: number) => any;
321
281
  export const opfs_reduceCapacity: (a: number) => any;
282
+ export const __wbg_signaturerequesthandle_free: (a: number, b: number) => void;
283
+ export const verifySignedWithPublicKey: (a: number, b: number, c: any, d: any) => [number, number];
284
+ export const revokeInstallationsSignatureRequest: (a: number, b: number, c: any, d: number, e: number, f: number, g: number) => any;
285
+ export const applySignatureRequest: (a: number, b: number, c: number) => any;
286
+ export const __wbg_passkeysignature_free: (a: number, b: number) => void;
287
+ export const signaturerequesthandle_signatureText: (a: number) => any;
288
+ export const signaturerequesthandle_addEcdsaSignature: (a: number, b: any) => any;
289
+ export const signaturerequesthandle_addPasskeySignature: (a: number, b: number) => any;
290
+ export const signaturerequesthandle_addScwSignature: (a: number, b: any, c: any, d: bigint, e: number, f: bigint) => any;
291
+ export const client_createInboxSignatureRequest: (a: number) => [number, number, number];
292
+ export const client_addWalletSignatureRequest: (a: number, b: any) => any;
293
+ export const client_revokeWalletSignatureRequest: (a: number, b: any) => any;
294
+ export const client_revokeAllOtherInstallationsSignatureRequest: (a: number) => any;
295
+ export const client_revokeInstallationsSignatureRequest: (a: number, b: number, c: number) => any;
296
+ export const client_changeRecoveryIdentifierSignatureRequest: (a: number, b: any) => any;
297
+ export const client_applySignatureRequest: (a: number, b: number) => any;
298
+ export const client_registerIdentity: (a: number, b: number) => any;
299
+ export const client_signWithInstallationKey: (a: number, b: number, c: number) => [number, number, number];
300
+ export const client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
322
301
  export const __wbg_get_listconversationsoptions_createdAfterNs: (a: number) => [number, bigint];
323
302
  export const __wbg_get_listmessagesoptions_sentBeforeNs: (a: number) => [number, bigint];
324
303
  export const __wbg_get_listmessagesoptions_sentAfterNs: (a: number) => [number, bigint];
@@ -360,6 +339,32 @@ export const streamcloser_end: (a: number) => void;
360
339
  export const streamcloser_endAndWait: (a: number) => any;
361
340
  export const streamcloser_waitForReady: (a: number) => any;
362
341
  export const streamcloser_isClosed: (a: number) => number;
342
+ export const __wbg_client_free: (a: number, b: number) => void;
343
+ export const __wbg_logoptions_free: (a: number, b: number) => void;
344
+ export const __wbg_get_logoptions_structured: (a: number) => number;
345
+ export const __wbg_set_logoptions_structured: (a: number, b: number) => void;
346
+ export const __wbg_get_logoptions_performance: (a: number) => number;
347
+ export const __wbg_set_logoptions_performance: (a: number, b: number) => void;
348
+ export const __wbg_get_logoptions_level: (a: number) => number;
349
+ export const __wbg_set_logoptions_level: (a: number, b: number) => void;
350
+ export const logoptions_new: (a: number, b: number, c: number) => number;
351
+ export const createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => any;
352
+ export const client_accountIdentifier: (a: number) => any;
353
+ export const client_inboxId: (a: number) => [number, number];
354
+ export const client_isRegistered: (a: number) => number;
355
+ export const client_installationId: (a: number) => [number, number];
356
+ export const client_installationIdBytes: (a: number) => any;
357
+ export const client_canMessage: (a: number, b: number, c: number) => any;
358
+ export const client_sendSyncRequest: (a: number) => any;
359
+ export const client_findInboxIdByIdentifier: (a: number, b: any) => any;
360
+ export const client_inboxStateFromInboxIds: (a: number, b: number, c: number, d: number) => any;
361
+ export const client_conversations: (a: number) => number;
362
+ export const client_syncPreferences: (a: number) => any;
363
+ export const client_apiStatistics: (a: number) => number;
364
+ export const client_apiIdentityStatistics: (a: number) => number;
365
+ export const client_apiAggregateStatistics: (a: number) => [number, number];
366
+ export const client_clearAllStatistics: (a: number) => void;
367
+ export const client_uploadDebugArchive: (a: number, b: number, c: number) => any;
363
368
  export const __wbg_permissionpolicyset_free: (a: number, b: number) => void;
364
369
  export const __wbg_get_permissionpolicyset_addMemberPolicy: (a: number) => number;
365
370
  export const __wbg_set_permissionpolicyset_addMemberPolicy: (a: number, b: number) => void;
@@ -424,7 +429,7 @@ export const __wbindgen_export_7: WebAssembly.Table;
424
429
  export const __externref_table_dealloc: (a: number) => void;
425
430
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc094ec3bdf8c16b7: (a: number, b: number) => void;
426
431
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0eb99f8c2f057fcc: (a: number, b: number) => void;
427
- export const closure4569_externref_shim: (a: number, b: number, c: any) => void;
432
+ export const closure4617_externref_shim: (a: number, b: number, c: any) => void;
428
433
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h232599d7dcf89d52: (a: number, b: number) => void;
429
- export const closure5545_externref_shim: (a: number, b: number, c: any, d: any) => void;
434
+ export const closure5593_externref_shim: (a: number, b: number, c: any, d: any) => void;
430
435
  export const __wbindgen_start: () => void;
package/dist/version.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "branch": "release/v1.2",
3
- "version": "d0f0b67",
4
- "date": "2025-06-18 21:31:37 +0000"
3
+ "version": "df2f166",
4
+ "date": "2025-06-24 23:56:47 +0000"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmtp/wasm-bindings",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "WASM bindings for the libXMTP rust library",