-
Notifications
You must be signed in to change notification settings - Fork 34
EIP-0028 ErgoAuth #53
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
Open
MrStahlfelge
wants to merge
14
commits into
master
Choose a base branch
from
ergoauth
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2d8c580
EIP-0028 ErgoAuth
MrStahlfelge 4d4cc34
Update eip-0028.md
MrStahlfelge f2cd92b
Apply suggestions from code review
MrStahlfelge a00645a
Update eip-0028.md
MrStahlfelge bd5bfd9
Update eip-0028.md
MrStahlfelge 0a31b3c
Update eip-0028.md
MrStahlfelge ccfe519
Update eip-0028.md
MrStahlfelge a66e9ba
EIP-0028 Add hostname to signed message
MrStahlfelge 9d7e1c2
ErgoAuth: use signingMessage before 0-byte as user prompt, restrict r…
MrStahlfelge 863b29a
ErgoAuth: typo fixed
MrStahlfelge a7a4694
Merge remote-tracking branch 'origin/master' into ergoauth
MrStahlfelge 978372a
EIP-28 support for cold wallets
MrStahlfelge 0a1714c
Merge remote-tracking branch 'origin/master' into ergoauth
MrStahlfelge 5b1eeb1
Clarified middleman prevention addition
MrStahlfelge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| # ErgoAuth: user authentication protocol between wallet applications and dApps | ||
|
|
||
| * Author: @MrStahlfelge | ||
| * Status: Proposed | ||
| * Created: 25-Jan-2022 | ||
| * License: CC0 | ||
| * Forking: not needed | ||
|
|
||
| ## Contents | ||
| - [Description](#description) | ||
| - [Background And Motivation](#background-and-motivation) | ||
| - [ErgoPay Interaction Protocol](#ergoauth-authentication-protocol) | ||
| - [Data Formats](#data-formats) | ||
| - [Implementation in Mobile Wallet](#implementation-in-mobile-wallet) | ||
| - [Implementation in dApp](#implementation-in-dapp) | ||
| - [Benefits for dApps](#benefits-for-dapps) | ||
| - [Benefits for Mobile Wallets](#benefits-for-mobile-wallets) | ||
|
|
||
| ## Description | ||
| This EIP defines a standard for trustless authentication of users of a wallet app and an online | ||
| dApp. | ||
|
|
||
| ## Background And Motivation | ||
|
|
||
| dApps might want to validate if dApp users are really who they pretend to be. This is especially | ||
| useful for dApps that grant certain abilities to holders of special tokens. At the moment, | ||
| proofing that a user owns a token can only be done by sending the token to a depositary address. | ||
MrStahlfelge marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| By sending the token, the user proofed to have access privileges to the token. | ||
| However, sending token around is not always desirable. Especially for valuable tokens, users might | ||
| not want to send it away, and doing two transactions (one to send it to the depositary address, one | ||
| to refund it back) costs both time and transaction fees. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. User can just send a token to himself. And there is no need to submit that transaction either, just to check that the transaction is valid via transaction/check endpoint. |
||
|
|
||
| To overcome this, ErgoAuth proposes a way to authenticate users trustless to have access to certain | ||
| addresses storing a box. The protocol is trustless in both ways: The users don't need to trust | ||
| the dApp, because the dApp does not get access to funds or secrets. The dApp don't need to trust | ||
| the users or the wallet app, because it can validate the authentication keys. | ||
|
|
||
| ## ErgoAuth authentication protocol | ||
|
|
||
| An authentication with ErgoAuth is driven by a dApp that needs to authenticate a user. | ||
|
|
||
| 1) The user enters the necessary information in the dApp's UI for the dApp to know if authentication | ||
| is necessary. For example, users might enter their P2PK address (or, instead of manually entering, | ||
| use ErgoPay to send the address to the dApp automatically). | ||
|
|
||
| 2) The dApp determines that authenticating the user is needed. For this, the dApp prepares a unique | ||
| message that the wallet app should sign with a user's private key, and an Ergo address that the user | ||
| needs to authenticate for. This might be a P2PK address, but in general P2S addresses can be also | ||
| used for authentication. | ||
|
|
||
| 3) The dApp presents an ErgoAuth link for the user to click and open the wallet app and a QR code | ||
| for mobile users to scan from within the wallet app. | ||
|
|
||
| 4) The wallet application parses the QR code/link data and obtains a | ||
| `ErgoAuthRequestUrl` to fetch the actual `ErgoAuthRequest` data from | ||
| (see [Data Formats](#data-formats) section). | ||
|
|
||
| 5) When `ErgoAuthRequest` is obtained, the wallet presents a screen showing that a dApp wants to | ||
| authenticate the user, and the address the request is for. The wallet app should also inform the | ||
| user that no funds or moved and no secrets will leave the device. | ||
|
|
||
| 6) When the user agrees, the wallet app signs the obtained message from ErgoAuthRequest and sends | ||
| the signed message to the ErgoAuthRequest's replyToUrl. | ||
|
|
||
| 7) The dApp validates the signed message. When successful, it can proceed with its flow. | ||
aslesarenko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Data Formats | ||
|
|
||
| Wallet apps should be able to initiate ErgoAuth both by using URI schemes | ||
| (clickable links) or QR codes. | ||
|
|
||
| `ergoauth://<URL>` | ||
|
|
||
| An URL is provided without the https prefix. http communication is not allowed except for IP addresses | ||
| (in order to test within a local network). | ||
|
|
||
| Examples: | ||
| * `ergoauth://sigmavalley.io/auth/2021-16b8-66c4-b800-6e52-8ce4` will make the wallet app request | ||
| `https://sigmausd.io/auth/2021-16b8-66c4-b800-6e52-8ce4` | ||
| * `ergoauth://192.168.0.1/auth` will make the wallet app request | ||
| `http://192.168.0.1/auth` | ||
|
|
||
| #### Response body: ErgoAuthRequest | ||
|
|
||
| The wallet application should request URL and obtain the following data (json format) | ||
|
|
||
| ``` | ||
| ErgoAuthRequest: | ||
| - signingMessage: String | ||
MrStahlfelge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - address: String | ||
aslesarenko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - userMessage: String (optional*) | ||
| - messageSeverity: String (optional) "INFORMATION", "WARNING" | ||
| - replyToUrl: String | ||
| ``` | ||
|
|
||
| If provided, the wallet application should show the **userMessage** and display the **messageSeverity** | ||
| in a suitable way. | ||
|
|
||
| After signing is performed and the `SignedMessage` data is obtained, the | ||
aslesarenko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| wallet must POST the following data to the dApp using **replyToUrl** from the | ||
| request (json format). | ||
|
|
||
| ``` | ||
| ErgoAuthResponse: | ||
| - signedMessage: String (base64) | ||
| ``` | ||
|
|
||
| In case there was an error building the ErgoAuthRequest on the dApp side, the dApp might reply | ||
| with an `ErgoAuthRequestError` to inform the user about the error: | ||
|
|
||
| ``` | ||
| ErgoAuthRequestError: | ||
| - userMessage: String | ||
| ``` | ||
|
|
||
| The wallet application will show the user message to the user. | ||
|
|
||
|
|
||
| ## Implementation in wallet app | ||
| TODO | ||
|
|
||
| ## Implementation in dApp | ||
| TODO | ||
|
|
||
| ## Benefits for dApps | ||
| - A dApp or website don’t need to handle user's secrets (mnemonic/private keys), but can | ||
| safely validate if a user has access to certain Ergo addresses. | ||
| - dApp's users don't need to worry about security of their private keys as the | ||
| wallet guarantees they never leave the device | ||
aslesarenko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.