Closed SilentCicero closed 5 years ago
Will look into this
@SilentCicero what's this hash?
const hash = '0x87b2d4b93731813f851f44e4a8e98e8e6e3680cc98081ea0c5c4ba4f6948c5a6';
from the doc, it should be data before UTF-8 HEX decoded. Trust will do following: envelope ethereum signed message prefix -> keccak256 -> sign
please check if this comment helps: https://github.com/TrustWallet/trust-wallet-ios/issues/947#issuecomment-453736156
Just tried metamask and Trust iOS, it works for me, note the first parameter is message to sign, not address. If you want to sign string, please wrap it with `web3.toHex("
web3.currentProvider.sendAsync({
method: "personal_sign",
params: ["0x87b2d4b93731813f851f44e4a8e98e8e6e3680cc98081ea0c5c4ba4f6948c5a6", web3.eth.accounts[0]],
}, function(err, signerResult) {
if (err) return console.error(err);
console.log(signerResult);
});
When using
personal_sign
for Ethereum in iOS, TrustWallet states a different 20 byte payload from the 32 byte payload requested to sign. The resulting signature thus does not reduce to the "x19..." + len + hash below.Try to run the example code below to reproduce.