Closed Saqif280 closed 2 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.
π Inspect: https://vercel.com/solana-labs/solana-pay-docs/HVFn3XnpayvM7wNReFheFFhGn2g8
β
Preview: https://solana-pay-docs-git-fork-saqif280-support-wa-9473aa-solana-labs.vercel.app
[Deployment for e29c906 failed]
π Inspect: https://vercel.com/solana-labs/solana-pay/CwYsp1hrdLDZGFGUuvJGfTqQh8Dq
β
Preview: https://solana-pay-git-fork-saqif280-support-wallet-6ee23b-solana-labs.vercel.app
This is a breaking change, and is outdated, so probably won't be included.
Problem Overview
This branch addresses requests in https://github.com/solana-labs/solana-pay/issues/100 to update the Solana Pay protocol specification to support wallet disambiguation in iOS clients and deeplinking to address some security vulnerabilities.
Solution & Decision Log
The open issue proposes several changes; this PR is the first step towards implementing those changes from Solana Pay's end. In addition to this, there will need to be followup PRs to fully close the issue.
Handling the Spec Changes
The issue poster suggested to allow for a url like
https://phantom.app/code?
instead of the current url schemesolana:
. However, the suggested URL has a path, which should be used for therecipient
according to the current protocol spec. There are a few options of how we might want to handle this:recipient
as a query parameter. I'm avoiding this since breaking changes are costly.recipient
in the path, and just parse it out of the end of the wallet URL (in the cases where we use a wallet URL). This is a bit of a rigid solution since it relies on wallet applications registering a wildcard route to handlerecipient
in the path. The parsing also feels a little hacky to me, so Iβm not a fan of this one.recipient
query parameter. This will be encoded in the URL when a wallet is provided, otherwise it will default to puttingrecipient
in the path. This solution is backwards compatible and flexible so I decided to implement this.Supporting Wallet Disambiguation
This solution creates a TypeScript enum for tracking supported wallets called
SupportedWallet
. Wallets can create PRs to add their wallet and their registered url to this enum. This branch leaves the enum empty for now, which means we can't build much around this until enum entries are added.Testing
encodeURL.test.ts
will need additional tests once supported wallets have been added to theSupportedWallet
enum.Next Steps
request
query param usage). This could be included in this PR but I don't have access to the files for these diagrams.