mol_crypto_lib 0.1.1580 → 0.1.1582

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
@@ -1,5 +1,6 @@
1
1
  \/
2
2
  pack bun git \https://github.com/spleekz/mam_bun.git
3
+ pack hd git \https://github.com/hd4ru/hd.git
3
4
  pack hyoo git \https://github.com/hyoo-ru/mam_hyoo.git
4
5
  pack iva git \https://github.com/thenesterov/mam_iva.git
5
6
  pack jin git \https://github.com/nin-jin/mam_jin.git
package/node.mjs CHANGED
@@ -2288,7 +2288,7 @@ var $;
2288
2288
  serial = new Uint8Array(serial.buffer, serial.byteOffset, serial.byteLength);
2289
2289
  }
2290
2290
  ;
2291
- serial[0] = 0;
2291
+ serial[0] = 0xFF;
2292
2292
  const sacred = super.from(serial);
2293
2293
  return sacred;
2294
2294
  }
@@ -2300,8 +2300,8 @@ var $;
2300
2300
  }
2301
2301
  constructor(buffer, byteOffset, byteLength) {
2302
2302
  super(buffer, byteOffset, byteLength);
2303
- if (this.getUint8(0) !== 0)
2304
- $mol_fail(new Error('Buffer should starts with 0 byte'));
2303
+ if (this.getUint8(0) !== 0xFF)
2304
+ $mol_fail(new Error('Buffer should starts with 0xFF byte'));
2305
2305
  }
2306
2306
  toString() {
2307
2307
  return $mol_base64_url_encode(this.asArray());
@@ -2330,13 +2330,16 @@ var $;
2330
2330
  }, await this.native(), closed).catch($mol_crypto_restack));
2331
2331
  }
2332
2332
  async close(sacred, salt) {
2333
+ if (sacred.getUint8(0) !== 0xFF)
2334
+ throw new Error('Closable buffer should starts with 0xFF');
2333
2335
  const buf = new Uint8Array(sacred.buffer, sacred.byteOffset + 1, sacred.byteLength - 1);
2334
2336
  return this.encrypt(buf, salt);
2335
2337
  }
2336
2338
  async open(buf, salt) {
2337
2339
  const buf2 = new Uint8Array(16);
2340
+ buf2[0] = 0xFF;
2338
2341
  buf2.set(await this.decrypt(buf, salt), 1);
2339
- return new $mol_crypto_sacred(buf2.buffer);
2342
+ return buf2;
2340
2343
  }
2341
2344
  }
2342
2345
  __decorate([
package/node.test.js CHANGED
@@ -2279,7 +2279,7 @@ var $;
2279
2279
  serial = new Uint8Array(serial.buffer, serial.byteOffset, serial.byteLength);
2280
2280
  }
2281
2281
  ;
2282
- serial[0] = 0;
2282
+ serial[0] = 0xFF;
2283
2283
  const sacred = super.from(serial);
2284
2284
  return sacred;
2285
2285
  }
@@ -2291,8 +2291,8 @@ var $;
2291
2291
  }
2292
2292
  constructor(buffer, byteOffset, byteLength) {
2293
2293
  super(buffer, byteOffset, byteLength);
2294
- if (this.getUint8(0) !== 0)
2295
- $mol_fail(new Error('Buffer should starts with 0 byte'));
2294
+ if (this.getUint8(0) !== 0xFF)
2295
+ $mol_fail(new Error('Buffer should starts with 0xFF byte'));
2296
2296
  }
2297
2297
  toString() {
2298
2298
  return $mol_base64_url_encode(this.asArray());
@@ -2321,13 +2321,16 @@ var $;
2321
2321
  }, await this.native(), closed).catch($mol_crypto_restack));
2322
2322
  }
2323
2323
  async close(sacred, salt) {
2324
+ if (sacred.getUint8(0) !== 0xFF)
2325
+ throw new Error('Closable buffer should starts with 0xFF');
2324
2326
  const buf = new Uint8Array(sacred.buffer, sacred.byteOffset + 1, sacred.byteLength - 1);
2325
2327
  return this.encrypt(buf, salt);
2326
2328
  }
2327
2329
  async open(buf, salt) {
2328
2330
  const buf2 = new Uint8Array(16);
2331
+ buf2[0] = 0xFF;
2329
2332
  buf2.set(await this.decrypt(buf, salt), 1);
2330
- return new $mol_crypto_sacred(buf2.buffer);
2333
+ return buf2;
2331
2334
  }
2332
2335
  }
2333
2336
  __decorate([