idOS SDK Kotlin

Kotlin Multiplatform SDK for idOS - Android, iOS, and JVM support.
⚙️ Requirements
- Kotlin: 2.2.10+
- Android: API 28+ (Android 9.0 Pie)
- iOS: 15.0+
- JVM: Java 11+
📦 Installation
Android / JVM (Gradle)
Add the dependency to your build.gradle.kts:
dependencies {
implementation("org.idos:idos-sdk-kotlin:0.0.8")
}
Or in Groovy build.gradle:
dependencies {
implementation 'org.idos:idos-sdk-kotlin:0.0.8'
}
iOS (Swift Package Manager)
Add the package dependency in Xcode:
- Go to File → Add Package Dependencies...
- Enter the repository URL:
https://github.com/idos-network/idos-sdk-kotlin
- Select version
0.0.8 or specify a version rule
- Add to your target
Or add to your Package.swift:
dependencies: [
.package(url: "https://github.com/idos-network/idos-sdk-kotlin", from: "0.0.8")
]
Manual Download
Download the latest release artifacts:
- Android: Get the
.aar file from GitHub Releases
- iOS: Get the
idos_sdk.xcframework.zip from GitHub Releases
🚀 Quick Start
1. Create a Signer
import org.idos.kwil.security.signer.JvmEthSigner
import org.kethereum.bip32.toKey
import org.kethereum.bip39.model.MnemonicWords
import org.kethereum.bip39.toSeed
val mnemonic = MnemonicWords("your twelve or twenty four word mnemonic phrase")
val seed = mnemonic.toSeed("")
val key = seed.toKey("m/44'/60'/0'/0/0")
val signer = JvmEthSigner(key.keyPair)
2. Create Client
import org.idos.IdosClient
try {
val client = IdosClient.create(
baseUrl = "https://nodes.staging.idos.network",
chainId = "idos-testnet",
signer = signer
)
} catch (e: DomainError) {
println("Failed to create client: ${e.message}")
}
3. Use Organized APIs
📚 API Reference
IdosClient Groups
All operations are suspend functions that throw DomainError on failure.
Wallets (client.wallets)
suspend fun add(input: AddWalletParams): HexString - Add a new wallet
suspend fun getAll(): List<GetWalletsResponse> - Get all wallets
suspend fun remove(id: UuidString): HexString - Remove a wallet
Credentials (client.credentials)
suspend fun add(input: AddCredentialParams): HexString - Add a credential
Access Grants (client.accessGrants)
suspend fun create(input: CreateAccessGrantParams): HexString - Create an access grant
suspend fun getOwned(): List<GetAccessGrantsOwnedResponse> - Get owned grants
suspend fun getGranted(userId, page, size): List<GetAccessGrantsGrantedResponse> - Get granted grants
suspend fun getForCredential(credentialId): List<GetAccessGrantsForCredentialResponse> - Get grants for credential
Users (client.users)
suspend fun get(): GetUserResponse - Get current user profile
suspend fun hasProfile(address: HexString): Boolean - Check if address has profile
Attributes (client.attributes)
suspend fun add(input: AddAttributeParams): HexString - Add an attribute
suspend fun getAll(): List<GetAttributesResponse> - Get all attributes
suspend fun edit(input: EditAttributeParams): HexString - Edit an attribute
suspend fun remove(id: UuidString): HexString - Remove an attribute
suspend fun share(input: ShareAttributeParams): HexString - Share an attribute
🔐 Enclave (Encryption)
The SDK supports two encryption modes:
- LOCAL: Password-based encryption with local key storage
- MPC: Distributed encryption using Shamir's Secret Sharing across MPC nodes
The default EnclaveOrchestrator.create() supports both modes with type detection based on user enrollment. Use createLocal() or createMpc() for single-mode apps.
For real-world usage patterns handling enclave state in a ViewModel, see CredentialDetailViewModel.kt:103-138
🧪 Testing
Unit Tests & Instrumentation Tests
-
Copy the example environment file:
cp .env.example .
Note: Your mnemonic should be for a wallet that has an idOS profile for integration tests to work.
🏗️ Architecture
See ARCHITECTURE.md for detailed documentation on:
- 4-layer architecture (Transport → Protocol → Domain → Public API)
- Package structure and responsibilities
- KWIL protocol implementation details
- Transaction signing scheme
- Error handling strategy
- Platform-specific implementations
⚠️ Error Handling
All public APIs use suspend functions that throw DomainError on failure. Wrap calls in try-catch for error handling:
🔧 Platform Support
- JVM: Full support with KEthereum for Ethereum signing
- Android: Same as JVM, plus libsodium via Lazysodium for encryption, EncryptedFile with StrongBox for secure storage
- iOS: Darwin HTTP engine, libsodium XCFramework for encryption, iOS Keychain for secure storage
- SKIE library auto-converts Kotlin suspend/throws to Swift async/throws
- Seamless Swift interop with native error handling
📖 Further Reading
- ARCHITECTURE.md - Detailed architecture documentation
- PUBLISHING.md - Complete guide for publishing releases
- KWIL Protocol - KWIL database documentation
- idOS Schema - Schema definitions
🚀 Publishing
For maintainers publishing new releases, see PUBLISHING.md for:
- Initial setup (Maven Central, GPG keys, GitHub secrets)
- Creating releases (automated via GitHub Actions)
- Build tasks and troubleshooting
- Distribution to Maven Central, GitHub Releases, and Swift Package Manager
📄 License
See LICENSE file for details.