@btc-vision/transaction 1.7.23 → 1.7.24

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
@@ -22,7 +22,7 @@ complicated.
22
22
 
23
23
  ### Prerequisites
24
24
 
25
- - Node.js version 16.x or higher
25
+ - Node.js version 24.x or higher
26
26
  - npm (Node Package Manager)
27
27
 
28
28
  ### Installation
@@ -1 +1 @@
1
- export declare const version = "1.7.23";
1
+ export declare const version = "1.7.24";
package/browser/index.js CHANGED
@@ -7,7 +7,7 @@ import { s as Xi, m as Yi, e as Gi } from "./noble-curves.js";
7
7
  import { A as Qi, z as oe, x as ji, u as Zi } from "./noble-hashes.js";
8
8
  import { i as Ke } from "./btc-vision-logger.js";
9
9
  import { s as gt } from "./bip39.js";
10
- const Ji = "1.7.23";
10
+ const Ji = "1.7.24";
11
11
  class N {
12
12
  static {
13
13
  this.zlibOptions = {
@@ -1072,7 +1072,14 @@ class k extends Uint8Array {
1072
1072
  // After processing, this is 32-byte tweaked x-only (same as original behavior)
1073
1073
  #c;
1074
1074
  constructor(t, e) {
1075
- super(D), t && (e && (this.#d = new Uint8Array(e.length), this.#d.set(e)), this.setMldsaKey(t));
1075
+ if (super(D), !!t) {
1076
+ if (e) {
1077
+ if (![D, 33, 65].includes(e.length))
1078
+ throw new Error(`Invalid public key length ${e.length}`);
1079
+ this.#d = new Uint8Array(e.length), this.#d.set(e);
1080
+ }
1081
+ this.setMldsaKey(t);
1082
+ }
1076
1083
  }
1077
1084
  get mldsaLevel() {
1078
1085
  return this.#p;
@@ -1574,14 +1581,12 @@ class k extends Uint8Array {
1574
1581
  if (this.#g) return;
1575
1582
  this.#g = !0;
1576
1583
  const t = this.#d;
1577
- if (!t) return;
1578
- if (![D, 33, 65].includes(t.length))
1579
- throw new Error(`Invalid public key length ${t.length}`);
1580
- if (t.length === D) {
1581
- const i = a.alloc(D);
1582
- i.set(t), this.#n = re.generateHybridKeyFromHash(i), this.#c = t;
1583
- } else
1584
- this.autoFormat(t);
1584
+ if (t)
1585
+ if (t.length === D) {
1586
+ const e = a.alloc(D);
1587
+ e.set(t), this.#n = re.generateHybridKeyFromHash(e), this.#c = t;
1588
+ } else
1589
+ this.autoFormat(t);
1585
1590
  }
1586
1591
  /**
1587
1592
  * Processes a 33 or 65 byte public key, performing EC operations.
@@ -1 +1 @@
1
- export declare const version = "1.7.23";
1
+ export declare const version = "1.7.24";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.7.23';
1
+ export const version = '1.7.24';
@@ -42,6 +42,10 @@ export class Address extends Uint8Array {
42
42
  return;
43
43
  }
44
44
  if (publicKeyOrTweak) {
45
+ const validLengths = [ADDRESS_BYTE_LENGTH, 33, 65];
46
+ if (!validLengths.includes(publicKeyOrTweak.length)) {
47
+ throw new Error(`Invalid public key length ${publicKeyOrTweak.length}`);
48
+ }
45
49
  __classPrivateFieldSet(this, _Address_pendingLegacyKey, new Uint8Array(publicKeyOrTweak.length), "f");
46
50
  __classPrivateFieldGet(this, _Address_pendingLegacyKey, "f").set(publicKeyOrTweak);
47
51
  }
@@ -404,10 +408,6 @@ export class Address extends Uint8Array {
404
408
  const pending = __classPrivateFieldGet(this, _Address_pendingLegacyKey, "f");
405
409
  if (!pending)
406
410
  return;
407
- const validLengths = [ADDRESS_BYTE_LENGTH, 33, 65];
408
- if (!validLengths.includes(pending.length)) {
409
- throw new Error(`Invalid public key length ${pending.length}`);
410
- }
411
411
  if (pending.length === ADDRESS_BYTE_LENGTH) {
412
412
  const buf = Buffer.alloc(ADDRESS_BYTE_LENGTH);
413
413
  buf.set(pending);
@@ -33,5 +33,3 @@ Complete documentation for the OPNet Transaction Library - Bitcoin transaction b
33
33
  - [Address Generation](./quantum-support/03-address-generation.md) - All address types
34
34
  - [Message Signing](./quantum-support/04-message-signing.md) - ML-DSA and Schnorr signatures
35
35
  - [Address Verification](./quantum-support/05-address-verification.md) - Validation and type detection
36
- - [Complete Examples](./quantum-support/06-complete-examples.md) - Production-ready code
37
- - [Complete Message Signing Example](./quantum-support/complete-message-signing-example.md) - Full working example with proper typings
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@btc-vision/transaction",
3
3
  "type": "module",
4
- "version": "1.7.23",
4
+ "version": "1.7.24",
5
5
  "author": "BlobMaster41",
6
6
  "description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
7
7
  "engines": {
8
- "node": ">=20.0.0"
8
+ "node": ">=24.0.0"
9
9
  },
10
10
  "exports": {
11
11
  ".": {
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.7.23';
1
+ export const version = '1.7.24';
@@ -51,6 +51,12 @@ export class Address extends Uint8Array {
51
51
  }
52
52
 
53
53
  if (publicKeyOrTweak) {
54
+ // Validate length immediately (cheap check), defer EC operations
55
+ const validLengths = [ADDRESS_BYTE_LENGTH, 33, 65];
56
+ if (!validLengths.includes(publicKeyOrTweak.length)) {
57
+ throw new Error(`Invalid public key length ${publicKeyOrTweak.length}`);
58
+ }
59
+
54
60
  // Store but don't process yet - defer EC operations
55
61
  this.#pendingLegacyKey = new Uint8Array(publicKeyOrTweak.length);
56
62
  this.#pendingLegacyKey.set(publicKeyOrTweak);
@@ -784,10 +790,7 @@ export class Address extends Uint8Array {
784
790
  const pending = this.#pendingLegacyKey;
785
791
  if (!pending) return;
786
792
 
787
- const validLengths = [ADDRESS_BYTE_LENGTH, 33, 65];
788
- if (!validLengths.includes(pending.length)) {
789
- throw new Error(`Invalid public key length ${pending.length}`);
790
- }
793
+ // Length validation already done in constructor
791
794
 
792
795
  if (pending.length === ADDRESS_BYTE_LENGTH) {
793
796
  // 32-byte input: already tweaked x-only, just generate hybrid