aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-09-27 17:03:54 +0800
committerFabio Berger <me@fabioberger.com>2018-09-27 17:03:54 +0800
commit0591f1d32a4696924d9b063b09ec8a373e6757c7 (patch)
tree18155fe5a4ef127f3ecc11caac80df1fdcce3048 /packages/order-utils/src
parent1402119c840dcb634efd99c02e76007ed013b54a (diff)
downloaddexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.tar
dexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.tar.gz
dexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.tar.bz2
dexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.tar.lz
dexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.tar.xz
dexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.tar.zst
dexon-sol-tools-0591f1d32a4696924d9b063b09ec8a373e6757c7.zip
Add address normalization to isValidECSignature method
Diffstat (limited to 'packages/order-utils/src')
-rw-r--r--packages/order-utils/src/signature_utils.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts
index c0c9e71a7..3b656d3fc 100644
--- a/packages/order-utils/src/signature_utils.ts
+++ b/packages/order-utils/src/signature_utils.ts
@@ -174,6 +174,7 @@ export const signatureUtils = {
assert.isHexString('data', data);
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
assert.isETHAddressHex('signerAddress', signerAddress);
+ const normalizedSignerAddress = signerAddress.toLowerCase();
const msgHashBuff = ethUtil.toBuffer(data);
try {
@@ -184,7 +185,8 @@ export const signatureUtils = {
ethUtil.toBuffer(signature.s),
);
const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
- return retrievedAddress === signerAddress;
+ const normalizedRetrievedAddress = retrievedAddress.toLowerCase();
+ return normalizedRetrievedAddress === normalizedSignerAddress;
} catch (err) {
return false;
}