Create Wallet
Create personalized wallets for end users.
The sampleCreateWallet function is provided by the DICE ID SDK to demonstrate the process of creating a wallet for the end user.
It prompts the user to enter the wallet name and key, sets the wallet type to "indy", and calls the createWallet function from the diceidsdk.cloudwallet module.
API Elements:
walletInput: An object that holds the wallet name, key, and type for creating the wallet.
walletOutput: A variable that stores the response from the createWallet API.
wallet_name: Stores the wallet name entered by the user.
wallet_key: Stores the wallet key entered by the user.
walletInput.wallet_name: Sets the wallet name in the walletInput object.
walletInput.wallet_key: Sets the wallet key in the walletInput object.
walletInput.wallet_type: Sets the wallet type as "indy" in the walletInput object.
diceidsdk.cloudwallet.createWallet(): Creates a wallet using the walletInput object.
resp: Holds the response from the createWallet API, including the wallet details.
err: Stores any error that occurs during the process.
Running the Code
Step 1: Add the sampleCreateWallet function: Copy the above sampleCreateWallet function code and paste it into your JavaScript file after importing the diceidsdk module.
Step 2: Run the function: Invoke the sampleCreateWallet function in your code to execute it. For example:
Step 3: Provide input: The function will prompt you to enter the wallet name and key. Enter the required information in the terminal or command prompt.
Step 4: Handle the response: Once the createWallet function completes, you can handle the response within the .then() block of the promise or perform any necessary error handling in the .catch() block.
Step 5: The generated Wallet ID should copied into the "appconfig" file
Last updated