-
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.
feat(pollux): implement Issue Credential v2 Protocol (#144)
* feat(pollux): add 'CredentialGenerated' state * chore(pollux): disable Doobie log handler * chore(pollux): move DIDComm message creation and storage in credential service * mend chore(pollux): move DIDComm message creation and storage in credential service * chore(prism-agent): inject DidComm layer in credential service * chore(pollux): generate DidComm IssueCredential message when accepting credential request * chore(prism-agent): do not create DidComm messages in background job * chore(prism-agent): wip * chore(prism-agent): add missing import * chore(prism-agent): bump pollux dependency version to 0.2.0-SNAPSHOT * fix(prism-agent): fix pollux DbConfig package change * fix(pollux): populate record claims in DB when receiving the DIDComm OfferCredential message * chore(pollux): remove obsolete claims attribute from DB and retrieve them from the offer * chore(pollux): reinstate 'markCredentialGenerated' method * feat(prism-agent): return JWT credential based on issue-credential and claims based on offer-credential from REST API calls * chore(prism-agent): get rid of 'claims' attribute and make sure whole flow is working waiting for publication to be integrated * chore(pollux): add 'automatic-issuance' flag to support auto request acceptance by issuer * chore(prism-agent): add 'automaticIssuance' attribute to issue REST API * chore(prism-agent): bump pollux dependency version to 0.3.0-SNAPSHOT * chore(pollux): bump version to 0.3.0-SNAPSHOT * chore(pollux): introduce 'awaitConfirmation' flag in issue credential record * chore(pollux): introduce 'awaitConfirmation' flag in issue credential protocol REST API * chore(prism-agent): limit pollux DB transactor connection pool * feature(pollux): add creationDateTime attribute to issue credential record * feature(prism-agent): add creationDateTime in issue credential protocol REST API * feature(prism-agent): add 'updateAt' field to issue credential record * feat(pollux): Add job that publishes credentials to DLT (#92) * Remove SNAPSHOT from versions, fix some errirs with scala version mismatch, make local docker compose runnable * Add getCredentialRecordsByState * Add function to make credential from issue credential record * WIP: implement the job * Add inclusion proof to IssueCredentialRecord * Add serializer and decserializer for inclusion proofs * WIP: Add updateCredentialRecordStateAndProofByCredentialIdBulk * Add updateCredentialRecordStateAndProofByCredentialIdBulk * Fix merge conflict erros * Remove MockCredentialService * Fix errors caused by conflicts * Edit createCredentialPayloadFromRecord, get credential from requestCredential didcome message * Revert remove "extractIdFromCredential" * Make it compile * Update mercyry to 0.6.0 * Finalize protocol * remove confusing response texts * Format * format prism agent * add my branch to releases * remove my branch from release Co-authored-by: FabioPinheiro <[email protected]> * feat(prism-agent): return JWT credential from API call * chore(pollux): restore prism-agent folder to main branch => 2 PRs split Co-authored-by: shota jolbordi <[email protected]> Co-authored-by: FabioPinheiro <[email protected]>
- Loading branch information
1 parent
e4d4a41
commit a80702f
Showing
19 changed files
with
601 additions
and
181 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
ThisBuild / version := "0.2.0-SNAPSHOT" | ||
ThisBuild / version := "0.1.0" | ||
This comment has been minimized.
Sorry, 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
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 |
---|---|---|
|
@@ -85,9 +85,10 @@ lazy val mediator = project | |
libraryDependencies ++= Seq(D.mercuryModels.value, D.mercuryAgent.value), | ||
Compile / unmanagedResourceDirectories += apiBaseDirectory.value, | ||
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), | ||
githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), | ||
// ### Build Docker Image ### | ||
Docker / maintainer := "[email protected]", | ||
Docker / dockerRepository := Some("ghcr.io"), | ||
Docker / dockerRepository := Some("atala-prism.io"), | ||
Docker / dockerUsername := Some("input-output-hk"), | ||
Docker / githubOwner := "atala-prism-building-blocks", | ||
Docker / dockerUpdateLatest := true, | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
ThisBuild / version := "0.1.0-SNAPSHOT" | ||
ThisBuild / version := "0.1.0" |
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
8 changes: 8 additions & 0 deletions
8
.../scala/io/iohk/atala/pollux/core/model/error/CreateCredentialPayloadFromRecordError.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,8 @@ | ||
package io.iohk.atala.pollux.core.model.error | ||
|
||
sealed trait CreateCredentialPayloadFromRecordError | ||
|
||
object CreateCredentialPayloadFromRecordError { | ||
final case class RepositoryError(cause: Throwable) extends CreateCredentialPayloadFromRecordError | ||
final case class CouldNotExtractClaimsError(cause: Throwable) extends CreateCredentialPayloadFromRecordError | ||
} |
6 changes: 6 additions & 0 deletions
6
.../lib/core/src/main/scala/io/iohk/atala/pollux/core/model/error/IssueCredentialError.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 |
---|---|---|
@@ -1,7 +1,13 @@ | ||
package io.iohk.atala.pollux.core.model.error | ||
|
||
import java.util.UUID | ||
|
||
sealed trait IssueCredentialError | ||
|
||
object IssueCredentialError { | ||
final case class RepositoryError(cause: Throwable) extends IssueCredentialError | ||
final case class RecordIdNotFound(recordId: UUID) extends IssueCredentialError | ||
final case class ThreadIdNotFound(thid: UUID) extends IssueCredentialError | ||
final case class InvalidFlowStateError(msg: String) extends IssueCredentialError | ||
final case class UnexpectedError(msg: String) extends IssueCredentialError | ||
} |
11 changes: 11 additions & 0 deletions
11
...ala/io/iohk/atala/pollux/core/model/error/MarkCredentialRecordsAsPublishQueuedError.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,11 @@ | ||
package io.iohk.atala.pollux.core.model.error | ||
|
||
import io.iohk.atala.pollux.vc.jwt.W3cCredentialPayload | ||
|
||
sealed trait MarkCredentialRecordsAsPublishQueuedError | ||
|
||
object MarkCredentialRecordsAsPublishQueuedError { | ||
final case class RepositoryError(cause: Throwable) extends MarkCredentialRecordsAsPublishQueuedError | ||
final case class CredentialIdNotDefined(credential: W3cCredentialPayload) | ||
extends MarkCredentialRecordsAsPublishQueuedError | ||
} |
24 changes: 15 additions & 9 deletions
24
...x/lib/core/src/main/scala/io/iohk/atala/pollux/core/repository/CredentialRepository.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 |
---|---|---|
@@ -1,32 +1,38 @@ | ||
package io.iohk.atala.pollux.core.repository | ||
|
||
import io.iohk.atala.pollux.core.model.EncodedJWTCredential | ||
import zio.* | ||
import io.iohk.atala.pollux.core.model.IssueCredentialRecord | ||
import io.iohk.atala.prism.crypto.MerkleInclusionProof | ||
import zio.* | ||
|
||
import java.util.UUID | ||
import io.iohk.atala.mercury.protocol.issuecredential.RequestCredential | ||
import io.iohk.atala.mercury.protocol.issuecredential.IssueCredential | ||
import io.iohk.atala.pollux.core.model.IssueCredentialRecord.ProtocolState | ||
|
||
trait CredentialRepository[F[_]] { | ||
def createIssueCredentialRecord(record: IssueCredentialRecord): F[Int] | ||
|
||
def getIssueCredentialRecords(): F[Seq[IssueCredentialRecord]] | ||
def getIssueCredentialRecord(recordId: UUID): F[Option[IssueCredentialRecord]] | ||
def getIssueCredentialRecordsByState(state: IssueCredentialRecord.ProtocolState): F[Seq[IssueCredentialRecord]] | ||
def updateCredentialRecordStateAndProofByCredentialIdBulk( | ||
idsStatesAndProofs: Seq[(UUID, IssueCredentialRecord.PublicationState, MerkleInclusionProof)] | ||
): F[Int] | ||
|
||
def getIssueCredentialRecord(id: UUID): F[Option[IssueCredentialRecord]] | ||
|
||
def getIssueCredentialRecordByThreadId(id: UUID): F[Option[IssueCredentialRecord]] | ||
def getIssueCredentialRecordByThreadId(thid: UUID): F[Option[IssueCredentialRecord]] | ||
|
||
def updateCredentialRecordProtocolState( | ||
id: UUID, | ||
recordId: UUID, | ||
from: IssueCredentialRecord.ProtocolState, | ||
to: IssueCredentialRecord.ProtocolState | ||
): F[Int] | ||
def updateCredentialRecordPublicationState( | ||
id: UUID, | ||
recordId: UUID, | ||
from: Option[IssueCredentialRecord.PublicationState], | ||
to: Option[IssueCredentialRecord.PublicationState] | ||
): F[Int] | ||
|
||
def updateWithRequestCredential(request: RequestCredential): F[Int] | ||
def updateWithRequestCredential(recordId: UUID, request: RequestCredential, protocolState: ProtocolState): F[Int] | ||
|
||
def updateWithIssueCredential(issue: IssueCredential): F[Int] | ||
def updateWithIssueCredential(recordId: UUID, issue: IssueCredential, protocolState: ProtocolState): F[Int] | ||
} |
Oops, something went wrong.
=(