diff --git a/CHANGELOG.md b/CHANGELOG.md index 5adff53e..d87c3a7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ ## Unreleased -## 3.10.0 (2026-06-13) - +- added: Support the `-wif:` protohandler prefix (e.g. `bch-wif:`) in `parseUri` so CashStamps private keys can be swept. - changed: Convert the build tooling from Yarn to npm. - changed: Replace git dependencies (ecpair, groestl-hash-js, bs58grscheck) with @edge.app-scoped npm packages so installs no longer require git/SSH access. - security: Upgrade dependencies per Socket security recommendations. +## 3.10.0 (2026-06-13) + ## 3.9.0 (2026-03-10) diff --git a/src/common/plugin/CurrencyTools.ts b/src/common/plugin/CurrencyTools.ts index 4cec6c8c..53c84279 100644 --- a/src/common/plugin/CurrencyTools.ts +++ b/src/common/plugin/CurrencyTools.ts @@ -107,6 +107,16 @@ export function makeCurrencyTools( }, async parseUri(uri: string): Promise { + // CashStamps and similar paper-wallet tools prefix a WIF private key with + // a "-wif:" protohandler (e.g. "bch-wif:"). Strip it so the + // bare WIF is handled by the private-key detection in parsePathname. The + // prefix is derived from the wallet's own currency code, so it can only + // ever match this coin. + const wifPrefix = `${currencyInfo.currencyCode.toLowerCase()}-wif:` + if (uri.toLowerCase().startsWith(wifPrefix)) { + uri = uri.slice(wifPrefix.length) + } + const isGateway = uri .toLocaleLowerCase() .startsWith(`${coinInfo.name}://`) diff --git a/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoincash.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoincash.ts index b7535bcc..60d1dff0 100644 --- a/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoincash.ts +++ b/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoincash.ts @@ -264,6 +264,27 @@ export const bitcoincash: FixtureType = { metadata: {}, privateKeys: ['5JJY5LkdXsRSh1X2pLMezk3f11wHkSBJM1AmJ6zKJyzJtQnAe3F'] } + ], + 'bch-wif protohandler - Compressed': [ + 'bch-wif:L5FyMaAPJGqivZmCzFAEATptdvgha4UqwVWbLLZgr5iLGtQRo4x2', + { + metadata: {}, + privateKeys: ['L5FyMaAPJGqivZmCzFAEATptdvgha4UqwVWbLLZgr5iLGtQRo4x2'] + } + ], + 'bch-wif protohandler - Non Compressed': [ + 'bch-wif:5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF', + { + metadata: {}, + privateKeys: ['5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF'] + } + ], + 'bch-wif protohandler - Uppercase prefix': [ + 'BCH-WIF:L5FyMaAPJGqivZmCzFAEATptdvgha4UqwVWbLLZgr5iLGtQRo4x2', + { + metadata: {}, + privateKeys: ['L5FyMaAPJGqivZmCzFAEATptdvgha4UqwVWbLLZgr5iLGtQRo4x2'] + } ] }, encodeUri: {