generated from y9vad9/kotlin-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Prepare
Vadym Yaroshchuk edited this page Feb 26, 2024
·
7 revisions
1. Add TimeMates Maven to your build script:
repositories {
maven("https://maven.timemates.org/releases")
}
2. Add the dependency:
dependencies {
commonMainImplementation("org.timemates.credentials:credentials-manager:1.0.0")
}
Create a common factory class or method to obtain a CredentialsStorage instance.
// common
expect class CredentialsStorageFactory {
fun create(): CredentialsStorage
}
// Android
actual class CredentialsStorageFactory(val context: Context) {
actual fun create(): CredentialsStorage {
return AndroidEncryptedPrefsCredentials(context)
}
}
// Desktop
actual class CredentialsStorageFactory {
actual fun create(): CredentialsStorage {
return DesktopCredentialsStorage(context)
}
}
// Js
actual class CredentialsStorageFactory {
actual fun create(): CredentialsStorage {
return JsLocalCredentialsStorage()
}
}
And now, you can go to Usage examples.