Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: VPJWT JSON decoder in the issue-credential protocol #1505

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ object MessagingService {
else didCommService.packEncrypted(msg = finalMessage, to = to)

_ <- ZIO.log(s"Sending a Message to '$serviceEndpoint'")
_ <- ZIO.debug(s"Plain message: $msg")
resp <- org.hyperledger.identus.mercury.HttpClient
.postDIDComm(url = serviceEndpoint, data = encryptedMessage.string)
.catchAll { case ex => ZIO.fail(SendMessageError(ex, Some(encryptedMessage.string))) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,9 @@ class CredentialServiceImpl(
JwtPresentation.validatePresentation(jwt, options.domain, options.challenge) match
case ZValidation.Success(log, value) => ZIO.unit
case ZValidation.Failure(log, error) =>
ZIO.fail(CredentialRequestValidationFailed("domain/challenge proof validation failed"))
ZIO.fail(
CredentialRequestValidationFailed(s"JWTPresentation validation failed: ${error.toList.mkString(";")}")
)

clock = java.time.Clock.system(ZoneId.systemDefault)
verificationResult <- JwtPresentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ object JwtVp {
.map(IndexedSeq(_))
.orElse(ctx.as[IndexedSeq[VerifiableCredentialPayload]])
)
.orElse(Right(IndexedSeq.empty[VerifiableCredentialPayload]))
} yield Json_JwtVp(context, typ, vcp)
}

Expand Down Expand Up @@ -484,7 +485,7 @@ object JwtPresentation {
domain: Option[String]
): Validation[String, Unit] = {
if (!domain.forall(domain => decodedJwtPresentation.aud.contains(domain))) {
Validation.fail(s"domain/Audience dont match doamin=$domain, exp=${decodedJwtPresentation.aud}")
Validation.fail(s"domain/Audience dont match domain=$domain, exp=${decodedJwtPresentation.aud}")
} else Validation.unit
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ class CredentialSteps {
equalTo(CREDENTIAL_RECEIVED),
),
)
holder.remember("issuedCredential", ListenToEvents.with(holder).credentialEvents.last().data)

val issueCredentialRecord = ListenToEvents.with(holder).credentialEvents.last().data

issueCredentialRecord.credential?.let {
println("Issued Credentials:")
println(it)
}

holder.remember("issuedCredential", issueCredentialRecord)
}

@Then("{actor} should see that credential issuance has failed")
Expand Down
Loading