Skip to content

Commit

Permalink
feat: Accept Presentation Request (#781)
Browse files Browse the repository at this point in the history
Signed-off-by: Bassam Riman <[email protected]>
  • Loading branch information
CryptoKnightIOG committed Feb 9, 2024
1 parent 5ba22d0 commit 8a5dfdd
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ final case class IssueCredentialRecord(
final case class ValidIssuedCredentialRecord(
id: DidCommID,
issuedCredentialRaw: Option[String],
credentialFormat: CredentialFormat,
subjectId: Option[String]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object PresentationError {
final case class InvalidFlowStateError(msg: String) extends PresentationError
final case class UnexpectedError(msg: String) extends PresentationError
final case class IssuedCredentialNotFoundError(cause: Throwable) extends PresentationError
final case class NotMatchingPresentationCredentialFormat(cause: Throwable) extends PresentationError
final case class PresentationDecodingError(cause: Throwable) extends PresentationError
final case class PresentationNotFoundError(cause: Throwable) extends PresentationError
final case class HolderBindingError(msg: String) extends PresentationError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class CredentialRepositoryInMemory(
store <- storeRef.get
} yield store.values
.filter(rec => recordId.contains(rec.id) && rec.issuedCredentialRaw.isDefined)
.map(rec => ValidIssuedCredentialRecord(rec.id, rec.issuedCredentialRaw, rec.subjectId))
.map(rec => ValidIssuedCredentialRecord(rec.id, rec.issuedCredentialRaw, rec.credentialFormat, rec.subjectId))
.toSeq
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,23 +411,32 @@ private class PresentationServiceImpl(

for {
record <- getRecordWithState(recordId, ProtocolState.RequestReceived)
issuedValidCredentials <- credentialRepository
issuedCredentials <- credentialRepository
.getValidIssuedCredentials(credentialsToUse.map(DidCommID(_)))
.mapError(RepositoryError.apply)
_ <- ZIO.cond(
(issuedValidCredentials.map(_.subjectId).toSet.size == 1),
(issuedCredentials.map(_.subjectId).toSet.size == 1),
(),
PresentationError.HolderBindingError(
s"Creating a Verifiable Presentation for credential with different subject DID is not supported, found : ${issuedValidCredentials
s"Creating a Verifiable Presentation for credential with different subject DID is not supported, found : ${issuedCredentials
.map(_.subjectId)}"
)
)
signedCredentials = issuedValidCredentials.flatMap(_.issuedCredentialRaw)
// record.credentialFormat match {
// case PresentationRecord.CredentialFormat.JWT => issuedRawCredentials
// case CredentialFormat.AnonCreds => issuedRawCredentials
// }
issuedCredentials <- ZIO.fromEither(
validatedCredentials <- ZIO.fromEither(
Either.cond(
issuedCredentials.forall(issuedValidCredential =>
issuedValidCredential.credentialFormat == record.credentialFormat
),
issuedCredentials,
PresentationError.NotMatchingPresentationCredentialFormat(
new IllegalArgumentException(
s"No matching issued credentials format: expectedFormat=${record.credentialFormat}"
)
)
)
)
signedCredentials = validatedCredentials.flatMap(_.issuedCredentialRaw)
_ <- ZIO.fromEither(
Either.cond(
signedCredentials.nonEmpty,
signedCredentials,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.iohk.atala.pollux.core.service

import io.iohk.atala.event.notification.{EventNotificationService, EventNotificationServiceImpl}
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.presentproof.{Presentation, RequestPresentation}
import io.iohk.atala.mercury.protocol.presentproof.{PresentCredentialRequestFormat, Presentation, RequestPresentation}
import io.iohk.atala.pollux.core.model.PresentationRecord.ProtocolState
import io.iohk.atala.pollux.core.model.{CredentialFormat, DidCommID, PresentationRecord}
import zio.mock.Expectation
Expand Down Expand Up @@ -169,7 +169,7 @@ object PresentationServiceNotifierSpec extends ZIOSpecDefault with PresentationS
svc <- ZIO.service[PresentationService]
ens <- ZIO.service[EventNotificationService]

_ <- svc.receiveRequestPresentation(None, requestPresentationJWT)
_ <- svc.receiveRequestPresentation(None, requestPresentation(PresentCredentialRequestFormat.JWT))
_ <- svc.acceptRequestPresentation(record.id, Seq.empty)
_ <- svc.markPresentationGenerated(record.id, presentation(record.thid.value))
_ <- svc.markPresentationSent(record.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
test("createPresentationPayloadFromRecord returns jwt prsentation payload") {
for {
repo <- ZIO.service[CredentialRepository]
aIssueCredentialRecord = issueCredentialRecord
aIssueCredentialRecord = issueCredentialRecord(CredentialFormat.JWT)
_ <- repo.createIssueCredentialRecord(aIssueCredentialRecord)
rawCredentialData =
"""{"base64":"ZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKcFlYUWlPakUyTnprek1qYzROaklzSW1GMVpDSTZJbVJ2YldGcGJpSXNJbTV2Ym1ObElqb2lZMlk1T1RJMk56Z3RPREV3TmkwME1EZzVMV0UxWXprdE5tTmhObU0wWkRBMU1HVTBJaXdpZG5BaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZjSEpsYzJWdWRHRjBhVzl1Y3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZRY21WelpXNTBZWFJwYjI0aVhYMHNJbWx6Y3lJNkltUnBaRHB3Y21semJUcGhaR0psT1RJNE9XUXdZelZtWWpVMlptWmhOVEF6T0Rka01UZ3dOR0ZpTkdFeE5UYzJOVEkzWXprME5tRTFNalV5T0RFM1ptRTRaVGhoTW1OalpXUXdPa056YzBKRGMyZENSVzFKUzBSWE1XaGpNMUpzWTJsb2NHSnRVbXhsUTJ0UlFWVktVRU5uYkZSYVYwNTNUV3BWTW1GNlJWTkpSUzFNYVVkTU0xRklaRlZ1VG10d1dXSkthSE5VYTIxWVVGaEpVM0ZXZWpjMll6RlZPWGhvVURseWNFZHBSSEZXTlRselJYcEtWbEpEYWxJMGEwMHdaMGg0YkhWUU5tVk5Ta2wwZHpJMk4yWllWbEpoTUhoRE5XaEthVU5uTVhSWldFNHdXbGhKYjJGWE5XdGFXR2R3UlVGU1ExUjNiMHBWTWxacVkwUkpNVTV0YzNoRmFVSlFhVFJvYVRrd1FqTldTbnBhUzFkSGVWbGlSVFZLYkhveGVVVnhiR010TFc1T1ZsQmpXVlJmWVRaU2IyYzJiR1ZtWWtKTmVWWlZVVzh3WlVwRVRrbENPRnBpYWkxdWFrTlRUR05PZFhVek1URlZWM1JOVVhWWkluMC5CcmFpbEVXa2VlSXhWbjY3dnpkVHZGTXpBMV9oNzFoaDZsODBHRFBpbkRaVVB4ajAxSC0tUC1QZDIxTk9wRDd3am51SDkxdUNBOFZMUW9fS2FnVjlnQQo="}"""
Expand Down Expand Up @@ -444,10 +444,10 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
fails(isSubtype[InvalidAnoncredPresentationRequest](anything))
)
},
test("acceptRequestPresentation updates the PresentatinRecord JWT") {
test("acceptRequestPresentation updates the PresentationRecord JWT") {
for {
repo <- ZIO.service[CredentialRepository]
aIssueCredentialRecord = issueCredentialRecord
aIssueCredentialRecord = issueCredentialRecord(CredentialFormat.JWT)
_ <- repo.createIssueCredentialRecord(aIssueCredentialRecord)
rawCredentialData =
"""{"base64":"ZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKcFlYUWlPakUyTnprek1qYzROaklzSW1GMVpDSTZJbVJ2YldGcGJpSXNJbTV2Ym1ObElqb2lZMlk1T1RJMk56Z3RPREV3TmkwME1EZzVMV0UxWXprdE5tTmhObU0wWkRBMU1HVTBJaXdpZG5BaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZjSEpsYzJWdWRHRjBhVzl1Y3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZRY21WelpXNTBZWFJwYjI0aVhYMHNJbWx6Y3lJNkltUnBaRHB3Y21semJUcGhaR0psT1RJNE9XUXdZelZtWWpVMlptWmhOVEF6T0Rka01UZ3dOR0ZpTkdFeE5UYzJOVEkzWXprME5tRTFNalV5T0RFM1ptRTRaVGhoTW1OalpXUXdPa056YzBKRGMyZENSVzFKUzBSWE1XaGpNMUpzWTJsb2NHSnRVbXhsUTJ0UlFWVktVRU5uYkZSYVYwNTNUV3BWTW1GNlJWTkpSUzFNYVVkTU0xRklaRlZ1VG10d1dXSkthSE5VYTIxWVVGaEpVM0ZXZWpjMll6RlZPWGhvVURseWNFZHBSSEZXTlRselJYcEtWbEpEYWxJMGEwMHdaMGg0YkhWUU5tVk5Ta2wwZHpJMk4yWllWbEpoTUhoRE5XaEthVU5uTVhSWldFNHdXbGhKYjJGWE5XdGFXR2R3UlVGU1ExUjNiMHBWTWxacVkwUkpNVTV0YzNoRmFVSlFhVFJvYVRrd1FqTldTbnBhUzFkSGVWbGlSVFZLYkhveGVVVnhiR010TFc1T1ZsQmpXVlJmWVRaU2IyYzJiR1ZtWWtKTmVWWlZVVzh3WlVwRVRrbENPRnBpYWkxdWFrTlRUR05PZFhVek1URlZWM1JOVVhWWkluMC5CcmFpbEVXa2VlSXhWbjY3dnpkVHZGTXpBMV9oNzFoaDZsODBHRFBpbkRaVVB4ajAxSC0tUC1QZDIxTk9wRDd3am51SDkxdUNBOFZMUW9fS2FnVjlnQQo="}"""
Expand All @@ -460,7 +460,54 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
svc <- ZIO.service[PresentationService]
connectionId = Some("connectionId")

aRecord <- svc.receiveRequestPresentation(connectionId, requestPresentationJWT)
aRecord <- svc.receiveRequestPresentation(
connectionId,
requestPresentation(PresentCredentialRequestFormat.JWT)
)
credentialsToUse = Seq(aIssueCredentialRecord.id.value)
updateRecord <- svc.acceptRequestPresentation(aRecord.id, credentialsToUse)

} yield {
assertTrue(updateRecord.connectionId == connectionId) &&
// assertTrue(updateRecord.requestPresentationData == Some(requestPresentation)) && // FIXME: enabling them make the test fail.
assertTrue(updateRecord.credentialsToUse.contains(credentialsToUse))
}
},
test("acceptRequestPresentation updates the PresentationRecord AnonCreds") {
for {
repo <- ZIO.service[CredentialRepository]
aIssueCredentialRecord = issueCredentialRecord(CredentialFormat.AnonCreds)
_ <- repo.createIssueCredentialRecord(aIssueCredentialRecord)
rawCredentialData =
"""{"base64":"ZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKcFlYUWlPakUyTnprek1qYzROaklzSW1GMVpDSTZJbVJ2YldGcGJpSXNJbTV2Ym1ObElqb2lZMlk1T1RJMk56Z3RPREV3TmkwME1EZzVMV0UxWXprdE5tTmhObU0wWkRBMU1HVTBJaXdpZG5BaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZjSEpsYzJWdWRHRjBhVzl1Y3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZRY21WelpXNTBZWFJwYjI0aVhYMHNJbWx6Y3lJNkltUnBaRHB3Y21semJUcGhaR0psT1RJNE9XUXdZelZtWWpVMlptWmhOVEF6T0Rka01UZ3dOR0ZpTkdFeE5UYzJOVEkzWXprME5tRTFNalV5T0RFM1ptRTRaVGhoTW1OalpXUXdPa056YzBKRGMyZENSVzFKUzBSWE1XaGpNMUpzWTJsb2NHSnRVbXhsUTJ0UlFWVktVRU5uYkZSYVYwNTNUV3BWTW1GNlJWTkpSUzFNYVVkTU0xRklaRlZ1VG10d1dXSkthSE5VYTIxWVVGaEpVM0ZXZWpjMll6RlZPWGhvVURseWNFZHBSSEZXTlRselJYcEtWbEpEYWxJMGEwMHdaMGg0YkhWUU5tVk5Ta2wwZHpJMk4yWllWbEpoTUhoRE5XaEthVU5uTVhSWldFNHdXbGhKYjJGWE5XdGFXR2R3UlVGU1ExUjNiMHBWTWxacVkwUkpNVTV0YzNoRmFVSlFhVFJvYVRrd1FqTldTbnBhUzFkSGVWbGlSVFZLYkhveGVVVnhiR010TFc1T1ZsQmpXVlJmWVRaU2IyYzJiR1ZtWWtKTmVWWlZVVzh3WlVwRVRrbENPRnBpYWkxdWFrTlRUR05PZFhVek1URlZWM1JOVVhWWkluMC5CcmFpbEVXa2VlSXhWbjY3dnpkVHZGTXpBMV9oNzFoaDZsODBHRFBpbkRaVVB4ajAxSC0tUC1QZDIxTk9wRDd3am51SDkxdUNBOFZMUW9fS2FnVjlnQQo="}"""
_ <- repo.updateWithIssuedRawCredential(
aIssueCredentialRecord.id,
IssueCredential.makeIssueCredentialFromRequestCredential(requestCredential.makeMessage),
rawCredentialData,
IssueCredentialRecord.ProtocolState.CredentialReceived
)
svc <- ZIO.service[PresentationService]
connectionId = Some("connectionId")
anoncredPresentationRequestV1 = AnoncredPresentationRequestV1(
Map.empty,
Map.empty,
"name",
"nonce",
"version",
None
)
attachmentDescriptor = AttachmentDescriptor.buildBase64Attachment(
mediaType = Some("application/json"),
format = Some(PresentCredentialRequestFormat.Anoncred.name),
payload = AnoncredPresentationRequestV1.schemaSerDes.serialize(anoncredPresentationRequestV1).getBytes()
)
requestPresentation = RequestPresentation(
body = RequestPresentation.Body(goal_code = Some("Presentation Request")),
attachments = Seq(attachmentDescriptor),
to = DidId("did:peer:Prover"),
from = DidId("did:peer:Verifier"),
)
aRecord <- svc.receiveRequestPresentation(connectionId, requestPresentation)
credentialsToUse = Seq(aIssueCredentialRecord.id.value)
updateRecord <- svc.acceptRequestPresentation(aRecord.id, credentialsToUse)

Expand All @@ -470,11 +517,56 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(updateRecord.credentialsToUse.contains(credentialsToUse))
}
},
test("rejectRequestPresentation updates the PresentatinRecord") {
test("acceptRequestPresentation should fail given unmatching format") {
for {
repo <- ZIO.service[CredentialRepository]
aIssueCredentialRecord = issueCredentialRecord(CredentialFormat.JWT)
_ <- repo.createIssueCredentialRecord(aIssueCredentialRecord)
rawCredentialData =
"""{"base64":"ZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKcFlYUWlPakUyTnprek1qYzROaklzSW1GMVpDSTZJbVJ2YldGcGJpSXNJbTV2Ym1ObElqb2lZMlk1T1RJMk56Z3RPREV3TmkwME1EZzVMV0UxWXprdE5tTmhObU0wWkRBMU1HVTBJaXdpZG5BaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZjSEpsYzJWdWRHRjBhVzl1Y3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZRY21WelpXNTBZWFJwYjI0aVhYMHNJbWx6Y3lJNkltUnBaRHB3Y21semJUcGhaR0psT1RJNE9XUXdZelZtWWpVMlptWmhOVEF6T0Rka01UZ3dOR0ZpTkdFeE5UYzJOVEkzWXprME5tRTFNalV5T0RFM1ptRTRaVGhoTW1OalpXUXdPa056YzBKRGMyZENSVzFKUzBSWE1XaGpNMUpzWTJsb2NHSnRVbXhsUTJ0UlFWVktVRU5uYkZSYVYwNTNUV3BWTW1GNlJWTkpSUzFNYVVkTU0xRklaRlZ1VG10d1dXSkthSE5VYTIxWVVGaEpVM0ZXZWpjMll6RlZPWGhvVURseWNFZHBSSEZXTlRselJYcEtWbEpEYWxJMGEwMHdaMGg0YkhWUU5tVk5Ta2wwZHpJMk4yWllWbEpoTUhoRE5XaEthVU5uTVhSWldFNHdXbGhKYjJGWE5XdGFXR2R3UlVGU1ExUjNiMHBWTWxacVkwUkpNVTV0YzNoRmFVSlFhVFJvYVRrd1FqTldTbnBhUzFkSGVWbGlSVFZLYkhveGVVVnhiR010TFc1T1ZsQmpXVlJmWVRaU2IyYzJiR1ZtWWtKTmVWWlZVVzh3WlVwRVRrbENPRnBpYWkxdWFrTlRUR05PZFhVek1URlZWM1JOVVhWWkluMC5CcmFpbEVXa2VlSXhWbjY3dnpkVHZGTXpBMV9oNzFoaDZsODBHRFBpbkRaVVB4ajAxSC0tUC1QZDIxTk9wRDd3am51SDkxdUNBOFZMUW9fS2FnVjlnQQo="}"""
_ <- repo.updateWithIssuedRawCredential(
aIssueCredentialRecord.id,
IssueCredential.makeIssueCredentialFromRequestCredential(requestCredential.makeMessage),
rawCredentialData,
IssueCredentialRecord.ProtocolState.CredentialReceived
)
svc <- ZIO.service[PresentationService]
connectionId = Some("connectionId")
anoncredPresentationRequestV1 = AnoncredPresentationRequestV1(
Map.empty,
Map.empty,
"name",
"nonce",
"version",
None
)
attachmentDescriptor = AttachmentDescriptor.buildBase64Attachment(
mediaType = Some("application/json"),
format = Some(PresentCredentialRequestFormat.Anoncred.name),
payload = AnoncredPresentationRequestV1.schemaSerDes.serialize(anoncredPresentationRequestV1).getBytes()
)
requestPresentation = RequestPresentation(
body = RequestPresentation.Body(goal_code = Some("Presentation Request")),
attachments = Seq(attachmentDescriptor),
to = DidId("did:peer:Prover"),
from = DidId("did:peer:Verifier"),
)
aRecord <- svc.receiveRequestPresentation(connectionId, requestPresentation)
credentialsToUse = Seq(aIssueCredentialRecord.id.value)
result <- svc.acceptRequestPresentation(aRecord.id, credentialsToUse).exit

} yield assert(result)(
fails(isSubtype[NotMatchingPresentationCredentialFormat](anything))
)
},
test("rejectRequestPresentation updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
connectionId = Some("connectionId")
aRecord <- svc.receiveRequestPresentation(connectionId, requestPresentationJWT)
aRecord <- svc.receiveRequestPresentation(
connectionId,
requestPresentation(PresentCredentialRequestFormat.JWT)
)
updateRecord <- svc.rejectRequestPresentation(aRecord.id)

} yield {
Expand All @@ -500,7 +592,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(record.protocolState == PresentationRecord.ProtocolState.PresentationSent)
}
},
test("receivePresentation updates the PresentatinRecord") {
test("receivePresentation updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
aRecord <- svc.createJwtRecord()
Expand All @@ -512,7 +604,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(aRecordReceived.presentationData == Some(p))
}
},
test("acceptPresentation updates the PresentatinRecord") {
test("acceptPresentation updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
aRecord <- svc.createJwtRecord()
Expand All @@ -530,7 +622,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(aRecordReceived.presentationData == Some(p))
}
},
test("markPresentationRejected updates the PresentatinRecord") {
test("markPresentationRejected updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
aRecord <- svc.createJwtRecord()
Expand All @@ -549,7 +641,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(aRecordReject.protocolState == PresentationRecord.ProtocolState.PresentationRejected)
}
},
test("rejectPresentation updates the PresentatinRecord") {
test("rejectPresentation updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
aRecord <- svc.createJwtRecord()
Expand Down Expand Up @@ -601,7 +693,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(record.protocolState == PresentationRecord.ProtocolState.ProposalSent)
}
},
test("receiveProposePresentation updates the PresentatinRecord") {
test("receiveProposePresentation updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
aRecord <- svc.createJwtRecord()
Expand All @@ -612,7 +704,7 @@ object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSp
assertTrue(aRecordReceived.proposePresentationData == Some(p))
}
},
test("acceptProposePresentation updates the PresentatinRecord") {
test("acceptProposePresentation updates the PresentationRecord") {
for {
svc <- ZIO.service[PresentationService]
aRecord <- svc.createJwtRecord()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ trait PresentationServiceSpecHelper {
attachments = Nil
)

protected def requestPresentationJWT: RequestPresentation = {
protected def requestPresentation(credentialFormat: PresentCredentialRequestFormat): RequestPresentation = {
val body = RequestPresentation.Body(goal_code = Some("Presentation Request"))
val presentationAttachmentAsJson =
"""{
Expand All @@ -66,7 +66,7 @@ trait PresentationServiceSpecHelper {

val attachmentDescriptor = AttachmentDescriptor.buildJsonAttachment(
payload = presentationAttachmentAsJson,
format = Some(PresentCredentialRequestFormat.JWT.name)
format = Some(credentialFormat.name)
)
RequestPresentation(
body = body,
Expand Down Expand Up @@ -116,14 +116,14 @@ trait PresentationServiceSpecHelper {
)
}

protected def issueCredentialRecord = IssueCredentialRecord(
protected def issueCredentialRecord(credentialFormat: CredentialFormat) = IssueCredentialRecord(
id = DidCommID(),
createdAt = Instant.now,
updatedAt = None,
thid = DidCommID(),
schemaId = None,
credentialDefinitionId = None,
credentialFormat = CredentialFormat.JWT,
credentialFormat = credentialFormat,
role = IssueCredentialRecord.Role.Issuer,
subjectId = None,
validityPeriod = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ class JdbcCredentialRepository(xa: Transactor[ContextAwareTask], xb: Transactor[
| SELECT
| id,
| issued_credential_raw,
| credential_format,
| subject_id
| FROM public.issue_credential_records
| WHERE
Expand Down

0 comments on commit 8a5dfdd

Please sign in to comment.