mol_crypto2_lib 0.0.1 → 0.0.2

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/node.meta.tree CHANGED
@@ -26,3 +26,4 @@
26
26
  include \/mol/crypto2/cipher
27
27
  include \/mol/crypto2/public
28
28
  include \/mol/crypto2/private
29
+ include \/mol/crypto2/nonce
package/node.mjs CHANGED
@@ -2580,11 +2580,17 @@ var $;
2580
2580
  "use strict";
2581
2581
  var $;
2582
2582
  (function ($) {
2583
- function $mol_crypto_salt() {
2583
+ function $mol_crypto2_nonce() {
2584
2584
  return $mol_crypto_native.getRandomValues(new Uint8Array(16));
2585
2585
  }
2586
- $.$mol_crypto_salt = $mol_crypto_salt;
2587
- $.$mol_crypto_salt_once = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
2586
+ $.$mol_crypto2_nonce = $mol_crypto2_nonce;
2587
+ })($ || ($ = {}));
2588
+
2589
+ ;
2590
+ "use strict";
2591
+ var $;
2592
+ (function ($) {
2593
+ $.$mol_crypto_salt = $mol_crypto2_nonce;
2588
2594
  })($ || ($ = {}));
2589
2595
 
2590
2596
  ;
package/node.test.js CHANGED
@@ -2571,11 +2571,17 @@ var $;
2571
2571
  "use strict";
2572
2572
  var $;
2573
2573
  (function ($) {
2574
- function $mol_crypto_salt() {
2574
+ function $mol_crypto2_nonce() {
2575
2575
  return $mol_crypto_native.getRandomValues(new Uint8Array(16));
2576
2576
  }
2577
- $.$mol_crypto_salt = $mol_crypto_salt;
2578
- $.$mol_crypto_salt_once = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
2577
+ $.$mol_crypto2_nonce = $mol_crypto2_nonce;
2578
+ })($ || ($ = {}));
2579
+
2580
+ ;
2581
+ "use strict";
2582
+ var $;
2583
+ (function ($) {
2584
+ $.$mol_crypto_salt = $mol_crypto2_nonce;
2579
2585
  })($ || ($ = {}));
2580
2586
 
2581
2587
  ;
@@ -5251,12 +5257,12 @@ var $;
5251
5257
  const secretB = await Bella.cipher().secret(Alice.socket());
5252
5258
  $mol_assert_equal(secretA, secretB);
5253
5259
  const data = new Uint8Array([1, 2, 3]);
5254
- const salt = $mol_crypto_salt();
5255
- const closed = await secretA.encrypt(data, salt);
5260
+ const nonce = $mol_crypto2_nonce();
5261
+ const closed = await secretA.encrypt(data, nonce);
5256
5262
  const digest = $mol_crypto_hash(closed);
5257
5263
  const sign = await Alice.signer().sign(digest);
5258
5264
  $mol_assert_equal(true, await Alice.auditor().verify(digest, sign));
5259
- $mol_assert_equal(data, await secretA.decrypt(closed, salt));
5265
+ $mol_assert_equal(data, await secretA.decrypt(closed, nonce));
5260
5266
  },
5261
5267
  async "Serial & Deserial"($) {
5262
5268
  const orig = await $mol_crypto2_private.generate();