From 8a856680190f88b85770be6fb508558279cc6b67 Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Tue, 14 Apr 2020 17:28:50 +0300 Subject: [PATCH] add hash --- src/ocean/utils/SignatureUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ocean/utils/SignatureUtils.ts b/src/ocean/utils/SignatureUtils.ts index 21da9bd..04cf97e 100644 --- a/src/ocean/utils/SignatureUtils.ts +++ b/src/ocean/utils/SignatureUtils.ts @@ -43,12 +43,12 @@ export class SignatureUtils { publicKey: string, password?: string ): Promise { + const hash = this.web3.utils.utf8ToHex(text) const isMetaMask = this.web3 && this.web3.currentProvider && (this.web3.currentProvider as any).isMetaMask try { - const hash = this.web3.utils.utf8ToHex(text) return await this.web3.eth.personal.sign(hash, publicKey, password) } catch (e) { if (isMetaMask) { @@ -57,7 +57,7 @@ export class SignatureUtils { this.logger.warn('Error on personal sign.') this.logger.warn(e) try { - return await this.web3.eth.sign(text, publicKey) + return await this.web3.eth.sign(hash, publicKey) } catch (e2) { this.logger.error('Error on sign.') this.logger.error(e2)