
Modular client SDK: unified networking, encrypted settings, security policies and MFA, multi-method identity and session management, WebSocket lifecycles, pluggable error parsers, composable UI and navigation.
A modular Kotlin Multiplatform (KMP) client SDK for Android and Web (Wasm). It provides a unified foundation for building multiplatform applications with shared logic for networking, encrypted storage, security policies, and identity management. By bundling Compose Multiplatform UI and Decompose navigation, it allows host apps to integrate complex auth flows and system settings with minimal boilerplate.
| Module | Purpose |
|---|---|
| core/common |
Foundation: Ktor bootstrap, WebSocket lifecycle, EncryptedSettings abstraction, platform metadata, and Chain of Responsibility error parsing. |
| core/settings | Global Settings: Logic for application configuration, encrypted caching, and reactive state management. |
| core/security | Security Domain: Password policy validation, MFA state management, and localized security errors. |
| feature/settingsapi | Settings Network: Ktor implementation for fetching global application configurations. |
| feature/securityapi | Security Network: Ktor implementation for fetching security policies and MFA requirements. |
| feature/user | Identity & Auth: Identity solution with multi-method auth (Email, Phone, Google), session management, and Decompose UI flows. |
| bom | Bill of Materials: Gradle platform to ensure version alignment across all SDK modules. |
Add the BOM and the required modules to your commonMain dependencies:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(platform("io.github.mudrichenkoevgeny:kmp-platform-sdk-bom:0.0.1"))
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-core-common")
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-feature-user")
// Add other core or feature modules as needed
}
}
}Initialize the EncryptedSettingsComponent and the root CommonComponent using platform-specific context.
val encryptedSettingsComponent = EncryptedSettingsComponent(platformContext)
val commonComponent = CommonComponent(
encryptedSettings = encryptedSettingsComponent.encryptedSettings,
deviceInfo = deviceInfo,
baseUrl = "https://api.example.com",
accessTokenProvider = authStorage,
appScope = appScope,
platformContext = platformContext
)Construct the networking providers and domain components by sharing the core HttpClient and WebSocketService.
val securityApi = SecurityApiComponent(httpClient = commonComponent.httpClient).securitySettingsApi
val settingsApi = SettingsApiComponent(httpClient = commonComponent.httpClient).globalSettingsApi
val securityComponent = SecurityComponent(
webSocketService = commonComponent.webSocketService,
securitySettingsApi = securityApi,
encryptedSettings = commonComponent.encryptedSettings,
parentScope = appScope
)
val settingsComponent = SettingsComponent(
webSocketService = commonComponent.webSocketService,
globalSettingsApi = settingsApi,
encryptedSettings = commonComponent.encryptedSettings,
parentScope = appScope
)Wire the UserComponent with its core collaborators and platform-specific authentication services.
val userComponent = UserComponent(
commonComponent = commonComponent,
settingsComponent = settingsComponent,
securityComponent = securityComponent,
authStorage = encryptedAuthStorage,
authServices = platformAuthServices,
parentScope = appScope
)Register auth interceptors, domain error parsers, and WebSocket message handlers during the application startup sequence.
fun init() {
commonComponent.httpClientConfigPlugins.add(userComponent.authHttpClientConfigPlugin)
commonComponent.init(
appErrorParserSpecificParsers = listOf(
SecurityErrorParser,
UserErrorParser
)
)
commonComponent.webSocketService.updateWebSocketMessageHandlers(
listOf(
commonComponent.commonWebSocketMessageHandler,
securityComponent.securityWebSocketMessageHandler,
settingsComponent.settingsWebSocketMessageHandler,
userComponent.userWebSocketMessageHandler
)
)
}Inject the SDK graph into your Compose Multiplatform tree using CompositionLocalProvider.
@Composable
@Composable
fun App(appComponent: AppComponent) {
val isInitialized by appComponent.isInitialized.collectAsState()
if (isInitialized) {
CompositionLocalProvider(
LocalCommonComponent provides appComponent.commonComponent,
LocalErrorParser provides appComponent.commonComponent.appErrorParser,
LocalAppComponent provides appComponent
) {
// Embed feature UI or launch LoginRootComponent navigation
}
} else {
SplashScreen()
}
}For a complete wiring example, refer to the sample application.
A modular Kotlin Multiplatform (KMP) client SDK for Android and Web (Wasm). It provides a unified foundation for building multiplatform applications with shared logic for networking, encrypted storage, security policies, and identity management. By bundling Compose Multiplatform UI and Decompose navigation, it allows host apps to integrate complex auth flows and system settings with minimal boilerplate.
| Module | Purpose |
|---|---|
| core/common |
Foundation: Ktor bootstrap, WebSocket lifecycle, EncryptedSettings abstraction, platform metadata, and Chain of Responsibility error parsing. |
| core/settings | Global Settings: Logic for application configuration, encrypted caching, and reactive state management. |
| core/security | Security Domain: Password policy validation, MFA state management, and localized security errors. |
| feature/settingsapi | Settings Network: Ktor implementation for fetching global application configurations. |
| feature/securityapi | Security Network: Ktor implementation for fetching security policies and MFA requirements. |
| feature/user | Identity & Auth: Identity solution with multi-method auth (Email, Phone, Google), session management, and Decompose UI flows. |
| bom | Bill of Materials: Gradle platform to ensure version alignment across all SDK modules. |
Add the BOM and the required modules to your commonMain dependencies:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(platform("io.github.mudrichenkoevgeny:kmp-platform-sdk-bom:0.0.1"))
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-core-common")
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-feature-user")
// Add other core or feature modules as needed
}
}
}Initialize the EncryptedSettingsComponent and the root CommonComponent using platform-specific context.
val encryptedSettingsComponent = EncryptedSettingsComponent(platformContext)
val commonComponent = CommonComponent(
encryptedSettings = encryptedSettingsComponent.encryptedSettings,
deviceInfo = deviceInfo,
baseUrl = "https://api.example.com",
accessTokenProvider = authStorage,
appScope = appScope,
platformContext = platformContext
)Construct the networking providers and domain components by sharing the core HttpClient and WebSocketService.
val securityApi = SecurityApiComponent(httpClient = commonComponent.httpClient).securitySettingsApi
val settingsApi = SettingsApiComponent(httpClient = commonComponent.httpClient).globalSettingsApi
val securityComponent = SecurityComponent(
webSocketService = commonComponent.webSocketService,
securitySettingsApi = securityApi,
encryptedSettings = commonComponent.encryptedSettings,
parentScope = appScope
)
val settingsComponent = SettingsComponent(
webSocketService = commonComponent.webSocketService,
globalSettingsApi = settingsApi,
encryptedSettings = commonComponent.encryptedSettings,
parentScope = appScope
)Wire the UserComponent with its core collaborators and platform-specific authentication services.
val userComponent = UserComponent(
commonComponent = commonComponent,
settingsComponent = settingsComponent,
securityComponent = securityComponent,
authStorage = encryptedAuthStorage,
authServices = platformAuthServices,
parentScope = appScope
)Register auth interceptors, domain error parsers, and WebSocket message handlers during the application startup sequence.
fun init() {
commonComponent.httpClientConfigPlugins.add(userComponent.authHttpClientConfigPlugin)
commonComponent.init(
appErrorParserSpecificParsers = listOf(
SecurityErrorParser,
UserErrorParser
)
)
commonComponent.webSocketService.updateWebSocketMessageHandlers(
listOf(
commonComponent.commonWebSocketMessageHandler,
securityComponent.securityWebSocketMessageHandler,
settingsComponent.settingsWebSocketMessageHandler,
userComponent.userWebSocketMessageHandler
)
)
}Inject the SDK graph into your Compose Multiplatform tree using CompositionLocalProvider.
@Composable
@Composable
fun App(appComponent: AppComponent) {
val isInitialized by appComponent.isInitialized.collectAsState()
if (isInitialized) {
CompositionLocalProvider(
LocalCommonComponent provides appComponent.commonComponent,
LocalErrorParser provides appComponent.commonComponent.appErrorParser,
LocalAppComponent provides appComponent
) {
// Embed feature UI or launch LoginRootComponent navigation
}
} else {
SplashScreen()
}
}For a complete wiring example, refer to the sample application.