Integration Guide

There are two possible integration approaches:

Option 1: Embedded Wallet App

In this approach, the Wallet App is embedded directly inside the Beneficiary App (as a WebView or native module).

Workflow

  1. Beneficiary App launches the embedded Wallet UI.

  2. User onboards into the Wallet (via Dhiway).

  3. User adds/imports VCs directly through the Wallet interface.

  4. Beneficiary App fetches VC references from the embedded Wallet context.

Advantages

  • ✅ Faster integration (minimal code changes in Beneficiary App).

  • ✅ Secure by design (Wallet handles onboarding, VC storage, compliance).

  • ✅ Standard UI/UX for Wallet functions.

Considerations

  • ❌ Limited customization (UI/UX is dictated by Wallet app).

  • ❌ Tight coupling — updating Wallet UI may affect Beneficiary app.

Complete Integration Flow

1. Initial Setup & Environment Configuration

Beneficiary App (Parent) Configuration

Wallet App (Child) Configurationjavascript

2. Authentication Token Management

Step 1: Wallet Token Storage in Beneficiary App (Parent App)

The beneficiary/parent app can store the user's wallet service token, and when the user wants to use the wallet app the beneficiary app can fetch the user's wallet token and store the wallet authentication token in localStorage. Now it can be used while opening the wallet app in an iframe in embedded mode:

Step 2: Iframe Creation and Authentication Passingtypescript

Step 3: Wallet App Receives Authentication

Once this is done, you will be able to log in already logged-in user and access their wallet app within the beneficiary / parent app itself

Step 4: Wallet App Fetches VCs

Step 5: User Selects VCs to Share

Once the VCs are shared by the wallet app using the postMessage, now the parent app needs to listen to the data shared from the wallet app

Step 6: Message Listener in Beneficiary App

Step 7: VC Data Processing

Now the beneficiary app can process the revived VC data to store it or use it as needed

Option 2: Direct Wallet API Integration

In this approach, the Beneficiary App communicates with the Wallet Service APIs directly.

a Postman collection is available here:

👉 UBI Wallet Middleware Postman Collection

1. User Onboarding

2. User Login

3. Fetch VC List

4. Get VC Details

Security Best Practices

  1. Token Storage: Store authentication tokens securely (consider using httpOnly cookies in production)

  2. HTTPS: Always use HTTPS in production environments

  3. Input Validation: Validate all user inputs before sending to API

  4. Error Handling: Implement proper error handling for all API calls

  5. Rate Limiting: Implement client-side rate limiting to prevent abuse

Last updated