@massalabs/gossip-sdk 0.0.2 → 0.1.1-dev.20260716142646

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,40 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Decrypts data using AES-256-SIV authenticated encryption.
5
- *
6
- * # Parameters
7
- *
8
- * - `key`: The encryption key (64 bytes, must match encryption key)
9
- * - `nonce`: The nonce (16 bytes, must match encryption nonce)
10
- * - `ciphertext`: The encrypted data with authentication tag
11
- * - `aad`: Additional authenticated data (must match encryption AAD)
12
- *
13
- * # Returns
14
- *
15
- * The decrypted plaintext, or `null` if authentication fails.
16
- *
17
- * # Security Notes
18
- *
19
- * - Returns `null` if:
20
- * - The ciphertext has been tampered with
21
- * - The wrong key or nonce is used
22
- * - The AAD doesn't match
23
- * - Never ignore a decryption failure; it indicates tampering or corruption
24
- *
25
- * # Example
26
- *
27
- * ```javascript
28
- * const plaintext = aead_decrypt(key, nonce, ciphertext, aad);
29
- * if (plaintext) {
30
- * console.log("Decrypted:", new TextDecoder().decode(plaintext));
31
- * } else {
32
- * console.error("Decryption failed - data may be corrupted or tampered");
33
- * }
34
- * ```
35
- */
36
- export function aead_decrypt(key: EncryptionKey, nonce: Nonce, ciphertext: Uint8Array, aad: Uint8Array): Uint8Array | undefined;
37
- export function start(): void;
38
3
  /**
39
4
  * Encrypts data using AES-256-SIV authenticated encryption.
40
5
  *
@@ -75,6 +40,41 @@ export function aead_encrypt(key: EncryptionKey, nonce: Nonce, plaintext: Uint8A
75
40
  * the passphrase crosses the JS boundary only once.
76
41
  */
77
42
  export function generate_user_keys(passphrase: string): UserKeys;
43
+ export function start(): void;
44
+ /**
45
+ * Decrypts data using AES-256-SIV authenticated encryption.
46
+ *
47
+ * # Parameters
48
+ *
49
+ * - `key`: The encryption key (64 bytes, must match encryption key)
50
+ * - `nonce`: The nonce (16 bytes, must match encryption nonce)
51
+ * - `ciphertext`: The encrypted data with authentication tag
52
+ * - `aad`: Additional authenticated data (must match encryption AAD)
53
+ *
54
+ * # Returns
55
+ *
56
+ * The decrypted plaintext, or `null` if authentication fails.
57
+ *
58
+ * # Security Notes
59
+ *
60
+ * - Returns `null` if:
61
+ * - The ciphertext has been tampered with
62
+ * - The wrong key or nonce is used
63
+ * - The AAD doesn't match
64
+ * - Never ignore a decryption failure; it indicates tampering or corruption
65
+ *
66
+ * # Example
67
+ *
68
+ * ```javascript
69
+ * const plaintext = aead_decrypt(key, nonce, ciphertext, aad);
70
+ * if (plaintext) {
71
+ * console.log("Decrypted:", new TextDecoder().decode(plaintext));
72
+ * } else {
73
+ * console.error("Decryption failed - data may be corrupted or tampered");
74
+ * }
75
+ * ```
76
+ */
77
+ export function aead_decrypt(key: EncryptionKey, nonce: Nonce, ciphertext: Uint8Array, aad: Uint8Array): Uint8Array | undefined;
78
78
  /**
79
79
  * Session status indicating the state of a peer session.
80
80
  */
@@ -135,64 +135,6 @@ function _assertClass(instance, klass) {
135
135
  throw new Error(`expected instance of ${klass.name}`);
136
136
  }
137
137
  }
138
- /**
139
- * Decrypts data using AES-256-SIV authenticated encryption.
140
- *
141
- * # Parameters
142
- *
143
- * - `key`: The encryption key (64 bytes, must match encryption key)
144
- * - `nonce`: The nonce (16 bytes, must match encryption nonce)
145
- * - `ciphertext`: The encrypted data with authentication tag
146
- * - `aad`: Additional authenticated data (must match encryption AAD)
147
- *
148
- * # Returns
149
- *
150
- * The decrypted plaintext, or `null` if authentication fails.
151
- *
152
- * # Security Notes
153
- *
154
- * - Returns `null` if:
155
- * - The ciphertext has been tampered with
156
- * - The wrong key or nonce is used
157
- * - The AAD doesn't match
158
- * - Never ignore a decryption failure; it indicates tampering or corruption
159
- *
160
- * # Example
161
- *
162
- * ```javascript
163
- * const plaintext = aead_decrypt(key, nonce, ciphertext, aad);
164
- * if (plaintext) {
165
- * console.log("Decrypted:", new TextDecoder().decode(plaintext));
166
- * } else {
167
- * console.error("Decryption failed - data may be corrupted or tampered");
168
- * }
169
- * ```
170
- * @param {EncryptionKey} key
171
- * @param {Nonce} nonce
172
- * @param {Uint8Array} ciphertext
173
- * @param {Uint8Array} aad
174
- * @returns {Uint8Array | undefined}
175
- */
176
- export function aead_decrypt(key, nonce, ciphertext, aad) {
177
- _assertClass(key, EncryptionKey);
178
- _assertClass(nonce, Nonce);
179
- const ptr0 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
180
- const len0 = WASM_VECTOR_LEN;
181
- const ptr1 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
182
- const len1 = WASM_VECTOR_LEN;
183
- const ret = wasm.aead_decrypt(key.__wbg_ptr, nonce.__wbg_ptr, ptr0, len0, ptr1, len1);
184
- let v3;
185
- if (ret[0] !== 0) {
186
- v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
187
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
188
- }
189
- return v3;
190
- }
191
-
192
- export function start() {
193
- wasm.start();
194
- }
195
-
196
138
  /**
197
139
  * Encrypts data using AES-256-SIV authenticated encryption.
198
140
  *
@@ -261,6 +203,64 @@ export function generate_user_keys(passphrase) {
261
203
  return UserKeys.__wrap(ret[0]);
262
204
  }
263
205
 
206
+ export function start() {
207
+ wasm.start();
208
+ }
209
+
210
+ /**
211
+ * Decrypts data using AES-256-SIV authenticated encryption.
212
+ *
213
+ * # Parameters
214
+ *
215
+ * - `key`: The encryption key (64 bytes, must match encryption key)
216
+ * - `nonce`: The nonce (16 bytes, must match encryption nonce)
217
+ * - `ciphertext`: The encrypted data with authentication tag
218
+ * - `aad`: Additional authenticated data (must match encryption AAD)
219
+ *
220
+ * # Returns
221
+ *
222
+ * The decrypted plaintext, or `null` if authentication fails.
223
+ *
224
+ * # Security Notes
225
+ *
226
+ * - Returns `null` if:
227
+ * - The ciphertext has been tampered with
228
+ * - The wrong key or nonce is used
229
+ * - The AAD doesn't match
230
+ * - Never ignore a decryption failure; it indicates tampering or corruption
231
+ *
232
+ * # Example
233
+ *
234
+ * ```javascript
235
+ * const plaintext = aead_decrypt(key, nonce, ciphertext, aad);
236
+ * if (plaintext) {
237
+ * console.log("Decrypted:", new TextDecoder().decode(plaintext));
238
+ * } else {
239
+ * console.error("Decryption failed - data may be corrupted or tampered");
240
+ * }
241
+ * ```
242
+ * @param {EncryptionKey} key
243
+ * @param {Nonce} nonce
244
+ * @param {Uint8Array} ciphertext
245
+ * @param {Uint8Array} aad
246
+ * @returns {Uint8Array | undefined}
247
+ */
248
+ export function aead_decrypt(key, nonce, ciphertext, aad) {
249
+ _assertClass(key, EncryptionKey);
250
+ _assertClass(nonce, Nonce);
251
+ const ptr0 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ const ptr1 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
254
+ const len1 = WASM_VECTOR_LEN;
255
+ const ret = wasm.aead_decrypt(key.__wbg_ptr, nonce.__wbg_ptr, ptr0, len0, ptr1, len1);
256
+ let v3;
257
+ if (ret[0] !== 0) {
258
+ v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
259
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
260
+ }
261
+ return v3;
262
+ }
263
+
264
264
  /**
265
265
  * Session status indicating the state of a peer session.
266
266
  * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
@@ -2,6 +2,7 @@
2
2
  "name": "gossip-wasm",
3
3
  "type": "module",
4
4
  "version": "0.1.0",
5
+ "license": "AGPL-3.0-or-later",
5
6
  "files": [
6
7
  "gossip_wasm_bg.wasm",
7
8
  "gossip_wasm.js",
@@ -112,8 +112,8 @@ export interface InitOutput {
112
112
  readonly __externref_table_dealloc: (a: number) => void;
113
113
  readonly closure112_externref_shim: (a: number, b: number, c: any) => void;
114
114
  readonly wasm_bindgen_3f82e0ab9dbbc377___convert__closures_____invoke______: (a: number, b: number) => void;
115
- readonly closure678_externref_shim: (a: number, b: number, c: any) => void;
116
115
  readonly closure56_externref_shim_multivalue_shim: (a: number, b: number, c: any) => [number, number];
116
+ readonly closure678_externref_shim: (a: number, b: number, c: any) => void;
117
117
  readonly closure723_externref_shim: (a: number, b: number, c: any, d: any) => void;
118
118
  readonly __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
119
119
  readonly __wbindgen_start: (a: number) => void;
@@ -456,25 +456,25 @@ export function wbg_rayon_start_worker(receiver) {
456
456
  wasm.wbg_rayon_start_worker(receiver);
457
457
  }
458
458
 
459
- function __wbg_adapter_8(arg0, arg1, arg2) {
459
+ function __wbg_adapter_6(arg0, arg1, arg2) {
460
460
  wasm.closure112_externref_shim(arg0, arg1, arg2);
461
461
  }
462
462
 
463
- function __wbg_adapter_13(arg0, arg1) {
463
+ function __wbg_adapter_9(arg0, arg1) {
464
464
  wasm.wasm_bindgen_3f82e0ab9dbbc377___convert__closures_____invoke______(arg0, arg1);
465
465
  }
466
466
 
467
- function __wbg_adapter_20(arg0, arg1, arg2) {
468
- wasm.closure678_externref_shim(arg0, arg1, arg2);
469
- }
470
-
471
- function __wbg_adapter_25(arg0, arg1, arg2) {
467
+ function __wbg_adapter_18(arg0, arg1, arg2) {
472
468
  const ret = wasm.closure56_externref_shim_multivalue_shim(arg0, arg1, arg2);
473
469
  if (ret[1]) {
474
470
  throw takeFromExternrefTable0(ret[0]);
475
471
  }
476
472
  }
477
473
 
474
+ function __wbg_adapter_21(arg0, arg1, arg2) {
475
+ wasm.closure678_externref_shim(arg0, arg1, arg2);
476
+ }
477
+
478
478
  function __wbg_adapter_186(arg0, arg1, arg2, arg3) {
479
479
  wasm.closure723_externref_shim(arg0, arg1, arg2, arg3);
480
480
  }
@@ -1095,12 +1095,12 @@ function __wbg_get_imports() {
1095
1095
  };
1096
1096
  imports.wbg.__wbindgen_cast_059aacf5a239a77f = function(arg0, arg1) {
1097
1097
  // Cast intrinsic for `Closure(Closure { dtor_idx: 675, function: Function { arguments: [NamedExternref("Event")], shim_idx: 678, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1098
- const ret = makeClosure(arg0, arg1, 675, __wbg_adapter_20);
1098
+ const ret = makeClosure(arg0, arg1, 675, __wbg_adapter_21);
1099
1099
  return ret;
1100
1100
  };
1101
1101
  imports.wbg.__wbindgen_cast_146fd35f906c65cd = function(arg0, arg1) {
1102
1102
  // Cast intrinsic for `Closure(Closure { dtor_idx: 111, function: Function { arguments: [Externref], shim_idx: 112, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1103
- const ret = makeMutClosure(arg0, arg1, 111, __wbg_adapter_8);
1103
+ const ret = makeMutClosure(arg0, arg1, 111, __wbg_adapter_6);
1104
1104
  return ret;
1105
1105
  };
1106
1106
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -1110,7 +1110,7 @@ function __wbg_get_imports() {
1110
1110
  };
1111
1111
  imports.wbg.__wbindgen_cast_7ebbbe5a2f6a40ca = function(arg0, arg1) {
1112
1112
  // Cast intrinsic for `Closure(Closure { dtor_idx: 55, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 56, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1113
- const ret = makeMutClosure(arg0, arg1, 55, __wbg_adapter_25);
1113
+ const ret = makeMutClosure(arg0, arg1, 55, __wbg_adapter_18);
1114
1114
  return ret;
1115
1115
  };
1116
1116
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -1120,7 +1120,7 @@ function __wbg_get_imports() {
1120
1120
  };
1121
1121
  imports.wbg.__wbindgen_cast_a53a037200293105 = function(arg0, arg1) {
1122
1122
  // Cast intrinsic for `Closure(Closure { dtor_idx: 111, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 112, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1123
- const ret = makeMutClosure(arg0, arg1, 111, __wbg_adapter_8);
1123
+ const ret = makeMutClosure(arg0, arg1, 111, __wbg_adapter_6);
1124
1124
  return ret;
1125
1125
  };
1126
1126
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
@@ -1135,7 +1135,7 @@ function __wbg_get_imports() {
1135
1135
  };
1136
1136
  imports.wbg.__wbindgen_cast_e55b3bcdac329b29 = function(arg0, arg1) {
1137
1137
  // Cast intrinsic for `Closure(Closure { dtor_idx: 675, function: Function { arguments: [], shim_idx: 676, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1138
- const ret = makeClosure(arg0, arg1, 675, __wbg_adapter_13);
1138
+ const ret = makeClosure(arg0, arg1, 675, __wbg_adapter_9);
1139
1139
  return ret;
1140
1140
  };
1141
1141
  imports.wbg.__wbindgen_init_externref_table = function() {
@@ -46,8 +46,8 @@ export const __wbindgen_export_7: WebAssembly.Table;
46
46
  export const __externref_table_dealloc: (a: number) => void;
47
47
  export const closure112_externref_shim: (a: number, b: number, c: any) => void;
48
48
  export const wasm_bindgen_3f82e0ab9dbbc377___convert__closures_____invoke______: (a: number, b: number) => void;
49
- export const closure678_externref_shim: (a: number, b: number, c: any) => void;
50
49
  export const closure56_externref_shim_multivalue_shim: (a: number, b: number, c: any) => [number, number];
50
+ export const closure678_externref_shim: (a: number, b: number, c: any) => void;
51
51
  export const closure723_externref_shim: (a: number, b: number, c: any, d: any) => void;
52
52
  export const __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
53
53
  export const __wbindgen_start: (a: number) => void;
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@massalabs/gossip-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.1.1-dev.20260716142646",
4
4
  "description": "Gossip SDK for automation, chatbot, and integration use cases",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "files": [
9
9
  "dist",
10
- "README.md"
10
+ "README.md",
11
+ "LICENSE",
12
+ "THIRD_PARTY_NOTICES.txt"
11
13
  ],
12
14
  "exports": {
13
15
  ".": {
@@ -42,7 +44,7 @@
42
44
  "massa",
43
45
  "blockchain"
44
46
  ],
45
- "license": "MIT",
47
+ "license": "AGPL-3.0-or-later",
46
48
  "devDependencies": {
47
49
  "@types/varint": "^6.0.3",
48
50
  "drizzle-kit": "^0.31.1",