From bdfbfb829b66b57ecb26a053a2b23665c9fd1549 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 7 Jul 2017 14:20:59 -0700 Subject: Remove duplication of 27, 28 v values --- src/0x.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/0x.ts b/src/0x.ts index 837855426..3ff7c830b 100644 --- a/src/0x.ts +++ b/src/0x.ts @@ -225,16 +225,17 @@ export class ZeroEx { // v + r + s OR r + s + v, and different clients (even different versions of the same client) // return the signature params in different orders. In order to support all client implementations, // we parse the signature in both ways, and evaluate if either one is a valid signature. - const ecSignatureVRS = this.parseSignatureHexAsVRS(signature); - if (ecSignatureVRS.v === 27 || ecSignatureVRS.v === 28) { + const validVParamValues = [27, 28]; + const ecSignatureVRS = signatureUtils.parseSignatureHexAsVRS(signature); + if (_.includes(validVParamValues, ecSignatureVRS.v)) { const isValidVRSSignature = ZeroEx.isValidSignature(orderHash, ecSignatureVRS, signerAddress); if (isValidVRSSignature) { return ecSignatureVRS; } } - const ecSignatureRSV = this.parseSignatureHexAsRSV(signature); - if (ecSignatureRSV.v === 27 || ecSignatureRSV.v === 28) { + const ecSignatureRSV = signatureUtils.parseSignatureHexAsRSV(signature); + if (_.includes(validVParamValues, ecSignatureRSV.v)) { const isValidRSVSignature = ZeroEx.isValidSignature(orderHash, ecSignatureRSV, signerAddress); if (isValidRSVSignature) { return ecSignatureRSV; -- cgit v1.2.3