Skip to main content

Data Wallet (Aries) SDKs

The following steps outline how developers can integrate Data Wallet SDKs for Android and iOS into their existing Android or iOS applications.

Step 01: Installation

Use the following code to add depedency:

settings.gradle
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://repo.sovrin.org/repository/maven-public'}
maven {
name = "GitHubPackages"
url 'https://maven.pkg.github.com/L3-iGrant/ama-android-sdk'
credentials {
username = "L3-iGrant"
password = <Contact to get password>
}
}
}
settings.gradle
dependencies {
implementation 'com.github.L3-iGrant:data_wallet:2024.6.2'
}

Additional dependencies:

settings.gradle
dependencies {
implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation 'com.google.firebase:firebase-dynamic-links-ktx'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'org.hyperledger:indy:1.16.0'
implementation 'net.java.dev.jna:jna:5.6.0'
implementation 'org.apache.commons:commons-lang3:3.7'
implementation 'commons-io:commons-io:2.8.0'
implementation('com.squareup.retrofit2:retrofit:2.7.1') {
exclude module: 'okhttp'
}
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation 'com.squareup.okhttp3:okhttp:4.3.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.airbnb.android:lottie:3.5.0'
implementation 'org.greenrobot:eventbus:3.1.1'
annotationProcessor "org.greenrobot:eventbus-annotation-processor:3.1.1"
implementation 'com.github.koushikcse:LoadingButton:1.7'
implementation 'com.github.mediapark-pk:Base58-android:0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
implementation 'com.tbuonomo:dotsindicator:4.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
}

Step 02: Initialise Data Wallet

MyActivity.kt
DataWallet.initializeSdk(
this,
object : InitializeWalletCallback {
override fun progressUpdate(progress: Int) {
when (progress) {
InitializeWalletState.INITIALIZE_WALLET_STARTED -> {}
InitializeWalletState.INITIALIZE_WALLET_EXTERNAL_FILES_LOADED -> {}
InitializeWalletState.POOL_CREATED -> {}
InitializeWalletState.WALLET_OPENED -> {
DataWalletConfigurations.registerForSubscription(this)
}
}
}
},
LedgerNetworkType.getSelectedNetwork(this)
)

Supported Wallet Functions

Show Wallet UI

This function presents the data wallet's home view. The wallet home provides a user interface for managing wallet contents, accessing shared data, and performing wallet-related operations.

MyActivity.kt
DataWallet.showWallet(this)

Show Connections UI

This function presents the connections view of the data wallet. This view displays the list of established connections, allowing users to manage their connections, view connection details, and perform connection-related actions.

MyActivity.kt
DataWallet.showConnections(this)

Show Notifications UI

This function presents the data wallet's notifications views. This view provides a user interface for managing wallet notifications, such as receiving and viewing notifications related to data sharing or wallet updates.

MyActivity.kt
DataWallet.showNotifications(this)

Show MySharedData UI

This function presents the share data history view of the data wallet. The share data history view displays a log of all the shared data, allowing the user to view the details of each shared item and manage data-sharing permissions.

MyActivity.kt
DataWallet.showMySharedData(this)

Show DataAgreementPolicy UI

This function enables your application, integrated with the wallet, to retrieve data agreements associated with a specific organisation. By passing the required parameters such as api_key, organization_id, and agreement_id, along with a context (this), the function securely fetches the details of the specified agreement. This capability is essential for managing data consents and agreements programmatically, ensuring that your application adheres to specified data use policies and user consents.

MyActivity.kt
DataAgreementUtils.fetchDataAgreement(
"api_key",
"organization_id",
"agreement_id",
this
)

Delete Data Wallet

MyActivity.kt
val result = DataWallet.deleteWallet()

when (result) {
is DeleteWalletResult.Success -> {
// Show success message or perform any other action
DataWallet.releaseSdk()
}
is DeleteWalletResult.Error -> {
// Show error message
}
}

Query Credentials

This is used to query credentials based on the credential definition ID and schema ID. It will query all the credentials if we don't pass any value(s).

MyActivity.kt
DataWallet.queryCredentials(
"credential_definition_id",
"schema_id"
)

This function is used when scanning a QR code or generating a clickable link that opens the Data Wallet app, facilitating connections, as well as the issuance and verification of credentials. To integrate this functionality, add the specified intent filter to the activity where the SDK is initialised.

To register your app to open didcomm:// deeplinks, add the following:

AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="didcomm" />
</intent-filter>

Then, add the code below to Wallet SDK and initialise the callback -> InitializeWalletState.WALLET_OPENED.

MyActivity.kt
if (intent.scheme == "didcomm"){
DataWallet.processDeepLink(this, intent.data.toString())
}

Change Language

This function allows you to change the language used by the SDK. Provide the language code (e.g., "en" for English) to switch the SDK's localization to the desired language.

MyActivity.kt
This is done during initialisation. Contact support@igrant.io for more info. 

Connect Without a UI

This function enables your application, integrated with the wallet, to programmatically connect to another wallet—be it individual or organisational—without requiring a user interface for scanning or clicking a deep link. This feature can be particularly useful for automatically linking users to predefined organisations during app onboarding.

MyActivity.kt
DataWallet.saveConnection(
Uri.parse("connection_invitation_url"),
object : ConnectionCallback {
override fun success(
connectionId: String
) {}

override fun failure(reason: String?) {}
}
)

Subscribe To Notifications

This function enables your application, integrated with the wallet, to register for subscriptions using specific arguments such as api_key and organization_id. It sets up a listener to process incoming notifications by type, such as SHARE_REQUEST or OFFER_REQUEST. Upon notification receipt, it executes tailored logic and navigates to relevant screens based on the provided intent. This functionality is crucial for enabling dynamic, automatic responses to user interactions or system events.

MyActivity.kt
DataWalletConfigurations.registerForSubscription(this@MainActivity,
object : NotificationListener {
override fun receivedNotification(
notificationType: String,
intent: Intent
) {
when (notificationType) {
MessageTypes.SHARE_REQUEST -> {
// your logic
// intent will contain the screen to redirect
// startActivity(intent)
}
MessageTypes.OFFER_REQUEST -> {
// Do your logic
// intent will contain the screen to redirect
// startActivity(intent)
}
}
}
}
)

Self Attested Credential

The ama-ios-sdk provides applications with the ability to save, update, retrieve, and delete self-attested credentials securely.

Add

Allows the Applications can store self-attested credentials.

MyActivity.kt
val credentialId = SelfAttestedCredential.add(  
title = "Test title",
description ="Sample description" , // optional
attributes = attributes,
// connectionName = "ConnectionName",
// location = "location",
connectionId = "<connectionId>", // if connection id is not there then need to provide connectionName and location
issuedDate = <timeStamp> //optional
)

Update

Allows the Applications can update self-attested credentials.

MyActivity.kt
SelfAttestedCredential.update("<credentialId>","Title","description",attributes)

Get

Allows the Applications can read the self-attested credential.

MyActivity.kt
val credential = SelfAttestedCredential.get("<credentialId>")

Delete

Allows the Applications can delete the self-attested credential.

MyActivity.kt
SelfAttestedCredential.delete("<credentialId>")

Backup and Restore

The ama-ios-sdk enables applications to backup and restore wallet data. Currently, backup and restore operations are supported only through Data Pods by igrant.io.

Before initiating backup or restore, users must have an account with Data Pods.

Backup

To initiate the backup

MyActivity.kt
DataWallet.initiateBackUp(context)

Restore

To initiate the restore the backup. Before restoring make sure to delete wallet.

MyActivity.kt
DataWallet.initiateRestore(context, object : RestoreCallback {
override fun onRestoreSuccess() {
// Handle successful restore here
}

override fun onRestoreFailed(error: String) {
// Handle restore failure here
}
})