Store a Wallet on a Remote Drive
This section of the documentation focuses on the importance of storing a wallet.
During the development of a web application that incorporates a wallet, you might choose to store it using Unsafe Storage. This simple interface makes wallet implementation easier for developers, thereby streamlining the testing process and facilitating the development of new features.
However, it is crucial to understand that this method of storing the wallet in Unsafe Storage MUST NOT be used in a production environment. Unsafe Storage does not provide the necessary security measures to protect sensitive data such as wallet key shares and such data can be easily lost.
For a production application, it is highly recommended to use a more secure and reliable storage method, such as a remote drive (e.g., Google Drive or Dropbox). These remote storage solutions provide robust security features, data encryption, and backup options, thereby ensuring the safety and accessibility of your wallet data.
Storing a Wallet
In this code snippet, we demonstrate how to set up and utilize the SDK for storing a wallet. The script initiates the SDK with a provided client ID, stores the wallet to the user's Google Drive. This serves as a foundation example for developers who are looking to build and manage a wallet using the SDK.
Retrieving a Wallet
Retrieving the wallet is completely transparent to the developer, as it is integrated into the instantiate method of the Wallet namespace.
- Eniblock class
- WalletNamespace.instantiate() method
- AccountNamespace.get() method
- Account.getAddress() method
- Account.alias property
- Account.getNativeBalance() method
- Account.getPublicKey() method
- Account.creationDate property
Store a wallet with Google Drive
Step 1: Create a Google Cloud Platform (GCP) Project
Visit the Google Cloud Platform Console.
Log in with your Google account or create a new account if you don't have one.
Click on the project dropdown and select or create the project you want to use for your web app.
Click on the project dropdown
Create the project you want to use for your web app
Name and save your new project
Select your new project
Step 2: Enable Google drive API
Enter in the "Enable APIS AND SERVICES" section
Select "Google Drive API" and enable the API
Step 3: Set Up OAuth 2.0 Consent Screen
Navigate to the "APIs & Services" dashboard and open the consent screen configuration
From the dashboard, click on "Explore and enable APIs"
From the dashboard, click on "Click on "Credentials."
Click on "Configure consent screen"
Select the appropriate User Type for your app
Create your consent screen
Fill the consent screen configuration
Fill all the consent screen configuration
Click on "ADD OR REMOVE SCOPES"
Add manually a new scopehttps://www.googleapis.com/auth/drive.appdata
Optionnaly, function of the User Type, add Test users.
Step 4: Set Up OAuth 2.0 Client IDs
Select Credentials and click on "Create credentials" and select "OAuth client ID."
Click on "Create credentials" and select "OAuth client ID."
Set the application type
Choose "Web application" as the application type.
Fill in the required fields
Click "Create" to generate your OAuth 2.0 credentials
Save the generated "Client ID" and "Client Secret" for later use.