@massalabs/gossip-sdk 0.0.2-dev.20260413083255 → 0.0.2-dev.20260414143529
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
|
*/
|
|
@@ -379,7 +378,7 @@ export class UserKeys {
|
|
|
379
378
|
free(): void;
|
|
380
379
|
[Symbol.dispose](): void;
|
|
381
380
|
/**
|
|
382
|
-
* EIP-55 checksummed EVM address (0x…) derived from the
|
|
381
|
+
* EIP-55 checksummed EVM address (0x…) derived from the EVM public key.
|
|
383
382
|
*/
|
|
384
383
|
evm_address(): string;
|
|
385
384
|
/**
|
|
@@ -390,6 +389,10 @@ export class UserKeys {
|
|
|
390
389
|
* Gets the secret keys.
|
|
391
390
|
*/
|
|
392
391
|
secret_keys(): UserSecretKeys;
|
|
392
|
+
/**
|
|
393
|
+
* Massa address (AU…) derived from the Massa public key.
|
|
394
|
+
*/
|
|
395
|
+
massa_address(): string;
|
|
393
396
|
}
|
|
394
397
|
/**
|
|
395
398
|
* User public keys for authentication and encryption.
|
|
@@ -410,6 +413,10 @@ export class UserPublicKeys {
|
|
|
410
413
|
* Derives a unique user ID from the public keys.
|
|
411
414
|
*/
|
|
412
415
|
derive_id(): Uint8Array;
|
|
416
|
+
/**
|
|
417
|
+
* Gets the EVM public key bytes (compressed, secp256k1).
|
|
418
|
+
*/
|
|
419
|
+
readonly evm_public_key: Uint8Array;
|
|
413
420
|
/**
|
|
414
421
|
* Gets the KEM public key bytes.
|
|
415
422
|
*/
|
|
@@ -438,6 +445,10 @@ export class UserSecretKeys {
|
|
|
438
445
|
* Serializes the secret keys to bytes for secure storage.
|
|
439
446
|
*/
|
|
440
447
|
to_bytes(): Uint8Array;
|
|
448
|
+
/**
|
|
449
|
+
* Gets the EVM secret key bytes (raw 32-byte scalar).
|
|
450
|
+
*/
|
|
451
|
+
readonly evm_secret_key: Uint8Array;
|
|
441
452
|
/**
|
|
442
453
|
* Gets the KEM secret key bytes.
|
|
443
454
|
*/
|
|
@@ -582,10 +593,12 @@ export interface InitOutput {
|
|
|
582
593
|
b: number
|
|
583
594
|
) => [number, number, number, number];
|
|
584
595
|
readonly userkeys_evm_address: (a: number) => [number, number];
|
|
596
|
+
readonly userkeys_massa_address: (a: number) => [number, number];
|
|
585
597
|
readonly userkeys_public_keys: (a: number) => [number, number, number];
|
|
586
598
|
readonly userkeys_secret_keys: (a: number) => [number, number, number];
|
|
587
599
|
readonly userpublickeys_derive_id: (a: number) => [number, number];
|
|
588
600
|
readonly userpublickeys_dsa_verification_key: (a: number) => [number, number];
|
|
601
|
+
readonly userpublickeys_evm_public_key: (a: number) => [number, number];
|
|
589
602
|
readonly userpublickeys_from_bytes: (
|
|
590
603
|
a: number,
|
|
591
604
|
b: number
|
|
@@ -596,6 +609,7 @@ export interface InitOutput {
|
|
|
596
609
|
a: number
|
|
597
610
|
) => [number, number, number, number];
|
|
598
611
|
readonly usersecretkeys_dsa_signing_key: (a: number) => [number, number];
|
|
612
|
+
readonly usersecretkeys_evm_secret_key: (a: number) => [number, number];
|
|
599
613
|
readonly usersecretkeys_from_bytes: (
|
|
600
614
|
a: number,
|
|
601
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() {
|
|
@@ -1099,6 +1098,22 @@ export class UserKeys {
|
|
|
1099
1098
|
}
|
|
1100
1099
|
return UserSecretKeys.__wrap(ret[0]);
|
|
1101
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
|
+
}
|
|
1102
1117
|
}
|
|
1103
1118
|
if (Symbol.dispose)
|
|
1104
1119
|
UserKeys.prototype[Symbol.dispose] = UserKeys.prototype.free;
|
|
@@ -1146,6 +1161,16 @@ export class UserPublicKeys {
|
|
|
1146
1161
|
}
|
|
1147
1162
|
return UserPublicKeys.__wrap(ret[0]);
|
|
1148
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
|
+
}
|
|
1149
1174
|
/**
|
|
1150
1175
|
* Gets the KEM public key bytes.
|
|
1151
1176
|
* @returns {Uint8Array}
|
|
@@ -1246,6 +1271,16 @@ export class UserSecretKeys {
|
|
|
1246
1271
|
}
|
|
1247
1272
|
return UserSecretKeys.__wrap(ret[0]);
|
|
1248
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
|
+
}
|
|
1249
1284
|
/**
|
|
1250
1285
|
* Gets the KEM secret key bytes.
|
|
1251
1286
|
* @returns {Uint8Array}
|
|
Binary file
|
|
@@ -125,12 +125,14 @@ export const sessionmanagerwrapper_to_encrypted_blob: (
|
|
|
125
125
|
b: number
|
|
126
126
|
) => [number, number, number, number];
|
|
127
127
|
export const userkeys_evm_address: (a: number) => [number, number];
|
|
128
|
+
export const userkeys_massa_address: (a: number) => [number, number];
|
|
128
129
|
export const userkeys_public_keys: (a: number) => [number, number, number];
|
|
129
130
|
export const userkeys_secret_keys: (a: number) => [number, number, number];
|
|
130
131
|
export const userpublickeys_derive_id: (a: number) => [number, number];
|
|
131
132
|
export const userpublickeys_dsa_verification_key: (
|
|
132
133
|
a: number
|
|
133
134
|
) => [number, number];
|
|
135
|
+
export const userpublickeys_evm_public_key: (a: number) => [number, number];
|
|
134
136
|
export const userpublickeys_from_bytes: (
|
|
135
137
|
a: number,
|
|
136
138
|
b: number
|
|
@@ -141,6 +143,7 @@ export const userpublickeys_to_bytes: (
|
|
|
141
143
|
a: number
|
|
142
144
|
) => [number, number, number, number];
|
|
143
145
|
export const usersecretkeys_dsa_signing_key: (a: number) => [number, number];
|
|
146
|
+
export const usersecretkeys_evm_secret_key: (a: number) => [number, number];
|
|
144
147
|
export const usersecretkeys_from_bytes: (
|
|
145
148
|
a: number,
|
|
146
149
|
b: number
|
package/package.json
CHANGED