mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
parent
628c2fc1fc
commit
29c5c8b60e
@ -109,14 +109,18 @@ export class Provider {
|
|||||||
public async signProviderRequest(
|
public async signProviderRequest(
|
||||||
web3: Web3,
|
web3: Web3,
|
||||||
accountId: string,
|
accountId: string,
|
||||||
message: string
|
message: string,
|
||||||
|
password?: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const consumerMessage = web3.utils.soliditySha3({
|
const consumerMessage = web3.utils.soliditySha3({
|
||||||
t: 'bytes',
|
t: 'bytes',
|
||||||
v: web3.utils.utf8ToHex(message)
|
v: web3.utils.utf8ToHex(message)
|
||||||
})
|
})
|
||||||
const consumerSignature = await web3.eth.sign(consumerMessage, accountId)
|
const isMetaMask =
|
||||||
return consumerSignature
|
web3 && web3.currentProvider && (web3.currentProvider as any).isMetaMask
|
||||||
|
if (isMetaMask)
|
||||||
|
return await web3.eth.personal.sign(consumerMessage, accountId, password)
|
||||||
|
else return await web3.eth.sign(consumerMessage, accountId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Encrypt data using the Provider's own symmetric key
|
/** Encrypt data using the Provider's own symmetric key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user