DICE Developer Docs
  • Developer Docs
    • DICE Test Drive
      • Sign-up for Issuer Portal
      • Issue Credentials
      • Verify Credentials
    • Key Concepts
      • DID & Verifiable Credentials
      • DICE ID Architecture
    • Platform Console
      • Dashboard
      • Customers
        • Onboard Customer
      • Credentials
        • Issue Credentials to New Customer
      • Schema
      • Batch Issuance
        • Batch Issuance - Useful Tips
      • Verifications
        • Verification Template
      • Templates
        • Certificate Template
          • Create Template
          • Manage Template
        • Email Template
          • Create Template
          • Manage Template
      • Organization
      • Departments
      • Organization Users
      • API Access
      • Callback Configuration
      • Tutorials
        • Credential Issuance from DICE ID Console
        • Credential Issuance using DICE ID APIs
        • Credential Verification using QR code
        • Credential Verification from DICE ID console
        • Batch Credential Issuance from DICE ID Console
    • Integrations
      • Auth0 Integration
        • Login using OIDC (First Factor Authentication)
        • Custom MFA Rule (For 2FA)
    • DICE ID SDK
      • DICE ID
        • DID & Verifiable Credentials
        • DICE ID Architecture
      • SDK Functionalities
      • Create Wallet
      • Create Connection
      • Creating a Schema
      • Issue a Credential
      • Send Presentation Request
      • Get Verification State
      • Configuration and Customization
      • Error Handling & Troubleshooting
      • Conclusion
      • Additional Resources
  • Getting Started with DICE ID Skill Credentials
    • Building Trust Ecosystems Powered by Credentials
    • DICE ID Integration for Issuers
    • DICE ID Integration for Verifiers
    • DICE ID Brand Usage Guidelines
    • DICE ID Onboarding Confirmation
    • Helpful Q&A
    • Troubleshooting Guide
Powered by GitBook
On this page
  1. Developer Docs
  2. DICE ID SDK

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:

  1. walletInput: An object that holds the wallet name, key, and type for creating the wallet.

  2. walletOutput: A variable that stores the response from the createWallet API.

  3. wallet_name: Stores the wallet name entered by the user.

  4. wallet_key: Stores the wallet key entered by the user.

  5. walletInput.wallet_name: Sets the wallet name in the walletInput object.

  6. walletInput.wallet_key: Sets the wallet key in the walletInput object.

  7. walletInput.wallet_type: Sets the wallet type as "indy" in the walletInput object.

  8. diceidsdk.cloudwallet.createWallet(): Creates a wallet using the walletInput object.

  9. resp: Holds the response from the createWallet API, including the wallet details.

  10. err: Stores any error that occurs during the process.

function sampleCreateWallet() {
  const walletInput = {};
  let walletOutput = {};
  // Prompt the user for wallet name and key
  const wallet_name = prompt('Enter Wallet name: ');
  const wallet_key = prompt('Enter Wallet key: ');
  // Set the wallet name, key, and type
  walletInput.wallet_name = wallet_name;
  walletInput.wallet_key = wallet_key;
  walletInput.wallet_type = "indy";
  // Call the createWallet function
  diceidsdk.cloudwallet.createWallet(walletInput)
    .then(resp => {
      walletOutput = resp;
      // Handle the wallet creation response
    })
    .catch(err => console.log("Not able to create wallet"));
}

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:

node sampleCreateWallet.js

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

PreviousSDK FunctionalitiesNextCreate Connection

Last updated 1 year ago