TronLink / tronlink-extension

TronLink Chrome Extension
1 stars 3 forks source link

different signing message protocols? #283

Open ghost opened 4 years ago

ghost commented 4 years ago

I am writing a web application. I have noticed, that desktop web application (tronlink-extension) and mobile web application (android application) produces different signed messages for the exact same data, though I use the same interface TronWeb.Trx.signString!

const TronWeb = require('tronweb');
const tronlinkExtensionSignature = `0xf3777a9e387160c10130d6210d6e9175bc88cdb796dccb6038129a79a48d40e524d0a78bc3c8daabd17701cd565d58f8ab362d6af0cae9e282b1dd347dd2272d1b`
const androidAppSignature = `0x419910d2339370b119ae773169607984cebc5ba7276240ca91bda5b2e1a42246209c78be0cdb639ec8ead81303623ca55117cd1d792f11fe60a9d0854ae1fb311b`

console.log(TronWeb.Trx.verifySignature('0x16fab5ce271', 'TTCS21ZpzEuy9wxbR6A6qY9Xvn8jtpaegP', androidAppSignature)) //false
console.log(TronWeb.Trx.verifySignature('0x16fab5ce271', 'TTCS21ZpzEuy9wxbR6A6qY9Xvn8jtpaegP', tronlinkExtensionSignature)) //true

private key being used: 9ad9454f756095f6b97746a7017c24d4ca3d899c0a613d497ae1d90455e88dbc

It seems, that tronlink extension expects a message in a format \x19TRON Signed Message:\n32<keccak256(message)>. But it's not clear for me, which protocol the Android application uses to sign messages.

CQBinh commented 4 years ago

I met the same issue with tronlink ios app