@massalabs/gossip-sdk 0.0.2-dev.20260414113456 → 0.0.2-dev.20260414152302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function start(): void;
|
|
3
4
|
/**
|
|
4
5
|
* Encrypts data using AES-256-SIV authenticated encryption.
|
|
5
6
|
*
|
|
@@ -38,6 +39,13 @@ export function aead_encrypt(
|
|
|
38
39
|
plaintext: Uint8Array,
|
|
39
40
|
aad: Uint8Array
|
|
40
41
|
): Uint8Array;
|
|
42
|
+
/**
|
|
43
|
+
* Generates user keys from a passphrase.
|
|
44
|
+
*
|
|
45
|
+
* Derives all gossip keys (DSA, KEM, Massa, EVM) in a single WASM call so
|
|
46
|
+
* the passphrase crosses the JS boundary only once.
|
|
47
|
+
*/
|
|
48
|
+
export function generate_user_keys(passphrase: string): UserKeys;
|
|
41
49
|
/**
|
|
42
50
|
* Decrypts data using AES-256-SIV authenticated encryption.
|
|
43
51
|
*
|
|
@@ -77,15 +85,6 @@ export function aead_decrypt(
|
|
|
77
85
|
ciphertext: Uint8Array,
|
|
78
86
|
aad: Uint8Array
|
|
79
87
|
): Uint8Array | undefined;
|
|
80
|
-
export function start(): void;
|
|
81
|
-
/**
|
|
82
|
-
* Generates user keys from a passphrase (typically a BIP39 mnemonic).
|
|
83
|
-
*
|
|
84
|
-
* Derives gossip keys (DSA, KEM, Massa) and, when the passphrase is a
|
|
85
|
-
* valid BIP39 mnemonic, the EVM address — all in a single WASM call so
|
|
86
|
-
* the mnemonic crosses the JS boundary only once.
|
|
87
|
-
*/
|
|
88
|
-
export function generate_user_keys(passphrase: string): UserKeys;
|
|
89
88
|
/**
|
|
90
89
|
* Session status indicating the state of a peer session.
|
|
91
90
|
*/
|
|
@@ -382,10 +381,6 @@ export class UserKeys {
|
|
|
382
381
|
* EIP-55 checksummed EVM address (0x…) derived from the EVM public key.
|
|
383
382
|
*/
|
|
384
383
|
evm_address(): string;
|
|
385
|
-
/**
|
|
386
|
-
* Massa address (AU…) derived from the Massa public key.
|
|
387
|
-
*/
|
|
388
|
-
massa_address(): string;
|
|
389
384
|
/**
|
|
390
385
|
* Gets the public keys.
|
|
391
386
|
*/
|
|
@@ -394,6 +389,10 @@ export class UserKeys {
|
|
|
394
389
|
* Gets the secret keys.
|
|
395
390
|
*/
|
|
396
391
|
secret_keys(): UserSecretKeys;
|
|
392
|
+
/**
|
|
393
|
+
* Massa address (AU…) derived from the Massa public key.
|
|
394
|
+
*/
|
|
395
|
+
massa_address(): string;
|
|
397
396
|
}
|
|
398
397
|
/**
|
|
399
398
|
* User public keys for authentication and encryption.
|
|
@@ -414,6 +413,10 @@ export class UserPublicKeys {
|
|
|
414
413
|
* Derives a unique user ID from the public keys.
|
|
415
414
|
*/
|
|
416
415
|
derive_id(): Uint8Array;
|
|
416
|
+
/**
|
|
417
|
+
* Gets the EVM public key bytes (compressed, secp256k1).
|
|
418
|
+
*/
|
|
419
|
+
readonly evm_public_key: Uint8Array;
|
|
417
420
|
/**
|
|
418
421
|
* Gets the KEM public key bytes.
|
|
419
422
|
*/
|
|
@@ -442,6 +445,10 @@ export class UserSecretKeys {
|
|
|
442
445
|
* Serializes the secret keys to bytes for secure storage.
|
|
443
446
|
*/
|
|
444
447
|
to_bytes(): Uint8Array;
|
|
448
|
+
/**
|
|
449
|
+
* Gets the EVM secret key bytes (raw 32-byte scalar).
|
|
450
|
+
*/
|
|
451
|
+
readonly evm_secret_key: Uint8Array;
|
|
445
452
|
/**
|
|
446
453
|
* Gets the KEM secret key bytes.
|
|
447
454
|
*/
|
|
@@ -591,6 +598,7 @@ export interface InitOutput {
|
|
|
591
598
|
readonly userkeys_secret_keys: (a: number) => [number, number, number];
|
|
592
599
|
readonly userpublickeys_derive_id: (a: number) => [number, number];
|
|
593
600
|
readonly userpublickeys_dsa_verification_key: (a: number) => [number, number];
|
|
601
|
+
readonly userpublickeys_evm_public_key: (a: number) => [number, number];
|
|
594
602
|
readonly userpublickeys_from_bytes: (
|
|
595
603
|
a: number,
|
|
596
604
|
b: number
|
|
@@ -601,6 +609,7 @@ export interface InitOutput {
|
|
|
601
609
|
a: number
|
|
602
610
|
) => [number, number, number, number];
|
|
603
611
|
readonly usersecretkeys_dsa_signing_key: (a: number) => [number, number];
|
|
612
|
+
readonly usersecretkeys_evm_secret_key: (a: number) => [number, number];
|
|
604
613
|
readonly usersecretkeys_from_bytes: (
|
|
605
614
|
a: number,
|
|
606
615
|
b: number
|
|
@@ -147,6 +147,10 @@ function takeFromExternrefTable0(idx) {
|
|
|
147
147
|
return value;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
export function start() {
|
|
151
|
+
wasm.start();
|
|
152
|
+
}
|
|
153
|
+
|
|
150
154
|
function _assertClass(instance, klass) {
|
|
151
155
|
if (!(instance instanceof klass)) {
|
|
152
156
|
throw new Error(`expected instance of ${klass.name}`);
|
|
@@ -209,6 +213,28 @@ export function aead_encrypt(key, nonce, plaintext, aad) {
|
|
|
209
213
|
return v3;
|
|
210
214
|
}
|
|
211
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Generates user keys from a passphrase.
|
|
218
|
+
*
|
|
219
|
+
* Derives all gossip keys (DSA, KEM, Massa, EVM) in a single WASM call so
|
|
220
|
+
* the passphrase crosses the JS boundary only once.
|
|
221
|
+
* @param {string} passphrase
|
|
222
|
+
* @returns {UserKeys}
|
|
223
|
+
*/
|
|
224
|
+
export function generate_user_keys(passphrase) {
|
|
225
|
+
const ptr0 = passStringToWasm0(
|
|
226
|
+
passphrase,
|
|
227
|
+
wasm.__wbindgen_malloc,
|
|
228
|
+
wasm.__wbindgen_realloc
|
|
229
|
+
);
|
|
230
|
+
const len0 = WASM_VECTOR_LEN;
|
|
231
|
+
const ret = wasm.generate_user_keys(ptr0, len0);
|
|
232
|
+
if (ret[2]) {
|
|
233
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
234
|
+
}
|
|
235
|
+
return UserKeys.__wrap(ret[0]);
|
|
236
|
+
}
|
|
237
|
+
|
|
212
238
|
/**
|
|
213
239
|
* Decrypts data using AES-256-SIV authenticated encryption.
|
|
214
240
|
*
|
|
@@ -270,33 +296,6 @@ export function aead_decrypt(key, nonce, ciphertext, aad) {
|
|
|
270
296
|
return v3;
|
|
271
297
|
}
|
|
272
298
|
|
|
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
|
-
|
|
300
299
|
/**
|
|
301
300
|
* Session status indicating the state of a peer session.
|
|
302
301
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
|
|
@@ -1062,7 +1061,7 @@ export class UserKeys {
|
|
|
1062
1061
|
wasm.__wbg_userkeys_free(ptr, 0);
|
|
1063
1062
|
}
|
|
1064
1063
|
/**
|
|
1065
|
-
* EIP-55 checksummed EVM address (0x…) derived from the
|
|
1064
|
+
* EIP-55 checksummed EVM address (0x…) derived from the EVM public key.
|
|
1066
1065
|
* @returns {string}
|
|
1067
1066
|
*/
|
|
1068
1067
|
evm_address() {
|
|
@@ -1077,22 +1076,6 @@ export class UserKeys {
|
|
|
1077
1076
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1078
1077
|
}
|
|
1079
1078
|
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Massa address (AU…) derived from the Massa public key.
|
|
1082
|
-
* @returns {string}
|
|
1083
|
-
*/
|
|
1084
|
-
massa_address() {
|
|
1085
|
-
let deferred1_0;
|
|
1086
|
-
let deferred1_1;
|
|
1087
|
-
try {
|
|
1088
|
-
const ret = wasm.userkeys_massa_address(this.__wbg_ptr);
|
|
1089
|
-
deferred1_0 = ret[0];
|
|
1090
|
-
deferred1_1 = ret[1];
|
|
1091
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1092
|
-
} finally {
|
|
1093
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
1079
|
/**
|
|
1097
1080
|
* Gets the public keys.
|
|
1098
1081
|
* @returns {UserPublicKeys}
|
|
@@ -1115,6 +1098,22 @@ export class UserKeys {
|
|
|
1115
1098
|
}
|
|
1116
1099
|
return UserSecretKeys.__wrap(ret[0]);
|
|
1117
1100
|
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Massa address (AU…) derived from the Massa public key.
|
|
1103
|
+
* @returns {string}
|
|
1104
|
+
*/
|
|
1105
|
+
massa_address() {
|
|
1106
|
+
let deferred1_0;
|
|
1107
|
+
let deferred1_1;
|
|
1108
|
+
try {
|
|
1109
|
+
const ret = wasm.userkeys_massa_address(this.__wbg_ptr);
|
|
1110
|
+
deferred1_0 = ret[0];
|
|
1111
|
+
deferred1_1 = ret[1];
|
|
1112
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1113
|
+
} finally {
|
|
1114
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1118
1117
|
}
|
|
1119
1118
|
if (Symbol.dispose)
|
|
1120
1119
|
UserKeys.prototype[Symbol.dispose] = UserKeys.prototype.free;
|
|
@@ -1162,6 +1161,16 @@ export class UserPublicKeys {
|
|
|
1162
1161
|
}
|
|
1163
1162
|
return UserPublicKeys.__wrap(ret[0]);
|
|
1164
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Gets the EVM public key bytes (compressed, secp256k1).
|
|
1166
|
+
* @returns {Uint8Array}
|
|
1167
|
+
*/
|
|
1168
|
+
get evm_public_key() {
|
|
1169
|
+
const ret = wasm.userpublickeys_evm_public_key(this.__wbg_ptr);
|
|
1170
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1171
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1172
|
+
return v1;
|
|
1173
|
+
}
|
|
1165
1174
|
/**
|
|
1166
1175
|
* Gets the KEM public key bytes.
|
|
1167
1176
|
* @returns {Uint8Array}
|
|
@@ -1262,6 +1271,16 @@ export class UserSecretKeys {
|
|
|
1262
1271
|
}
|
|
1263
1272
|
return UserSecretKeys.__wrap(ret[0]);
|
|
1264
1273
|
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Gets the EVM secret key bytes (raw 32-byte scalar).
|
|
1276
|
+
* @returns {Uint8Array}
|
|
1277
|
+
*/
|
|
1278
|
+
get evm_secret_key() {
|
|
1279
|
+
const ret = wasm.usersecretkeys_evm_secret_key(this.__wbg_ptr);
|
|
1280
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1281
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1282
|
+
return v1;
|
|
1283
|
+
}
|
|
1265
1284
|
/**
|
|
1266
1285
|
* Gets the KEM secret key bytes.
|
|
1267
1286
|
* @returns {Uint8Array}
|
|
Binary file
|
|
@@ -132,6 +132,7 @@ export const userpublickeys_derive_id: (a: number) => [number, number];
|
|
|
132
132
|
export const userpublickeys_dsa_verification_key: (
|
|
133
133
|
a: number
|
|
134
134
|
) => [number, number];
|
|
135
|
+
export const userpublickeys_evm_public_key: (a: number) => [number, number];
|
|
135
136
|
export const userpublickeys_from_bytes: (
|
|
136
137
|
a: number,
|
|
137
138
|
b: number
|
|
@@ -142,6 +143,7 @@ export const userpublickeys_to_bytes: (
|
|
|
142
143
|
a: number
|
|
143
144
|
) => [number, number, number, number];
|
|
144
145
|
export const usersecretkeys_dsa_signing_key: (a: number) => [number, number];
|
|
146
|
+
export const usersecretkeys_evm_secret_key: (a: number) => [number, number];
|
|
145
147
|
export const usersecretkeys_from_bytes: (
|
|
146
148
|
a: number,
|
|
147
149
|
b: number
|
package/package.json
CHANGED