From ff7b980143fb901f0d2228196111e94b6c81e6b1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 21 Jun 2016 17:13:02 -0700 Subject: Fix eth sign with dennis' test input --- app/scripts/lib/id-management.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'app') 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') } + -- cgit