diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/PresentBackgroundJobs.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/PresentBackgroundJobs.scala index 458c9598e5..b8279cf035 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/PresentBackgroundJobs.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/PresentBackgroundJobs.scala @@ -686,7 +686,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper { didResolverService <- ZIO.service[JwtDidResolver] credentialsClaimsValidationResult <- p.attachments.head.data match { case Base64(data) => - val base64Decoded = new String(java.util.Base64.getDecoder.decode(data)) + val base64Decoded = new String(java.util.Base64.getUrlDecoder.decode(data)) val maybePresentationOptions: Either[PresentationError, Option[ org.hyperledger.identus.pollux.core.model.presentation.Options ]] = @@ -836,7 +836,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper { didResolverService <- ZIO.service[JwtDidResolver] credentialsClaimsValidationResult <- p.attachments.head.data match { case Base64(data) => - val base64Decoded = new String(java.util.Base64.getDecoder.decode(data)) + val base64Decoded = new String(java.util.Base64.getUrlDecoder.decode(data)) val verifiedClaims = for { presentation <- ZIO.succeed(PresentationCompact.unsafeFromCompact(base64Decoded)) iss <- ZIO.fromEither(presentation.iss) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/PresentationStatus.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/PresentationStatus.scala index 6624a3857d..48d7c9010d 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/PresentationStatus.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/PresentationStatus.scala @@ -43,7 +43,7 @@ object PresentationStatus { case Some(p) => p.attachments.head.data match { case Base64(data) => - val base64Decoded = new String(java.util.Base64.getDecoder.decode(data)) + val base64Decoded = new String(java.util.Base64.getUrlDecoder.decode(data)) Seq(base64Decoded) case any => ??? } diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala index b3673766a8..92a97efe42 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala @@ -744,7 +744,7 @@ private class CredentialServiceImpl( .find(_.format.contains(IssueCredentialOfferFormat.Anoncred.name)) .map(_.data) .flatMap { - case Base64(value) => Some(new String(java.util.Base64.getDecoder.decode(value))) + case Base64(value) => Some(new String(java.util.Base64.getUrlDecoder.decode(value))) case _ => None } ) @@ -1548,7 +1548,7 @@ private class CredentialServiceImpl( jwt <- attachmentDescriptor.data match case Base64(b64) => ZIO.succeed { - val base64Decoded = new String(java.util.Base64.getDecoder.decode(b64)) + val base64Decoded = new String(java.util.Base64.getUrlDecoder.decode(b64)) JWT(base64Decoded) } case _ => ZIO.fail(UnexpectedError(s"Attachment doesn't contain Base64Data: ${record.id}")) diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceImpl.scala index 2409e63229..ecae304040 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceImpl.scala @@ -514,9 +514,12 @@ private class PresentationServiceImpl( PresentationError.PresentationDecodingError, Seq[CredentialCompact] ] = issuedCredentials.map { signedCredential => + println("******signedCredential***********") + println(signedCredential) + println("*******signedCredential**********") decode[org.hyperledger.identus.mercury.model.Base64](signedCredential) .flatMap(x => - Right(CredentialCompact.unsafeFromCompact(new String(java.util.Base64.getDecoder.decode(x.base64)))) + Right(CredentialCompact.unsafeFromCompact(new String(java.util.Base64.getUrlDecoder.decode(x.base64)))) ) .left .map(err => PresentationDecodingError(s"JsonData decoding error: $err")) @@ -525,6 +528,9 @@ private class PresentationServiceImpl( import io.circe.parser.decode import io.circe.syntax._ import java.util.Base64 + println("*****************") + println(requestPresentation.attachments.head) + println("*****************") val result: Either[PresentationDecodingError, SDJwtPresentation] = requestPresentation.attachments.headOption @@ -574,7 +580,7 @@ private class PresentationServiceImpl( ] = issuedCredentials.map { signedCredential => decode[org.hyperledger.identus.mercury.model.Base64](signedCredential) - .flatMap(x => Right(new String(java.util.Base64.getDecoder.decode(x.base64)))) + .flatMap(x => Right(new String(java.util.Base64.getUrlDecoder.decode(x.base64)))) .flatMap(x => Right(JwtVerifiableCredentialPayload(JWT(x)))) .left .map(err => PresentationDecodingError(s"JsonData decoding error: $err"))