fix(@desktop/browser): Unable to sign message from simepledapp.eth

This commit is contained in:
Khushboo Mehta 2022-04-05 17:45:01 +02:00 committed by Khushboo-dev-cpp
parent 6dec2eaaf1
commit d2663d30a5
3 changed files with 9 additions and 19 deletions

View File

@ -9,15 +9,9 @@ type
const postMessageTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} = const postMessageTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
let arg = decode[PostMessageTaskArg](argEncoded) let arg = decode[PostMessageTaskArg](argEncoded)
let jsonMessage = arg.message.parseJson let result = status_go_provider.providerRequest(arg.requestType, arg.message).result
let password = jsonMessage{"payload"}{"password"}.getStr
if password != "":
let hashedPassword = hashPassword(password)
jsonMessage["payload"]["password"] = newJString(hashedPassword)
let result = status_go_provider.providerRequest(arg.requestType, $jsonMessage).result
let responseJson = %* { let responseJson = %* {
"payloadMethod": arg.payloadMethod, "payloadMethod": arg.payloadMethod,
"result": $result, "result": $result,
} }
arg.finish(responseJson) arg.finish(responseJson)

View File

@ -45,15 +45,10 @@ QtObject {
} }
} catch (e) { } catch (e) {
if (Utils.isInvalidPasswordMessage(e.message)){
//% "Wrong password"
sendDialog.transactionSigner.validationError = qsTrId("wrong-password")
return
}
if (isTx) { if (isTx) {
showSendingError(e.message) showSendingError(e.message)
} else if (isSign) { } else if (isSign) {
showSigningError(e.message) showSigningError(e.message.message)
} }
} }
} }

View File

@ -724,15 +724,16 @@ QtObject {
.replace(/'/g, "'"); .replace(/'/g, "'");
} }
// Leave this function at the bottom of the file as QT Creator messes up the code color after this
function isPunct(c) {
return /(!|\@|#|\$|%|\^|&|\*|\(|\)|_|\+|\||-|=|\\|{|}|[|]|"|;|'|<|>|\?|,|\.|\/)/.test(c)
}
function isInvalidPasswordMessage(msg) { function isInvalidPasswordMessage(msg) {
return ( return (
msg.includes("could not decrypt key with given password") || msg.includes("could not decrypt key with given password") ||
msg.includes("invalid password") msg.includes("invalid password")
); );
} }
// Leave this function at the bottom of the file as QT Creator messes up the code color after this
function isPunct(c) {
return /(!|\@|#|\$|%|\^|&|\*|\(|\)|_|\+|\||-|=|\\|{|}|[|]|"|;|'|<|>|\?|,|\.|\/)/.test(c)
}
} }