@xmtp/wasm-bindings 1.7.0-rc1 → 1.7.0-rc3

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.
@@ -230,6 +230,19 @@ function takeFromExternrefTable0(idx) {
230
230
  wasm.__externref_table_dealloc(idx);
231
231
  return value;
232
232
  }
233
+ /**
234
+ * @param {string} signatureText
235
+ * @param {Uint8Array} signatureBytes
236
+ * @param {Uint8Array} publicKey
237
+ */
238
+ export function verifySignedWithPublicKey(signatureText, signatureBytes, publicKey) {
239
+ const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
+ const len0 = WASM_VECTOR_LEN;
241
+ const ret = wasm.verifySignedWithPublicKey(ptr0, len0, signatureBytes, publicKey);
242
+ if (ret[1]) {
243
+ throw takeFromExternrefTable0(ret[0]);
244
+ }
245
+ }
233
246
 
234
247
  function passArrayJsValueToWasm0(array, malloc) {
235
248
  const ptr = malloc(array.length * 4, 4) >>> 0;
@@ -240,6 +253,68 @@ function passArrayJsValueToWasm0(array, malloc) {
240
253
  WASM_VECTOR_LEN = array.length;
241
254
  return ptr;
242
255
  }
256
+ /**
257
+ * @param {string} host
258
+ * @param {string | null | undefined} gatewayHost
259
+ * @param {Identifier} recoveryIdentifier
260
+ * @param {string} inboxId
261
+ * @param {Uint8Array[]} installationIds
262
+ * @returns {SignatureRequestHandle}
263
+ */
264
+ export function revokeInstallationsSignatureRequest(host, gatewayHost, recoveryIdentifier, inboxId, installationIds) {
265
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
268
+ var len1 = WASM_VECTOR_LEN;
269
+ const ptr2 = passStringToWasm0(inboxId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
270
+ const len2 = WASM_VECTOR_LEN;
271
+ const ptr3 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
272
+ const len3 = WASM_VECTOR_LEN;
273
+ const ret = wasm.revokeInstallationsSignatureRequest(ptr0, len0, ptr1, len1, recoveryIdentifier, ptr2, len2, ptr3, len3);
274
+ if (ret[2]) {
275
+ throw takeFromExternrefTable0(ret[1]);
276
+ }
277
+ return SignatureRequestHandle.__wrap(ret[0]);
278
+ }
279
+
280
+ function _assertClass(instance, klass) {
281
+ if (!(instance instanceof klass)) {
282
+ throw new Error(`expected instance of ${klass.name}`);
283
+ }
284
+ }
285
+ /**
286
+ * @param {string} host
287
+ * @param {string | null | undefined} gatewayHost
288
+ * @param {SignatureRequestHandle} signatureRequest
289
+ * @returns {Promise<void>}
290
+ */
291
+ export function applySignatureRequest(host, gatewayHost, signatureRequest) {
292
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ const len0 = WASM_VECTOR_LEN;
294
+ var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
+ var len1 = WASM_VECTOR_LEN;
296
+ _assertClass(signatureRequest, SignatureRequestHandle);
297
+ const ret = wasm.applySignatureRequest(ptr0, len0, ptr1, len1, signatureRequest.__wbg_ptr);
298
+ return ret;
299
+ }
300
+
301
+ /**
302
+ * @param {string} host
303
+ * @param {string | null | undefined} gatewayHost
304
+ * @param {string[]} inboxIds
305
+ * @returns {Promise<InboxState[]>}
306
+ */
307
+ export function inboxStateFromInboxIds(host, gatewayHost, inboxIds) {
308
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
309
+ const len0 = WASM_VECTOR_LEN;
310
+ var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
311
+ var len1 = WASM_VECTOR_LEN;
312
+ const ptr2 = passArrayJsValueToWasm0(inboxIds, wasm.__wbindgen_malloc);
313
+ const len2 = WASM_VECTOR_LEN;
314
+ const ret = wasm.inboxStateFromInboxIds(ptr0, len0, ptr1, len1, ptr2, len2);
315
+ return ret;
316
+ }
317
+
243
318
  /**
244
319
  * @param {Attachment} attachment
245
320
  * @returns {EncodedContent}
@@ -296,12 +371,22 @@ export function leaveRequestContentType() {
296
371
  return ret;
297
372
  }
298
373
 
374
+ function passArray8ToWasm0(arg, malloc) {
375
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
376
+ getUint8ArrayMemory0().set(arg, ptr / 1);
377
+ WASM_VECTOR_LEN = arg.length;
378
+ return ptr;
379
+ }
299
380
  /**
300
- * @param {RemoteAttachment} remote_attachment
301
- * @returns {EncodedContent}
381
+ * Decrypts an encrypted payload from a remote attachment.
382
+ * @param {Uint8Array} encryptedBytes
383
+ * @param {RemoteAttachment} remoteAttachment
384
+ * @returns {Attachment}
302
385
  */
303
- export function encodeRemoteAttachment(remote_attachment) {
304
- const ret = wasm.encodeRemoteAttachment(remote_attachment);
386
+ export function decryptAttachment(encryptedBytes, remoteAttachment) {
387
+ const ptr0 = passArray8ToWasm0(encryptedBytes, wasm.__wbindgen_malloc);
388
+ const len0 = WASM_VECTOR_LEN;
389
+ const ret = wasm.decryptAttachment(ptr0, len0, remoteAttachment);
305
390
  if (ret[2]) {
306
391
  throw takeFromExternrefTable0(ret[1]);
307
392
  }
@@ -317,11 +402,28 @@ export function remoteAttachmentContentType() {
317
402
  }
318
403
 
319
404
  /**
320
- * @returns {ContentTypeId}
405
+ * Encrypts an attachment for storage as a remote attachment.
406
+ * @param {Attachment} attachment
407
+ * @returns {EncryptedAttachment}
321
408
  */
322
- export function walletSendCallsContentType() {
323
- const ret = wasm.walletSendCallsContentType();
324
- return ret;
409
+ export function encryptAttachment(attachment) {
410
+ const ret = wasm.encryptAttachment(attachment);
411
+ if (ret[2]) {
412
+ throw takeFromExternrefTable0(ret[1]);
413
+ }
414
+ return takeFromExternrefTable0(ret[0]);
415
+ }
416
+
417
+ /**
418
+ * @param {RemoteAttachment} remote_attachment
419
+ * @returns {EncodedContent}
420
+ */
421
+ export function encodeRemoteAttachment(remote_attachment) {
422
+ const ret = wasm.encodeRemoteAttachment(remote_attachment);
423
+ if (ret[2]) {
424
+ throw takeFromExternrefTable0(ret[1]);
425
+ }
426
+ return takeFromExternrefTable0(ret[0]);
325
427
  }
326
428
 
327
429
  /**
@@ -336,6 +438,14 @@ export function encodeWalletSendCalls(wallet_send_calls) {
336
438
  return takeFromExternrefTable0(ret[0]);
337
439
  }
338
440
 
441
+ /**
442
+ * @returns {ContentTypeId}
443
+ */
444
+ export function walletSendCallsContentType() {
445
+ const ret = wasm.walletSendCallsContentType();
446
+ return ret;
447
+ }
448
+
339
449
  /**
340
450
  * @param {TransactionReference} transaction_reference
341
451
  * @returns {EncodedContent}
@@ -356,14 +466,6 @@ export function transactionReferenceContentType() {
356
466
  return ret;
357
467
  }
358
468
 
359
- /**
360
- * @returns {ContentTypeId}
361
- */
362
- export function multiRemoteAttachmentContentType() {
363
- const ret = wasm.multiRemoteAttachmentContentType();
364
- return ret;
365
- }
366
-
367
469
  /**
368
470
  * @param {MultiRemoteAttachment} multi_remote_attachment
369
471
  * @returns {EncodedContent}
@@ -376,6 +478,14 @@ export function encodeMultiRemoteAttachment(multi_remote_attachment) {
376
478
  return takeFromExternrefTable0(ret[0]);
377
479
  }
378
480
 
481
+ /**
482
+ * @returns {ContentTypeId}
483
+ */
484
+ export function multiRemoteAttachmentContentType() {
485
+ const ret = wasm.multiRemoteAttachmentContentType();
486
+ return ret;
487
+ }
488
+
379
489
  /**
380
490
  * @param {string} text
381
491
  * @returns {EncodedContent}
@@ -406,6 +516,14 @@ export function replyContentType() {
406
516
  return ret;
407
517
  }
408
518
 
519
+ /**
520
+ * @returns {ContentTypeId}
521
+ */
522
+ export function intentContentType() {
523
+ const ret = wasm.intentContentType();
524
+ return ret;
525
+ }
526
+
409
527
  /**
410
528
  * @param {Intent} intent
411
529
  * @returns {EncodedContent}
@@ -418,14 +536,6 @@ export function encodeIntent(intent) {
418
536
  return takeFromExternrefTable0(ret[0]);
419
537
  }
420
538
 
421
- /**
422
- * @returns {ContentTypeId}
423
- */
424
- export function intentContentType() {
425
- const ret = wasm.intentContentType();
426
- return ret;
427
- }
428
-
429
539
  /**
430
540
  * @returns {ContentTypeId}
431
541
  */
@@ -446,11 +556,25 @@ export function encodeActions(actions) {
446
556
  return takeFromExternrefTable0(ret[0]);
447
557
  }
448
558
 
559
+ /**
560
+ * @param {string} text
561
+ * @returns {EncodedContent}
562
+ */
563
+ export function encodeMarkdown(text) {
564
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
565
+ const len0 = WASM_VECTOR_LEN;
566
+ const ret = wasm.encodeMarkdown(ptr0, len0);
567
+ if (ret[2]) {
568
+ throw takeFromExternrefTable0(ret[1]);
569
+ }
570
+ return takeFromExternrefTable0(ret[0]);
571
+ }
572
+
449
573
  /**
450
574
  * @returns {ContentTypeId}
451
575
  */
452
- export function reactionContentType() {
453
- const ret = wasm.reactionContentType();
576
+ export function markdownContentType() {
577
+ const ret = wasm.markdownContentType();
454
578
  return ret;
455
579
  }
456
580
 
@@ -466,11 +590,14 @@ export function encodeReaction(reaction) {
466
590
  return takeFromExternrefTable0(ret[0]);
467
591
  }
468
592
 
469
- function _assertClass(instance, klass) {
470
- if (!(instance instanceof klass)) {
471
- throw new Error(`expected instance of ${klass.name}`);
472
- }
593
+ /**
594
+ * @returns {ContentTypeId}
595
+ */
596
+ export function reactionContentType() {
597
+ const ret = wasm.reactionContentType();
598
+ return ret;
473
599
  }
600
+
474
601
  /**
475
602
  * @param {string} host
476
603
  * @param {string} inboxId
@@ -511,92 +638,6 @@ export function createClient(host, inboxId, accountIdentifier, dbPath, encryptio
511
638
  return ret;
512
639
  }
513
640
 
514
- /**
515
- * @param {string} host
516
- * @param {string | null | undefined} gatewayHost
517
- * @param {Identifier} recoveryIdentifier
518
- * @param {string} inboxId
519
- * @param {Uint8Array[]} installationIds
520
- * @returns {SignatureRequestHandle}
521
- */
522
- export function revokeInstallationsSignatureRequest(host, gatewayHost, recoveryIdentifier, inboxId, installationIds) {
523
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
524
- const len0 = WASM_VECTOR_LEN;
525
- var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
526
- var len1 = WASM_VECTOR_LEN;
527
- const ptr2 = passStringToWasm0(inboxId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
528
- const len2 = WASM_VECTOR_LEN;
529
- const ptr3 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
530
- const len3 = WASM_VECTOR_LEN;
531
- const ret = wasm.revokeInstallationsSignatureRequest(ptr0, len0, ptr1, len1, recoveryIdentifier, ptr2, len2, ptr3, len3);
532
- if (ret[2]) {
533
- throw takeFromExternrefTable0(ret[1]);
534
- }
535
- return SignatureRequestHandle.__wrap(ret[0]);
536
- }
537
-
538
- /**
539
- * @param {string} signatureText
540
- * @param {Uint8Array} signatureBytes
541
- * @param {Uint8Array} publicKey
542
- */
543
- export function verifySignedWithPublicKey(signatureText, signatureBytes, publicKey) {
544
- const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
- const len0 = WASM_VECTOR_LEN;
546
- const ret = wasm.verifySignedWithPublicKey(ptr0, len0, signatureBytes, publicKey);
547
- if (ret[1]) {
548
- throw takeFromExternrefTable0(ret[0]);
549
- }
550
- }
551
-
552
- /**
553
- * @param {string} host
554
- * @param {string | null | undefined} gatewayHost
555
- * @param {SignatureRequestHandle} signatureRequest
556
- * @returns {Promise<void>}
557
- */
558
- export function applySignatureRequest(host, gatewayHost, signatureRequest) {
559
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
560
- const len0 = WASM_VECTOR_LEN;
561
- var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
562
- var len1 = WASM_VECTOR_LEN;
563
- _assertClass(signatureRequest, SignatureRequestHandle);
564
- const ret = wasm.applySignatureRequest(ptr0, len0, ptr1, len1, signatureRequest.__wbg_ptr);
565
- return ret;
566
- }
567
-
568
- /**
569
- * @param {string} host
570
- * @param {string | null | undefined} gatewayHost
571
- * @param {string[]} inboxIds
572
- * @returns {Promise<InboxState[]>}
573
- */
574
- export function inboxStateFromInboxIds(host, gatewayHost, inboxIds) {
575
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
576
- const len0 = WASM_VECTOR_LEN;
577
- var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
578
- var len1 = WASM_VECTOR_LEN;
579
- const ptr2 = passArrayJsValueToWasm0(inboxIds, wasm.__wbindgen_malloc);
580
- const len2 = WASM_VECTOR_LEN;
581
- const ret = wasm.inboxStateFromInboxIds(ptr0, len0, ptr1, len1, ptr2, len2);
582
- return ret;
583
- }
584
-
585
- /**
586
- * @param {string} host
587
- * @param {string | null | undefined} gatewayHost
588
- * @param {Identifier} accountIdentifier
589
- * @returns {Promise<string | undefined>}
590
- */
591
- export function getInboxIdForIdentifier(host, gatewayHost, accountIdentifier) {
592
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
593
- const len0 = WASM_VECTOR_LEN;
594
- var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
595
- var len1 = WASM_VECTOR_LEN;
596
- const ret = wasm.getInboxIdForIdentifier(ptr0, len0, ptr1, len1, accountIdentifier);
597
- return ret;
598
- }
599
-
600
641
  /**
601
642
  * @param {Identifier} accountIdentifier
602
643
  * @param {bigint | null} [nonce]
@@ -621,6 +662,21 @@ export function generateInboxId(accountIdentifier, nonce) {
621
662
  }
622
663
  }
623
664
 
665
+ /**
666
+ * @param {string} host
667
+ * @param {string | null | undefined} gatewayHost
668
+ * @param {Identifier} accountIdentifier
669
+ * @returns {Promise<string | undefined>}
670
+ */
671
+ export function getInboxIdForIdentifier(host, gatewayHost, accountIdentifier) {
672
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
673
+ const len0 = WASM_VECTOR_LEN;
674
+ var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
675
+ var len1 = WASM_VECTOR_LEN;
676
+ const ret = wasm.getInboxIdForIdentifier(ptr0, len0, ptr1, len1, accountIdentifier);
677
+ return ret;
678
+ }
679
+
624
680
  /**
625
681
  * Entry point invoked by JavaScript in a worker.
626
682
  * @param {number} ptr
@@ -640,14 +696,14 @@ function wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6(arg0, arg
640
696
  wasm.wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6(arg0, arg1, arg2);
641
697
  }
642
698
 
643
- function wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1) {
644
- wasm.wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1);
645
- }
646
-
647
699
  function wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1(arg0, arg1) {
648
700
  wasm.wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1(arg0, arg1);
649
701
  }
650
702
 
703
+ function wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1) {
704
+ wasm.wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1);
705
+ }
706
+
651
707
  function wasm_bindgen__convert__closures_____invoke__h47a8fb56fc48c5fb(arg0, arg1, arg2, arg3) {
652
708
  wasm.wasm_bindgen__convert__closures_____invoke__h47a8fb56fc48c5fb(arg0, arg1, arg2, arg3);
653
709
  }
@@ -682,73 +738,186 @@ export class AuthHandle {
682
738
  wasm.__wbg_authhandle_free(ptr, 0);
683
739
  }
684
740
  /**
685
- * @returns {number}
741
+ * @returns {number}
742
+ */
743
+ id() {
744
+ const ret = wasm.authhandle_id(this.__wbg_ptr);
745
+ return ret >>> 0;
746
+ }
747
+ constructor() {
748
+ const ret = wasm.authhandle_new();
749
+ this.__wbg_ptr = ret >>> 0;
750
+ AuthHandleFinalization.register(this, this.__wbg_ptr, this);
751
+ return this;
752
+ }
753
+ /**
754
+ * @param {Credential} credential
755
+ * @returns {Promise<void>}
756
+ */
757
+ set(credential) {
758
+ const ret = wasm.authhandle_set(this.__wbg_ptr, credential);
759
+ return ret;
760
+ }
761
+ }
762
+ if (Symbol.dispose) AuthHandle.prototype[Symbol.dispose] = AuthHandle.prototype.free;
763
+
764
+ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
765
+ ? { register: () => {}, unregister: () => {} }
766
+ : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
767
+
768
+ export class Client {
769
+
770
+ static __wrap(ptr) {
771
+ ptr = ptr >>> 0;
772
+ const obj = Object.create(Client.prototype);
773
+ obj.__wbg_ptr = ptr;
774
+ ClientFinalization.register(obj, obj.__wbg_ptr, obj);
775
+ return obj;
776
+ }
777
+
778
+ __destroy_into_raw() {
779
+ const ptr = this.__wbg_ptr;
780
+ this.__wbg_ptr = 0;
781
+ ClientFinalization.unregister(this);
782
+ return ptr;
783
+ }
784
+
785
+ free() {
786
+ const ptr = this.__destroy_into_raw();
787
+ wasm.__wbg_client_free(ptr, 0);
788
+ }
789
+ /**
790
+ * @param {SignatureRequestHandle} signatureRequest
791
+ * @returns {Promise<void>}
792
+ */
793
+ registerIdentity(signatureRequest) {
794
+ _assertClass(signatureRequest, SignatureRequestHandle);
795
+ var ptr0 = signatureRequest.__destroy_into_raw();
796
+ const ret = wasm.client_registerIdentity(this.__wbg_ptr, ptr0);
797
+ return ret;
798
+ }
799
+ /**
800
+ * @param {SignatureRequestHandle} signatureRequest
801
+ * @returns {Promise<void>}
802
+ */
803
+ applySignatureRequest(signatureRequest) {
804
+ _assertClass(signatureRequest, SignatureRequestHandle);
805
+ const ret = wasm.client_applySignatureRequest(this.__wbg_ptr, signatureRequest.__wbg_ptr);
806
+ return ret;
807
+ }
808
+ /**
809
+ * @param {string} signatureText
810
+ * @returns {Uint8Array}
811
+ */
812
+ signWithInstallationKey(signatureText) {
813
+ const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
814
+ const len0 = WASM_VECTOR_LEN;
815
+ const ret = wasm.client_signWithInstallationKey(this.__wbg_ptr, ptr0, len0);
816
+ if (ret[2]) {
817
+ throw takeFromExternrefTable0(ret[1]);
818
+ }
819
+ return takeFromExternrefTable0(ret[0]);
820
+ }
821
+ /**
822
+ * @returns {SignatureRequestHandle | undefined}
823
+ */
824
+ createInboxSignatureRequest() {
825
+ const ret = wasm.client_createInboxSignatureRequest(this.__wbg_ptr);
826
+ if (ret[2]) {
827
+ throw takeFromExternrefTable0(ret[1]);
828
+ }
829
+ return ret[0] === 0 ? undefined : SignatureRequestHandle.__wrap(ret[0]);
830
+ }
831
+ /**
832
+ * @param {Identifier} newIdentifier
833
+ * @returns {Promise<SignatureRequestHandle>}
834
+ */
835
+ addWalletSignatureRequest(newIdentifier) {
836
+ const ret = wasm.client_addWalletSignatureRequest(this.__wbg_ptr, newIdentifier);
837
+ return ret;
838
+ }
839
+ /**
840
+ * @param {Identifier} identifier
841
+ * @returns {Promise<SignatureRequestHandle>}
842
+ */
843
+ revokeWalletSignatureRequest(identifier) {
844
+ const ret = wasm.client_revokeWalletSignatureRequest(this.__wbg_ptr, identifier);
845
+ return ret;
846
+ }
847
+ /**
848
+ * @param {string} signatureText
849
+ * @param {Uint8Array} signatureBytes
850
+ */
851
+ verifySignedWithInstallationKey(signatureText, signatureBytes) {
852
+ const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
853
+ const len0 = WASM_VECTOR_LEN;
854
+ const ret = wasm.client_verifySignedWithInstallationKey(this.__wbg_ptr, ptr0, len0, signatureBytes);
855
+ if (ret[1]) {
856
+ throw takeFromExternrefTable0(ret[0]);
857
+ }
858
+ }
859
+ /**
860
+ * @param {Uint8Array[]} installationIds
861
+ * @returns {Promise<SignatureRequestHandle>}
862
+ */
863
+ revokeInstallationsSignatureRequest(installationIds) {
864
+ const ptr0 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
865
+ const len0 = WASM_VECTOR_LEN;
866
+ const ret = wasm.client_revokeInstallationsSignatureRequest(this.__wbg_ptr, ptr0, len0);
867
+ return ret;
868
+ }
869
+ /**
870
+ * @param {Identifier} newRecoveryIdentifier
871
+ * @returns {Promise<SignatureRequestHandle>}
686
872
  */
687
- id() {
688
- const ret = wasm.authhandle_id(this.__wbg_ptr);
689
- return ret >>> 0;
690
- }
691
- constructor() {
692
- const ret = wasm.authhandle_new();
693
- this.__wbg_ptr = ret >>> 0;
694
- AuthHandleFinalization.register(this, this.__wbg_ptr, this);
695
- return this;
873
+ changeRecoveryIdentifierSignatureRequest(newRecoveryIdentifier) {
874
+ const ret = wasm.client_changeRecoveryIdentifierSignatureRequest(this.__wbg_ptr, newRecoveryIdentifier);
875
+ return ret;
696
876
  }
697
877
  /**
698
- * @param {Credential} credential
699
- * @returns {Promise<void>}
878
+ * @returns {Promise<SignatureRequestHandle | undefined>}
700
879
  */
701
- set(credential) {
702
- const ret = wasm.authhandle_set(this.__wbg_ptr, credential);
880
+ revokeAllOtherInstallationsSignatureRequest() {
881
+ const ret = wasm.client_revokeAllOtherInstallationsSignatureRequest(this.__wbg_ptr);
703
882
  return ret;
704
883
  }
705
- }
706
- if (Symbol.dispose) AuthHandle.prototype[Symbol.dispose] = AuthHandle.prototype.free;
707
-
708
- const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
709
- ? { register: () => {}, unregister: () => {} }
710
- : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
711
-
712
- export class Client {
713
-
714
- static __wrap(ptr) {
715
- ptr = ptr >>> 0;
716
- const obj = Object.create(Client.prototype);
717
- obj.__wbg_ptr = ptr;
718
- ClientFinalization.register(obj, obj.__wbg_ptr, obj);
719
- return obj;
720
- }
721
-
722
- __destroy_into_raw() {
723
- const ptr = this.__wbg_ptr;
724
- this.__wbg_ptr = 0;
725
- ClientFinalization.unregister(this);
726
- return ptr;
727
- }
728
-
729
- free() {
730
- const ptr = this.__destroy_into_raw();
731
- wasm.__wbg_client_free(ptr, 0);
884
+ /**
885
+ *
886
+ * * Get the client's inbox state.
887
+ * *
888
+ * * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
889
+ * * Otherwise, the state will be read from the local database.
890
+ *
891
+ * @param {boolean} refreshFromNetwork
892
+ * @returns {Promise<InboxState>}
893
+ */
894
+ inboxState(refreshFromNetwork) {
895
+ const ret = wasm.client_inboxState(this.__wbg_ptr, refreshFromNetwork);
896
+ return ret;
732
897
  }
733
898
  /**
734
- * @param {ConsentEntityType} entityType
735
- * @param {string} entity
736
- * @returns {Promise<ConsentState>}
899
+ * @param {string} inboxId
900
+ * @returns {Promise<InboxState>}
737
901
  */
738
- getConsentState(entityType, entity) {
739
- const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
902
+ getLatestInboxState(inboxId) {
903
+ const ptr0 = passStringToWasm0(inboxId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
740
904
  const len0 = WASM_VECTOR_LEN;
741
- const ret = wasm.client_getConsentState(this.__wbg_ptr, entityType, ptr0, len0);
905
+ const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
742
906
  return ret;
743
907
  }
744
908
  /**
745
- * @param {Consent[]} records
746
- * @returns {Promise<void>}
909
+ *
910
+ * * Get key package statuses for a list of installation IDs.
911
+ * *
912
+ * * Returns a JavaScript object mapping installation ID strings to KeyPackageStatus objects.
913
+ *
914
+ * @param {string[]} installationIds
915
+ * @returns {Promise<any>}
747
916
  */
748
- setConsentStates(records) {
749
- const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
917
+ getKeyPackageStatusesForInstallationIds(installationIds) {
918
+ const ptr0 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
750
919
  const len0 = WASM_VECTOR_LEN;
751
- const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
920
+ const ret = wasm.client_getKeyPackageStatusesForInstallationIds(this.__wbg_ptr, ptr0, len0);
752
921
  return ret;
753
922
  }
754
923
  /**
@@ -916,137 +1085,24 @@ export class Client {
916
1085
  }
917
1086
  }
918
1087
  /**
919
- * @param {SignatureRequestHandle} signatureRequest
920
- * @returns {Promise<void>}
921
- */
922
- registerIdentity(signatureRequest) {
923
- _assertClass(signatureRequest, SignatureRequestHandle);
924
- var ptr0 = signatureRequest.__destroy_into_raw();
925
- const ret = wasm.client_registerIdentity(this.__wbg_ptr, ptr0);
926
- return ret;
927
- }
928
- /**
929
- * @param {SignatureRequestHandle} signatureRequest
930
- * @returns {Promise<void>}
931
- */
932
- applySignatureRequest(signatureRequest) {
933
- _assertClass(signatureRequest, SignatureRequestHandle);
934
- const ret = wasm.client_applySignatureRequest(this.__wbg_ptr, signatureRequest.__wbg_ptr);
935
- return ret;
936
- }
937
- /**
938
- * @param {string} signatureText
939
- * @returns {Uint8Array}
940
- */
941
- signWithInstallationKey(signatureText) {
942
- const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
943
- const len0 = WASM_VECTOR_LEN;
944
- const ret = wasm.client_signWithInstallationKey(this.__wbg_ptr, ptr0, len0);
945
- if (ret[2]) {
946
- throw takeFromExternrefTable0(ret[1]);
947
- }
948
- return takeFromExternrefTable0(ret[0]);
949
- }
950
- /**
951
- * @returns {SignatureRequestHandle | undefined}
952
- */
953
- createInboxSignatureRequest() {
954
- const ret = wasm.client_createInboxSignatureRequest(this.__wbg_ptr);
955
- if (ret[2]) {
956
- throw takeFromExternrefTable0(ret[1]);
957
- }
958
- return ret[0] === 0 ? undefined : SignatureRequestHandle.__wrap(ret[0]);
959
- }
960
- /**
961
- * @param {Identifier} newIdentifier
962
- * @returns {Promise<SignatureRequestHandle>}
963
- */
964
- addWalletSignatureRequest(newIdentifier) {
965
- const ret = wasm.client_addWalletSignatureRequest(this.__wbg_ptr, newIdentifier);
966
- return ret;
967
- }
968
- /**
969
- * @param {Identifier} identifier
970
- * @returns {Promise<SignatureRequestHandle>}
971
- */
972
- revokeWalletSignatureRequest(identifier) {
973
- const ret = wasm.client_revokeWalletSignatureRequest(this.__wbg_ptr, identifier);
974
- return ret;
975
- }
976
- /**
977
- * @param {string} signatureText
978
- * @param {Uint8Array} signatureBytes
979
- */
980
- verifySignedWithInstallationKey(signatureText, signatureBytes) {
981
- const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
982
- const len0 = WASM_VECTOR_LEN;
983
- const ret = wasm.client_verifySignedWithInstallationKey(this.__wbg_ptr, ptr0, len0, signatureBytes);
984
- if (ret[1]) {
985
- throw takeFromExternrefTable0(ret[0]);
986
- }
987
- }
988
- /**
989
- * @param {Uint8Array[]} installationIds
990
- * @returns {Promise<SignatureRequestHandle>}
991
- */
992
- revokeInstallationsSignatureRequest(installationIds) {
993
- const ptr0 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
994
- const len0 = WASM_VECTOR_LEN;
995
- const ret = wasm.client_revokeInstallationsSignatureRequest(this.__wbg_ptr, ptr0, len0);
996
- return ret;
997
- }
998
- /**
999
- * @param {Identifier} newRecoveryIdentifier
1000
- * @returns {Promise<SignatureRequestHandle>}
1001
- */
1002
- changeRecoveryIdentifierSignatureRequest(newRecoveryIdentifier) {
1003
- const ret = wasm.client_changeRecoveryIdentifierSignatureRequest(this.__wbg_ptr, newRecoveryIdentifier);
1004
- return ret;
1005
- }
1006
- /**
1007
- * @returns {Promise<SignatureRequestHandle | undefined>}
1008
- */
1009
- revokeAllOtherInstallationsSignatureRequest() {
1010
- const ret = wasm.client_revokeAllOtherInstallationsSignatureRequest(this.__wbg_ptr);
1011
- return ret;
1012
- }
1013
- /**
1014
- *
1015
- * * Get the client's inbox state.
1016
- * *
1017
- * * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
1018
- * * Otherwise, the state will be read from the local database.
1019
- *
1020
- * @param {boolean} refreshFromNetwork
1021
- * @returns {Promise<InboxState>}
1022
- */
1023
- inboxState(refreshFromNetwork) {
1024
- const ret = wasm.client_inboxState(this.__wbg_ptr, refreshFromNetwork);
1025
- return ret;
1026
- }
1027
- /**
1028
- * @param {string} inboxId
1029
- * @returns {Promise<InboxState>}
1088
+ * @param {ConsentEntityType} entityType
1089
+ * @param {string} entity
1090
+ * @returns {Promise<ConsentState>}
1030
1091
  */
1031
- getLatestInboxState(inboxId) {
1032
- const ptr0 = passStringToWasm0(inboxId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1092
+ getConsentState(entityType, entity) {
1093
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1033
1094
  const len0 = WASM_VECTOR_LEN;
1034
- const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
1095
+ const ret = wasm.client_getConsentState(this.__wbg_ptr, entityType, ptr0, len0);
1035
1096
  return ret;
1036
1097
  }
1037
1098
  /**
1038
- *
1039
- * * Get key package statuses for a list of installation IDs.
1040
- * *
1041
- * * Returns a JavaScript object mapping installation ID strings to KeyPackageStatus objects.
1042
- *
1043
- * @param {string[]} installationIds
1044
- * @returns {Promise<any>}
1099
+ * @param {Consent[]} records
1100
+ * @returns {Promise<void>}
1045
1101
  */
1046
- getKeyPackageStatusesForInstallationIds(installationIds) {
1047
- const ptr0 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
1102
+ setConsentStates(records) {
1103
+ const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
1048
1104
  const len0 = WASM_VECTOR_LEN;
1049
- const ret = wasm.client_getKeyPackageStatusesForInstallationIds(this.__wbg_ptr, ptr0, len0);
1105
+ const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
1050
1106
  return ret;
1051
1107
  }
1052
1108
  }
@@ -1203,6 +1259,17 @@ export class Conversation {
1203
1259
  }
1204
1260
  return takeFromExternrefTable0(ret[0]);
1205
1261
  }
1262
+ /**
1263
+ * @param {string} markdown
1264
+ * @param {boolean | null} [optimistic]
1265
+ * @returns {Promise<string>}
1266
+ */
1267
+ sendMarkdown(markdown, optimistic) {
1268
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1269
+ const len0 = WASM_VECTOR_LEN;
1270
+ const ret = wasm.conversation_sendMarkdown(this.__wbg_ptr, ptr0, len0, isLikeNone(optimistic) ? 0xFFFFFF : optimistic ? 1 : 0);
1271
+ return ret;
1272
+ }
1206
1273
  /**
1207
1274
  * @param {Reaction} reaction
1208
1275
  * @param {boolean | null} [optimistic]
@@ -1613,7 +1680,7 @@ export class Conversation {
1613
1680
  }
1614
1681
  /**
1615
1682
  * @param {Uint8Array} envelopeBytes
1616
- * @returns {Promise<Message>}
1683
+ * @returns {Promise<Message[]>}
1617
1684
  */
1618
1685
  processStreamedGroupMessage(envelopeBytes) {
1619
1686
  const ret = wasm.conversation_processStreamedGroupMessage(this.__wbg_ptr, envelopeBytes);
@@ -2979,26 +3046,26 @@ function __wbg_get_imports() {
2979
3046
  const ret = Date.now();
2980
3047
  return ret;
2981
3048
  };
2982
- imports.wbg.__wbg_on_auth_required_8476980913dd50f2 = function() { return handleError(function (arg0) {
3049
+ imports.wbg.__wbg_on_auth_required_4d27971fad5718ff = function() { return handleError(function (arg0) {
2983
3050
  const ret = arg0.on_auth_required();
2984
3051
  return ret;
2985
3052
  }, arguments) };
2986
- imports.wbg.__wbg_on_close_05f7935034ab5e97 = function(arg0) {
3053
+ imports.wbg.__wbg_on_close_14821f03bb5ede2f = function(arg0) {
2987
3054
  arg0.on_close();
2988
3055
  };
2989
- imports.wbg.__wbg_on_consent_update_318b5cbee8045c0b = function(arg0, arg1) {
3056
+ imports.wbg.__wbg_on_consent_update_dc96dde83bbb726e = function(arg0, arg1) {
2990
3057
  arg0.on_consent_update(arg1);
2991
3058
  };
2992
- imports.wbg.__wbg_on_conversation_eddde0c86e7f5b59 = function(arg0, arg1) {
3059
+ imports.wbg.__wbg_on_conversation_d996b7e46a9c857e = function(arg0, arg1) {
2993
3060
  arg0.on_conversation(Conversation.__wrap(arg1));
2994
3061
  };
2995
- imports.wbg.__wbg_on_error_df964036f71f7815 = function(arg0, arg1) {
3062
+ imports.wbg.__wbg_on_error_718c5bce4272e57a = function(arg0, arg1) {
2996
3063
  arg0.on_error(arg1);
2997
3064
  };
2998
- imports.wbg.__wbg_on_message_d0e048141546680a = function(arg0, arg1) {
3065
+ imports.wbg.__wbg_on_message_d08be52589042a46 = function(arg0, arg1) {
2999
3066
  arg0.on_message(arg1);
3000
3067
  };
3001
- imports.wbg.__wbg_on_message_deleted_73d3fb76668ad7c9 = function(arg0, arg1, arg2) {
3068
+ imports.wbg.__wbg_on_message_deleted_48a1c63e2869646f = function(arg0, arg1, arg2) {
3002
3069
  let deferred0_0;
3003
3070
  let deferred0_1;
3004
3071
  try {
@@ -3009,7 +3076,7 @@ function __wbg_get_imports() {
3009
3076
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3010
3077
  }
3011
3078
  };
3012
- imports.wbg.__wbg_on_user_preference_update_93fc1cc120dae040 = function(arg0, arg1, arg2) {
3079
+ imports.wbg.__wbg_on_user_preference_update_5ece44a4cfcd5994 = function(arg0, arg1, arg2) {
3013
3080
  var v0 = getArrayJsValueFromWasm0(arg1, arg2).slice();
3014
3081
  wasm.__wbindgen_free(arg1, arg2 * 4, 4);
3015
3082
  arg0.on_user_preference_update(v0);
@@ -3273,9 +3340,9 @@ function __wbg_get_imports() {
3273
3340
  const ret = arg0.write(arg1, arg2);
3274
3341
  return ret;
3275
3342
  }, arguments) };
3276
- imports.wbg.__wbindgen_cast_0d8290f976305839 = function(arg0, arg1) {
3277
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7076, function: Function { arguments: [], shim_idx: 7077, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3278
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hfbd660e60d498df9, wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040);
3343
+ imports.wbg.__wbindgen_cast_072c4209cbb41c0f = function(arg0, arg1) {
3344
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 6914, function: Function { arguments: [], shim_idx: 6915, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3345
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he7b712e0eb1b5ac1, wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1);
3279
3346
  return ret;
3280
3347
  };
3281
3348
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -3295,11 +3362,6 @@ function __wbg_get_imports() {
3295
3362
  const ret = v0;
3296
3363
  return ret;
3297
3364
  };
3298
- imports.wbg.__wbindgen_cast_792d1412e663a663 = function(arg0, arg1) {
3299
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7235, function: Function { arguments: [], shim_idx: 7236, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3300
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3c5639ee43c80f22, wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005);
3301
- return ret;
3302
- };
3303
3365
  imports.wbg.__wbindgen_cast_8e37b4ad2f2ba653 = function(arg0, arg1) {
3304
3366
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3305
3367
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -3319,21 +3381,16 @@ function __wbg_get_imports() {
3319
3381
  const ret = arg0;
3320
3382
  return ret;
3321
3383
  };
3322
- imports.wbg.__wbindgen_cast_a7b16010a4dd7f9d = function(arg0, arg1) {
3323
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7268, function: Function { arguments: [Externref], shim_idx: 7269, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3324
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hed8af60076250245, wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6);
3325
- return ret;
3326
- };
3327
- imports.wbg.__wbindgen_cast_c06d34399c7c349c = function(arg0, arg1) {
3328
- // Cast intrinsic for `Closure(Closure { dtor_idx: 6859, function: Function { arguments: [], shim_idx: 6860, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3329
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he7b712e0eb1b5ac1, wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1);
3330
- return ret;
3331
- };
3332
3384
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
3333
3385
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
3334
3386
  const ret = getArrayU8FromWasm0(arg0, arg1);
3335
3387
  return ret;
3336
3388
  };
3389
+ imports.wbg.__wbindgen_cast_ccc31394da4c983b = function(arg0, arg1) {
3390
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7323, function: Function { arguments: [Externref], shim_idx: 7324, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3391
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hed8af60076250245, wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6);
3392
+ return ret;
3393
+ };
3337
3394
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
3338
3395
  // Cast intrinsic for `F64 -> Externref`.
3339
3396
  const ret = arg0;
@@ -3346,6 +3403,11 @@ function __wbg_get_imports() {
3346
3403
  const ret = v0;
3347
3404
  return ret;
3348
3405
  };
3406
+ imports.wbg.__wbindgen_cast_ee75496ec5e2c856 = function(arg0, arg1) {
3407
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7290, function: Function { arguments: [], shim_idx: 7291, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3408
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3c5639ee43c80f22, wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005);
3409
+ return ret;
3410
+ };
3349
3411
  imports.wbg.__wbindgen_cast_f20a506f31063fd0 = function(arg0, arg1) {
3350
3412
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3351
3413
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -3353,6 +3415,11 @@ function __wbg_get_imports() {
3353
3415
  const ret = v0;
3354
3416
  return ret;
3355
3417
  };
3418
+ imports.wbg.__wbindgen_cast_f8f15095990b7349 = function(arg0, arg1) {
3419
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7131, function: Function { arguments: [], shim_idx: 7132, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3420
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hfbd660e60d498df9, wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040);
3421
+ return ret;
3422
+ };
3356
3423
  imports.wbg.__wbindgen_init_externref_table = function() {
3357
3424
  const table = wasm.__wbindgen_externrefs;
3358
3425
  const offset = table.grow(4);