consenlabs / webview

WebView utils for imToken application v2.
MIT License
9 stars 11 forks source link

implemented signRaw method on imToken was: How to sign message? #24

Closed paulvi closed 2 years ago

paulvi commented 2 years ago

Bug report

It looks like it is not possible to use this project for signing message

https://polkadot.js.org/docs/extension/cookbook/

image

When using snippet from the reference

// We arbitraily select the first account returned from the above snippet
// `account` is of type InjectedAccountWithMeta 
const account = allAccount[0];

// to be able to retrieve the signer interface from this account
// we can use web3FromSource which will return an InjectedExtension type
const injector = await web3FromSource(account.meta.source);

// this injector object has a signer and a signRaw method
// to be able to sign raw bytes
const signRaw = injector?.signer?.signRaw;

if (!!signRaw) {
    // after making sure that signRaw is defined
    // we can use it to sign our message
    const { signature } = await signRaw({
        account.address,
        data: stringToHex('message to sign'),
        type: 'bytes'
    });
}

Within mobile app, there is no response from wallet.

Version & Environment

Behaviour and expectations

The behavior I expect is ... message come to wallet, so wallet start UI interaction

Actual results (or Errors)

No effect, no response.

unix commented 2 years ago

Related discussions: #26