aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.js.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/0x.js.ts')
-rw-r--r--src/0x.js.ts14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts
index 8f1178b2a..f275d9fbd 100644
--- a/src/0x.js.ts
+++ b/src/0x.js.ts
@@ -40,19 +40,7 @@ export class ZeroEx {
assert.doesConformToSchema('signature', signature, ecSignatureSchema);
assert.isETHAddressHex('signerAddressHex', signerAddressHex);
- const dataBuff = ethUtil.toBuffer(dataHex);
- 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 === signerAddressHex;
- } catch (err) {
- return false;
- }
+ return utils.isValidSignature(dataHex, signature, signerAddressHex);
}
/**
* Generates pseudo-random 256 bit salt.