developers.diem.com/docs/wallets-and-merchant-stores/diem-reference-wallet/reference-wallet-local-web.md
The local web wallet is the web version of the Diem Reference Wallet.
The local web wallet is a web wallet interface provided as a demonstration of a centralized (custodial) service for consumers. It is meant to be run on a local machine. The wallet demonstrates the following use cases:
The main purpose is to demonstrate common use cases when working with Diem Coins and show options for further development. To illustrate key Diem wallet concepts, we’ve simplified the implementation and avoided some of the complexities of real world, production-grade financial software.
<BlockQuote type="danger"> This code is to be used as a reference only. Never use this code in production! </BlockQuote>The Reference Wallet web UI has been developed using the following tools:
| Programming languages | TypeScript, HTML, Sass |
| Package manager | Yarn |
| UI framework | React |
| Components and layout framework | Bootstrap |
| Testing framework | Jest |
| HTTP client | Axios |
The Reference Wallet implementation makes several assumptions to simplify the system.
The Reference Wallet uses simplified authentication and authorization mechanisms. Users are authenticated using a username and password. When a user logs in successfully, a bearer token is issued for the user by the backend server and stored in the tokens table.
The software client is expected to pass the allocated token in the header of each request, as per the Bearer token authorization specification (RFC 6750). Any request presenting the token is fully authorized to access associated resources, without demonstrating any right for the token possession. In addition, it is the client’s responsibility to refresh the token frequently enough, before the token expires (usually refreshed upon page transitions, posting data, and so on).
The Reference Wallet simulates the account verification process by returning the verification URL to the client directly upon the completion of the sign-up phase. The client automatically navigates to the address. At this point, you may choose to send an email to the user allowing them to click on and verify the message.
The image below details the different user flows for the local Reference Wallet web client. <small className="figure">Figure 1.0 User flows for the local web wallet</small>
You can read further technical documentation in the Reference Wallet git repository. All web UI resources can be found here.
To deploy the Reference Wallet, please refer to the latest information in the Backend README here.
New users who want to use the reference wallet local client need to register with the service. The registration process:
During registration, the local user is asked to provide information required for proper identity verification and account security. The registration process collects this information in multiple steps:
The account verification begins once the user completes registration. The user won’t be able to access the wallet until their account is verified.
<BlockQuote type="info"> Account verification demos the expected behavior of a hypothetical wallet. For the Reference Wallet local client, the verification succeeds automatically and the “pending” state is presented briefly to the user for demo purposes only.In addition, the identification document is always accepted and is not analyzed or stored by the backend. Real-world user verification and risk management are beyond the scope of the reference wallet and contain many opportunities for further development.
</BlockQuote>Read more about the user verification in the Risk section.
The local web client is accessible only for authenticated users. When a user accesses the wallet website, the login page is the first page presented to the user. This is where the user is authenticated using their email id and password.
Upon login, if a user is presented with a “Verification Pending” page, it means that the authentication has been successful but the user verification process is still underway.
The password can be reset using the “Forgot Password” link. Alternatively, if the user is not yet registered, they can proceed to register by activating the “Sign up” link on the page.
A user can sign out of the wallet on the Settings page.
It is possible to reset the user password by entering a verified email address on the password reset page. The page is accessible by following the “Forgot Password” link on the login page. Note that the email address provided must be an address previously registered in the system.
Note: For the reference wallet, entering a known email address redirects the user immediately to the password change page, without sending the reset message.
The home page is where most user actions are performed, and an overview of the wallet balances can be seen. The balances are displayed separately for each Diem Coin currency and as an approximation of the total amount.
User actions available on the home page include:
<small className="figure">Figure 2.0 View home page</small>
On the Settings page, a user can sign out from the wallet, edit general preferences, and add payment methods.
The modifiable preferences are:
The supported payment methods are:
In addition, the page shows the email address of the active user. It is not possible to change the user’s email address.
<small className="figure">Figure 2.1 View local web wallet settings page</small>
<BlockQuote type="info"> The payment methods are for demonstration purposes only. The supplied information is not validated, and no real transactions are made using the configured credit cards and bank accounts. </BlockQuote>To change the wallet UI language, enter the Settings page and choose the desired language from the languages dropdown menu:
<small className="figure">Figure 2.2 Choose language in settings</small>
Choosing a specific Diem Coin currency on the home page shows all the wallet transactions for that currency in descending order. Transactions may be internal (i.e., off-chain), within the wallet’s network (e.g., Diem deposit from a credit card), or external (i.e., on-chain) on the Diem Blockchain (e.g., Diem transfer to some external Diem address).
<small className="figure">Figure 3.0 View transactions list</small>
Each transaction consists of:
Clicking a transaction in the transactions list will open a window with transaction details.
<small className="figure">Figure 3.1 View transaction details</small>
Each transaction consists of:
Users can deposit and withdraw Diem Coins to and from the Reference Wallet.
When a user requests to deposit an amount of Diem Coin, the Reference Wallet simulates a purchase of Diem Coins using the user's credit card or bank account wire transfer.
<BlockQuote type="danger"> For your safety and security, never use real credit card or bank account details. </BlockQuote>To perform a deposit, follow these steps:
The Diem withdrawal process is performed by clicking “Transfer” and then “Withdraw.” The process behaves very similarly to the deposit process. Upon withdrawal execution, the specified amount is deducted from the user balances.
To convert from one Diem Coin currency to another:
To send Diem Coins to another address:
Other wallets can send funds without any action on the receiving party’s side, assuming they know the recipient’s address. To see the address of a wallet, click “Request” on the home page. A wallet has a different address for each Diem Coin currency. To get the correct address, the user should verify that the right currency is selected. The actual address is presented at the bottom of the dialog as clear text. It can be copied into the clipboard by clicking the available button, or scanned using the QR code.
<ThankFirst/>