aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-06-22 08:13:02 +0800
committerDan Finlay <dan@danfinlay.com>2016-06-22 08:13:02 +0800
commitff7b980143fb901f0d2228196111e94b6c81e6b1 (patch)
treea53586158e9624ca6bc86e8edf9c59105929d9a3 /app/scripts/lib
parent03550b7e9a8462947a681d57d1ab15a0f596366d (diff)
downloadtangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.tar
tangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.tar.gz
tangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.tar.bz2
tangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.tar.lz
tangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.tar.xz
tangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.tar.zst
tangerine-wallet-browser-ff7b980143fb901f0d2228196111e94b6c81e6b1.zip
Fix eth sign with dennis' test input
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/id-management.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/scripts/lib/id-management.js b/app/scripts/lib/id-management.js
index 30ea866f4..cc50bd649 100644
--- a/app/scripts/lib/id-management.js
+++ b/app/scripts/lib/id-management.js
@@ -69,10 +69,12 @@ function padWithZeroes (number, length) {
}
function concatSig (v, r, s) {
- r = padWithZeroes(ethUtil.fromSigned(r), 64)
- s = padWithZeroes(ethUtil.fromSigned(s), 64)
- r = ethUtil.stripHexPrefix(r.toString('hex'))
- s = ethUtil.stripHexPrefix(s.toString('hex'))
- v = ethUtil.stripHexPrefix(ethUtil.intToHex(v))
- return ethUtil.addHexPrefix(r.concat(s, v))
+ const rSig = ethUtil.fromSigned(r)
+ const sSig = ethUtil.fromSigned(s)
+ const vSig = ethUtil.bufferToInt(v)
+ const rStr = padWithZeroes(ethUtil.toUnsigned(rSig).toString('hex'), 64)
+ const sStr = padWithZeroes(ethUtil.toUnsigned(sSig).toString('hex'), 64)
+ const vStr = ethUtil.stripHexPrefix(ethUtil.intToHex(vSig))
+ return ethUtil.addHexPrefix(rStr.concat(sStr, vStr)).toString('hex')
}
+