@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 +1 -1
- package/browser/_version.d.ts +1 -1
- package/browser/index.js +15 -10
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/keypair/Address.js +4 -4
- package/documentation/README.md +0 -2
- package/package.json +2 -2
- package/src/_version.ts +1 -1
- package/src/keypair/Address.ts +7 -4
package/README.md
CHANGED
package/browser/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.7.
|
|
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.
|
|
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
|
|
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 (
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
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.
|
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.7.
|
|
1
|
+
export declare const version = "1.7.24";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.7.
|
|
1
|
+
export const version = '1.7.24';
|
package/build/keypair/Address.js
CHANGED
|
@@ -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);
|
package/documentation/README.md
CHANGED
|
@@ -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.
|
|
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": ">=
|
|
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.
|
|
1
|
+
export const version = '1.7.24';
|
package/src/keypair/Address.ts
CHANGED
|
@@ -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
|
-
|
|
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
|