mol_crypto_lib 0.1.1080 → 0.1.1082

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.mjs CHANGED
@@ -1655,7 +1655,10 @@ var $node = new Proxy({ require }, {
1655
1655
  }
1656
1656
  catch (error) {
1657
1657
  if (error.code === 'ERR_REQUIRE_ESM') {
1658
- return importSync(name);
1658
+ const module = cache.get(name);
1659
+ if (module)
1660
+ return module;
1661
+ throw import(name).then(module => cache.set(name, module));
1659
1662
  }
1660
1663
  $.$mol_fail_log(error);
1661
1664
  return null;
@@ -1666,8 +1669,7 @@ var $node = new Proxy({ require }, {
1666
1669
  return true;
1667
1670
  },
1668
1671
  });
1669
- const importAsync = async (uri) => import(uri);
1670
- const importSync = $.$mol_wire_sync(importAsync);
1672
+ const cache = new Map();
1671
1673
  require = (req => Object.assign(function require(name) {
1672
1674
  return $node[name];
1673
1675
  }, req))(require);
@@ -1787,19 +1789,19 @@ var $;
1787
1789
  return new this(secret);
1788
1790
  }
1789
1791
  async serial() {
1790
- return await $mol_crypto_native.subtle.exportKey('raw', this.native);
1792
+ return new Uint8Array(await $mol_crypto_native.subtle.exportKey('raw', this.native));
1791
1793
  }
1792
1794
  async encrypt(open, salt) {
1793
- return await $mol_crypto_native.subtle.encrypt({
1795
+ return new Uint8Array(await $mol_crypto_native.subtle.encrypt({
1794
1796
  ...algorithm,
1795
1797
  iv: salt,
1796
- }, this.native, open);
1798
+ }, this.native, open));
1797
1799
  }
1798
1800
  async decrypt(closed, salt) {
1799
- return await $mol_crypto_native.subtle.decrypt({
1801
+ return new Uint8Array(await $mol_crypto_native.subtle.decrypt({
1800
1802
  ...algorithm,
1801
1803
  iv: salt,
1802
- }, this.native, closed);
1804
+ }, this.native, closed));
1803
1805
  }
1804
1806
  }
1805
1807
  $.$mol_crypto_secret = $mol_crypto_secret;
@@ -2195,7 +2197,7 @@ var $;
2195
2197
  return new $mol_crypto_key_public(this.buffer, this.byteOffset, this.byteOffset + 64);
2196
2198
  }
2197
2199
  async sign(data) {
2198
- return await $mol_crypto_native.subtle.sign(algorithm, await this.native(), data);
2200
+ return new Uint8Array(await $mol_crypto_native.subtle.sign(algorithm, await this.native(), data));
2199
2201
  }
2200
2202
  }
2201
2203
  __decorate([
@@ -2287,6 +2289,7 @@ var $;
2287
2289
  return $mol_crypto_native.getRandomValues(new Uint8Array(16));
2288
2290
  }
2289
2291
  $.$mol_crypto_salt = $mol_crypto_salt;
2292
+ $.$mol_crypto_salt_once = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
2290
2293
  })($ || ($ = {}));
2291
2294
 
2292
2295
 
package/node.test.js CHANGED
@@ -1646,7 +1646,10 @@ var $node = new Proxy({ require }, {
1646
1646
  }
1647
1647
  catch (error) {
1648
1648
  if (error.code === 'ERR_REQUIRE_ESM') {
1649
- return importSync(name);
1649
+ const module = cache.get(name);
1650
+ if (module)
1651
+ return module;
1652
+ throw import(name).then(module => cache.set(name, module));
1650
1653
  }
1651
1654
  $.$mol_fail_log(error);
1652
1655
  return null;
@@ -1657,8 +1660,7 @@ var $node = new Proxy({ require }, {
1657
1660
  return true;
1658
1661
  },
1659
1662
  });
1660
- const importAsync = async (uri) => import(uri);
1661
- const importSync = $.$mol_wire_sync(importAsync);
1663
+ const cache = new Map();
1662
1664
  require = (req => Object.assign(function require(name) {
1663
1665
  return $node[name];
1664
1666
  }, req))(require);
@@ -1778,19 +1780,19 @@ var $;
1778
1780
  return new this(secret);
1779
1781
  }
1780
1782
  async serial() {
1781
- return await $mol_crypto_native.subtle.exportKey('raw', this.native);
1783
+ return new Uint8Array(await $mol_crypto_native.subtle.exportKey('raw', this.native));
1782
1784
  }
1783
1785
  async encrypt(open, salt) {
1784
- return await $mol_crypto_native.subtle.encrypt({
1786
+ return new Uint8Array(await $mol_crypto_native.subtle.encrypt({
1785
1787
  ...algorithm,
1786
1788
  iv: salt,
1787
- }, this.native, open);
1789
+ }, this.native, open));
1788
1790
  }
1789
1791
  async decrypt(closed, salt) {
1790
- return await $mol_crypto_native.subtle.decrypt({
1792
+ return new Uint8Array(await $mol_crypto_native.subtle.decrypt({
1791
1793
  ...algorithm,
1792
1794
  iv: salt,
1793
- }, this.native, closed);
1795
+ }, this.native, closed));
1794
1796
  }
1795
1797
  }
1796
1798
  $.$mol_crypto_secret = $mol_crypto_secret;
@@ -2186,7 +2188,7 @@ var $;
2186
2188
  return new $mol_crypto_key_public(this.buffer, this.byteOffset, this.byteOffset + 64);
2187
2189
  }
2188
2190
  async sign(data) {
2189
- return await $mol_crypto_native.subtle.sign(algorithm, await this.native(), data);
2191
+ return new Uint8Array(await $mol_crypto_native.subtle.sign(algorithm, await this.native(), data));
2190
2192
  }
2191
2193
  }
2192
2194
  __decorate([
@@ -2278,6 +2280,7 @@ var $;
2278
2280
  return $mol_crypto_native.getRandomValues(new Uint8Array(16));
2279
2281
  }
2280
2282
  $.$mol_crypto_salt = $mol_crypto_salt;
2283
+ $.$mol_crypto_salt_once = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
2281
2284
  })($ || ($ = {}));
2282
2285
 
2283
2286
  ;