aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ts/0x.js.ts6
-rw-r--r--src/ts/globals.d.ts7
-rw-r--r--src/ts/utils/assert.ts2
3 files changed, 7 insertions, 8 deletions
diff --git a/src/ts/0x.js.ts b/src/ts/0x.js.ts
index d189b48b1..a3a83670d 100644
--- a/src/ts/0x.js.ts
+++ b/src/ts/0x.js.ts
@@ -20,10 +20,10 @@ export class ZeroEx {
* Verifies that the elliptic curve signature `signature` was generated
* by signing `data` with the private key corresponding to the `signer` address.
*/
- public static isValidSignature(dataHex: string, signature: ECSignature, signer: ETHAddressHex): boolean {
+ public static isValidSignature(dataHex: string, signature: ECSignature, signerAddress: string): boolean {
assert.isHexString('dataHex', dataHex);
assert.doesConformToSchema('signature', signature, ECSignatureSchema);
- assert.isETHAddressHex('signer', signer);
+ assert.isETHAddressHex('signerAddress', signerAddress);
const dataBuff = ethUtil.toBuffer(dataHex);
const msgHashBuff = ethUtil.hashPersonalMessage(dataBuff);
@@ -33,7 +33,7 @@ export class ZeroEx {
ethUtil.toBuffer(signature.r),
ethUtil.toBuffer(signature.s));
const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
- return retrievedAddress === signer;
+ return retrievedAddress === signerAddress;
} catch (err) {
return false;
}
diff --git a/src/ts/globals.d.ts b/src/ts/globals.d.ts
index 58efe136a..1e502b061 100644
--- a/src/ts/globals.d.ts
+++ b/src/ts/globals.d.ts
@@ -1,5 +1,3 @@
-declare type ETHPublicKey = string;
-declare type ETHAddressHex = string;
declare type ETHAddressBuff = Buffer;
declare interface Schema {
@@ -10,6 +8,7 @@ declare module 'ethereumjs-util' {
const toBuffer: (dataHex: string) => Buffer;
const hashPersonalMessage: (msg: Buffer) => Buffer;
const bufferToHex: (buff: Buffer) => string;
- const ecrecover: (msgHashBuff: Buffer, v: number, r: Buffer, s: Buffer) => ETHPublicKey;
- const pubToAddress: (pubKey: ETHPublicKey) => ETHAddressBuff;
+ const ecrecover: (msgHashBuff: Buffer, v: number, r: Buffer, s: Buffer) => string;
+ const pubToAddress: (pubKey: string) => ETHAddressBuff;
+ const isValidAddress: (address: string) => boolean;
}
diff --git a/src/ts/utils/assert.ts b/src/ts/utils/assert.ts
index 58182dac0..509590ee6 100644
--- a/src/ts/utils/assert.ts
+++ b/src/ts/utils/assert.ts
@@ -17,7 +17,7 @@ export const assert = {
this.assert(_.isString(value) && HEX_REGEX.test(value),
this.typeAssertionMessage(variableName, 'HexString', value));
},
- isETHAddressHex(variableName: string, value: ETHAddressHex) {
+ isETHAddressHex(variableName: string, value: string) {
const web3 = new Web3();
this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
},