Search…
Integrate the Sudo Profiles SDK
Integrate the Sudo Profiles SDK into your application

Prerequisites

Get Started

Integrate the iOS SDK

To use Sudo Profiles SDK in an iOS app you need to install `SudoProfiles` pod via CocoaPods.
Install CocoaPods by running the following command:
shell
1
sudo gem install cocoapods
Copied!
Initialize CocoaPods for your app project by running the following command:
shell
1
pod init
Copied!
Open the created Podfile in a text editor and add SudProfiles pod a dependency to your app target.
Podfile
1
target 'YOUR-APP-NAME' do
2
use_frameworks!
3
​
4
pod 'SudoProfiles'
5
​
6
# other pods
7
end
Copied!
Install pod dependencies by running the following command:
shell
1
pod install --repo-update
Copied!
Instantiating and initializing a client:
Swift
1
do {
2
let client: SudoProfilesClient = try DefaultSudoProfilesClient(sudoUserClient: sudoUserClient, blobContainerURL: blobContainerURL)
3
} catch let error {
4
// Handle initialization error. An error might be thrown due to invalid
5
// or missing confiugration file.
6
}
Copied!
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.

Integrate the Android SDK

To use Sudo Profiles SDK in an Android app you need to add SudoProfiles library as a dependency to your project.
Edit the app module Gradle script (build.gradle) and add SudoProfiles library as a dependency.
gradle
1
dependencies {
2
api 'com.sudoplatform:sudoprofiles:$latest_version'
3
}
Copied!
The latest version of the SDK can be found at SDK Releases.
Edit AndroidManifest.xml to add the following app permissions:
Diff
1
<?xml version="1.0" encoding="utf-8"?>
2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools"
4
package="com.sudoplatform.sampleapp">
5
​
6
+ <uses-permission android:name="android.permission.INTERNET" />
7
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
8
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
9
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
10
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
11
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
12
​
13
<application
14
+ tools:replace="android:allowBackup"
15
+ android:allowBackup="false"
Copied!
Instantiating and initializing a client:
Kotlin
1
val client = SudoProfilesClient
2
.builder(appContext, sudoUserClient, blobContainerUri)
3
.build()
Copied!
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.

Integrate the JS SDK

To use the Sudo Profiles SDK in a JS project you must add @sudoplatform/sudo-profiles as a dependency to your project
1
yarn add '@sudoplatform/sudo-profiles'
2
# or
3
npm install --save '@sudoplatform/sudo-profiles'
Copied!
Instantiating and initializing a Sudo Profiles client:
TypeScript
1
import {
2
DefaultSudoProfilesClient,
3
} from '@sudoplatform/sudo-profiles'
4
​
5
// Instantiate and initialize the client
6
const sudoProfilesClient = new DefaultSudoProfilesClient({
7
sudoUserClient: sudoUserClient,
8
})
Copied!
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.

Symmetric Key Management for JS SDK

Symmetric keys are used in Sudo Profiles JS SDK to encrypt and decrypt Sudo claims. These keys are not stored within our system and need to be loaded into the Sudo Profile Client to be able to encrypt and decrypt your Sudo claims data. These symmetric keys can also be rotated, therefore a potential list of keys will need to be set. The storage and management of these keys will also be the responsibility of the consumer of the Sudo Profiles JS SDK.
Adding Symmetric keys to Sudo Profiles Client:
TypeScript
1
sudoProfilesClient.pushSymmetricKey('1234', '14A9B3C3540142A11E70ACBB1BD8969F')
Copied!
Symmetric keys are loaded into the Sudo Profiles Client after the client has been instantiated and initialized. Any old keys that have been used in the past to encrypt Sudo claims will also need to be set so that those Sudo claims can be decrypted. The last key loaded will be set as the current key for encrypting and decrypting new Sudo claims.
It is a requirement that the Sudo Profiles Client be loaded with at least one symmetric key.
Last modified 7mo ago