-
Notifications
You must be signed in to change notification settings - Fork 1k
[WIP] 1.0.0 #1097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[WIP] 1.0.0 #1097
Conversation
I have a question—after making this change, it means that signMessage now has two different implementations (Phantom's implementation and Ledger's implementation). When a dApp verifies the result of signMessage, does it need to support both for compatibility? |
Ideally every wallet should move to the Offchain Message Signing Spec @ByteZhang1024. |
|
…igning) (#1094) * Update OffChainMessageSigning to latest Anza spec and Ledger release * Fix version parsing issue * Throw a more descriptive error message
* Change return type * Address comments
d5e55c5
to
dcfa013
Compare
I originally envisioned two possible approaches: All wallet implementations of signMessage should move to the Offchain Message Signing Spec going forward. Introduce a new method to help wallets and dApps transition gradually, with the eventual deprecation of signMessage. That's why I submitted another Issue, but it looks like we've decided to go with option one. So that Issue can probably be closed: anza-xyz/wallet-standard#81 |
Important to note that the Ledger implementation in this PR is using
This is a poorly designed part of the spec, IMO, and I disagree with all of it. It's an off-chain message. Referencing an on-chain thing is unnecessary and antithetical. The spec also recommends that wallets display this value to users. Displaying a base58 pubkey of a Solana program that the user certainly will not recognize is useless and bad. My recommendation to implementing wallets and apps:
|
I might be late to the discussion but IMO wallets will not and should not convert the dApp's message to an OCMSF message (at least for foreseeable future), because as soon as they do, any dApp that does not verify the Until now, the only way to implement this was by implementing the Wallet Standard directly, and I don't think a lot of dApps do that. They might start doing it (and they should) with the release of the adapter v1.0.0 but it will take time until everybody upgrades since this is a breaking change and not just an From the adapter's perspective, this is a breaking change that won't affect dApps until they upgrade the library, but as soon as wallets change how the |
@vsakos are you saying that apps should special case when the user tries to sign with a Ledger-imported account? (Otherwise, Ledger will reject the signature request due to incorrect formatting—it only accepts OCMSF messages now.) If that's not the case, the ecosystem won't have Ledger support for off-chain signatures for quite some time. Another question I'm wondering about—what major apps are currently using the message signing flow? My understanding is that not many teams have adopted it yet, since doing so currently excludes Ledger users, who represent a significant group. |
@vsakos Not too late, and it's good to highlight this problem. Apps AND wallets, whether using Wallet Adapter or the Wallet Standard, are going to have to make changes to handle Ledger-signed messages, no matter what. To illustrate this, here are the set of possible outcomes I see:
My takeaways from this: In the near term, wallets SHOULD NOT convert messages to OCMSF unless they are signing with a Ledger account. This does leak information about the nature of the account if it's a Ledger account, but it means that most calls to This implies that apps also SHOULD NOT convert messages to OCMSF, because they don't know if they are signing with a Ledger account or not, and they don't know if a given wallet supports OCMSF. Apps SHOULD expect that wallets may have converted the message to OCMSF, so if they don't get a |
I was asked by someone what the recommendations for wallets are:
This does leave an open question: what should wallets do with their
While I think this is unnecessarily hacky for Wallet Adapter to do, because we have to make other changes to format and verify messages anyway and we can publish multiple versions, it's actually a decent option for wallets with an existing Apps will still need to make changes and should use Wallet Adapter 1.x to do so. |
For me it still makes sense to keep the wallet side as-is (sign the whole payload and return the signature), basically this:
I do not agree that it will fail since the signing is (and should always be) handled in Uint8Array and UTF-8 is strictly for the UI. If the app sends a correct OCMSF payload (just the message, not the whole Apps would have to change their logic anyway if they want to support Ledger users (either by formatting to OCMSF before signing or sending the base message but then verifying if the returned OCMSF is allright), but if for some reason they do not implement any of this, the base signing would still work without Ledger support. Now, my recommendation would be to keep |
There is no guarantee or mechanism to enforce that a wallet will not modify the message before signing, just as with We may want to take this approach now with some of the other methods as well for 1.0.0 if it makes sense to: a longer-term goal is to get everyone using the Standard and phase Wallet Adapter out (e.g. @solana/kit, fka web3js 2.x, supports the Wallet Standard and will not support Wallet Adapter which is coupled to web3.js 1.x). For example, it's been requested to add For |
A related data point -- the Mobile Wallet Adapter protocol returns a payload of |
We at the OneKey team offer both hardware and software wallets, so I’d like to share our perspective as well. About
|
@ByteZhang1024 I want to address this first before coming back to the rest of the ideas here. I'm not sure I understand why it would help to have an optional Wallets can add a separate As a result, I'm still not sure why this would be necessary, because the reality is that apps who want to do Ledger signing are going to have to be liberal in what they sign AND liberal in what they verify, because they simply cannot know for sure what a given wallet implementation will do, or if it even supports Ledger devices at all. The most flexible thing for them to do is to NOT convert messages to OCMSF, see what the wallet does with them, and verify accordingly. As an example for why I think this is valuable -- Right now, we just have Ledger devices supporting OCMSF, displaying via restricted ASCII, and (maybe) blind signing for UTF-8. But nothing precludes Ledger or a different wallet from displaying longer messages in UTF-8 in the future for various reasons (e.g., perhaps for an EIP-712 type of format). The app has no way of knowing what type of device the account is on before encoding the message, but the wallet can and usually would know this. This leaves the wallet in generally the best position to do the encoding, unless the app knows specifically what the wallet supports AND wants to be restrictive about the encoding it accepts. I think restrictiveness is an anti-goal for apps right now -- they just want signing of very basic messages, or SIWS messages, to work minimally in the broadest set of places. |
We are preparing the release of Wallet Adapter v1.0.0
This will be the first major breaking change of Wallet Adapter in a long time, and may require small code changes in applications.
signMessage
to support the Solana Off-Chain Message Signing Format specification, allowing signing with Ledger devices (Update LedgerAdapter to latest Solana Ledger App (to enable message signing) #1094 / feat: add ledger signMessage #1047)There are some things TBD (feel free to suggest others)
signAndSendAllTransactions
(WIP of signAndSendTransaction + signAndSendAllTransactions API #841 / signAndSendTransaction + signAndSendAllTransactions API #889)WalletName
generic (Remove genericName
parameter of WalletAdapterProps #560)Release checklist (will add more steps/detail as we go)
master
master
@solana/wallet-standard-wallet-adapter-base
to be 1.0.0-compatible (will require a breaking change of that package)@solana-mobile/wallet-adapter-mobile
to be 1.0.0-compatible (will require a breaking change of that package)