-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate to quill for generic secret storage
Signed-off-by: Pat Losoponkul <[email protected]>
- Loading branch information
Pat Losoponkul
committed
Aug 23, 2024
1 parent
6f8c9ff
commit b31cfd9
Showing
4 changed files
with
45 additions
and
33 deletions.
There are no files selected for viewing
44 changes: 14 additions & 30 deletions
44
...src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcGenericSecretStorage.scala
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
30 changes: 30 additions & 0 deletions
30
...-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/model/GenericSecret.scala
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,30 @@ | ||
package org.hyperledger.identus.agent.walletapi.sql.model | ||
|
||
import io.getquill.{SnakeCase, *} | ||
import io.getquill.context.json.PostgresJsonExtensions | ||
import io.getquill.doobie.DoobieContext | ||
import org.hyperledger.identus.shared.models.WalletId | ||
import zio.json.ast.Json | ||
|
||
import java.time.Instant | ||
|
||
final case class GenericSecret( | ||
key: String, | ||
payload: JsonValue[Json], | ||
createdAt: Instant, | ||
walletId: WalletId | ||
) | ||
|
||
object GenericSecretSql extends DoobieContext.Postgres(SnakeCase), PostgresJsonExtensions { | ||
def insert(secret: GenericSecret) = run { | ||
quote( | ||
query[GenericSecret].insertValue(lift(secret)) | ||
) | ||
} | ||
|
||
def findByKey(key: String) = run { | ||
quote( | ||
query[GenericSecret].filter(_.key == lift(key)).take(1) | ||
) | ||
} | ||
} |
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