aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-10 06:18:03 +0800
committerFabio Berger <me@fabioberger.com>2017-11-10 06:18:03 +0800
commit62861d1e1315a14e955b30a45db05e7907b0d22d (patch)
tree86077be09b3a9ce41923c44fd57ecede1a94cc1d /src/0x.ts
parent0c8886ad0c0e1cffa7da0495a648028d1fe54476 (diff)
downloaddexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.tar
dexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.tar.gz
dexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.tar.bz2
dexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.tar.lz
dexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.tar.xz
dexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.tar.zst
dexon-sol-tools-62861d1e1315a14e955b30a45db05e7907b0d22d.zip
Move isValidSignature implementation into signatureUtils
Diffstat (limited to 'src/0x.ts')
-rw-r--r--src/0x.ts15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/0x.ts b/src/0x.ts
index cb0090469..59688e948 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -88,19 +88,8 @@ export class ZeroEx {
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
assert.isETHAddressHex('signerAddress', signerAddress);
- const dataBuff = ethUtil.toBuffer(data);
- const msgHashBuff = ethUtil.hashPersonalMessage(dataBuff);
- try {
- const pubKey = ethUtil.ecrecover(
- msgHashBuff,
- signature.v,
- ethUtil.toBuffer(signature.r),
- ethUtil.toBuffer(signature.s));
- const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
- return retrievedAddress === signerAddress;
- } catch (err) {
- return false;
- }
+ const isValidSignature = signatureUtils.isValidSignature(data, signature, signerAddress);
+ return isValidSignature;
}
/**
* Generates a pseudo-random 256-bit salt.