trustwallet / wallet-core

Cross-platform, cross-blockchain wallet library.
https://developer.trustwallet.com/wallet-core
Apache License 2.0
2.84k stars 1.59k forks source link

How to sign message in iOS & Android APP? #2963

Closed Olive-l closed 1 year ago

Olive-l commented 1 year ago

[1] Describe the requirement I'm developing an APP, which wanna use the wallet to login the app. So I need to sign a message to send to our backend service, to verify the wallet address it's valid or not.

[2] To Reproduce In web-js, to do the validation by blow code: sign = await this.provider.request({ method: 'personal_sign', params: [message, publicKey],

[3] Expected behavior in iOS I want to do the same thing as web-js in iOS & Android APP. Is there any solution about this???

[4] additional remarks I checked the API in iOS wallet-core SDK, it's only one object named "AnySigner" related with Sign. But can't do the 'personal_sign' thing.

Milerius commented 1 year ago

[1] Describe the requirement I'm developing an APP, which wanna use the wallet to login the app. So I need to sign a message to send to our backend service, to verify the wallet address it's valid or not.

[2] To Reproduce In web-js, to do the validation by blow code: sign = await this.provider.request({ method: 'personal_sign', params: [message, publicKey],

[3] Expected behavior in iOS I want to do the same thing as web-js in iOS & Android APP. Is there any solution about this???

[4] additional remarks I checked the API in iOS wallet-core SDK, it's only one object named "AnySigner" related with Sign. But can't do the 'personal_sign' thing.

Hello @Olive-l we support message signing on few blockchains at the moment.

Please let me know if u have any other questions

Olive-l commented 1 year ago

@Milerius Thanks much for your reply. New question is, I can't find the class: EthereumMessageSigner or BitcoinMessageSigner in my TrustWalletCore SDK.

I used pod to import the SDK, and the SDK version of iOS is 3.0.4.

Olive-l commented 1 year ago

I've updated the SDK version, and it fixed very well. thanks a lot! @Milerius

Milerius commented 1 year ago

You're welcome @Olive-l !