-
Notifications
You must be signed in to change notification settings - Fork 531
Open
Description
Edit: The information below is no longer up-to-date. A current version of the proposed changes can be viewed at #169.
All feedback is appreciated. I can be reached on telegram @samhogan.
Original Issue
Solana Pay should support message signing via HTTP request. The following is an attempt to summarize how a dapp can request that a wallet sign a message via Solana Pay.
The flow is as follows:
- The user scans a QR code or taps NFC.
- The wallet parses the link from the QR code and makes a GET and POST request in accordance with the Solana Pay transaction request specification.
- The server responds with the following fields in the request body:
The<data>field is the data that will be signed. It must be a base64-encoded value adhering to the Proposal for off-chain message signing solana#26915 specification once it is finalized.
The<state>field is a MAC that the wallet will pass back to the server in order to verify that the contents of the<data>field were not modified before signing.
The<message>field is an optional UTF-8 string value to display to the user.
{
"data": "aGVyZS1pcy1hLW1lc3NhZ2UtdG8tc2lnbg==",
"state": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduYXjF9.43WZK82a_sGU-ImVvCUnMJmNprs6Fe30pm0",
"message": "Login with Solana Pay"
}- The wallet displays the message and asks the user if they would like to sign the data.
- If the user signs the data, the wallet makes a second POST request to the same url with the following fields in the request body:
The<account>field is the base-58 encoded value of the user's public key
The<state>field is the same as the<state>field from the first POST request response body. It should be returned to the server unmodified.
The<signature>field is the base-58 encoded signature from signing the<data>field with the users private key
{
"account": "C9uYZinjZmmqxaF7FENdmzMVMuNVqRkKHXpbmd933W98",
"state": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduYXjF9.43WZK82a_sGU-ImVvCUnMJmNprs6Fe30pm0",
"signature": "CUghXMN18pTQPoxm9zmrQY1PQXctp3xrGHpXxSJd1UYkRcBQBaUetZwKuc57VgjwjH7cC1Zbm6t1Zz1WJkVBMnW"
}- The dapp server will decode the
<state>field to ensure that it has not changed and then attempt to verify the<signature>against the content from the<state>field and<account>field. If the signature is verified, the server knows that the wallet controls the private key for the<account>.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels