diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-06-17 02:46:35 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-06-17 02:46:35 +0800 |
commit | 408addb1b2a795515149dbde8131fa40cba721f4 (patch) | |
tree | 73421e7b49a1aca972a22f53b39cfb9cd7a6a18e /test | |
parent | 6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d (diff) | |
download | tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.tar tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.tar.gz tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.tar.bz2 tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.tar.lz tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.tar.xz tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.tar.zst tangerine-wallet-browser-408addb1b2a795515149dbde8131fa40cba721f4.zip |
Fixed signing of hashes
Signing now always takes a 64 digit hex string, and returns a message signature which appropriately pads r, s, and v with zeroes.
Need to verify with Denis that this is the behavior he requires.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/id-management-test.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/unit/id-management-test.js b/test/unit/id-management-test.js index ca1f0ffaa..61cdf4d8b 100644 --- a/test/unit/id-management-test.js +++ b/test/unit/id-management-test.js @@ -17,15 +17,17 @@ describe('IdManagement', function() { describe('#signMsg', function () { const address = '0x926cD0393816429a580037475ec23eD65fDC893B' - const message = '0x0987654321abcdef' + const message = '0x96b8d442f4c09a08d266bf37b18219465cfb341c1b3ab9792a6103a93583fdf7' const privateKey = '0xd291f7aa01b94941b446f260bca42c0752762571428ad4ed6239613c66365cf4' - const expectedResult = 'foo' + const expectedResult = '0x04881196121781472543750166203264808665659193717384627772472141185319786561270240926993050673320157359365329096037150419976876479876332927284781689204045461c' const idManagement = new IdManagement() - const exportKeyStub = sinon.stub(idManagement, 'exportPrivateKey', () => privateKey) + const exportKeyStub = sinon.stub(idManagement, 'exportPrivateKey', (addr) => { + assert.equal(addr, address) + return privateKey + }) const result = idManagement.signMsg(address, message) - console.log(result) assert.equal(result, expectedResult) }) }) |