@xmtp/wasm-bindings 1.0.0-rc4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,9 @@ export function decodeMultiRemoteAttachment(bytes: Uint8Array): MultiRemoteAttac
5
5
  export function encodeReaction(reaction: Reaction): Uint8Array;
6
6
  export function decodeReaction(bytes: Uint8Array): Reaction;
7
7
  export function verifySignedWithPublicKey(signature_text: string, signature_bytes: Uint8Array, public_key: Uint8Array): void;
8
- export function createClient(host: string, inbox_id: string, account_identifier: Identifier, db_path?: string | null, encryption_key?: Uint8Array | null, history_sync_url?: string | null, log_options?: LogOptions | null): Promise<Client>;
9
8
  export function getInboxIdForIdentifier(host: string, accountIdentifier: Identifier): Promise<string | undefined>;
10
9
  export function generateInboxId(accountIdentifier: Identifier): string;
10
+ export function createClient(host: string, inbox_id: string, account_identifier: Identifier, db_path?: string | null, encryption_key?: Uint8Array | null, history_sync_url?: string | null, log_options?: LogOptions | null): Promise<Client>;
11
11
  export enum ConsentEntityType {
12
12
  GroupId = 0,
13
13
  InboxId = 1,
@@ -131,6 +131,8 @@ export class Client {
131
131
  applySignatureRequests(): Promise<void>;
132
132
  signWithInstallationKey(signature_text: string): Uint8Array;
133
133
  verifySignedWithInstallationKey(signature_text: string, signature_bytes: Uint8Array): void;
134
+ setConsentStates(records: Consent[]): Promise<void>;
135
+ getConsentState(entity_type: ConsentEntityType, entity: string): Promise<ConsentState>;
134
136
  /**
135
137
  * Output booleans should be zipped with the index of input identifiers
136
138
  */
@@ -150,8 +152,6 @@ export class Client {
150
152
  */
151
153
  inboxState(refresh_from_network: boolean): Promise<InboxState>;
152
154
  getLatestInboxState(inbox_id: string): Promise<InboxState>;
153
- setConsentStates(records: Consent[]): Promise<void>;
154
- getConsentState(entity_type: ConsentEntityType, entity: string): Promise<ConsentState>;
155
155
  readonly accountIdentifier: Identifier;
156
156
  readonly inboxId: string;
157
157
  readonly isRegistered: boolean;
@@ -434,6 +434,48 @@ export class MultiRemoteAttachment {
434
434
  constructor(attachments: RemoteAttachmentInfo[]);
435
435
  attachments: RemoteAttachmentInfo[];
436
436
  }
437
+ export class Opfs {
438
+ private constructor();
439
+ free(): void;
440
+ /**
441
+ * Check if the global OPFS object has been initialized
442
+ */
443
+ static exists(): boolean;
444
+ /**
445
+ * gets the error from Opfs, if any.
446
+ */
447
+ static error(): string | undefined;
448
+ static wipeFiles(): Promise<void>;
449
+ /**
450
+ * If a virtual file exists with the given name, disassociates it from the pool and returns true, else returns false without side effects.
451
+ */
452
+ static rm(name: string): boolean;
453
+ /**
454
+ * list files in current pool
455
+ */
456
+ static getFileNames(): string[];
457
+ /**
458
+ * import a db file at 'path'
459
+ */
460
+ static importDb(path: string, bytes: Uint8Array): void;
461
+ /**
462
+ * export db file with 'name'
463
+ */
464
+ static exportFile(name: string): Uint8Array;
465
+ /**
466
+ * get number of files in pool
467
+ */
468
+ static getFileCount(): number;
469
+ static getCapacity(): number;
470
+ /**
471
+ * Adds n entries to the current pool.
472
+ */
473
+ static addCapacity(n: number): Promise<number>;
474
+ /**
475
+ * Removes up to n entries from the pool, with the caveat that it can only remove currently-unused entries.
476
+ */
477
+ static reduceCapacity(n: number): Promise<number>;
478
+ }
437
479
  export class PasskeySignature {
438
480
  private constructor();
439
481
  free(): void;
@@ -605,49 +647,6 @@ export interface InitOutput {
605
647
  readonly client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
606
648
  readonly __wbg_set_reaction_reference: (a: number, b: number, c: number) => void;
607
649
  readonly __wbg_get_reaction_reference: (a: number) => [number, number];
608
- readonly __wbg_client_free: (a: number, b: number) => void;
609
- readonly __wbg_logoptions_free: (a: number, b: number) => void;
610
- readonly __wbg_get_logoptions_structured: (a: number) => number;
611
- readonly __wbg_set_logoptions_structured: (a: number, b: number) => void;
612
- readonly __wbg_get_logoptions_performance: (a: number) => number;
613
- readonly __wbg_set_logoptions_performance: (a: number, b: number) => void;
614
- readonly __wbg_get_logoptions_level: (a: number) => number;
615
- readonly __wbg_set_logoptions_level: (a: number, b: number) => void;
616
- readonly logoptions_new: (a: number, b: number, c: number) => number;
617
- readonly createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number) => any;
618
- readonly client_accountIdentifier: (a: number) => any;
619
- readonly client_inboxId: (a: number) => [number, number];
620
- readonly client_isRegistered: (a: number) => number;
621
- readonly client_installationId: (a: number) => [number, number];
622
- readonly client_installationIdBytes: (a: number) => any;
623
- readonly client_canMessage: (a: number, b: number, c: number) => any;
624
- readonly client_registerIdentity: (a: number) => any;
625
- readonly client_sendHistorySyncRequest: (a: number) => any;
626
- readonly client_sendConsentSyncRequest: (a: number) => any;
627
- readonly client_findInboxIdByIdentifier: (a: number, b: any) => any;
628
- readonly client_conversations: (a: number) => number;
629
- readonly getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
630
- readonly generateInboxId: (a: any) => [number, number, number, number];
631
- readonly __wbg_installation_free: (a: number, b: number) => void;
632
- readonly __wbg_get_installation_bytes: (a: number) => any;
633
- readonly __wbg_set_installation_bytes: (a: number, b: any) => void;
634
- readonly __wbg_get_installation_id: (a: number) => [number, number];
635
- readonly __wbg_set_installation_id: (a: number, b: number, c: number) => void;
636
- readonly __wbg_get_installation_clientTimestampNs: (a: number) => [number, bigint];
637
- readonly __wbg_set_installation_clientTimestampNs: (a: number, b: number, c: bigint) => void;
638
- readonly installation_new: (a: any, b: number, c: number, d: number, e: bigint) => number;
639
- readonly __wbg_inboxstate_free: (a: number, b: number) => void;
640
- readonly __wbg_get_inboxstate_inboxId: (a: number) => [number, number];
641
- readonly __wbg_set_inboxstate_inboxId: (a: number, b: number, c: number) => void;
642
- readonly __wbg_get_inboxstate_recoveryIdentifier: (a: number) => any;
643
- readonly __wbg_set_inboxstate_recoveryIdentifier: (a: number, b: any) => void;
644
- readonly __wbg_get_inboxstate_installations: (a: number) => [number, number];
645
- readonly __wbg_set_inboxstate_installations: (a: number, b: number, c: number) => void;
646
- readonly __wbg_get_inboxstate_accountIdentifiers: (a: number) => [number, number];
647
- readonly __wbg_set_inboxstate_accountIdentifiers: (a: number, b: number, c: number) => void;
648
- readonly inboxstate_new: (a: number, b: number, c: any, d: number, e: number, f: number, g: number) => number;
649
- readonly client_inboxState: (a: number, b: number) => any;
650
- readonly client_getLatestInboxState: (a: number, b: number, c: number) => any;
651
650
  readonly __wbg_consent_free: (a: number, b: number) => void;
652
651
  readonly __wbg_get_consent_entityType: (a: number) => number;
653
652
  readonly __wbg_set_consent_entityType: (a: number, b: number) => void;
@@ -681,6 +680,11 @@ export interface InitOutput {
681
680
  readonly __wbg_grouppermissions_free: (a: number, b: number) => void;
682
681
  readonly grouppermissions_policyType: (a: number) => [number, number, number];
683
682
  readonly grouppermissions_policySet: (a: number) => [number, number, number];
683
+ readonly __wbg_streamcloser_free: (a: number, b: number) => void;
684
+ readonly streamcloser_end: (a: number) => void;
685
+ readonly streamcloser_endAndWait: (a: number) => any;
686
+ readonly streamcloser_waitForReady: (a: number) => any;
687
+ readonly streamcloser_isClosed: (a: number) => number;
684
688
  readonly __wbg_listconversationsoptions_free: (a: number, b: number) => void;
685
689
  readonly __wbg_get_listconversationsoptions_consentStates: (a: number) => [number, number];
686
690
  readonly __wbg_set_listconversationsoptions_consentStates: (a: number, b: number, c: number) => void;
@@ -766,6 +770,8 @@ export interface InitOutput {
766
770
  readonly __wbg_get_encodedcontent_content: (a: number) => any;
767
771
  readonly __wbg_set_encodedcontent_content: (a: number, b: any) => void;
768
772
  readonly encodedcontent_new: (a: number, b: any, c: number, d: number, e: number, f: any) => number;
773
+ readonly getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
774
+ readonly generateInboxId: (a: any) => [number, number, number, number];
769
775
  readonly __wbg_listmessagesoptions_free: (a: number, b: number) => void;
770
776
  readonly __wbg_get_listmessagesoptions_contentTypes: (a: number) => [number, number];
771
777
  readonly __wbg_set_listmessagesoptions_contentTypes: (a: number, b: number, c: number) => void;
@@ -793,11 +799,18 @@ export interface InitOutput {
793
799
  readonly __wbg_set_messagewithreactions_message: (a: number, b: number) => void;
794
800
  readonly __wbg_get_messagewithreactions_reactions: (a: number) => [number, number];
795
801
  readonly __wbg_set_messagewithreactions_reactions: (a: number, b: number, c: number) => void;
796
- readonly __wbg_streamcloser_free: (a: number, b: number) => void;
797
- readonly streamcloser_end: (a: number) => void;
798
- readonly streamcloser_endAndWait: (a: number) => any;
799
- readonly streamcloser_waitForReady: (a: number) => any;
800
- readonly streamcloser_isClosed: (a: number) => number;
802
+ readonly __wbg_opfs_free: (a: number, b: number) => void;
803
+ readonly opfs_exists: () => number;
804
+ readonly opfs_error: () => [number, number];
805
+ readonly opfs_wipeFiles: () => any;
806
+ readonly opfs_rm: (a: number, b: number) => [number, number, number];
807
+ readonly opfs_getFileNames: () => [number, number];
808
+ readonly opfs_importDb: (a: number, b: number, c: number, d: number) => [number, number];
809
+ readonly opfs_exportFile: (a: number, b: number) => [number, number, number, number];
810
+ readonly opfs_getFileCount: () => number;
811
+ readonly opfs_getCapacity: () => number;
812
+ readonly opfs_addCapacity: (a: number) => any;
813
+ readonly opfs_reduceCapacity: (a: number) => any;
801
814
  readonly __wbg_get_messagedisappearingsettings_fromNs: (a: number) => bigint;
802
815
  readonly __wbg_get_message_sentAtNs: (a: number) => bigint;
803
816
  readonly __wbg_set_listmessagesoptions_sentBeforeNs: (a: number, b: number, c: bigint) => void;
@@ -810,6 +823,47 @@ export interface InitOutput {
810
823
  readonly __wbg_get_listmessagesoptions_sentBeforeNs: (a: number) => [number, bigint];
811
824
  readonly __wbg_get_listmessagesoptions_sentAfterNs: (a: number) => [number, bigint];
812
825
  readonly __wbg_get_listmessagesoptions_limit: (a: number) => [number, bigint];
826
+ readonly __wbg_client_free: (a: number, b: number) => void;
827
+ readonly __wbg_logoptions_free: (a: number, b: number) => void;
828
+ readonly __wbg_get_logoptions_structured: (a: number) => number;
829
+ readonly __wbg_set_logoptions_structured: (a: number, b: number) => void;
830
+ readonly __wbg_get_logoptions_performance: (a: number) => number;
831
+ readonly __wbg_set_logoptions_performance: (a: number, b: number) => void;
832
+ readonly __wbg_get_logoptions_level: (a: number) => number;
833
+ readonly __wbg_set_logoptions_level: (a: number, b: number) => void;
834
+ readonly logoptions_new: (a: number, b: number, c: number) => number;
835
+ readonly createClient: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number, k: number) => any;
836
+ readonly client_accountIdentifier: (a: number) => any;
837
+ readonly client_inboxId: (a: number) => [number, number];
838
+ readonly client_isRegistered: (a: number) => number;
839
+ readonly client_installationId: (a: number) => [number, number];
840
+ readonly client_installationIdBytes: (a: number) => any;
841
+ readonly client_canMessage: (a: number, b: number, c: number) => any;
842
+ readonly client_registerIdentity: (a: number) => any;
843
+ readonly client_sendHistorySyncRequest: (a: number) => any;
844
+ readonly client_sendConsentSyncRequest: (a: number) => any;
845
+ readonly client_findInboxIdByIdentifier: (a: number, b: any) => any;
846
+ readonly client_conversations: (a: number) => number;
847
+ readonly __wbg_installation_free: (a: number, b: number) => void;
848
+ readonly __wbg_get_installation_bytes: (a: number) => any;
849
+ readonly __wbg_set_installation_bytes: (a: number, b: any) => void;
850
+ readonly __wbg_get_installation_id: (a: number) => [number, number];
851
+ readonly __wbg_set_installation_id: (a: number, b: number, c: number) => void;
852
+ readonly __wbg_get_installation_clientTimestampNs: (a: number) => [number, bigint];
853
+ readonly __wbg_set_installation_clientTimestampNs: (a: number, b: number, c: bigint) => void;
854
+ readonly installation_new: (a: any, b: number, c: number, d: number, e: bigint) => number;
855
+ readonly __wbg_inboxstate_free: (a: number, b: number) => void;
856
+ readonly __wbg_get_inboxstate_inboxId: (a: number) => [number, number];
857
+ readonly __wbg_set_inboxstate_inboxId: (a: number, b: number, c: number) => void;
858
+ readonly __wbg_get_inboxstate_recoveryIdentifier: (a: number) => any;
859
+ readonly __wbg_set_inboxstate_recoveryIdentifier: (a: number, b: any) => void;
860
+ readonly __wbg_get_inboxstate_installations: (a: number) => [number, number];
861
+ readonly __wbg_set_inboxstate_installations: (a: number, b: number, c: number) => void;
862
+ readonly __wbg_get_inboxstate_accountIdentifiers: (a: number) => [number, number];
863
+ readonly __wbg_set_inboxstate_accountIdentifiers: (a: number, b: number, c: number) => void;
864
+ readonly inboxstate_new: (a: number, b: number, c: any, d: number, e: number, f: number, g: number) => number;
865
+ readonly client_inboxState: (a: number, b: number) => any;
866
+ readonly client_getLatestInboxState: (a: number, b: number, c: number) => any;
813
867
  readonly rust_sqlite_wasm_shim_localtime_js: (a: bigint, b: number) => void;
814
868
  readonly rust_sqlite_wasm_shim_tzset_js: (a: number, b: number, c: number, d: number) => void;
815
869
  readonly rust_sqlite_wasm_shim_emscripten_get_now: () => number;
@@ -840,9 +894,9 @@ export interface InitOutput {
840
894
  readonly __wbindgen_export_7: WebAssembly.Table;
841
895
  readonly __externref_table_dealloc: (a: number) => void;
842
896
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hff1927556d6713ec: (a: number, b: number) => void;
843
- readonly closure3753_externref_shim: (a: number, b: number, c: any) => void;
844
- readonly closure4762_externref_shim: (a: number, b: number, c: any, d: number, e: any) => number;
845
- readonly closure4761_externref_shim: (a: number, b: number, c: any, d: any) => void;
897
+ readonly closure3799_externref_shim: (a: number, b: number, c: any) => void;
898
+ readonly closure4807_externref_shim: (a: number, b: number, c: any, d: number, e: any) => number;
899
+ readonly closure4806_externref_shim: (a: number, b: number, c: any, d: any) => void;
846
900
  readonly __wbindgen_start: () => void;
847
901
  }
848
902
 
@@ -301,34 +301,12 @@ export function verifySignedWithPublicKey(signature_text, signature_bytes, publi
301
301
  }
302
302
  }
303
303
 
304
- /**
305
- * @param {string} host
306
- * @param {string} inbox_id
307
- * @param {Identifier} account_identifier
308
- * @param {string | null} [db_path]
309
- * @param {Uint8Array | null} [encryption_key]
310
- * @param {string | null} [history_sync_url]
311
- * @param {LogOptions | null} [log_options]
312
- * @returns {Promise<Client>}
313
- */
314
- export function createClient(host, inbox_id, account_identifier, db_path, encryption_key, history_sync_url, log_options) {
315
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
- const len0 = WASM_VECTOR_LEN;
317
- const ptr1 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
318
- const len1 = WASM_VECTOR_LEN;
319
- var ptr2 = isLikeNone(db_path) ? 0 : passStringToWasm0(db_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
- var len2 = WASM_VECTOR_LEN;
321
- var ptr3 = isLikeNone(history_sync_url) ? 0 : passStringToWasm0(history_sync_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
- var len3 = WASM_VECTOR_LEN;
323
- let ptr4 = 0;
324
- if (!isLikeNone(log_options)) {
325
- _assertClass(log_options, LogOptions);
326
- ptr4 = log_options.__destroy_into_raw();
327
- }
328
- const ret = wasm.createClient(ptr0, len0, ptr1, len1, account_identifier, ptr2, len2, isLikeNone(encryption_key) ? 0 : addToExternrefTable0(encryption_key), ptr3, len3, ptr4);
329
- return ret;
304
+ function passArray8ToWasm0(arg, malloc) {
305
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
306
+ getUint8ArrayMemory0().set(arg, ptr / 1);
307
+ WASM_VECTOR_LEN = arg.length;
308
+ return ptr;
330
309
  }
331
-
332
310
  /**
333
311
  * @param {string} host
334
312
  * @param {Identifier} accountIdentifier
@@ -364,27 +342,49 @@ export function generateInboxId(accountIdentifier) {
364
342
  }
365
343
  }
366
344
 
367
- function passArray8ToWasm0(arg, malloc) {
368
- const ptr = malloc(arg.length * 1, 1) >>> 0;
369
- getUint8ArrayMemory0().set(arg, ptr / 1);
370
- WASM_VECTOR_LEN = arg.length;
371
- return ptr;
345
+ /**
346
+ * @param {string} host
347
+ * @param {string} inbox_id
348
+ * @param {Identifier} account_identifier
349
+ * @param {string | null} [db_path]
350
+ * @param {Uint8Array | null} [encryption_key]
351
+ * @param {string | null} [history_sync_url]
352
+ * @param {LogOptions | null} [log_options]
353
+ * @returns {Promise<Client>}
354
+ */
355
+ export function createClient(host, inbox_id, account_identifier, db_path, encryption_key, history_sync_url, log_options) {
356
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ptr1 = passStringToWasm0(inbox_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
359
+ const len1 = WASM_VECTOR_LEN;
360
+ var ptr2 = isLikeNone(db_path) ? 0 : passStringToWasm0(db_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
+ var len2 = WASM_VECTOR_LEN;
362
+ var ptr3 = isLikeNone(history_sync_url) ? 0 : passStringToWasm0(history_sync_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
363
+ var len3 = WASM_VECTOR_LEN;
364
+ let ptr4 = 0;
365
+ if (!isLikeNone(log_options)) {
366
+ _assertClass(log_options, LogOptions);
367
+ ptr4 = log_options.__destroy_into_raw();
368
+ }
369
+ const ret = wasm.createClient(ptr0, len0, ptr1, len1, account_identifier, ptr2, len2, isLikeNone(encryption_key) ? 0 : addToExternrefTable0(encryption_key), ptr3, len3, ptr4);
370
+ return ret;
372
371
  }
372
+
373
373
  function __wbg_adapter_48(arg0, arg1) {
374
374
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hff1927556d6713ec(arg0, arg1);
375
375
  }
376
376
 
377
377
  function __wbg_adapter_51(arg0, arg1, arg2) {
378
- wasm.closure3753_externref_shim(arg0, arg1, arg2);
378
+ wasm.closure3799_externref_shim(arg0, arg1, arg2);
379
379
  }
380
380
 
381
- function __wbg_adapter_585(arg0, arg1, arg2, arg3, arg4) {
382
- const ret = wasm.closure4762_externref_shim(arg0, arg1, arg2, arg3, arg4);
381
+ function __wbg_adapter_598(arg0, arg1, arg2, arg3, arg4) {
382
+ const ret = wasm.closure4807_externref_shim(arg0, arg1, arg2, arg3, arg4);
383
383
  return ret !== 0;
384
384
  }
385
385
 
386
- function __wbg_adapter_686(arg0, arg1, arg2, arg3) {
387
- wasm.closure4761_externref_shim(arg0, arg1, arg2, arg3);
386
+ function __wbg_adapter_699(arg0, arg1, arg2, arg3) {
387
+ wasm.closure4806_externref_shim(arg0, arg1, arg2, arg3);
388
388
  }
389
389
 
390
390
  /**
@@ -673,6 +673,27 @@ export class Client {
673
673
  throw takeFromExternrefTable0(ret[0]);
674
674
  }
675
675
  }
676
+ /**
677
+ * @param {Consent[]} records
678
+ * @returns {Promise<void>}
679
+ */
680
+ setConsentStates(records) {
681
+ const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
682
+ const len0 = WASM_VECTOR_LEN;
683
+ const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
684
+ return ret;
685
+ }
686
+ /**
687
+ * @param {ConsentEntityType} entity_type
688
+ * @param {string} entity
689
+ * @returns {Promise<ConsentState>}
690
+ */
691
+ getConsentState(entity_type, entity) {
692
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
693
+ const len0 = WASM_VECTOR_LEN;
694
+ const ret = wasm.client_getConsentState(this.__wbg_ptr, entity_type, ptr0, len0);
695
+ return ret;
696
+ }
676
697
  /**
677
698
  * @returns {Identifier}
678
699
  */
@@ -795,27 +816,6 @@ export class Client {
795
816
  const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
796
817
  return ret;
797
818
  }
798
- /**
799
- * @param {Consent[]} records
800
- * @returns {Promise<void>}
801
- */
802
- setConsentStates(records) {
803
- const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
804
- const len0 = WASM_VECTOR_LEN;
805
- const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
806
- return ret;
807
- }
808
- /**
809
- * @param {ConsentEntityType} entity_type
810
- * @param {string} entity
811
- * @returns {Promise<ConsentState>}
812
- */
813
- getConsentState(entity_type, entity) {
814
- const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
815
- const len0 = WASM_VECTOR_LEN;
816
- const ret = wasm.client_getConsentState(this.__wbg_ptr, entity_type, ptr0, len0);
817
- return ret;
818
- }
819
819
  }
820
820
 
821
821
  const ConsentFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3499,6 +3499,141 @@ export class MultiRemoteAttachment {
3499
3499
  }
3500
3500
  }
3501
3501
 
3502
+ const OpfsFinalization = (typeof FinalizationRegistry === 'undefined')
3503
+ ? { register: () => {}, unregister: () => {} }
3504
+ : new FinalizationRegistry(ptr => wasm.__wbg_opfs_free(ptr >>> 0, 1));
3505
+
3506
+ export class Opfs {
3507
+
3508
+ __destroy_into_raw() {
3509
+ const ptr = this.__wbg_ptr;
3510
+ this.__wbg_ptr = 0;
3511
+ OpfsFinalization.unregister(this);
3512
+ return ptr;
3513
+ }
3514
+
3515
+ free() {
3516
+ const ptr = this.__destroy_into_raw();
3517
+ wasm.__wbg_opfs_free(ptr, 0);
3518
+ }
3519
+ /**
3520
+ * Check if the global OPFS object has been initialized
3521
+ * @returns {boolean}
3522
+ */
3523
+ static exists() {
3524
+ const ret = wasm.opfs_exists();
3525
+ return ret !== 0;
3526
+ }
3527
+ /**
3528
+ * gets the error from Opfs, if any.
3529
+ * @returns {string | undefined}
3530
+ */
3531
+ static error() {
3532
+ const ret = wasm.opfs_error();
3533
+ let v1;
3534
+ if (ret[0] !== 0) {
3535
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
3536
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3537
+ }
3538
+ return v1;
3539
+ }
3540
+ /**
3541
+ * @returns {Promise<void>}
3542
+ */
3543
+ static wipeFiles() {
3544
+ const ret = wasm.opfs_wipeFiles();
3545
+ return ret;
3546
+ }
3547
+ /**
3548
+ * If a virtual file exists with the given name, disassociates it from the pool and returns true, else returns false without side effects.
3549
+ * @param {string} name
3550
+ * @returns {boolean}
3551
+ */
3552
+ static rm(name) {
3553
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3554
+ const len0 = WASM_VECTOR_LEN;
3555
+ const ret = wasm.opfs_rm(ptr0, len0);
3556
+ if (ret[2]) {
3557
+ throw takeFromExternrefTable0(ret[1]);
3558
+ }
3559
+ return ret[0] !== 0;
3560
+ }
3561
+ /**
3562
+ * list files in current pool
3563
+ * @returns {string[]}
3564
+ */
3565
+ static getFileNames() {
3566
+ const ret = wasm.opfs_getFileNames();
3567
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
3568
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
3569
+ return v1;
3570
+ }
3571
+ /**
3572
+ * import a db file at 'path'
3573
+ * @param {string} path
3574
+ * @param {Uint8Array} bytes
3575
+ */
3576
+ static importDb(path, bytes) {
3577
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3578
+ const len0 = WASM_VECTOR_LEN;
3579
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
3580
+ const len1 = WASM_VECTOR_LEN;
3581
+ const ret = wasm.opfs_importDb(ptr0, len0, ptr1, len1);
3582
+ if (ret[1]) {
3583
+ throw takeFromExternrefTable0(ret[0]);
3584
+ }
3585
+ }
3586
+ /**
3587
+ * export db file with 'name'
3588
+ * @param {string} name
3589
+ * @returns {Uint8Array}
3590
+ */
3591
+ static exportFile(name) {
3592
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3593
+ const len0 = WASM_VECTOR_LEN;
3594
+ const ret = wasm.opfs_exportFile(ptr0, len0);
3595
+ if (ret[3]) {
3596
+ throw takeFromExternrefTable0(ret[2]);
3597
+ }
3598
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3599
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3600
+ return v2;
3601
+ }
3602
+ /**
3603
+ * get number of files in pool
3604
+ * @returns {number}
3605
+ */
3606
+ static getFileCount() {
3607
+ const ret = wasm.opfs_getFileCount();
3608
+ return ret >>> 0;
3609
+ }
3610
+ /**
3611
+ * @returns {number}
3612
+ */
3613
+ static getCapacity() {
3614
+ const ret = wasm.opfs_getCapacity();
3615
+ return ret >>> 0;
3616
+ }
3617
+ /**
3618
+ * Adds n entries to the current pool.
3619
+ * @param {number} n
3620
+ * @returns {Promise<number>}
3621
+ */
3622
+ static addCapacity(n) {
3623
+ const ret = wasm.opfs_addCapacity(n);
3624
+ return ret;
3625
+ }
3626
+ /**
3627
+ * Removes up to n entries from the pool, with the caveat that it can only remove currently-unused entries.
3628
+ * @param {number} n
3629
+ * @returns {Promise<number>}
3630
+ */
3631
+ static reduceCapacity(n) {
3632
+ const ret = wasm.opfs_reduceCapacity(n);
3633
+ return ret;
3634
+ }
3635
+ }
3636
+
3502
3637
  const PasskeySignatureFinalization = (typeof FinalizationRegistry === 'undefined')
3503
3638
  ? { register: () => {}, unregister: () => {} }
3504
3639
  : new FinalizationRegistry(ptr => wasm.__wbg_passkeysignature_free(ptr >>> 0, 1));
@@ -4263,7 +4398,7 @@ function __wbg_get_imports() {
4263
4398
  const a = state0.a;
4264
4399
  state0.a = 0;
4265
4400
  try {
4266
- return __wbg_adapter_585(a, state0.b, arg0, arg1, arg2);
4401
+ return __wbg_adapter_598(a, state0.b, arg0, arg1, arg2);
4267
4402
  } finally {
4268
4403
  state0.a = a;
4269
4404
  }
@@ -4293,7 +4428,7 @@ function __wbg_get_imports() {
4293
4428
  const a = state0.a;
4294
4429
  state0.a = 0;
4295
4430
  try {
4296
- return __wbg_adapter_585(a, state0.b, arg0, arg1, arg2);
4431
+ return __wbg_adapter_598(a, state0.b, arg0, arg1, arg2);
4297
4432
  } finally {
4298
4433
  state0.a = a;
4299
4434
  }
@@ -4581,7 +4716,7 @@ function __wbg_get_imports() {
4581
4716
  const a = state0.a;
4582
4717
  state0.a = 0;
4583
4718
  try {
4584
- return __wbg_adapter_686(a, state0.b, arg0, arg1);
4719
+ return __wbg_adapter_699(a, state0.b, arg0, arg1);
4585
4720
  } finally {
4586
4721
  state0.a = a;
4587
4722
  }
@@ -4773,6 +4908,10 @@ function __wbg_get_imports() {
4773
4908
  const ret = RemoteAttachmentInfo.__unwrap(arg0);
4774
4909
  return ret;
4775
4910
  };
4911
+ imports.wbg.__wbg_removeEntry_9f6bc325e3383e59 = function(arg0, arg1, arg2) {
4912
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
4913
+ return ret;
4914
+ };
4776
4915
  imports.wbg.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
4777
4916
  const ret = module.require;
4778
4917
  return ret;
@@ -4980,12 +5119,12 @@ function __wbg_get_imports() {
4980
5119
  const ret = false;
4981
5120
  return ret;
4982
5121
  };
4983
- imports.wbg.__wbindgen_closure_wrapper16206 = function(arg0, arg1, arg2) {
4984
- const ret = makeMutClosure(arg0, arg1, 3682, __wbg_adapter_48);
5122
+ imports.wbg.__wbindgen_closure_wrapper16361 = function(arg0, arg1, arg2) {
5123
+ const ret = makeMutClosure(arg0, arg1, 3728, __wbg_adapter_48);
4985
5124
  return ret;
4986
5125
  };
4987
- imports.wbg.__wbindgen_closure_wrapper16502 = function(arg0, arg1, arg2) {
4988
- const ret = makeMutClosure(arg0, arg1, 3754, __wbg_adapter_51);
5126
+ imports.wbg.__wbindgen_closure_wrapper16655 = function(arg0, arg1, arg2) {
5127
+ const ret = makeMutClosure(arg0, arg1, 3800, __wbg_adapter_51);
4989
5128
  return ret;
4990
5129
  };
4991
5130
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -108,49 +108,6 @@ export const client_signWithInstallationKey: (a: number, b: number, c: number) =
108
108
  export const client_verifySignedWithInstallationKey: (a: number, b: number, c: number, d: any) => [number, number];
109
109
  export const __wbg_set_reaction_reference: (a: number, b: number, c: number) => void;
110
110
  export const __wbg_get_reaction_reference: (a: number) => [number, number];
111
- export const __wbg_client_free: (a: number, b: number) => void;
112
- export const __wbg_logoptions_free: (a: number, b: number) => void;
113
- export const __wbg_get_logoptions_structured: (a: number) => number;
114
- export const __wbg_set_logoptions_structured: (a: number, b: number) => void;
115
- export const __wbg_get_logoptions_performance: (a: number) => number;
116
- export const __wbg_set_logoptions_performance: (a: number, b: number) => void;
117
- export const __wbg_get_logoptions_level: (a: number) => number;
118
- export const __wbg_set_logoptions_level: (a: number, b: number) => void;
119
- export const logoptions_new: (a: number, b: number, c: number) => number;
120
- 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) => any;
121
- export const client_accountIdentifier: (a: number) => any;
122
- export const client_inboxId: (a: number) => [number, number];
123
- export const client_isRegistered: (a: number) => number;
124
- export const client_installationId: (a: number) => [number, number];
125
- export const client_installationIdBytes: (a: number) => any;
126
- export const client_canMessage: (a: number, b: number, c: number) => any;
127
- export const client_registerIdentity: (a: number) => any;
128
- export const client_sendHistorySyncRequest: (a: number) => any;
129
- export const client_sendConsentSyncRequest: (a: number) => any;
130
- export const client_findInboxIdByIdentifier: (a: number, b: any) => any;
131
- export const client_conversations: (a: number) => number;
132
- export const getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
133
- export const generateInboxId: (a: any) => [number, number, number, number];
134
- export const __wbg_installation_free: (a: number, b: number) => void;
135
- export const __wbg_get_installation_bytes: (a: number) => any;
136
- export const __wbg_set_installation_bytes: (a: number, b: any) => void;
137
- export const __wbg_get_installation_id: (a: number) => [number, number];
138
- export const __wbg_set_installation_id: (a: number, b: number, c: number) => void;
139
- export const __wbg_get_installation_clientTimestampNs: (a: number) => [number, bigint];
140
- export const __wbg_set_installation_clientTimestampNs: (a: number, b: number, c: bigint) => void;
141
- export const installation_new: (a: any, b: number, c: number, d: number, e: bigint) => number;
142
- export const __wbg_inboxstate_free: (a: number, b: number) => void;
143
- export const __wbg_get_inboxstate_inboxId: (a: number) => [number, number];
144
- export const __wbg_set_inboxstate_inboxId: (a: number, b: number, c: number) => void;
145
- export const __wbg_get_inboxstate_recoveryIdentifier: (a: number) => any;
146
- export const __wbg_set_inboxstate_recoveryIdentifier: (a: number, b: any) => void;
147
- export const __wbg_get_inboxstate_installations: (a: number) => [number, number];
148
- export const __wbg_set_inboxstate_installations: (a: number, b: number, c: number) => void;
149
- export const __wbg_get_inboxstate_accountIdentifiers: (a: number) => [number, number];
150
- export const __wbg_set_inboxstate_accountIdentifiers: (a: number, b: number, c: number) => void;
151
- export const inboxstate_new: (a: number, b: number, c: any, d: number, e: number, f: number, g: number) => number;
152
- export const client_inboxState: (a: number, b: number) => any;
153
- export const client_getLatestInboxState: (a: number, b: number, c: number) => any;
154
111
  export const __wbg_consent_free: (a: number, b: number) => void;
155
112
  export const __wbg_get_consent_entityType: (a: number) => number;
156
113
  export const __wbg_set_consent_entityType: (a: number, b: number) => void;
@@ -184,6 +141,11 @@ export const permissionpolicyset_new: (a: number, b: number, c: number, d: numbe
184
141
  export const __wbg_grouppermissions_free: (a: number, b: number) => void;
185
142
  export const grouppermissions_policyType: (a: number) => [number, number, number];
186
143
  export const grouppermissions_policySet: (a: number) => [number, number, number];
144
+ export const __wbg_streamcloser_free: (a: number, b: number) => void;
145
+ export const streamcloser_end: (a: number) => void;
146
+ export const streamcloser_endAndWait: (a: number) => any;
147
+ export const streamcloser_waitForReady: (a: number) => any;
148
+ export const streamcloser_isClosed: (a: number) => number;
187
149
  export const __wbg_listconversationsoptions_free: (a: number, b: number) => void;
188
150
  export const __wbg_get_listconversationsoptions_consentStates: (a: number) => [number, number];
189
151
  export const __wbg_set_listconversationsoptions_consentStates: (a: number, b: number, c: number) => void;
@@ -269,6 +231,8 @@ export const __wbg_set_encodedcontent_compression: (a: number, b: number) => voi
269
231
  export const __wbg_get_encodedcontent_content: (a: number) => any;
270
232
  export const __wbg_set_encodedcontent_content: (a: number, b: any) => void;
271
233
  export const encodedcontent_new: (a: number, b: any, c: number, d: number, e: number, f: any) => number;
234
+ export const getInboxIdForIdentifier: (a: number, b: number, c: any) => any;
235
+ export const generateInboxId: (a: any) => [number, number, number, number];
272
236
  export const __wbg_listmessagesoptions_free: (a: number, b: number) => void;
273
237
  export const __wbg_get_listmessagesoptions_contentTypes: (a: number) => [number, number];
274
238
  export const __wbg_set_listmessagesoptions_contentTypes: (a: number, b: number, c: number) => void;
@@ -296,11 +260,18 @@ export const __wbg_get_messagewithreactions_message: (a: number) => number;
296
260
  export const __wbg_set_messagewithreactions_message: (a: number, b: number) => void;
297
261
  export const __wbg_get_messagewithreactions_reactions: (a: number) => [number, number];
298
262
  export const __wbg_set_messagewithreactions_reactions: (a: number, b: number, c: number) => void;
299
- export const __wbg_streamcloser_free: (a: number, b: number) => void;
300
- export const streamcloser_end: (a: number) => void;
301
- export const streamcloser_endAndWait: (a: number) => any;
302
- export const streamcloser_waitForReady: (a: number) => any;
303
- export const streamcloser_isClosed: (a: number) => number;
263
+ export const __wbg_opfs_free: (a: number, b: number) => void;
264
+ export const opfs_exists: () => number;
265
+ export const opfs_error: () => [number, number];
266
+ export const opfs_wipeFiles: () => any;
267
+ export const opfs_rm: (a: number, b: number) => [number, number, number];
268
+ export const opfs_getFileNames: () => [number, number];
269
+ export const opfs_importDb: (a: number, b: number, c: number, d: number) => [number, number];
270
+ export const opfs_exportFile: (a: number, b: number) => [number, number, number, number];
271
+ export const opfs_getFileCount: () => number;
272
+ export const opfs_getCapacity: () => number;
273
+ export const opfs_addCapacity: (a: number) => any;
274
+ export const opfs_reduceCapacity: (a: number) => any;
304
275
  export const __wbg_get_messagedisappearingsettings_fromNs: (a: number) => bigint;
305
276
  export const __wbg_get_message_sentAtNs: (a: number) => bigint;
306
277
  export const __wbg_set_listmessagesoptions_sentBeforeNs: (a: number, b: number, c: bigint) => void;
@@ -313,6 +284,47 @@ export const __wbg_get_creategroupoptions_messageDisappearingSettings: (a: numbe
313
284
  export const __wbg_get_listmessagesoptions_sentBeforeNs: (a: number) => [number, bigint];
314
285
  export const __wbg_get_listmessagesoptions_sentAfterNs: (a: number) => [number, bigint];
315
286
  export const __wbg_get_listmessagesoptions_limit: (a: number) => [number, bigint];
287
+ export const __wbg_client_free: (a: number, b: number) => void;
288
+ export const __wbg_logoptions_free: (a: number, b: number) => void;
289
+ export const __wbg_get_logoptions_structured: (a: number) => number;
290
+ export const __wbg_set_logoptions_structured: (a: number, b: number) => void;
291
+ export const __wbg_get_logoptions_performance: (a: number) => number;
292
+ export const __wbg_set_logoptions_performance: (a: number, b: number) => void;
293
+ export const __wbg_get_logoptions_level: (a: number) => number;
294
+ export const __wbg_set_logoptions_level: (a: number, b: number) => void;
295
+ export const logoptions_new: (a: number, b: number, c: number) => number;
296
+ 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) => any;
297
+ export const client_accountIdentifier: (a: number) => any;
298
+ export const client_inboxId: (a: number) => [number, number];
299
+ export const client_isRegistered: (a: number) => number;
300
+ export const client_installationId: (a: number) => [number, number];
301
+ export const client_installationIdBytes: (a: number) => any;
302
+ export const client_canMessage: (a: number, b: number, c: number) => any;
303
+ export const client_registerIdentity: (a: number) => any;
304
+ export const client_sendHistorySyncRequest: (a: number) => any;
305
+ export const client_sendConsentSyncRequest: (a: number) => any;
306
+ export const client_findInboxIdByIdentifier: (a: number, b: any) => any;
307
+ export const client_conversations: (a: number) => number;
308
+ export const __wbg_installation_free: (a: number, b: number) => void;
309
+ export const __wbg_get_installation_bytes: (a: number) => any;
310
+ export const __wbg_set_installation_bytes: (a: number, b: any) => void;
311
+ export const __wbg_get_installation_id: (a: number) => [number, number];
312
+ export const __wbg_set_installation_id: (a: number, b: number, c: number) => void;
313
+ export const __wbg_get_installation_clientTimestampNs: (a: number) => [number, bigint];
314
+ export const __wbg_set_installation_clientTimestampNs: (a: number, b: number, c: bigint) => void;
315
+ export const installation_new: (a: any, b: number, c: number, d: number, e: bigint) => number;
316
+ export const __wbg_inboxstate_free: (a: number, b: number) => void;
317
+ export const __wbg_get_inboxstate_inboxId: (a: number) => [number, number];
318
+ export const __wbg_set_inboxstate_inboxId: (a: number, b: number, c: number) => void;
319
+ export const __wbg_get_inboxstate_recoveryIdentifier: (a: number) => any;
320
+ export const __wbg_set_inboxstate_recoveryIdentifier: (a: number, b: any) => void;
321
+ export const __wbg_get_inboxstate_installations: (a: number) => [number, number];
322
+ export const __wbg_set_inboxstate_installations: (a: number, b: number, c: number) => void;
323
+ export const __wbg_get_inboxstate_accountIdentifiers: (a: number) => [number, number];
324
+ export const __wbg_set_inboxstate_accountIdentifiers: (a: number, b: number, c: number) => void;
325
+ export const inboxstate_new: (a: number, b: number, c: any, d: number, e: number, f: number, g: number) => number;
326
+ export const client_inboxState: (a: number, b: number) => any;
327
+ export const client_getLatestInboxState: (a: number, b: number, c: number) => any;
316
328
  export const rust_sqlite_wasm_shim_localtime_js: (a: bigint, b: number) => void;
317
329
  export const rust_sqlite_wasm_shim_tzset_js: (a: number, b: number, c: number, d: number) => void;
318
330
  export const rust_sqlite_wasm_shim_emscripten_get_now: () => number;
@@ -343,7 +355,7 @@ export const __externref_drop_slice: (a: number, b: number) => void;
343
355
  export const __wbindgen_export_7: WebAssembly.Table;
344
356
  export const __externref_table_dealloc: (a: number) => void;
345
357
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hff1927556d6713ec: (a: number, b: number) => void;
346
- export const closure3753_externref_shim: (a: number, b: number, c: any) => void;
347
- export const closure4762_externref_shim: (a: number, b: number, c: any, d: number, e: any) => number;
348
- export const closure4761_externref_shim: (a: number, b: number, c: any, d: any) => void;
358
+ export const closure3799_externref_shim: (a: number, b: number, c: any) => void;
359
+ export const closure4807_externref_shim: (a: number, b: number, c: any, d: number, e: any) => number;
360
+ export const closure4806_externref_shim: (a: number, b: number, c: any, d: any) => void;
349
361
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmtp/wasm-bindings",
3
- "version": "1.0.0-rc4",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "WASM bindings for the libXMTP rust library",