@massalabs/gossip-sdk 0.0.2-dev.20260409113004 → 0.0.2-dev.20260410072024

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.
@@ -134,39 +134,17 @@ function isLikeNone(x) {
134
134
  return x === undefined || x === null;
135
135
  }
136
136
 
137
- export function start() {
138
- wasm.start();
139
- }
140
-
141
- function takeFromExternrefTable0(idx) {
142
- const value = wasm.__wbindgen_export_2.get(idx);
143
- wasm.__externref_table_dealloc(idx);
144
- return value;
145
- }
146
-
147
137
  function passArray8ToWasm0(arg, malloc) {
148
138
  const ptr = malloc(arg.length * 1, 1) >>> 0;
149
139
  getUint8ArrayMemory0().set(arg, ptr / 1);
150
140
  WASM_VECTOR_LEN = arg.length;
151
141
  return ptr;
152
142
  }
153
- /**
154
- * Generates user keys from a passphrase using password-based key derivation.
155
- * @param {string} passphrase
156
- * @returns {UserKeys}
157
- */
158
- export function generate_user_keys(passphrase) {
159
- const ptr0 = passStringToWasm0(
160
- passphrase,
161
- wasm.__wbindgen_malloc,
162
- wasm.__wbindgen_realloc
163
- );
164
- const len0 = WASM_VECTOR_LEN;
165
- const ret = wasm.generate_user_keys(ptr0, len0);
166
- if (ret[2]) {
167
- throw takeFromExternrefTable0(ret[1]);
168
- }
169
- return UserKeys.__wrap(ret[0]);
143
+
144
+ function takeFromExternrefTable0(idx) {
145
+ const value = wasm.__wbindgen_export_2.get(idx);
146
+ wasm.__externref_table_dealloc(idx);
147
+ return value;
170
148
  }
171
149
 
172
150
  function _assertClass(instance, klass) {
@@ -292,6 +270,33 @@ export function aead_decrypt(key, nonce, ciphertext, aad) {
292
270
  return v3;
293
271
  }
294
272
 
273
+ export function start() {
274
+ wasm.start();
275
+ }
276
+
277
+ /**
278
+ * Generates user keys from a passphrase (typically a BIP39 mnemonic).
279
+ *
280
+ * Derives gossip keys (DSA, KEM, Massa) and, when the passphrase is a
281
+ * valid BIP39 mnemonic, the EVM address — all in a single WASM call so
282
+ * the mnemonic crosses the JS boundary only once.
283
+ * @param {string} passphrase
284
+ * @returns {UserKeys}
285
+ */
286
+ export function generate_user_keys(passphrase) {
287
+ const ptr0 = passStringToWasm0(
288
+ passphrase,
289
+ wasm.__wbindgen_malloc,
290
+ wasm.__wbindgen_realloc
291
+ );
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ret = wasm.generate_user_keys(ptr0, len0);
294
+ if (ret[2]) {
295
+ throw takeFromExternrefTable0(ret[1]);
296
+ }
297
+ return UserKeys.__wrap(ret[0]);
298
+ }
299
+
295
300
  /**
296
301
  * Session status indicating the state of a peer session.
297
302
  * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
@@ -404,6 +409,20 @@ export class EncryptionKey {
404
409
  const ptr = this.__destroy_into_raw();
405
410
  wasm.__wbg_encryptionkey_free(ptr, 0);
406
411
  }
412
+ /**
413
+ * Creates an encryption key from raw bytes (must be 64 bytes).
414
+ * @param {Uint8Array} bytes
415
+ * @returns {EncryptionKey}
416
+ */
417
+ static from_bytes(bytes) {
418
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
419
+ const len0 = WASM_VECTOR_LEN;
420
+ const ret = wasm.encryptionkey_from_bytes(ptr0, len0);
421
+ if (ret[2]) {
422
+ throw takeFromExternrefTable0(ret[1]);
423
+ }
424
+ return EncryptionKey.__wrap(ret[0]);
425
+ }
407
426
  /**
408
427
  * Generates a new random encryption key (64 bytes).
409
428
  * @returns {EncryptionKey}
@@ -412,6 +431,16 @@ export class EncryptionKey {
412
431
  const ret = wasm.encryptionkey_generate();
413
432
  return EncryptionKey.__wrap(ret);
414
433
  }
434
+ /**
435
+ * Gets the raw bytes of the encryption key.
436
+ * @returns {Uint8Array}
437
+ */
438
+ to_bytes() {
439
+ const ret = wasm.encryptionkey_to_bytes(this.__wbg_ptr);
440
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
441
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
442
+ return v1;
443
+ }
415
444
  /**
416
445
  * Generates a deterministic encryption key (64 bytes) from a seed and salt.
417
446
  *
@@ -439,30 +468,6 @@ export class EncryptionKey {
439
468
  }
440
469
  return EncryptionKey.__wrap(ret[0]);
441
470
  }
442
- /**
443
- * Creates an encryption key from raw bytes (must be 64 bytes).
444
- * @param {Uint8Array} bytes
445
- * @returns {EncryptionKey}
446
- */
447
- static from_bytes(bytes) {
448
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
449
- const len0 = WASM_VECTOR_LEN;
450
- const ret = wasm.encryptionkey_from_bytes(ptr0, len0);
451
- if (ret[2]) {
452
- throw takeFromExternrefTable0(ret[1]);
453
- }
454
- return EncryptionKey.__wrap(ret[0]);
455
- }
456
- /**
457
- * Gets the raw bytes of the encryption key.
458
- * @returns {Uint8Array}
459
- */
460
- to_bytes() {
461
- const ret = wasm.encryptionkey_to_bytes(this.__wbg_ptr);
462
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
463
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
464
- return v1;
465
- }
466
471
  }
467
472
  if (Symbol.dispose)
468
473
  EncryptionKey.prototype[Symbol.dispose] = EncryptionKey.prototype.free;
@@ -497,14 +502,6 @@ export class Nonce {
497
502
  const ptr = this.__destroy_into_raw();
498
503
  wasm.__wbg_nonce_free(ptr, 0);
499
504
  }
500
- /**
501
- * Generates a new random nonce (16 bytes).
502
- * @returns {Nonce}
503
- */
504
- static generate() {
505
- const ret = wasm.nonce_generate();
506
- return Nonce.__wrap(ret);
507
- }
508
505
  /**
509
506
  * Creates a nonce from raw bytes (must be 16 bytes).
510
507
  * @param {Uint8Array} bytes
@@ -519,6 +516,14 @@ export class Nonce {
519
516
  }
520
517
  return Nonce.__wrap(ret[0]);
521
518
  }
519
+ /**
520
+ * Generates a new random nonce (16 bytes).
521
+ * @returns {Nonce}
522
+ */
523
+ static generate() {
524
+ const ret = wasm.nonce_generate();
525
+ return Nonce.__wrap(ret);
526
+ }
522
527
  /**
523
528
  * Gets the raw bytes of the nonce.
524
529
  * @returns {Uint8Array}
@@ -561,6 +566,14 @@ export class ReceiveMessageOutput {
561
566
  const ptr = this.__destroy_into_raw();
562
567
  wasm.__wbg_receivemessageoutput_free(ptr, 0);
563
568
  }
569
+ /**
570
+ * Gets the list of newly acknowledged seekers.
571
+ * @returns {Array<any>}
572
+ */
573
+ get acknowledged_seekers() {
574
+ const ret = wasm.receivemessageoutput_acknowledged_seekers(this.__wbg_ptr);
575
+ return ret;
576
+ }
564
577
  /**
565
578
  * Gets the received message contents.
566
579
  * @returns {Uint8Array}
@@ -571,22 +584,6 @@ export class ReceiveMessageOutput {
571
584
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
572
585
  return v1;
573
586
  }
574
- /**
575
- * Gets the message timestamp (milliseconds since Unix epoch).
576
- * @returns {number}
577
- */
578
- get timestamp() {
579
- const ret = wasm.receivemessageoutput_timestamp(this.__wbg_ptr);
580
- return ret;
581
- }
582
- /**
583
- * Gets the list of newly acknowledged seekers.
584
- * @returns {Array<any>}
585
- */
586
- get acknowledged_seekers() {
587
- const ret = wasm.receivemessageoutput_acknowledged_seekers(this.__wbg_ptr);
588
- return ret;
589
- }
590
587
  /**
591
588
  * Gets the sender's user id (32 bytes).
592
589
  * @returns {Uint8Array}
@@ -597,6 +594,14 @@ export class ReceiveMessageOutput {
597
594
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
598
595
  return v1;
599
596
  }
597
+ /**
598
+ * Gets the message timestamp (milliseconds since Unix epoch).
599
+ * @returns {number}
600
+ */
601
+ get timestamp() {
602
+ const ret = wasm.receivemessageoutput_timestamp(this.__wbg_ptr);
603
+ return ret;
604
+ }
600
605
  }
601
606
  if (Symbol.dispose)
602
607
  ReceiveMessageOutput.prototype[Symbol.dispose] =
@@ -632,21 +637,21 @@ export class SendMessageOutput {
632
637
  wasm.__wbg_sendmessageoutput_free(ptr, 0);
633
638
  }
634
639
  /**
635
- * Gets the seeker (identifier for message board lookup).
640
+ * Gets the encrypted message data.
636
641
  * @returns {Uint8Array}
637
642
  */
638
- get seeker() {
639
- const ret = wasm.sendmessageoutput_seeker(this.__wbg_ptr);
643
+ get data() {
644
+ const ret = wasm.sendmessageoutput_data(this.__wbg_ptr);
640
645
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
641
646
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
642
647
  return v1;
643
648
  }
644
649
  /**
645
- * Gets the encrypted message data.
650
+ * Gets the seeker (identifier for message board lookup).
646
651
  * @returns {Uint8Array}
647
652
  */
648
- get data() {
649
- const ret = wasm.sendmessageoutput_data(this.__wbg_ptr);
653
+ get seeker() {
654
+ const ret = wasm.sendmessageoutput_seeker(this.__wbg_ptr);
650
655
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
651
656
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
652
657
  return v1;
@@ -685,6 +690,22 @@ export class SessionConfig {
685
690
  const ptr = this.__destroy_into_raw();
686
691
  wasm.__wbg_sessionconfig_free(ptr, 0);
687
692
  }
693
+ /**
694
+ * Creates a default configuration with sensible defaults:
695
+ * - Announcement age: 1 week
696
+ * - Announcement future: 1 minute
697
+ * - Message age: 1 week
698
+ * - Message future: 1 minute
699
+ * - Session inactivity: 1 week
700
+ * - Keep-alive interval: 1 day
701
+ * - Max lag: 10000 messages
702
+ * - Max peer lag before keep-alive: 8 messages
703
+ * @returns {SessionConfig}
704
+ */
705
+ static new_default() {
706
+ const ret = wasm.sessionconfig_new_default();
707
+ return SessionConfig.__wrap(ret);
708
+ }
688
709
  /**
689
710
  * Creates a new session configuration with the given parameters.
690
711
  * @param {number} max_incoming_announcement_age_millis
@@ -720,22 +741,6 @@ export class SessionConfig {
720
741
  SessionConfigFinalization.register(this, this.__wbg_ptr, this);
721
742
  return this;
722
743
  }
723
- /**
724
- * Creates a default configuration with sensible defaults:
725
- * - Announcement age: 1 week
726
- * - Announcement future: 1 minute
727
- * - Message age: 1 week
728
- * - Message future: 1 minute
729
- * - Session inactivity: 1 week
730
- * - Keep-alive interval: 1 day
731
- * - Max lag: 10000 messages
732
- * - Max peer lag before keep-alive: 8 messages
733
- * @returns {SessionConfig}
734
- */
735
- static new_default() {
736
- const ret = wasm.sessionconfig_new_default();
737
- return SessionConfig.__wrap(ret);
738
- }
739
744
  }
740
745
  if (Symbol.dispose)
741
746
  SessionConfig.prototype[Symbol.dispose] = SessionConfig.prototype.free;
@@ -770,36 +775,43 @@ export class SessionManagerWrapper {
770
775
  wasm.__wbg_sessionmanagerwrapper_free(ptr, 0);
771
776
  }
772
777
  /**
773
- * Creates a new session manager with the given configuration.
774
- * @param {SessionConfig} config
778
+ * Discards a peer and all associated session state.
779
+ * @param {Uint8Array} peer_id
775
780
  */
776
- constructor(config) {
777
- _assertClass(config, SessionConfig);
778
- var ptr0 = config.__destroy_into_raw();
779
- const ret = wasm.sessionmanagerwrapper_new(ptr0);
780
- this.__wbg_ptr = ret >>> 0;
781
- SessionManagerWrapperFinalization.register(this, this.__wbg_ptr, this);
782
- return this;
781
+ peer_discard(peer_id) {
782
+ const ptr0 = passArray8ToWasm0(peer_id, wasm.__wbindgen_malloc);
783
+ const len0 = WASM_VECTOR_LEN;
784
+ const ret = wasm.sessionmanagerwrapper_peer_discard(
785
+ this.__wbg_ptr,
786
+ ptr0,
787
+ len0
788
+ );
789
+ if (ret[1]) {
790
+ throw takeFromExternrefTable0(ret[0]);
791
+ }
783
792
  }
784
793
  /**
785
- * Deserializes a session manager from an encrypted blob.
786
- * @param {Uint8Array} encrypted_blob
787
- * @param {EncryptionKey} key
788
- * @returns {SessionManagerWrapper}
794
+ * Sends a message to a peer.
795
+ * @param {Uint8Array} peer_id
796
+ * @param {Uint8Array} message_contents
797
+ * @returns {SendMessageOutput | undefined}
789
798
  */
790
- static from_encrypted_blob(encrypted_blob, key) {
791
- const ptr0 = passArray8ToWasm0(encrypted_blob, wasm.__wbindgen_malloc);
799
+ send_message(peer_id, message_contents) {
800
+ const ptr0 = passArray8ToWasm0(peer_id, wasm.__wbindgen_malloc);
792
801
  const len0 = WASM_VECTOR_LEN;
793
- _assertClass(key, EncryptionKey);
794
- const ret = wasm.sessionmanagerwrapper_from_encrypted_blob(
802
+ const ptr1 = passArray8ToWasm0(message_contents, wasm.__wbindgen_malloc);
803
+ const len1 = WASM_VECTOR_LEN;
804
+ const ret = wasm.sessionmanagerwrapper_send_message(
805
+ this.__wbg_ptr,
795
806
  ptr0,
796
807
  len0,
797
- key.__wbg_ptr
808
+ ptr1,
809
+ len1
798
810
  );
799
811
  if (ret[2]) {
800
812
  throw takeFromExternrefTable0(ret[1]);
801
813
  }
802
- return SessionManagerWrapper.__wrap(ret[0]);
814
+ return ret[0] === 0 ? undefined : SendMessageOutput.__wrap(ret[0]);
803
815
  }
804
816
  /**
805
817
  * Serializes and encrypts the session manager into a blob.
@@ -819,6 +831,44 @@ export class SessionManagerWrapper {
819
831
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
820
832
  return v1;
821
833
  }
834
+ /**
835
+ * Deserializes a session manager from an encrypted blob.
836
+ * @param {Uint8Array} encrypted_blob
837
+ * @param {EncryptionKey} key
838
+ * @returns {SessionManagerWrapper}
839
+ */
840
+ static from_encrypted_blob(encrypted_blob, key) {
841
+ const ptr0 = passArray8ToWasm0(encrypted_blob, wasm.__wbindgen_malloc);
842
+ const len0 = WASM_VECTOR_LEN;
843
+ _assertClass(key, EncryptionKey);
844
+ const ret = wasm.sessionmanagerwrapper_from_encrypted_blob(
845
+ ptr0,
846
+ len0,
847
+ key.__wbg_ptr
848
+ );
849
+ if (ret[2]) {
850
+ throw takeFromExternrefTable0(ret[1]);
851
+ }
852
+ return SessionManagerWrapper.__wrap(ret[0]);
853
+ }
854
+ /**
855
+ * Gets the session status for a peer.
856
+ * @param {Uint8Array} peer_id
857
+ * @returns {SessionStatus}
858
+ */
859
+ peer_session_status(peer_id) {
860
+ const ptr0 = passArray8ToWasm0(peer_id, wasm.__wbindgen_malloc);
861
+ const len0 = WASM_VECTOR_LEN;
862
+ const ret = wasm.sessionmanagerwrapper_peer_session_status(
863
+ this.__wbg_ptr,
864
+ ptr0,
865
+ len0
866
+ );
867
+ if (ret[2]) {
868
+ throw takeFromExternrefTable0(ret[1]);
869
+ }
870
+ return ret[0];
871
+ }
822
872
  /**
823
873
  * Establishes an outgoing session with a peer.
824
874
  *
@@ -928,29 +978,6 @@ export class SessionManagerWrapper {
928
978
  );
929
979
  return ret;
930
980
  }
931
- /**
932
- * Sends a message to a peer.
933
- * @param {Uint8Array} peer_id
934
- * @param {Uint8Array} message_contents
935
- * @returns {SendMessageOutput | undefined}
936
- */
937
- send_message(peer_id, message_contents) {
938
- const ptr0 = passArray8ToWasm0(peer_id, wasm.__wbindgen_malloc);
939
- const len0 = WASM_VECTOR_LEN;
940
- const ptr1 = passArray8ToWasm0(message_contents, wasm.__wbindgen_malloc);
941
- const len1 = WASM_VECTOR_LEN;
942
- const ret = wasm.sessionmanagerwrapper_send_message(
943
- this.__wbg_ptr,
944
- ptr0,
945
- len0,
946
- ptr1,
947
- len1
948
- );
949
- if (ret[2]) {
950
- throw takeFromExternrefTable0(ret[1]);
951
- }
952
- return ret[0] === 0 ? undefined : SendMessageOutput.__wrap(ret[0]);
953
- }
954
981
  /**
955
982
  * Processes an incoming message from the message board.
956
983
  * @param {Uint8Array} seeker
@@ -975,46 +1002,16 @@ export class SessionManagerWrapper {
975
1002
  return ret === 0 ? undefined : ReceiveMessageOutput.__wrap(ret);
976
1003
  }
977
1004
  /**
978
- * Gets the list of all peer IDs.
979
- * @returns {Array<any>}
980
- */
981
- peer_list() {
982
- const ret = wasm.sessionmanagerwrapper_peer_list(this.__wbg_ptr);
983
- return ret;
984
- }
985
- /**
986
- * Gets the session status for a peer.
987
- * @param {Uint8Array} peer_id
988
- * @returns {SessionStatus}
989
- */
990
- peer_session_status(peer_id) {
991
- const ptr0 = passArray8ToWasm0(peer_id, wasm.__wbindgen_malloc);
992
- const len0 = WASM_VECTOR_LEN;
993
- const ret = wasm.sessionmanagerwrapper_peer_session_status(
994
- this.__wbg_ptr,
995
- ptr0,
996
- len0
997
- );
998
- if (ret[2]) {
999
- throw takeFromExternrefTable0(ret[1]);
1000
- }
1001
- return ret[0];
1002
- }
1003
- /**
1004
- * Discards a peer and all associated session state.
1005
- * @param {Uint8Array} peer_id
1005
+ * Creates a new session manager with the given configuration.
1006
+ * @param {SessionConfig} config
1006
1007
  */
1007
- peer_discard(peer_id) {
1008
- const ptr0 = passArray8ToWasm0(peer_id, wasm.__wbindgen_malloc);
1009
- const len0 = WASM_VECTOR_LEN;
1010
- const ret = wasm.sessionmanagerwrapper_peer_discard(
1011
- this.__wbg_ptr,
1012
- ptr0,
1013
- len0
1014
- );
1015
- if (ret[1]) {
1016
- throw takeFromExternrefTable0(ret[0]);
1017
- }
1008
+ constructor(config) {
1009
+ _assertClass(config, SessionConfig);
1010
+ var ptr0 = config.__destroy_into_raw();
1011
+ const ret = wasm.sessionmanagerwrapper_new(ptr0);
1012
+ this.__wbg_ptr = ret >>> 0;
1013
+ SessionManagerWrapperFinalization.register(this, this.__wbg_ptr, this);
1014
+ return this;
1018
1015
  }
1019
1016
  /**
1020
1017
  * Refreshes sessions and returns peer IDs that need keep-alive messages.
@@ -1024,6 +1021,14 @@ export class SessionManagerWrapper {
1024
1021
  const ret = wasm.sessionmanagerwrapper_refresh(this.__wbg_ptr);
1025
1022
  return ret;
1026
1023
  }
1024
+ /**
1025
+ * Gets the list of all peer IDs.
1026
+ * @returns {Array<any>}
1027
+ */
1028
+ peer_list() {
1029
+ const ret = wasm.sessionmanagerwrapper_peer_list(this.__wbg_ptr);
1030
+ return ret;
1031
+ }
1027
1032
  }
1028
1033
  if (Symbol.dispose)
1029
1034
  SessionManagerWrapper.prototype[Symbol.dispose] =
@@ -1056,6 +1061,22 @@ export class UserKeys {
1056
1061
  const ptr = this.__destroy_into_raw();
1057
1062
  wasm.__wbg_userkeys_free(ptr, 0);
1058
1063
  }
1064
+ /**
1065
+ * EIP-55 checksummed EVM address (0x…) derived from the mnemonic.
1066
+ * @returns {string}
1067
+ */
1068
+ evm_address() {
1069
+ let deferred1_0;
1070
+ let deferred1_1;
1071
+ try {
1072
+ const ret = wasm.userkeys_evm_address(this.__wbg_ptr);
1073
+ deferred1_0 = ret[0];
1074
+ deferred1_1 = ret[1];
1075
+ return getStringFromWasm0(ret[0], ret[1]);
1076
+ } finally {
1077
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1078
+ }
1079
+ }
1059
1080
  /**
1060
1081
  * Gets the public keys.
1061
1082
  * @returns {UserPublicKeys}
@@ -1112,41 +1133,45 @@ export class UserPublicKeys {
1112
1133
  wasm.__wbg_userpublickeys_free(ptr, 0);
1113
1134
  }
1114
1135
  /**
1115
- * Derives a unique user ID from the public keys.
1116
- * @returns {Uint8Array}
1136
+ * Deserializes public keys from bytes.
1137
+ * @param {Uint8Array} bytes
1138
+ * @returns {UserPublicKeys}
1117
1139
  */
1118
- derive_id() {
1119
- const ret = wasm.userpublickeys_derive_id(this.__wbg_ptr);
1120
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1121
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1122
- return v1;
1140
+ static from_bytes(bytes) {
1141
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
1142
+ const len0 = WASM_VECTOR_LEN;
1143
+ const ret = wasm.userpublickeys_from_bytes(ptr0, len0);
1144
+ if (ret[2]) {
1145
+ throw takeFromExternrefTable0(ret[1]);
1146
+ }
1147
+ return UserPublicKeys.__wrap(ret[0]);
1123
1148
  }
1124
1149
  /**
1125
- * Gets the DSA verification key bytes.
1150
+ * Gets the KEM public key bytes.
1126
1151
  * @returns {Uint8Array}
1127
1152
  */
1128
- get dsa_verification_key() {
1129
- const ret = wasm.userpublickeys_dsa_verification_key(this.__wbg_ptr);
1153
+ get kem_public_key() {
1154
+ const ret = wasm.userpublickeys_kem_public_key(this.__wbg_ptr);
1130
1155
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1131
1156
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1132
1157
  return v1;
1133
1158
  }
1134
1159
  /**
1135
- * Gets the KEM public key bytes.
1160
+ * Gets the Massa public key bytes.
1136
1161
  * @returns {Uint8Array}
1137
1162
  */
1138
- get kem_public_key() {
1139
- const ret = wasm.userpublickeys_kem_public_key(this.__wbg_ptr);
1163
+ get massa_public_key() {
1164
+ const ret = wasm.userpublickeys_massa_public_key(this.__wbg_ptr);
1140
1165
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1141
1166
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1142
1167
  return v1;
1143
1168
  }
1144
1169
  /**
1145
- * Gets the Massa public key bytes.
1170
+ * Gets the DSA verification key bytes.
1146
1171
  * @returns {Uint8Array}
1147
1172
  */
1148
- get massa_public_key() {
1149
- const ret = wasm.userpublickeys_massa_public_key(this.__wbg_ptr);
1173
+ get dsa_verification_key() {
1174
+ const ret = wasm.userpublickeys_dsa_verification_key(this.__wbg_ptr);
1150
1175
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1151
1176
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1152
1177
  return v1;
@@ -1165,18 +1190,14 @@ export class UserPublicKeys {
1165
1190
  return v1;
1166
1191
  }
1167
1192
  /**
1168
- * Deserializes public keys from bytes.
1169
- * @param {Uint8Array} bytes
1170
- * @returns {UserPublicKeys}
1193
+ * Derives a unique user ID from the public keys.
1194
+ * @returns {Uint8Array}
1171
1195
  */
1172
- static from_bytes(bytes) {
1173
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
1174
- const len0 = WASM_VECTOR_LEN;
1175
- const ret = wasm.userpublickeys_from_bytes(ptr0, len0);
1176
- if (ret[2]) {
1177
- throw takeFromExternrefTable0(ret[1]);
1178
- }
1179
- return UserPublicKeys.__wrap(ret[0]);
1196
+ derive_id() {
1197
+ const ret = wasm.userpublickeys_derive_id(this.__wbg_ptr);
1198
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1199
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1200
+ return v1;
1180
1201
  }
1181
1202
  }
1182
1203
  if (Symbol.dispose)
@@ -1211,19 +1232,6 @@ export class UserSecretKeys {
1211
1232
  const ptr = this.__destroy_into_raw();
1212
1233
  wasm.__wbg_usersecretkeys_free(ptr, 0);
1213
1234
  }
1214
- /**
1215
- * Serializes the secret keys to bytes for secure storage.
1216
- * @returns {Uint8Array}
1217
- */
1218
- to_bytes() {
1219
- const ret = wasm.usersecretkeys_to_bytes(this.__wbg_ptr);
1220
- if (ret[3]) {
1221
- throw takeFromExternrefTable0(ret[2]);
1222
- }
1223
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1224
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1225
- return v1;
1226
- }
1227
1235
  /**
1228
1236
  * Deserializes secret keys from bytes.
1229
1237
  * @param {Uint8Array} bytes
@@ -1239,21 +1247,21 @@ export class UserSecretKeys {
1239
1247
  return UserSecretKeys.__wrap(ret[0]);
1240
1248
  }
1241
1249
  /**
1242
- * Gets the DSA signing key bytes.
1250
+ * Gets the KEM secret key bytes.
1243
1251
  * @returns {Uint8Array}
1244
1252
  */
1245
- get dsa_signing_key() {
1246
- const ret = wasm.usersecretkeys_dsa_signing_key(this.__wbg_ptr);
1253
+ get kem_secret_key() {
1254
+ const ret = wasm.usersecretkeys_kem_secret_key(this.__wbg_ptr);
1247
1255
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1248
1256
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1249
1257
  return v1;
1250
1258
  }
1251
1259
  /**
1252
- * Gets the KEM secret key bytes.
1260
+ * Gets the DSA signing key bytes.
1253
1261
  * @returns {Uint8Array}
1254
1262
  */
1255
- get kem_secret_key() {
1256
- const ret = wasm.usersecretkeys_kem_secret_key(this.__wbg_ptr);
1263
+ get dsa_signing_key() {
1264
+ const ret = wasm.usersecretkeys_dsa_signing_key(this.__wbg_ptr);
1257
1265
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1258
1266
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1259
1267
  return v1;
@@ -1268,6 +1276,19 @@ export class UserSecretKeys {
1268
1276
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1269
1277
  return v1;
1270
1278
  }
1279
+ /**
1280
+ * Serializes the secret keys to bytes for secure storage.
1281
+ * @returns {Uint8Array}
1282
+ */
1283
+ to_bytes() {
1284
+ const ret = wasm.usersecretkeys_to_bytes(this.__wbg_ptr);
1285
+ if (ret[3]) {
1286
+ throw takeFromExternrefTable0(ret[2]);
1287
+ }
1288
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1289
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1290
+ return v1;
1291
+ }
1271
1292
  }
1272
1293
  if (Symbol.dispose)
1273
1294
  UserSecretKeys.prototype[Symbol.dispose] = UserSecretKeys.prototype.free;