Integrate the Relay SDK
Integrate the Relay SDK into your application
Prerequisites
Get Started
Integrate the iOS SDK
To use the Relay SDK in an iOS app, you need to install the SudoDIRelay package via Swift Package Manager
Open your project settings in XCode, and go to the Package Dependencies
tab. Click on the +
sign to add a dependency.
Enter the repository URL https://github.com/sudoplatform/sudo-di-relay-ios
in the top right search box and select the sudo-di-relay-ios
repository.
Select the required version and Add Package
.
Sudo Platform SDKs conform to semantic versioning so in most cases you will leave the Dependency Rule as Up to Next Major Version
to receive regular updates without introducing any breaking changes.
This will resolve the local package dependency and install the latest version of the Relay SDK.
To instantiate the relay client in your application, add the following:
import SudoDIRelay
let userClient = // ... see "Users" docs
let relayClient = try DefaultSudoDIRelayClient(
sudoUserClient: sudoUserClient
)
You only need one DefaultSudoDIRelayClient
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.
See it in action. Be sure to take a look at the open-source iOS sample app on GitHub that our team published as a reference for integrating the Relay SDK into your app as quickly and seamlessly as possible.
Integrate the Android SDK
The Android SDK is open source and compatible with Android 6 (API level 23) and above.
Add this line to the dependencies section of the app module build.gradle
and synchronize your project with Android Studio.
dependencies {
implementation 'com.sudoplatform:sudodirelay:$latest_version'
}
Client Initialization
To instantiate a client in your application add the following:
// val appContext: Context // The Android application context
val userClient = // ... see "Users" docs
val relayClient = SudoDIRelayClient.builder()
.setContext(appContext)
.setSudoUserClient(userClient)
.build()
You only need one SudoDIRelayClient
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.
See it in action. Be sure to take a look at the open-source Android sample app on GitHub that our team published as a reference for integrating the Decentralized Identity Relay SDK into your app as quickly and seamlessly as possible.
Last updated