From e1a4c2303a23da0d7b9170628d0ee026fe5137a5 Mon Sep 17 00:00:00 2001 From: David C Goldenberg Date: Sat, 18 Jul 2026 21:15:17 -0400 Subject: [PATCH] Fixed more errors, finalized support to private ED25519 keys to public, and should be up to date with upstream as of Jul18th 2026. --- package-lock.json | 144 ++++++++++++++++++ package.json | 2 +- src/core/config/Categories.json | 2 +- src/core/lib/Bitcoin.mjs | 4 +- .../operations/tests/DecryptKeyStoreFile.mjs | 2 +- .../tests/PublicKeyToP2PKHAddress.mjs | 2 +- tests/operations/tests/SeedToAddress.mjs | 12 +- 7 files changed, 156 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index a8068e3f..ebd61118 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "dependencies": { "@alexaltea/capstone-js": "^3.0.5", "@astronautlabs/amf": "^0.0.6", + "@bitcoinerlab/secp256k1": "^1.2.0", "@blu3r4y/lzma": "^2.3.3", "@noble/hashes": "2.2.0", "@wavesenterprise/crypto-gost-js": "^2.1.0-RC1", @@ -22,6 +23,7 @@ "avsc": "^5.7.9", "bcryptjs": "^3.0.3", "bignumber.js": "^11.1.5", + "bip32": "^5.0.1", "blakejs": "^1.2.1", "bootstrap": "4.6.2", "bootstrap-colorpicker": "^3.4.0", @@ -1839,6 +1841,15 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/@bitcoinerlab/secp256k1": { + "version": "1.2.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/@bitcoinerlab/secp256k1/-/secp256k1-1.2.0.tgz", + "integrity": "sha512-jeujZSzb3JOZfmJYI0ph1PVpCRV5oaexCgy+RvCXV8XlY+XFB/2n3WOcvBsKLsOw78KYgnQrQWb2HrKE4be88Q==", + "license": "MIT", + "dependencies": { + "@noble/curves": "^1.7.0" + } + }, "node_modules/@blu3r4y/lzma": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@blu3r4y/lzma/-/lzma-2.3.3.tgz", @@ -4239,6 +4250,33 @@ "archiver": "^5.3.1" } }, + "node_modules/@noble/curves": { + "version": "1.9.7", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/hashes": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.2.0.tgz", @@ -4574,6 +4612,15 @@ "node": "^20.19.0 || ^22.12.0 || >=23" } }, + "node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@testim/chrome-version": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.1.4.tgz", @@ -5814,6 +5861,12 @@ "dev": true, "license": "MIT" }, + "node_modules/base-x": { + "version": "5.0.1", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/base-x/-/base-x-5.0.1.tgz", + "integrity": "sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg==", + "license": "MIT" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -5929,6 +5982,34 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bip32": { + "version": "5.0.1", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/bip32/-/bip32-5.0.1.tgz", + "integrity": "sha512-PWlHIAgYCfVhwqNpZyeakHXuLAGyN6rEQZnhxHxKI3BoFJRVWLl26455fhRlHsmbYcV986HqtPnt33Edu5sTCw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "^1.2.0", + "@scure/base": "^1.1.1", + "uint8array-tools": "^0.0.8", + "valibot": "^1.2.0", + "wif": "^5.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/bip32/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -6409,6 +6490,37 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bs58": { + "version": "6.0.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/bs58/-/bs58-6.0.0.tgz", + "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", + "license": "MIT", + "dependencies": { + "base-x": "^5.0.0" + } + }, + "node_modules/bs58check": { + "version": "4.0.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/bs58check/-/bs58check-4.0.0.tgz", + "integrity": "sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "^1.2.0", + "bs58": "^6.0.0" + } + }, + "node_modules/bs58check/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/bson": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/bson/-/bson-7.3.1.tgz", @@ -17799,6 +17911,15 @@ "integrity": "sha512-w+VZSp8hSZ/xWZfZNMppWNF6iqY+dcMYtG5CpwRDgxi94HIE6ematSdkzHGzVC4SDEaTsG65zrajN+oKoWG6ew==", "license": "MIT" }, + "node_modules/uint8array-tools": { + "version": "0.0.8", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/uint8array-tools/-/uint8array-tools-0.0.8.tgz", + "integrity": "sha512-xS6+s8e0Xbx++5/0L+yyexukU7pz//Yg6IHg3BKhXotg1JcYtgxVcUctQ0HxLByiJzpAkNFawz1Nz5Xadzo82g==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -18066,6 +18187,20 @@ "node": ">= 0.10" } }, + "node_modules/valibot": { + "version": "1.4.2", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/valibot/-/valibot-1.4.2.tgz", + "integrity": "sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg==", + "license": "MIT", + "peerDependencies": { + "typescript": ">=5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -18602,6 +18737,15 @@ "node": ">=8" } }, + "node_modules/wif": { + "version": "5.0.0", + "resolved": "https://artifacts.mitre.org:443/artifactory/api/npm/node-npm/wif/-/wif-5.0.0.tgz", + "integrity": "sha512-iFzrC/9ne740qFbNjTZ2FciSRJlHIXoxqk/Y5EnE08QOXu1WjJyCCswwDTYbohAOEnlCtLaAAQBhyaLRFh2hMA==", + "license": "MIT", + "dependencies": { + "bs58check": "^4.0.0" + } + }, "node_modules/wildcard": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", diff --git a/package.json b/package.json index 718b7a0b..ecca4ba0 100644 --- a/package.json +++ b/package.json @@ -107,6 +107,7 @@ "avsc": "^5.7.9", "bcryptjs": "^3.0.3", "bignumber.js": "^11.1.5", + "bip32": "^5.0.1", "blakejs": "^1.2.1", "bootstrap": "4.6.2", "bootstrap-colorpicker": "^3.4.0", @@ -116,7 +117,6 @@ "buffer": "^6.0.3", "cbor": "10.0.12", "chi-squared": "^1.1.0", - "chromedriver": "^146.0.1", "codepage": "^1.15.0", "crypto-api": "^0.8.5", "crypto-browserify": "^3.12.1", diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 8de0fe9f..e53a4dbd 100644 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -643,4 +643,4 @@ "Comment" ] } -] \ No newline at end of file +] diff --git a/src/core/lib/Bitcoin.mjs b/src/core/lib/Bitcoin.mjs index be790f58..1914ee4b 100644 --- a/src/core/lib/Bitcoin.mjs +++ b/src/core/lib/Bitcoin.mjs @@ -196,11 +196,11 @@ export function liftX(input) { const four = BigNumber(4); const two = BigNumber(2); - const pHex ="0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"; + const pHex ="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"; const p = BigNumber(pHex, 16); let x; try { - x = BigNumber("0x" + makeSureIsHex(input), 16); + x = BigNumber(makeSureIsHex(input), 16); } catch (TypeError) { return -1; } diff --git a/tests/operations/tests/DecryptKeyStoreFile.mjs b/tests/operations/tests/DecryptKeyStoreFile.mjs index 29c93fdb..6876aa4b 100644 --- a/tests/operations/tests/DecryptKeyStoreFile.mjs +++ b/tests/operations/tests/DecryptKeyStoreFile.mjs @@ -31,7 +31,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [false] + "args": [false, "secp256k1", "Public Key Only"] }, { "op": "Public Key To ETH Style Address", diff --git a/tests/operations/tests/PublicKeyToP2PKHAddress.mjs b/tests/operations/tests/PublicKeyToP2PKHAddress.mjs index 518cdfb5..17be46bd 100644 --- a/tests/operations/tests/PublicKeyToP2PKHAddress.mjs +++ b/tests/operations/tests/PublicKeyToP2PKHAddress.mjs @@ -202,7 +202,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To Bitcoin-Like Address", diff --git a/tests/operations/tests/SeedToAddress.mjs b/tests/operations/tests/SeedToAddress.mjs index d5d72baa..61e09be6 100644 --- a/tests/operations/tests/SeedToAddress.mjs +++ b/tests/operations/tests/SeedToAddress.mjs @@ -68,7 +68,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To Bitcoin-Like Address", @@ -134,7 +134,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To Bitcoin-Like Address", @@ -200,7 +200,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To Bitcoin-Like Address", @@ -266,7 +266,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To Bitcoin-Like Address", @@ -332,7 +332,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To ETH Style Address", @@ -398,7 +398,7 @@ TestRegister.addTests([ }, { "op": "Private EC Key to Public Key", - "args": [true] + "args": [true, "secp256k1", "Public Key Only"] }, { "op": "Public Key To TRX Style Address",