@invisi-labs/protocol 1.1.1 → 1.1.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/dist/index.cjs CHANGED
@@ -4271,8 +4271,8 @@ function notes(v, name) {
4271
4271
  throw new Error(`duplicate or zero ${name}`);
4272
4272
  return r;
4273
4273
  }
4274
- function envelope(v, length, version) {
4275
- if (!(0, import_ethers4.isHexString)(v) || !/^0x(?:[a-fA-F0-9]{2})*$/.test(v) || (0, import_ethers4.dataLength)(v) !== length)
4274
+ function envelope(v, length, version, maximum = length) {
4275
+ if (!(0, import_ethers4.isHexString)(v) || !/^0x(?:[a-fA-F0-9]{2})*$/.test(v) || (0, import_ethers4.dataLength)(v) < length || (0, import_ethers4.dataLength)(v) > maximum)
4276
4276
  throw new Error(`ciphertext must be ${length} bytes`);
4277
4277
  if (version !== void 0 && Number.parseInt(v.slice(2, 4), 16) !== version)
4278
4278
  throw new Error("unsupported ciphertext envelope version");
@@ -4318,8 +4318,9 @@ function normalizeDelivery(value, options = {}) {
4318
4318
  }
4319
4319
  const ciphertext = envelope(
4320
4320
  value.ciphertext,
4321
- options.credit ? 400 : 158,
4322
- options.credit ? 3 : 1
4321
+ options.credit ? 402 : 160,
4322
+ options.credit ? 4 : 2,
4323
+ options.credit ? 658 : 416
4323
4324
  );
4324
4325
  const clue = envelope(value.clue, 68);
4325
4326
  if (clue.slice(130, 132).toLowerCase() !== "18") throw new Error("clue precision must be 24");