libsodium-sumo 0.8.2 → 0.8.3
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.
package/README.md
CHANGED
|
@@ -73,8 +73,8 @@ await sodium.ready;
|
|
|
73
73
|
|
|
74
74
|
let key = sodium.crypto_secretstream_xchacha20poly1305_keygen();
|
|
75
75
|
|
|
76
|
-
let
|
|
77
|
-
|
|
76
|
+
let { state: state_out, header } =
|
|
77
|
+
sodium.crypto_secretstream_xchacha20poly1305_init_push(key);
|
|
78
78
|
let c1 = sodium.crypto_secretstream_xchacha20poly1305_push(state_out,
|
|
79
79
|
sodium.from_string('message 1'), null,
|
|
80
80
|
sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE);
|
|
@@ -84,9 +84,11 @@ let c2 = sodium.crypto_secretstream_xchacha20poly1305_push(state_out,
|
|
|
84
84
|
|
|
85
85
|
let state_in = sodium.crypto_secretstream_xchacha20poly1305_init_pull(header, key);
|
|
86
86
|
let r1 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c1);
|
|
87
|
-
let
|
|
87
|
+
let { message: m1_bytes, tag: tag1 } = r1;
|
|
88
|
+
let m1 = sodium.to_string(m1_bytes);
|
|
88
89
|
let r2 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c2);
|
|
89
|
-
let
|
|
90
|
+
let { message: m2_bytes, tag: tag2 } = r2;
|
|
91
|
+
let m2 = sodium.to_string(m2_bytes);
|
|
90
92
|
|
|
91
93
|
console.log(m1);
|
|
92
94
|
console.log(m2);
|
|
@@ -219,6 +221,13 @@ returns the following object:
|
|
|
219
221
|
{ publicKey: (Uint8Array), privateKey: (Uint8Array), keyType: 'x25519' }
|
|
220
222
|
```
|
|
221
223
|
|
|
224
|
+
This also applies to newer APIs such as:
|
|
225
|
+
```javascript
|
|
226
|
+
{ state: (StateAddress), header: (Uint8Array) }
|
|
227
|
+
{ ciphertext: (Uint8Array), sharedSecret: (Uint8Array) }
|
|
228
|
+
```
|
|
229
|
+
for `crypto_secretstream_xchacha20poly1305_init_push()` and `crypto_kem_enc()`.
|
|
230
|
+
|
|
222
231
|
### Standard vs Sumo version
|
|
223
232
|
|
|
224
233
|
The standard version (in the `dist/browsers`, `dist/modules`, and
|
|
@@ -247,9 +256,10 @@ need to be installed on your system:
|
|
|
247
256
|
* bun
|
|
248
257
|
* make
|
|
249
258
|
|
|
250
|
-
Running `make` will install the dev dependencies,
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
Running `make` will install the dev dependencies if needed, build the
|
|
260
|
+
standard and sumo distributions, regenerate API docs and TypeScript
|
|
261
|
+
bindings, pack the generated outputs, and rebuild the browser test
|
|
262
|
+
artifacts.
|
|
253
263
|
|
|
254
264
|
### Benchmarks
|
|
255
265
|
|