-
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.
Add repository and credentialStatus data types
Signed-off-by: Shota Jolbordi <shota.jolbordi@iohk.io>
- Loading branch information
Shota Jolbordi
committed
Dec 5, 2023
1 parent
027fe28
commit 5aa345b
Showing
15 changed files
with
194 additions
and
42 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
pollux/lib/core/src/main/scala/io/iohk/atala/pollux/core/model/CredentialStatusList.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,20 @@ | ||
package io.iohk.atala.pollux.core.model | ||
import io.iohk.atala.castor.core.model.did.DID | ||
import io.iohk.atala.pollux.vc.jwt.StatusPurpose | ||
import io.iohk.atala.shared.models.WalletId | ||
|
||
import java.time.Instant | ||
import java.util.UUID | ||
|
||
final case class CredentialStatusList( | ||
id: UUID, | ||
walletId: WalletId, | ||
issuer: DID, | ||
issued: Instant, | ||
purpose: StatusPurpose, | ||
statusListJwtCredential: String, | ||
size: Int, | ||
lastUsedIndex: Int, | ||
createdAt: Instant, | ||
updatedAt: Option[Instant] | ||
) {} |
13 changes: 13 additions & 0 deletions
13
.../src/main/scala/io/iohk/atala/pollux/core/repository/CredentialStatusListRepository.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,13 @@ | ||
package io.iohk.atala.pollux.core.repository | ||
|
||
import io.iohk.atala.mercury.protocol.issuecredential.{IssueCredential, RequestCredential} | ||
import io.iohk.atala.pollux.anoncreds.CredentialRequestMetadata | ||
import io.iohk.atala.pollux.core.model.* | ||
import io.iohk.atala.pollux.core.model.IssueCredentialRecord.ProtocolState | ||
import io.iohk.atala.shared.models.{WalletAccessContext, WalletId} | ||
import zio.* | ||
|
||
trait CredentialStatusListRepository { | ||
def getLatestOfTheWallet(walletId: WalletId): RIO[WalletAccessContext, CredentialStatusList] | ||
|
||
} |
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
38 changes: 38 additions & 0 deletions
38
...c/main/scala/io/iohk/atala/pollux/sql/repository/JdbcCredentialStatusListRepository.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,38 @@ | ||
package io.iohk.atala.pollux.sql.repository | ||
|
||
import cats.data.NonEmptyList | ||
import doobie.* | ||
import doobie.free.connection | ||
import doobie.implicits.* | ||
import doobie.postgres.implicits.* | ||
import io.circe.* | ||
import io.circe.parser.* | ||
import io.circe.syntax.* | ||
import io.iohk.atala.castor.core.model.did.* | ||
import io.iohk.atala.mercury.protocol.issuecredential.{IssueCredential, OfferCredential, RequestCredential} | ||
import io.iohk.atala.pollux.anoncreds.CredentialRequestMetadata | ||
import io.iohk.atala.pollux.core.model.* | ||
import io.iohk.atala.pollux.core.model.error.CredentialRepositoryError | ||
import io.iohk.atala.pollux.core.model.error.CredentialRepositoryError.* | ||
import io.iohk.atala.pollux.core.repository.{CredentialRepository, CredentialStatusListRepository} | ||
import io.iohk.atala.shared.db.ContextAwareTask | ||
import io.iohk.atala.shared.db.Implicits.* | ||
import io.iohk.atala.shared.models.WalletAccessContext | ||
import org.postgresql.util.PSQLException | ||
import zio.* | ||
import zio.interop.catz.* | ||
import zio.json.* | ||
import io.iohk.atala.shared.models.{WalletAccessContext, WalletId} | ||
|
||
import java.time.Instant | ||
|
||
class JdbcCredentialStatusListRepository(xa: Transactor[ContextAwareTask], xb: Transactor[Task]) | ||
extends CredentialStatusListRepository { | ||
def getLatestOfTheWallet(walletId: WalletId): RIO[WalletAccessContext, CredentialStatusList] = ??? | ||
|
||
} | ||
|
||
object JdbcCredentialStatusListRepository { | ||
val layer: URLayer[Transactor[ContextAwareTask] & Transactor[Task], CredentialStatusListRepository] = | ||
ZLayer.fromFunction(new JdbcCredentialStatusListRepository(_, _)) | ||
} |
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
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
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
Oops, something went wrong.