mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
add hash
This commit is contained in:
parent
2ed8237350
commit
8a85668019
@ -43,12 +43,12 @@ export class SignatureUtils {
|
|||||||
publicKey: string,
|
publicKey: string,
|
||||||
password?: string
|
password?: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
const hash = this.web3.utils.utf8ToHex(text)
|
||||||
const isMetaMask =
|
const isMetaMask =
|
||||||
this.web3 &&
|
this.web3 &&
|
||||||
this.web3.currentProvider &&
|
this.web3.currentProvider &&
|
||||||
(this.web3.currentProvider as any).isMetaMask
|
(this.web3.currentProvider as any).isMetaMask
|
||||||
try {
|
try {
|
||||||
const hash = this.web3.utils.utf8ToHex(text)
|
|
||||||
return await this.web3.eth.personal.sign(hash, publicKey, password)
|
return await this.web3.eth.personal.sign(hash, publicKey, password)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (isMetaMask) {
|
if (isMetaMask) {
|
||||||
@ -57,7 +57,7 @@ export class SignatureUtils {
|
|||||||
this.logger.warn('Error on personal sign.')
|
this.logger.warn('Error on personal sign.')
|
||||||
this.logger.warn(e)
|
this.logger.warn(e)
|
||||||
try {
|
try {
|
||||||
return await this.web3.eth.sign(text, publicKey)
|
return await this.web3.eth.sign(hash, publicKey)
|
||||||
} catch (e2) {
|
} catch (e2) {
|
||||||
this.logger.error('Error on sign.')
|
this.logger.error('Error on sign.')
|
||||||
this.logger.error(e2)
|
this.logger.error(e2)
|
||||||
|
Loading…
Reference in New Issue
Block a user