mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Improved signature helper using fallback non-personal sign method.
This commit is contained in:
parent
51aa0fbf64
commit
4f28092014
@ -7,10 +7,17 @@ export async function signText(text: string, publicKey: string, password?: strin
|
|||||||
try {
|
try {
|
||||||
return await web3.eth.personal.sign(text, publicKey, password)
|
return await web3.eth.personal.sign(text, publicKey, password)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Logger.error("Error on personal sign.")
|
||||||
Logger.error(e)
|
Logger.error(e)
|
||||||
|
try {
|
||||||
|
return await web3.eth.sign(text, publicKey, password)
|
||||||
|
} catch(e2) {
|
||||||
|
Logger.error("Error on sign.")
|
||||||
|
Logger.error(e2)
|
||||||
throw new Error("Error executing personal sign")
|
throw new Error("Error executing personal sign")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function verifyText(text: string, signature: string): Promise<string> {
|
export async function verifyText(text: string, signature: string): Promise<string> {
|
||||||
const web3 = Web3Provider.getWeb3()
|
const web3 = Web3Provider.getWeb3()
|
||||||
|
Loading…
Reference in New Issue
Block a user