Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12945056
D13694.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Subscribers
None
D13694.id.diff
View Options
diff --git a/cashtab/package-lock.json b/cashtab/package-lock.json
--- a/cashtab/package-lock.json
+++ b/cashtab/package-lock.json
@@ -29,6 +29,7 @@
"bignumber.js": "^9.0.0",
"bip39": "^3.0.2",
"bip66": "^1.1.5",
+ "bitcoinjs-message": "^2.2.0",
"browserslist": "^4.18.1",
"bs58": "^4.0.1",
"buffer": "^6.0.3",
@@ -95,8 +96,7 @@
"webpack-dev-server": "^4.6.0",
"webpack-manifest-plugin": "^4.0.2",
"wif": "^2.0.6",
- "workbox-webpack-plugin": "^6.4.1",
- "xecjs-message": "^1.0.6"
+ "workbox-webpack-plugin": "^6.4.1"
},
"devDependencies": {
"eslint-plugin-etc": "2.0.2",
@@ -5863,6 +5863,11 @@
"node": ">=4.5.0"
}
},
+ "node_modules/bech32": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz",
+ "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ=="
+ },
"node_modules/bfj": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/bfj/-/bfj-7.0.2.tgz",
@@ -6002,6 +6007,22 @@
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
"integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="
},
+ "node_modules/bitcoinjs-message": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/bitcoinjs-message/-/bitcoinjs-message-2.2.0.tgz",
+ "integrity": "sha512-103Wy3xg8Y9o+pdhGP4M3/mtQQuUWs6sPuOp1mYphSUoSMHjHTlkj32K4zxU8qMH0Ckv23emfkGlFWtoWZ7YFA==",
+ "dependencies": {
+ "bech32": "^1.1.3",
+ "bs58check": "^2.1.2",
+ "buffer-equals": "^1.0.3",
+ "create-hash": "^1.1.2",
+ "secp256k1": "^3.0.1",
+ "varuint-bitcoin": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
"node_modules/bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@@ -19826,21 +19847,6 @@
}
}
},
- "node_modules/xecjs-message": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/xecjs-message/-/xecjs-message-1.0.6.tgz",
- "integrity": "sha512-sRHNHr+YoiEqSgv9VsEaV7au2uAYJ9usnGJ2fFxqOVZrufL5ZlAgsXQ48UNw3RFwvjvobZlahGQ3JMZ4b8spFA==",
- "dependencies": {
- "buffer-equals": "^1.0.3",
- "create-hash": "^1.1.2",
- "ecashaddrjs": "^1.0.7",
- "secp256k1": "^3.0.1",
- "varuint-bitcoin": "^1.0.1"
- },
- "engines": {
- "node": ">=0.10"
- }
- },
"node_modules/xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
@@ -24017,6 +24023,11 @@
"resolved": "https://registry.npmjs.org/bc-bip68/-/bc-bip68-1.0.5.tgz",
"integrity": "sha512-GzaMlN7pNthrY5BhReVhnfr4Ixx+GUSfyNRHYh0QiMUF0d0+0YaD8MpEdv6AjFBksg/zlqL1fVCBBm6PpTt2Rg=="
},
+ "bech32": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz",
+ "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ=="
+ },
"bfj": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/bfj/-/bfj-7.0.2.tgz",
@@ -24134,6 +24145,19 @@
}
}
},
+ "bitcoinjs-message": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/bitcoinjs-message/-/bitcoinjs-message-2.2.0.tgz",
+ "integrity": "sha512-103Wy3xg8Y9o+pdhGP4M3/mtQQuUWs6sPuOp1mYphSUoSMHjHTlkj32K4zxU8qMH0Ckv23emfkGlFWtoWZ7YFA==",
+ "requires": {
+ "bech32": "^1.1.3",
+ "bs58check": "^2.1.2",
+ "buffer-equals": "^1.0.3",
+ "create-hash": "^1.1.2",
+ "secp256k1": "^3.0.1",
+ "varuint-bitcoin": "^1.0.1"
+ }
+ },
"bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@@ -34203,18 +34227,6 @@
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
"requires": {}
},
- "xecjs-message": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/xecjs-message/-/xecjs-message-1.0.6.tgz",
- "integrity": "sha512-sRHNHr+YoiEqSgv9VsEaV7au2uAYJ9usnGJ2fFxqOVZrufL5ZlAgsXQ48UNw3RFwvjvobZlahGQ3JMZ4b8spFA==",
- "requires": {
- "buffer-equals": "^1.0.3",
- "create-hash": "^1.1.2",
- "ecashaddrjs": "^1.0.7",
- "secp256k1": "^3.0.1",
- "varuint-bitcoin": "^1.0.1"
- }
- },
"xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
diff --git a/cashtab/package.json b/cashtab/package.json
--- a/cashtab/package.json
+++ b/cashtab/package.json
@@ -24,6 +24,7 @@
"bignumber.js": "^9.0.0",
"bip39": "^3.0.2",
"bip66": "^1.1.5",
+ "bitcoinjs-message": "^2.2.0",
"browserslist": "^4.18.1",
"bs58": "^4.0.1",
"buffer": "^6.0.3",
@@ -90,8 +91,7 @@
"webpack-dev-server": "^4.6.0",
"webpack-manifest-plugin": "^4.0.2",
"wif": "^2.0.6",
- "workbox-webpack-plugin": "^6.4.1",
- "xecjs-message": "^1.0.6"
+ "workbox-webpack-plugin": "^6.4.1"
},
"scripts": {
"start": "node scripts/start.js",
diff --git a/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js b/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js
--- a/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js
+++ b/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js
@@ -31,8 +31,9 @@
import { PlusSquareOutlined } from '@ant-design/icons';
import { currency, parseAddressForParams } from 'components/Common/Ticker.js';
import { isValidXecAddress, isValidEtokenAddress } from 'utils/validation';
-import xecMessage from 'xecjs-message';
+import xecMessage from 'bitcoinjs-message';
import * as utxolib from '@bitgo/utxo-lib';
+import cashaddr from 'ecashaddrjs';
const Wrapper = styled.div`
.ant-collapse {
@@ -107,7 +108,12 @@
// Now you can get the local signature
const messageSignature = xecMessage
- .sign(msgToSign, privKey, keyPair.compressed)
+ .sign(
+ msgToSign,
+ privKey,
+ keyPair.compressed,
+ utxolib.networks.ecash.messagePrefix,
+ )
.toString('base64');
setMessageSignature(messageSignature);
@@ -141,8 +147,9 @@
try {
verification = xecMessage.verify(
messageVerificationMsg,
- messageVerificationAddr,
+ cashaddr.toLegacy(messageVerificationAddr),
messageVerificationSig,
+ utxolib.networks.ecash.messagePrefix,
);
} catch (err) {
errorNotification(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 17:37 (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5082786
Default Alt Text
D13694.id.diff (7 KB)
Attached To
D13694: [Cashtab] Replace xecjs-message with bitcoinjs-message
Event Timeline
Log In to Comment