-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d4b9fa
commit 5b3e946
Showing
9 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
modules/local-kms/src/commonMain/kotlin/com/sphereon/oid/fed/kms/local/Constants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.sphereon.oid.fed.kms.local | ||
|
||
class Constants { | ||
companion object { | ||
const val DATASOURCE_URL = "DATASOURCE_URL" | ||
const val DATASOURCE_USER = "DATASOURCE_USER" | ||
const val DATASOURCE_PASSWORD = "DATASOURCE_PASSWORD" | ||
const val SQLITE_IS_NOT_SUPPORTED_IN_JVM = "SQLite is not supported in JVM" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...eon/oid/fed/kms/local/LocalKmsDatabase.kt → ...ed/kms/local/database/LocalKmsDatabase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...al-kms/src/commonMain/kotlin/com/sphereon/oid/fed/kms/local/database/PlatformSqlDriver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.sphereon.oid.fed.kms.local.database | ||
|
||
import app.cash.sqldelight.db.SqlDriver | ||
|
||
expect class PlatformSqlDriver { | ||
fun createPostgresDriver(url: String, username: String, password: String): SqlDriver | ||
fun createSqliteDriver(path: String): SqlDriver | ||
} |
6 changes: 3 additions & 3 deletions
6
...oid/fed/kms/local/LocalKmsDatabase.jvm.kt → ...ms/local/database/LocalKmsDatabase.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...local-kms/src/jvmMain/kotlin/com/sphereon/oid/fed/kms/local/database/PlatformSqlDriver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.sphereon.oid.fed.kms.local.database | ||
|
||
import app.cash.sqldelight.db.SqlDriver | ||
import app.cash.sqldelight.driver.jdbc.asJdbcDriver | ||
import com.sphereon.oid.fed.kms.local.Constants | ||
import com.zaxxer.hikari.HikariConfig | ||
import com.zaxxer.hikari.HikariDataSource | ||
|
||
actual class PlatformSqlDriver { | ||
actual fun createPostgresDriver(url: String, username: String, password: String): SqlDriver { | ||
val config = HikariConfig() | ||
config.jdbcUrl = url | ||
config.username = username | ||
config.password = password | ||
|
||
val dataSource = HikariDataSource(config) | ||
return dataSource.asJdbcDriver() | ||
} | ||
|
||
actual fun createSqliteDriver(path: String): SqlDriver { | ||
throw UnsupportedOperationException(Constants.SQLITE_IS_NOT_SUPPORTED_IN_JVM) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
modules/services/src/commonMain/kotlin/com/sphereon/oid/fed/services/KmsService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
...ereon/oid/fed/kms/local/LocalKmsClient.kt → ...hereon/oid/fed/services/LocalKmsClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters