-
Notifications
You must be signed in to change notification settings - Fork 3
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
52b0c0d
commit e6d167f
Showing
12 changed files
with
95 additions
and
130 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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: 12 additions & 0 deletions
12
modules/local-kms/src/commonMain/kotlin/com/sphereon/oid/fed/kms/local/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.sphereon.oid.fed.kms.local | ||
|
||
import com.sphereon.oid.fed.kms.local.models.Keys | ||
|
||
expect class LocalKmsDatabase { | ||
fun getKey(keyId: String): Keys | ||
fun insertKey(keyId: String, privateKey: ByteArray, publicKey: ByteArray, algorithm: String) | ||
fun updateKey(keyId: String, privateKey: ByteArray, publicKey: ByteArray, algorithm: String) | ||
fun deleteKey(keyId: String) | ||
} | ||
|
||
class KeyNotFoundException(message: String) : Exception(message) |
6 changes: 6 additions & 0 deletions
6
modules/local-kms/src/commonMain/sqldelight/com/sphereon/oid/fed/kms/local/models/Keys.sq
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,6 @@ | ||
CREATE TABLE keys ( | ||
id TEXT PRIMARY KEY, | ||
private_key TEXT NOT NULL, | ||
public_key TEXT NOT NULL, | ||
algorithm TEXT NOT NULL | ||
); |
45 changes: 45 additions & 0 deletions
45
modules/local-kms/src/jvmMain/kotlin/com/sphereon/oid/fed/kms/local/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.sphereon.oid.fed.kms.local | ||
|
||
import app.cash.sqldelight.db.SqlDriver | ||
import com.sphereon.oid.fed.kms.local.models.Keys | ||
import com.sphereon.oid.fed.persistence.Constants | ||
import com.sphereon.oid.fed.persistence.database.PlatformSqlDriver | ||
|
||
|
||
actual class LocalKmsDatabase { | ||
|
||
init { | ||
val driver = getDriver() | ||
|
||
val database = Database(driver) | ||
|
||
} | ||
|
||
private fun getDriver(): SqlDriver { | ||
return PlatformSqlDriver().createPostgresDriver( | ||
System.getenv(Constants.DATASOURCE_URL), | ||
System.getenv(Constants.DATASOURCE_USER), | ||
System.getenv(Constants.DATASOURCE_PASSWORD) | ||
) | ||
} | ||
|
||
actual fun getKey(keyId: String): Keys { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual fun insertKey( | ||
keyId: String, privateKey: ByteArray, publicKey: ByteArray, algorithm: String | ||
) { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual fun updateKey( | ||
keyId: String, privateKey: ByteArray, publicKey: ByteArray, algorithm: String | ||
) { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual fun deleteKey(keyId: String) { | ||
TODO("Not yet implemented") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
modules/local-kms/src/main/kotlin/LocalKmsDatabaseConnection.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
modules/local-kms/src/main/resources/application.properties
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.