diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-08-25 01:59:37 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-08-25 05:40:00 +0800 |
commit | bb4d449e92da347c305d64fbe1855b13a8db361b (patch) | |
tree | 6668efaf2eada2d930574ffed287f9f96eb57090 /packages | |
parent | 241534a63dab54172326ec71d6b5e78733bb24c6 (diff) | |
download | dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.tar dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.tar.gz dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.tar.bz2 dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.tar.lz dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.tar.xz dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.tar.zst dexon-sol-tools-bb4d449e92da347c305d64fbe1855b13a8db361b.zip |
Test case for Trezor Model T signature
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index a318d1f79..6bc0bbc02 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -465,6 +465,24 @@ describe('MixinSignatureValidator', () => { ); expect(isValidSignature).to.be.true(); }); + + it('should return true when message was signed by a Trezor Model T (firmware version 2.0.7)', async () => { + // messageHash translates to 0x2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b + const messageHash = ethUtil.bufferToHex(ethUtil.toBuffer('++++++++++++++++++++++++++++++++')); + const signer = '0x98ce6d9345e8ffa7d99ee0822272fae9d2c0e895'; + const v = ethUtil.toBuffer('0x1c'); + const r = ethUtil.toBuffer('0x423b71062c327f0ec4fe199b8da0f34185e59b4c1cb4cc23df86cac4a601fb3f'); + const s = ethUtil.toBuffer('0x53810d6591b5348b7ee08ee812c874b0fdfb942c9849d59512c90e295221091f'); + const trezorSignatureType = ethUtil.toBuffer(`0x${SignatureType.Trezor}`); + const signature = Buffer.concat([v, r, s, trezorSignatureType]); + const signatureHex = ethUtil.bufferToHex(signature); + const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync( + messageHash, + signer, + signatureHex, + ); + expect(isValidSignature).to.be.true(); + }); }); describe('setSignatureValidatorApproval', () => { |