diff --git a/.github/workflows/ff-merge.yml b/.github/workflows/ff-merge.yml index 01b8442da2..38c9ac1c97 100644 --- a/.github/workflows/ff-merge.yml +++ b/.github/workflows/ff-merge.yml @@ -7,7 +7,7 @@ name: Fast-forward merge # This workflow helps to merge multiple commits from PR to main branch of the repository # without loosing of PGP signature. # -# Related GitHub discussions: +# Related GitHub discussions: # https://github.com/community/community/discussions/10410 # https://github.com/orgs/community/discussions/5524 @@ -29,5 +29,5 @@ jobs: uses: endre-spotlab/fast-forward-js-action@2.1 with: GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} - success_message: 'Success! Fast forwarded ***target_base*** to ***source_head***! ```git checkout target_base && git merge source_head --ff-only``` ' - failure_message: 'Failed! Cannot do fast forward!' + success_message: "Success! Fast forwarded ***target_base*** to ***source_head***! ```git checkout target_base && git merge source_head --ff-only``` " + failure_message: "Failed! Cannot do fast forward!" diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 0000000000..f2213f9052 --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1,5 @@ +rules = [ OrganizeImports ] + +OrganizeImports.groupedImports = Merge +OrganizeImports.removeUnused = false +OrganizeImports.targetDialect = Scala3 diff --git a/.scalafmt.conf b/.scalafmt.conf index 5b62d16895..0a6c70a036 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -3,3 +3,11 @@ runner.dialect = scala3 maxColumn = 120 trailingCommas = preserve + +rewrite.rules = [Imports] +rewrite.imports.expand = false +rewrite.imports.sort = original +rewrite.imports.groups = [ + [".*"], + ["java\\..*", "scala\\..*"] +] diff --git a/build.sbt b/build.sbt index 069344a04e..e55456508d 100644 --- a/build.sbt +++ b/build.sbt @@ -92,7 +92,7 @@ lazy val V = new { val vaultDriver = "6.2.0" val micrometer = "1.11.11" - val nimbusJwt = "10.0.0" + val nimbusJwt = "9.37.3" val keycloak = "23.0.7" // scala-steward:off //TODO 24.0.3 // update all quay.io/keycloak/keycloak } @@ -129,9 +129,7 @@ lazy val D = new { val peerDidcommx: ModuleID = "org.didcommx" % "peerdid" % "0.5.0" val didScala: ModuleID = "app.fmgp" %% "did" % "0.0.0+113-61efa271-SNAPSHOT" - // Customized version of numbus jose jwt - // from https://github.com/goncalo-frade-iohk/Nimbus-JWT_Fork/commit/8a6665c25979e771afae29ce8c965c8b0312fefb - val nimbusJwt: ModuleID = "io.iohk.atala" % "nimbus-jose-jwt" % V.nimbusJwt + val nimbusJwt: ModuleID = "com.nimbusds" % "nimbus-jose-jwt" % V.nimbusJwt val typesafeConfig: ModuleID = "com.typesafe" % "config" % V.typesafeConfig val scalaPbRuntime: ModuleID = diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelper.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelper.scala index ab19920c9d..2a498df319 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelper.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelper.scala @@ -2,7 +2,10 @@ package org.hyperledger.identus.castor.core.model import com.google.protobuf.ByteString import io.circe.Json -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint +import io.iohk.atala.prism.protos.{common_models, node_api, node_models} +import io.iohk.atala.prism.protos.common_models.OperationStatus +import io.iohk.atala.prism.protos.node_models.KeyUsage +import io.iohk.atala.prism.protos.node_models.PublicKey.KeyData import org.hyperledger.identus.castor.core.model.did.{ DIDData, EllipticCurve, @@ -21,15 +24,13 @@ import org.hyperledger.identus.castor.core.model.did.{ UpdateDIDAction, VerificationRelationship } -import io.iohk.atala.prism.protos.common_models.OperationStatus -import io.iohk.atala.prism.protos.node_models.KeyUsage -import io.iohk.atala.prism.protos.node_models.PublicKey.KeyData -import io.iohk.atala.prism.protos.{common_models, node_api, node_models} +import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint import org.hyperledger.identus.shared.models.Base64UrlString import org.hyperledger.identus.shared.utils.Traverse.* +import zio.* + import java.time.Instant import scala.language.implicitConversions -import zio.* object ProtoModelHelper extends ProtoModelHelper diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDID.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDID.scala index b204c38281..fe6b00c885 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDID.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDID.scala @@ -1,13 +1,13 @@ package org.hyperledger.identus.castor.core.model.did -import org.hyperledger.identus.castor.core.model.ProtoModelHelper -import org.hyperledger.identus.shared.crypto.Sha256Hash import io.iohk.atala.prism.protos.node_models import io.iohk.atala.prism.protos.node_models.AtalaOperation.Operation -import org.hyperledger.identus.shared.models.Base64UrlString -import org.hyperledger.identus.shared.models.HexString -import scala.util.Try +import org.hyperledger.identus.castor.core.model.ProtoModelHelper +import org.hyperledger.identus.shared.crypto.Sha256Hash +import org.hyperledger.identus.shared.models.{Base64UrlString, HexString} + import scala.util.matching.Regex +import scala.util.Try /** Represents a [Did] used in PRISM with prism-specific method and keys as [PrismDid] */ diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDOperation.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDOperation.scala index 656abf4688..751d6f5e52 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDOperation.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDOperation.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.castor.core.model.did +import io.iohk.atala.prism.protos.node_models import org.hyperledger.identus.castor.core.model.ProtoModelHelper import org.hyperledger.identus.shared.crypto.Sha256Hash import scala.collection.compat.immutable.ArraySeq -import io.iohk.atala.prism.protos.node_models sealed trait PrismDIDOperation { def did: CanonicalPrismDID diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/w3c/W3CModelHelper.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/w3c/W3CModelHelper.scala index ff1e4210b9..8668d00cf0 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/w3c/W3CModelHelper.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/model/did/w3c/W3CModelHelper.scala @@ -4,11 +4,9 @@ import io.circe.Json import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.models.Base64UrlString -import org.hyperledger.identus.shared.models.HexString +import org.hyperledger.identus.shared.models.{Base64UrlString, HexString} -import java.time.Instant -import java.time.ZoneOffset +import java.time.{Instant, ZoneOffset} import java.time.format.DateTimeFormatter object W3CModelHelper extends W3CModelHelper diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/service/DIDService.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/service/DIDService.scala index 0b069c0e69..e65db12ccd 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/service/DIDService.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/service/DIDService.scala @@ -1,6 +1,8 @@ package org.hyperledger.identus.castor.core.service -import org.hyperledger.identus.castor.core.model.ProtoModelHelper +import io.iohk.atala.prism.protos.{node_api, node_models} +import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc.NodeService +import io.iohk.atala.prism.protos.node_models.OperationOutput.OperationMaybe import org.hyperledger.identus.castor.core.model.did.{ CanonicalPrismDID, DIDData, @@ -13,16 +15,14 @@ import org.hyperledger.identus.castor.core.model.did.{ ScheduledDIDOperationDetail, SignedPrismDIDOperation } -import org.hyperledger.identus.castor.core.model.error.OperationValidationError -import org.hyperledger.identus.castor.core.model.error.{DIDOperationError, DIDResolutionError} +import org.hyperledger.identus.castor.core.model.error.{DIDOperationError, DIDResolutionError, OperationValidationError} +import org.hyperledger.identus.castor.core.model.ProtoModelHelper import org.hyperledger.identus.castor.core.util.DIDOperationValidator -import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc.NodeService -import io.iohk.atala.prism.protos.node_models.OperationOutput.OperationMaybe -import io.iohk.atala.prism.protos.{node_api, node_models} import org.hyperledger.identus.shared.models.HexString +import zio.* + import java.time.Instant import scala.collection.immutable.ArraySeq -import zio.* trait DIDService { def scheduleOperation(operation: SignedPrismDIDOperation): IO[DIDOperationError, ScheduleDIDOperationOutcome] diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/service/MockDIDService.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/service/MockDIDService.scala index 890a2e209b..f3d4b8fd40 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/service/MockDIDService.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/service/MockDIDService.scala @@ -2,12 +2,11 @@ package org.hyperledger.identus.castor.core.service import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.castor.core.model.error -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair +import org.hyperledger.identus.shared.crypto.{Apollo, Secp256k1KeyPair} import org.hyperledger.identus.shared.models.Base64UrlString +import zio.{mock, IO, URLayer, ZIO, ZLayer} import zio.mock.{Expectation, Mock, Proxy} import zio.test.Assertion -import zio.{IO, URLayer, ZIO, ZLayer, mock} import scala.collection.immutable.ArraySeq diff --git a/castor/src/main/scala/org/hyperledger/identus/castor/core/util/UriUtils.scala b/castor/src/main/scala/org/hyperledger/identus/castor/core/util/UriUtils.scala index 06ee467f47..92bcfa81fb 100644 --- a/castor/src/main/scala/org/hyperledger/identus/castor/core/util/UriUtils.scala +++ b/castor/src/main/scala/org/hyperledger/identus/castor/core/util/UriUtils.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.castor.core.util -import io.lemonlabs.uri.{Uri, Url, Urn, QueryString} +import io.lemonlabs.uri.{QueryString, Uri, Url, Urn} import io.lemonlabs.uri.config.UriConfig -import io.lemonlabs.uri.encoding.PercentEncoder import io.lemonlabs.uri.decoding.UriDecodeException +import io.lemonlabs.uri.encoding.PercentEncoder // TODO: unify with the logic used in Node // https://github.com/input-output-hk/atala-prism/blob/ba7b3e3ef307f6bd06734af2bf8fed9b119ee98e/prism-backend/common/src/main/scala/io/iohk/atala/prism/utils/UriUtils.scala diff --git a/castor/src/test/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelperSpec.scala b/castor/src/test/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelperSpec.scala index c982b6d817..a72e0f9f82 100644 --- a/castor/src/test/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelperSpec.scala +++ b/castor/src/test/scala/org/hyperledger/identus/castor/core/model/ProtoModelHelperSpec.scala @@ -1,21 +1,19 @@ package org.hyperledger.identus.castor.core.model import com.google.protobuf.timestamp.Timestamp -import io.circe.Json -import io.circe.JsonObject -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriValue -import org.hyperledger.identus.castor.core.model.did.ServiceType -import org.hyperledger.identus.castor.core.util.GenUtils +import io.circe.{Json, JsonObject} import io.iohk.atala.prism.protos.common_models.Ledger import io.iohk.atala.prism.protos.node_models -import java.time.Instant -import scala.language.implicitConversions +import org.hyperledger.identus.castor.core.model.did.{ServiceEndpoint, ServiceType} +import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.{UriOrJsonEndpoint, UriValue} +import org.hyperledger.identus.castor.core.util.GenUtils import zio.* import zio.test.* import zio.test.Assertion.* +import java.time.Instant +import scala.language.implicitConversions + object ProtoModelHelperSpec extends ZIOSpecDefault { import ProtoModelHelper.* diff --git a/castor/src/test/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDSpec.scala b/castor/src/test/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDSpec.scala index d9e99d9d2b..bde94b49eb 100644 --- a/castor/src/test/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDSpec.scala +++ b/castor/src/test/scala/org/hyperledger/identus/castor/core/model/did/PrismDIDSpec.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.castor.core.model.did import com.google.protobuf.ByteString -import org.hyperledger.identus.shared.crypto.Sha256Hash import io.iohk.atala.prism.protos.node_models +import org.hyperledger.identus.shared.crypto.Sha256Hash import org.hyperledger.identus.shared.models.Base64UrlString import zio.* import zio.test.* diff --git a/castor/src/test/scala/org/hyperledger/identus/castor/core/service/DIDServiceSpec.scala b/castor/src/test/scala/org/hyperledger/identus/castor/core/service/DIDServiceSpec.scala index caa3b2a6c7..cc6695f788 100644 --- a/castor/src/test/scala/org/hyperledger/identus/castor/core/service/DIDServiceSpec.scala +++ b/castor/src/test/scala/org/hyperledger/identus/castor/core/service/DIDServiceSpec.scala @@ -1,13 +1,8 @@ package org.hyperledger.identus.castor.core.service import com.google.protobuf.ByteString -import org.hyperledger.identus.castor.core.model.did.{DIDData, PrismDID, PrismDIDOperation} -import org.hyperledger.identus.castor.core.model.error.DIDResolutionError -import org.hyperledger.identus.castor.core.util.{GenUtils} -import org.hyperledger.identus.castor.core.util.DIDOperationValidator +import io.iohk.atala.prism.protos.{node_api, node_models} import io.iohk.atala.prism.protos.common_models.{HealthCheckRequest, HealthCheckResponse} -import io.iohk.atala.prism.protos.node_api -import io.iohk.atala.prism.protos.node_models import io.iohk.atala.prism.protos.node_api.{ GetBatchStateRequest, GetBatchStateResponse, @@ -27,6 +22,9 @@ import io.iohk.atala.prism.protos.node_api.{ ScheduleOperationsRequest, ScheduleOperationsResponse } +import org.hyperledger.identus.castor.core.model.did.{DIDData, PrismDID, PrismDIDOperation} +import org.hyperledger.identus.castor.core.model.error.DIDResolutionError +import org.hyperledger.identus.castor.core.util.{DIDOperationValidator, GenUtils} import zio.* import zio.test.* import zio.test.Assertion.* diff --git a/castor/src/test/scala/org/hyperledger/identus/castor/core/util/GenUtils.scala b/castor/src/test/scala/org/hyperledger/identus/castor/core/util/GenUtils.scala index 5113a2f015..1eec00dd88 100644 --- a/castor/src/test/scala/org/hyperledger/identus/castor/core/util/GenUtils.scala +++ b/castor/src/test/scala/org/hyperledger/identus/castor/core/util/GenUtils.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.castor.core.util import io.circe.Json import org.hyperledger.identus.castor.core.model.did.* -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriValue +import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.{UriOrJsonEndpoint, UriValue} import org.hyperledger.identus.shared.crypto.Apollo import org.hyperledger.identus.shared.models.Base64UrlString import zio.* diff --git a/cloud-agent/service/server/src/main/resources/application.conf b/cloud-agent/service/server/src/main/resources/application.conf index 4e8a3be8e1..e06abbaf0a 100644 --- a/cloud-agent/service/server/src/main/resources/application.conf +++ b/cloud-agent/service/server/src/main/resources/application.conf @@ -49,6 +49,8 @@ pollux { syncRevocationStatusesBgJobRecurrenceDelay = ${?SYNC_REVOCATION_STATUSES_BG_JOB_RECURRENCE_DELAY} syncRevocationStatusesBgJobProcessingParallelism = 5 syncRevocationStatusesBgJobProcessingParallelism = ${?SYNC_REVOCATION_STATUSES_BG_JOB_PROCESSING_PARALLELISM} + credential.sdJwt.expiry = 30 days + credential.sdJwt.expiry = ${?CREDENTIAL_SD_JWT_EXPIRY} } connect { diff --git a/cloud-agent/service/server/src/main/resources/logback.xml b/cloud-agent/service/server/src/main/resources/logback.xml index 9cc86d2bba..9121c1c22d 100644 --- a/cloud-agent/service/server/src/main/resources/logback.xml +++ b/cloud-agent/service/server/src/main/resources/logback.xml @@ -10,7 +10,9 @@ %d{yyyy-MM-dd_HH:mm:ss.SSS} %highlight(%-5level) %cyan(%logger{5}@L%line:[%-4.30thread]) {%mdc} - %msg%n%xException - + + + diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/LogUtils.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/LogUtils.scala index bfe877b818..4199501d8f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/LogUtils.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/LogUtils.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus -import zio.* import org.hyperledger.identus.api.http.RequestContext import sttp.model.Header +import zio.* object LogUtils { inline val headerName = "X-Request-ID" diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/notification/WebhookPublisher.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/notification/WebhookPublisher.scala index 7eefc95f5c..850fa685bc 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/notification/WebhookPublisher.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/notification/WebhookPublisher.scala @@ -6,11 +6,14 @@ import org.hyperledger.identus.agent.server.config.AppConfig import org.hyperledger.identus.agent.walletapi.model.ManagedDIDDetail import org.hyperledger.identus.agent.walletapi.service.WalletManagementService import org.hyperledger.identus.connect.core.model.ConnectionRecord -import org.hyperledger.identus.event.notification.EventNotificationConfig -import org.hyperledger.identus.event.notification.{Event, EventConsumer, EventNotificationService} +import org.hyperledger.identus.event.notification.{ + Event, + EventConsumer, + EventNotificationConfig, + EventNotificationService +} import org.hyperledger.identus.pollux.core.model.{IssueCredentialRecord, PresentationRecord} -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.http.* import zio.json.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/ControllerHelper.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/ControllerHelper.scala index 30a756285a..55e0a23b74 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/ControllerHelper.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/ControllerHelper.scala @@ -1,18 +1,18 @@ package org.hyperledger.identus.agent.server -import org.hyperledger.identus.agent.walletapi.model.PublicationState.Published -import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState} +import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError +import org.hyperledger.identus.agent.walletapi.model.PublicationState.Published import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.castor.core.model.did.{LongFormPrismDID, PrismDID} -import org.hyperledger.identus.connect.core.model.ConnectionRecord -import org.hyperledger.identus.connect.core.model.ConnectionRecord.{ProtocolState, Role} import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.{ InvalidStateForOperation, RecordIdNotFound } +import org.hyperledger.identus.connect.core.model.ConnectionRecord +import org.hyperledger.identus.connect.core.model.ConnectionRecord.{ProtocolState, Role} import org.hyperledger.identus.connect.core.service.ConnectionService import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/MainApp.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/MainApp.scala index b04c9bb7f6..e561a0b40f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/MainApp.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/MainApp.scala @@ -24,12 +24,13 @@ import org.hyperledger.identus.connect.controller.ConnectionControllerImpl import org.hyperledger.identus.connect.core.service.{ConnectionServiceImpl, ConnectionServiceNotifier} import org.hyperledger.identus.connect.sql.repository.{JdbcConnectionRepository, Migrations as ConnectMigrations} import org.hyperledger.identus.credential.status.controller.CredentialStatusControllerImpl +import org.hyperledger.identus.didcomm.controller.DIDCommControllerImpl import org.hyperledger.identus.event.controller.EventControllerImpl import org.hyperledger.identus.event.notification.EventNotificationServiceImpl -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator import org.hyperledger.identus.iam.authentication.apikey.JdbcAuthenticationRepository -import org.hyperledger.identus.iam.authorization.DefaultPermissionManagementService +import org.hyperledger.identus.iam.authentication.DefaultAuthenticator import org.hyperledger.identus.iam.authorization.core.EntityPermissionManagementService +import org.hyperledger.identus.iam.authorization.DefaultPermissionManagementService import org.hyperledger.identus.iam.entity.http.controller.{EntityController, EntityControllerImpl} import org.hyperledger.identus.iam.wallet.http.controller.WalletManagementControllerImpl import org.hyperledger.identus.issue.controller.IssueControllerImpl @@ -45,12 +46,12 @@ import org.hyperledger.identus.pollux.credentialschema.controller.{ CredentialSchemaControllerImpl, VerificationPolicyControllerImpl } -import org.hyperledger.identus.pollux.sql.repository.JdbcOID4VCIIssuerMetadataRepository import org.hyperledger.identus.pollux.sql.repository.{ JdbcCredentialDefinitionRepository, JdbcCredentialRepository, JdbcCredentialSchemaRepository, JdbcCredentialStatusListRepository, + JdbcOID4VCIIssuerMetadataRepository, JdbcPresentationRepository, JdbcVerificationPolicyRepository, Migrations as PolluxMigrations @@ -59,11 +60,10 @@ import org.hyperledger.identus.presentproof.controller.PresentProofControllerImp import org.hyperledger.identus.resolvers.DIDResolver import org.hyperledger.identus.system.controller.SystemControllerImpl import org.hyperledger.identus.verification.controller.VcVerificationControllerImpl -import org.hyperledger.identus.didcomm.controller.DIDCommControllerImpl import zio.* import zio.logging.* -import zio.logging.LogFormat.* import zio.logging.backend.SLF4J +import zio.logging.LogFormat.* import zio.metrics.connectors.micrometer import zio.metrics.connectors.micrometer.MicrometerConfig import zio.metrics.jvm.DefaultJvmMetrics diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/Modules.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/Modules.scala index 92e42c4e0a..6f0dc8996f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/Modules.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/Modules.scala @@ -3,41 +3,44 @@ package org.hyperledger.identus.agent.server import com.typesafe.config.ConfigFactory import doobie.util.transactor.Transactor import io.grpc.ManagedChannelBuilder -import org.hyperledger.identus.agent.server.config.AppConfig -import org.hyperledger.identus.agent.server.config.SecretStorageBackend -import org.hyperledger.identus.agent.server.config.ValidatedVaultConfig -import org.hyperledger.identus.agent.walletapi.service.EntityService -import org.hyperledger.identus.agent.walletapi.service.WalletManagementService +import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc +import org.hyperledger.identus.agent.server.config.{AppConfig, SecretStorageBackend, ValidatedVaultConfig} +import org.hyperledger.identus.agent.walletapi.service.{EntityService, WalletManagementService} import org.hyperledger.identus.agent.walletapi.sql.{ JdbcDIDSecretStorage, JdbcGenericSecretStorage, JdbcWalletSecretStorage } import org.hyperledger.identus.agent.walletapi.storage.{DIDSecretStorage, GenericSecretStorage, WalletSecretStorage} -import org.hyperledger.identus.agent.walletapi.vault.* import org.hyperledger.identus.agent.walletapi.vault.{ VaultDIDSecretStorage, VaultKVClient, VaultKVClientImpl, - VaultWalletSecretStorage + VaultWalletSecretStorage, + * } import org.hyperledger.identus.castor.core.service.DIDService -import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyAuthenticator -import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyAuthenticatorImpl -import org.hyperledger.identus.iam.authentication.admin.AdminConfig -import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticator -import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticatorImpl -import org.hyperledger.identus.iam.authentication.apikey.ApiKeyConfig -import org.hyperledger.identus.iam.authentication.apikey.AuthenticationRepository -import org.hyperledger.identus.iam.authentication.oidc.KeycloakAuthenticator -import org.hyperledger.identus.iam.authentication.oidc.KeycloakAuthenticatorImpl -import org.hyperledger.identus.iam.authentication.oidc.KeycloakClientImpl -import org.hyperledger.identus.iam.authentication.oidc.KeycloakConfig -import org.hyperledger.identus.iam.authentication.oidc.KeycloakEntity +import org.hyperledger.identus.iam.authentication.admin.{ + AdminApiKeyAuthenticator, + AdminApiKeyAuthenticatorImpl, + AdminConfig +} +import org.hyperledger.identus.iam.authentication.apikey.{ + ApiKeyAuthenticator, + ApiKeyAuthenticatorImpl, + ApiKeyConfig, + AuthenticationRepository +} +import org.hyperledger.identus.iam.authentication.oidc.{ + KeycloakAuthenticator, + KeycloakAuthenticatorImpl, + KeycloakClientImpl, + KeycloakConfig, + KeycloakEntity +} import org.hyperledger.identus.iam.authorization.core.PermissionManagement import org.hyperledger.identus.iam.authorization.keycloak.admin.KeycloakPermissionManagementService -import org.hyperledger.identus.pollux.vc.jwt.{PrismDidResolver, DidResolver as JwtDidResolver} -import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc +import org.hyperledger.identus.pollux.vc.jwt.{DidResolver as JwtDidResolver, PrismDidResolver} import org.hyperledger.identus.shared.crypto.Apollo import org.hyperledger.identus.shared.db.{ContextAwareTask, DbConfig, TransactorLayer} import org.keycloak.authorization.client.AuthzClient diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/config/AppConfig.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/config/AppConfig.scala index f77eb1b6bc..891a18be4d 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/config/AppConfig.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/config/AppConfig.scala @@ -4,9 +4,10 @@ import org.hyperledger.identus.castor.core.model.did.VerificationRelationship import org.hyperledger.identus.iam.authentication.AuthenticationConfig import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.shared.db.DbConfig -import zio.Config import zio.config.* import zio.config.magnolia.* +import zio.Config + import java.net.URL import java.time.Duration import scala.util.Try diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/CustomServerInterceptors.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/CustomServerInterceptors.scala index 1a3c46a442..5b0b2d0e77 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/CustomServerInterceptors.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/CustomServerInterceptors.scala @@ -6,8 +6,8 @@ import org.log4s.* import sttp.tapir.* import sttp.tapir.json.zio.jsonBody import sttp.tapir.server.interceptor.* -import sttp.tapir.server.interceptor.decodefailure.DefaultDecodeFailureHandler.FailureMessages import sttp.tapir.server.interceptor.decodefailure.{DecodeFailureHandler, DefaultDecodeFailureHandler} +import sttp.tapir.server.interceptor.decodefailure.DefaultDecodeFailureHandler.FailureMessages import sttp.tapir.server.interceptor.exception.ExceptionHandler import sttp.tapir.server.interceptor.reject.RejectHandler import sttp.tapir.server.model.ValuedEndpointOutput diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/DocModels.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/DocModels.scala index 4da38db95f..0faceda3cf 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/DocModels.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/DocModels.scala @@ -9,8 +9,8 @@ import org.hyperledger.identus.issue.controller.IssueEndpoints import org.hyperledger.identus.pollux.credentialdefinition.CredentialDefinitionRegistryEndpoints import org.hyperledger.identus.pollux.credentialschema.{SchemaRegistryEndpoints, VerificationPolicyEndpoints} import org.hyperledger.identus.system.controller.SystemEndpoints -import sttp.apispec.openapi.* import sttp.apispec.{SecurityScheme, Tag} +import sttp.apispec.openapi.* import sttp.model.headers.AuthenticationScheme import scala.collection.immutable.ListMap diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttp4sBlazeServer.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttp4sBlazeServer.scala index 6fa4fb537c..f774627a68 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttp4sBlazeServer.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttp4sBlazeServer.scala @@ -7,8 +7,8 @@ import org.http4s.server.Router import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.system.controller.SystemEndpoints import sttp.tapir.* -import sttp.tapir.server.http4s.Http4sServerOptions import sttp.tapir.server.http4s.ztapir.ZHttp4sServerInterpreter +import sttp.tapir.server.http4s.Http4sServerOptions import sttp.tapir.server.metrics.prometheus.PrometheusMetrics import sttp.tapir.ztapir.ZServerEndpoint import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttpEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttpEndpoints.scala index a280470ac3..c920e3a089 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttpEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/http/ZHttpEndpoints.scala @@ -2,11 +2,11 @@ package org.hyperledger.identus.agent.server.http import org.hyperledger.identus.agent.server.buildinfo.BuildInfo import sttp.apispec.openapi.OpenAPI -import sttp.tapir.redoc.RedocUIOptions import sttp.tapir.redoc.bundle.RedocInterpreter +import sttp.tapir.redoc.RedocUIOptions import sttp.tapir.server.ServerEndpoint -import sttp.tapir.swagger.SwaggerUIOptions import sttp.tapir.swagger.bundle.SwaggerInterpreter +import sttp.tapir.swagger.SwaggerUIOptions object ZHttpEndpoints { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/BackgroundJobsHelper.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/BackgroundJobsHelper.scala index 13bed22f39..7a11869e4e 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/BackgroundJobsHelper.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/BackgroundJobsHelper.scala @@ -1,29 +1,22 @@ package org.hyperledger.identus.agent.server.jobs -import org.hyperledger.identus.agent.walletapi.model.error.DIDSecretStorageError.KeyNotFoundError import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState} +import org.hyperledger.identus.agent.walletapi.model.error.DIDSecretStorageError.{KeyNotFoundError, WalletNotFoundError} import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService +import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage import org.hyperledger.identus.castor.core.model.did.{LongFormPrismDID, PrismDID, VerificationRelationship} import org.hyperledger.identus.castor.core.service.DIDService -import org.hyperledger.identus.pollux.vc.jwt.{ - DIDResolutionFailed, - DIDResolutionSucceeded, - DidResolver as JwtDidResolver -} -import org.hyperledger.identus.pollux.vc.jwt.* -import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.{AgentPeerService, DidAgent} -import org.hyperledger.identus.pollux.vc.jwt.{ES256KSigner, EdSigner, Issuer as JwtIssuer} -import org.hyperledger.identus.shared.models.WalletAccessContext -import zio.{ZIO, ZLayer} -import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage -import org.hyperledger.identus.agent.walletapi.model.error.DIDSecretStorageError.WalletNotFoundError -import org.hyperledger.identus.shared.crypto.{Ed25519KeyPair, Ed25519PublicKey} +import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.pollux.core.model.error.PresentationError import org.hyperledger.identus.pollux.sdjwt.SDJWT.* +import org.hyperledger.identus.pollux.vc.jwt.{DIDResolutionFailed, DIDResolutionSucceeded, ES256KSigner, EdSigner, *} +import org.hyperledger.identus.pollux.vc.jwt.{DidResolver as JwtDidResolver, Issuer as JwtIssuer} +import org.hyperledger.identus.shared.crypto.{Ed25519KeyPair, Ed25519PublicKey, KmpEd25519KeyOps} +import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.{ZIO, ZLayer} import java.util.Base64 -import org.hyperledger.identus.shared.crypto.KmpEd25519KeyOps trait BackgroundJobsHelper { def getLongForm( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/ConnectBackgroundJobs.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/ConnectBackgroundJobs.scala index 9bc0bc8809..882c6ae990 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/ConnectBackgroundJobs.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/ConnectBackgroundJobs.scala @@ -12,8 +12,8 @@ import org.hyperledger.identus.connect.core.service.ConnectionService import org.hyperledger.identus.mercury.* import org.hyperledger.identus.resolvers.DIDResolver import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import org.hyperledger.identus.shared.utils.aspects.CustomMetricsAspect +import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import zio.* import zio.metrics.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/IssueBackgroundJobs.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/IssueBackgroundJobs.scala index cb7ef87c76..882fd92953 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/IssueBackgroundJobs.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/IssueBackgroundJobs.scala @@ -9,8 +9,8 @@ import org.hyperledger.identus.mercury.protocol.issuecredential.* import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.core.service.CredentialService -import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import org.hyperledger.identus.shared.utils.aspects.CustomMetricsAspect +import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import zio.* import zio.metrics.* 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 3915a1ccff..363b356a52 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 @@ -9,37 +9,36 @@ import org.hyperledger.identus.agent.server.jobs.BackgroundJobError.{ InvalidState, NotImplemented } +import org.hyperledger.identus.agent.walletapi.model.error.DIDSecretStorageError.WalletNotFoundError +import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService +import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage import org.hyperledger.identus.castor.core.model.did.* +import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.mercury.* import org.hyperledger.identus.mercury.model.* import org.hyperledger.identus.mercury.protocol.presentproof.* import org.hyperledger.identus.mercury.protocol.reportproblem.v2.* import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.error.PresentationError.* import org.hyperledger.identus.pollux.core.model.error.{CredentialServiceError, PresentationError} -import org.hyperledger.identus.pollux.core.service.serdes.AnoncredCredentialProofsV1 +import org.hyperledger.identus.pollux.core.model.error.PresentationError.* +import org.hyperledger.identus.pollux.core.model.presentation.SdJwtPresentationPayload import org.hyperledger.identus.pollux.core.service.{CredentialService, PresentationService} -import org.hyperledger.identus.pollux.vc.jwt.{JWT, JwtPresentation, DidResolver as JwtDidResolver} -import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds +import org.hyperledger.identus.pollux.core.service.serdes.AnoncredCredentialProofsV1 +import org.hyperledger.identus.pollux.sdjwt.{IssuerPublicKey, SDJWT} +import org.hyperledger.identus.pollux.vc.jwt.{DidResolver as JwtDidResolver, JWT, JwtPresentation} +import org.hyperledger.identus.resolvers.DIDResolver +import org.hyperledger.identus.shared.http.* +import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.shared.utils.aspects.CustomMetricsAspect +import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import zio.* -import zio.json.ast.Json import zio.json.* +import zio.json.ast.Json import zio.metrics.* import zio.prelude.Validation import zio.prelude.ZValidation.* -import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage -import org.hyperledger.identus.agent.walletapi.model.error.DIDSecretStorageError.WalletNotFoundError -import org.hyperledger.identus.resolvers.DIDResolver -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.pollux.core.model.presentation.SdJwtPresentationPayload import java.time.{Clock, Instant, ZoneId} -import org.hyperledger.identus.castor.core.service.DIDService -import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.pollux.sdjwt.{IssuerPublicKey} -import org.hyperledger.identus.shared.http.* -import org.hyperledger.identus.pollux.sdjwt.SDJWT object PresentBackgroundJobs extends BackgroundJobsHelper { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/StatusListJobs.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/StatusListJobs.scala index 3eb4e0625f..6a7753ded9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/StatusListJobs.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/jobs/StatusListJobs.scala @@ -7,9 +7,9 @@ import org.hyperledger.identus.mercury.protocol.revocationnotificaiton.Revocatio import org.hyperledger.identus.pollux.core.service.{CredentialService, CredentialStatusListService} import org.hyperledger.identus.pollux.vc.jwt.revocation.{VCStatusList2021, VCStatusList2021Error} import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import zio.* import zio.metrics.Metric -import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds object StatusListJobs extends BackgroundJobsHelper { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/sql/Migrations.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/sql/Migrations.scala index a3a06ba70d..253a2497a9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/sql/Migrations.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/agent/server/sql/Migrations.scala @@ -3,10 +3,9 @@ package org.hyperledger.identus.agent.server.sql import doobie.* import doobie.implicits.* import doobie.util.transactor.Transactor -import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.DbConfig -import org.hyperledger.identus.shared.db.Implicits.* import org.flywaydb.core.Flyway +import org.hyperledger.identus.shared.db.{ContextAwareTask, DbConfig} +import org.hyperledger.identus.shared.db.Implicits.* import zio.* import zio.interop.catz.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/EndpointOutputs.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/EndpointOutputs.scala index 3b0f0ccebf..1cefb2be86 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/EndpointOutputs.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/EndpointOutputs.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.api.http import sttp.model.StatusCode -import sttp.tapir.json.zio.jsonBody import sttp.tapir.{oneOfVariantValueMatcher, *} +import sttp.tapir.json.zio.jsonBody import sttp.tapir.EndpointOutput.OneOfVariant object EndpointOutputs { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/ErrorResponse.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/ErrorResponse.scala index 969d5c4694..cc59d4e40c 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/ErrorResponse.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/ErrorResponse.scala @@ -3,11 +3,11 @@ package org.hyperledger.identus.api.http import org.hyperledger.identus.api.http.ErrorResponse.annotations import org.hyperledger.identus.shared.models.Failure import sttp.model.StatusCode +import sttp.tapir.generic.auto.* import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import sttp.tapir.generic.auto.* -import zio.ZIO import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder} +import zio.ZIO import java.util.UUID import scala.language.implicitConversions diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/CirceJsonInterop.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/CirceJsonInterop.scala index d16f4e62af..d1f893316c 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/CirceJsonInterop.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/CirceJsonInterop.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.api.http.codec import io.circe.Json as CirceJson -import sttp.tapir.Schema import sttp.tapir.json.zio.* -import zio.json.ast.Json as ZioJson +import sttp.tapir.Schema import zio.json.* +import zio.json.ast.Json as ZioJson object CirceJsonInterop { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/DidCommIDCodec.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/DidCommIDCodec.scala index 322f8a643f..ed7e721ae0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/DidCommIDCodec.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/DidCommIDCodec.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.api.http.codec -import sttp.tapir._ -import sttp.tapir.Codec.PlainCodec import org.hyperledger.identus.pollux.core.model.DidCommID +import sttp.tapir.* +import sttp.tapir.Codec.PlainCodec import sttp.tapir.DecodeResult.* object DidCommIDCodec { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/OrderCodec.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/OrderCodec.scala index 0cdd28bd21..8a55a3a7f5 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/OrderCodec.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/OrderCodec.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.api.http.codec import org.hyperledger.identus.api.http.model.Order import org.hyperledger.identus.api.http.model.Order.Direction -import sttp.tapir.Codec.PlainCodec import sttp.tapir.{Codec, DecodeResult} +import sttp.tapir.Codec.PlainCodec import java.util.Base64 diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/model/PaginationInput.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/model/PaginationInput.scala index f0754920ef..cdda575621 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/model/PaginationInput.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/model/PaginationInput.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.api.http.model +import sttp.tapir.{Schema, Validator} import sttp.tapir.EndpointIO.annotations.{description, query} import sttp.tapir.Schema.annotations.validateEach -import sttp.tapir.{Schema, Validator} case class PaginationInput( @query diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionController.scala index 59ec27435c..f01ac8d8f9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionController.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.connect.controller -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.connect.controller.http.{ AcceptConnectionInvitationRequest, Connection, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionControllerImpl.scala index bb9591d11a..53bdc1a3ee 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionControllerImpl.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.connect.controller import org.hyperledger.identus.agent.server.config.AppConfig import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.connect.controller.http.{ AcceptConnectionInvitationRequest, Connection, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionEndpoints.scala index 6268685b61..231f7f9aba 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionEndpoints.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.connect.controller -import org.hyperledger.identus.api.http.EndpointOutputs.* -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.connect.controller.http.{ AcceptConnectionInvitationRequest, Connection, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionServerEndpoints.scala index 90c1d828ef..8a81c85fda 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/ConnectionServerEndpoints.scala @@ -1,15 +1,12 @@ package org.hyperledger.identus.connect.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.api.http.model.PaginationInput -import org.hyperledger.identus.connect.controller.ConnectionEndpoints.* +import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.connect.controller.http.{AcceptConnectionInvitationRequest, CreateConnectionRequest} -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic +import org.hyperledger.identus.connect.controller.ConnectionEndpoints.* +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/http/Connection.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/http/Connection.scala index f506c526a3..aa05512b0b 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/http/Connection.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/connect/controller/http/Connection.scala @@ -2,16 +2,16 @@ package org.hyperledger.identus.connect.controller.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.connect.controller.http.Connection.annotations +import org.hyperledger.identus.connect.controller.http.Connection.annotations.goalcode import org.hyperledger.identus.connect.core.model import org.hyperledger.identus.connect.core.model.ConnectionRecord.Role import sttp.model.Uri -import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import sttp.tapir.{Schema, Validator} +import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import java.time.{OffsetDateTime, ZoneOffset} import java.util.UUID -import org.hyperledger.identus.connect.controller.http.Connection.annotations.goalcode case class Connection( @description(annotations.connectionId.description) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDController.scala index 9b9d5bce6e..e2140cce56 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDController.scala @@ -1,15 +1,20 @@ package org.hyperledger.identus.castor.controller -import org.hyperledger.identus.castor.controller.http.DIDResolutionResult -import zio.* -import org.hyperledger.identus.castor.controller.http.{DIDDocument, DIDDocumentMetadata, DIDResolutionMetadata} +import org.hyperledger.identus.castor.controller.http.{ + DIDDocument, + DIDDocumentMetadata, + DIDResolutionMetadata, + DIDResolutionResult +} import org.hyperledger.identus.castor.core.model.did.w3c.{ + makeW3CResolver, DIDDocumentMetadataRepr, DIDDocumentRepr, DIDResolutionErrorRepr } import org.hyperledger.identus.castor.core.service.DIDService -import org.hyperledger.identus.castor.core.model.did.w3c.makeW3CResolver +import zio.* + import scala.language.implicitConversions trait DIDController { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDEndpoints.scala index 1d528676bc..0cfd86f64c 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDEndpoints.scala @@ -1,9 +1,8 @@ package org.hyperledger.identus.castor.controller -import org.hyperledger.identus.api.http.codec.DIDCodec.emptyDidJsonLD -import org.hyperledger.identus.api.http.codec.DIDCodec.{didJsonLD, didResolutionJsonLD} +import org.hyperledger.identus.api.http.codec.DIDCodec.{didJsonLD, didResolutionJsonLD, emptyDidJsonLD} import org.hyperledger.identus.api.http.RequestContext -import org.hyperledger.identus.castor.controller.http.{DIDResolutionResult, DIDInput} +import org.hyperledger.identus.castor.controller.http.{DIDInput, DIDResolutionResult} import sttp.apispec.Tag import sttp.model.StatusCode import sttp.tapir.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarController.scala index c1a8eded2d..e32d88012f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarController.scala @@ -1,27 +1,31 @@ package org.hyperledger.identus.castor.controller +import org.hyperledger.identus.agent.walletapi.model.error.{ + CreateManagedDIDError, + GetManagedDIDError, + PublishManagedDIDError, + UpdateManagedDIDError +} import org.hyperledger.identus.agent.walletapi.model.ManagedDIDDetail -import org.hyperledger.identus.agent.walletapi.model.error.CreateManagedDIDError -import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError -import org.hyperledger.identus.agent.walletapi.model.error.PublishManagedDIDError -import org.hyperledger.identus.agent.walletapi.model.error.UpdateManagedDIDError import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.api.http.model.CollectionStats -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.{CollectionStats, PaginationInput} import org.hyperledger.identus.api.util.PaginationUtils -import org.hyperledger.identus.castor.controller.http.CreateManagedDIDResponse -import org.hyperledger.identus.castor.controller.http.CreateManagedDidRequest -import org.hyperledger.identus.castor.controller.http.DIDOperationResponse -import org.hyperledger.identus.castor.controller.http.ManagedDID -import org.hyperledger.identus.castor.controller.http.ManagedDIDPage -import org.hyperledger.identus.castor.controller.http.UpdateManagedDIDRequest +import org.hyperledger.identus.castor.controller.http.{ + CreateManagedDIDResponse, + CreateManagedDidRequest, + DIDOperationResponse, + ManagedDID, + ManagedDIDPage, + UpdateManagedDIDRequest +} import org.hyperledger.identus.castor.core.model.did.PrismDID import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.shared.utils.Traverse.* -import scala.language.implicitConversions import zio.* +import scala.language.implicitConversions + trait DIDRegistrarController { def listManagedDid(paginationInput: PaginationInput)(implicit rc: RequestContext diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarEndpoints.scala index 172d2b1f40..bd0a2e42aa 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarEndpoints.scala @@ -1,16 +1,16 @@ package org.hyperledger.identus.castor.controller -import org.hyperledger.identus.api.http.EndpointOutputs.FailureVariant -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{EndpointOutputs, ErrorResponse, RequestContext} -import org.hyperledger.identus.castor.controller.http.DIDOperationResponse -import org.hyperledger.identus.castor.controller.http.UpdateManagedDIDRequest +import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.api.http.EndpointOutputs.FailureVariant import org.hyperledger.identus.castor.controller.http.{ CreateManagedDIDResponse, CreateManagedDidRequest, DIDInput, + DIDOperationResponse, ManagedDID, - ManagedDIDPage + ManagedDIDPage, + UpdateManagedDIDRequest } import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarServerEndpoints.scala index 06eb313e7b..fe76416d9f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/DIDRegistrarServerEndpoints.scala @@ -1,12 +1,9 @@ package org.hyperledger.identus.castor.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocument.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocument.scala index a1e5942649..83baf04949 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocument.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocument.scala @@ -1,11 +1,12 @@ package org.hyperledger.identus.castor.controller.http import org.hyperledger.identus.api.http.Annotation +import org.hyperledger.identus.castor.controller.http.DIDDocument.annotations import org.hyperledger.identus.castor.core.model.did.w3c import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} -import org.hyperledger.identus.castor.controller.http.DIDDocument.annotations +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} + import scala.language.implicitConversions @description("A W3C compliant Prism DID document representation.") diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocumentMetadata.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocumentMetadata.scala index d12cc5d645..51fcbcbc1a 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocumentMetadata.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDDocumentMetadata.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.castor.controller.http import org.hyperledger.identus.api.http.Annotation +import org.hyperledger.identus.castor.controller.http.DIDDocumentMetadata.annotations import org.hyperledger.identus.castor.core.model.did.w3c import sttp.tapir.Schema -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} import sttp.tapir.Schema.annotations.{description, encodedExample} -import org.hyperledger.identus.castor.controller.http.DIDDocumentMetadata.annotations +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} @description("[DID document metadata](https://www.w3.org/TR/did-core/#did-document-metadata)") final case class DIDDocumentMetadata( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionMetadata.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionMetadata.scala index 5426b27d58..d3ed1ee6d3 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionMetadata.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionMetadata.scala @@ -4,7 +4,7 @@ import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.castor.controller.http.DIDResolutionMetadata.annotations import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} @description("[DID resolution metadata](https://www.w3.org/TR/did-core/#did-resolution-metadata)") final case class DIDResolutionMetadata( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionResult.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionResult.scala index 9fb37052b5..b64a10c823 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionResult.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/DIDResolutionResult.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.castor.controller.http import sttp.tapir.Schema -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} final case class DIDResolutionResult( `@context`: Context, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ManagedDID.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ManagedDID.scala index 631711c7de..38d7164610 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ManagedDID.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ManagedDID.scala @@ -1,18 +1,14 @@ package org.hyperledger.identus.castor.controller.http +import org.hyperledger.identus.agent.walletapi.model.{DIDPublicKeyTemplate, ManagedDIDDetail, PublicationState} import org.hyperledger.identus.agent.walletapi.model as walletDomain -import org.hyperledger.identus.agent.walletapi.model.DIDPublicKeyTemplate -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDDetail -import org.hyperledger.identus.agent.walletapi.model.PublicationState import org.hyperledger.identus.api.http.Annotation +import org.hyperledger.identus.castor.core.model.did.{EllipticCurve, PrismDID, VerificationRelationship} import org.hyperledger.identus.castor.core.model.did as castorDomain -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.PrismDID -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship import org.hyperledger.identus.shared.utils.Traverse.* import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import scala.language.implicitConversions diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/PublicKeyJwk.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/PublicKeyJwk.scala index 7142f279d1..2e294b1607 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/PublicKeyJwk.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/PublicKeyJwk.scala @@ -2,7 +2,7 @@ package org.hyperledger.identus.castor.controller.http import org.hyperledger.identus.castor.core.model.did.w3c import sttp.tapir.Schema -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} final case class PublicKeyJwk( crv: Option[String] = None, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ScheduledOperation.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ScheduledOperation.scala index e1d1fd76f7..5dbfbe723f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ScheduledOperation.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/ScheduledOperation.scala @@ -5,7 +5,7 @@ import org.hyperledger.identus.castor.core.model.did.ScheduleDIDOperationOutcome import org.hyperledger.identus.shared.models.HexString import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} final case class DIDOperationResponse( scheduledOperation: DidOperationSubmission diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/Service.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/Service.scala index 08f47150c7..7229e911fc 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/Service.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/Service.scala @@ -1,18 +1,18 @@ package org.hyperledger.identus.castor.controller.http import io.circe.Json -import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.api.http.codec.CirceJsonInterop +import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.castor.controller.http.Service.annotations -import org.hyperledger.identus.castor.core.model.ProtoModelHelper -import org.hyperledger.identus.castor.core.model.did as castorDomain +import org.hyperledger.identus.castor.core.model.{did as castorDomain, ProtoModelHelper} import org.hyperledger.identus.castor.core.model.did.w3c import org.hyperledger.identus.shared.utils.Traverse.* -import scala.language.implicitConversions import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} +import scala.language.implicitConversions + @description("A service that should appear in the DID document. https://www.w3.org/TR/did-core/#services") final case class Service( @description(annotations.id.description) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/UpdateManagedDID.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/UpdateManagedDID.scala index 14a76c48d4..5edae1540b 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/UpdateManagedDID.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/UpdateManagedDID.scala @@ -6,7 +6,8 @@ import org.hyperledger.identus.castor.core.model.did as castorDomain import org.hyperledger.identus.shared.utils.Traverse.* import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} + import scala.language.implicitConversions final case class UpdateManagedDIDRequest( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/VerificationMethod.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/VerificationMethod.scala index b4464b4fb1..b5938d6e82 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/VerificationMethod.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/controller/http/VerificationMethod.scala @@ -1,11 +1,12 @@ package org.hyperledger.identus.castor.controller.http import org.hyperledger.identus.api.http.Annotation +import org.hyperledger.identus.castor.controller.http.VerificationMethod.annotations import org.hyperledger.identus.castor.core.model.did.w3c import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} -import org.hyperledger.identus.castor.controller.http.VerificationMethod.annotations +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} + import scala.language.implicitConversions @description( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusController.scala index 221dce9b9c..c7db576364 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusController.scala @@ -3,9 +3,9 @@ package org.hyperledger.identus.credential.status.controller import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} import org.hyperledger.identus.credential.status.controller.http.StatusListCredential import org.hyperledger.identus.pollux.core.model.error.CredentialStatusListServiceError +import org.hyperledger.identus.pollux.core.model.DidCommID import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* -import org.hyperledger.identus.pollux.core.model.DidCommID import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusControllerImpl.scala index 636935feb4..895f28f70a 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusControllerImpl.scala @@ -2,10 +2,10 @@ package org.hyperledger.identus.credential.status.controller import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} import org.hyperledger.identus.credential.status.controller.http.StatusListCredential -import org.hyperledger.identus.pollux.core.service.CredentialStatusListService -import zio.* import org.hyperledger.identus.pollux.core.model.DidCommID +import org.hyperledger.identus.pollux.core.service.CredentialStatusListService import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.* import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusEndpoints.scala index 298b5755db..e3b08c5a6e 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusEndpoints.scala @@ -1,17 +1,18 @@ package org.hyperledger.identus.credential.status.controller import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.codec.DidCommIDCodec.given import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.credential.status.controller.http.StatusListCredential -import sttp.tapir.* -import sttp.tapir.json.zio.jsonBody +import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader +import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials import org.hyperledger.identus.iam.authentication.oidc.JwtSecurityLogic.jwtAuthHeader -import java.util.UUID import org.hyperledger.identus.pollux.core.model.DidCommID -import org.hyperledger.identus.api.http.codec.DidCommIDCodec.given -import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials -import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials +import sttp.tapir.* +import sttp.tapir.json.zio.jsonBody + +import java.util.UUID object CredentialStatusEndpoints { val getCredentialStatusListEndpoint: PublicEndpoint[ diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusServiceEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusServiceEndpoints.scala index fc34063704..8afa07921e 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusServiceEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/CredentialStatusServiceEndpoints.scala @@ -2,16 +2,13 @@ package org.hyperledger.identus.credential.status.controller import org.hyperledger.identus.agent.walletapi.model.BaseEntity import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic +import org.hyperledger.identus.credential.status.controller.CredentialStatusEndpoints.* +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} +import org.hyperledger.identus.pollux.core.model.DidCommID import org.hyperledger.identus.shared.models.WalletAccessContext +import sttp.model.StatusCode import sttp.tapir.ztapir.* import zio.* -import org.hyperledger.identus.credential.status.controller.CredentialStatusEndpoints.* -import sttp.model.StatusCode -import org.hyperledger.identus.pollux.core.model.DidCommID import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/http/StatusListCredential.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/http/StatusListCredential.scala index c6f8497df5..e5ee74fab2 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/http/StatusListCredential.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/credentialstatus/controller/http/StatusListCredential.scala @@ -1,16 +1,17 @@ package org.hyperledger.identus.credential.status.controller.http -import org.hyperledger.identus.pollux.vc.jwt.StatusPurpose import org.hyperledger.identus.api.http.Annotation -import sttp.tapir.Schema.annotations.{description, encodedExample} import org.hyperledger.identus.credential.status.controller.http.StatusListCredential.annotations -import sttp.tapir.Schema -import zio.json.* -import org.hyperledger.identus.pollux.core.model.CredentialStatusList import org.hyperledger.identus.pollux.core.model.error.CredentialStatusListServiceError +import org.hyperledger.identus.pollux.core.model.CredentialStatusList +import org.hyperledger.identus.pollux.vc.jwt.StatusPurpose import sttp.tapir.json.zio.schemaForZioJsonValue -import zio.json.ast.Json +import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.* +import zio.json.* +import zio.json.ast.Json + import java.time.Instant case class StatusListCredential( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommControllerImpl.scala index 747bb3f7a0..f822561bf8 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommControllerImpl.scala @@ -1,21 +1,21 @@ package org.hyperledger.identus.didcomm.controller -import org.hyperledger.identus.agent.server.DidCommHttpServerError.DIDCommMessageParsingError import org.hyperledger.identus.agent.server.config.AppConfig +import org.hyperledger.identus.agent.server.DidCommHttpServerError.DIDCommMessageParsingError import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.service.ConnectionService -import org.hyperledger.identus.didcomm.controller.DIDCommControllerError.* import org.hyperledger.identus.didcomm.controller.http.DIDCommMessage +import org.hyperledger.identus.didcomm.controller.DIDCommControllerError.* import org.hyperledger.identus.mercury.* -import org.hyperledger.identus.mercury.DidOps.* import org.hyperledger.identus.mercury.model.* import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} import org.hyperledger.identus.mercury.protocol.issuecredential.* import org.hyperledger.identus.mercury.protocol.presentproof.* import org.hyperledger.identus.mercury.protocol.revocationnotificaiton.RevocationNotification +import org.hyperledger.identus.mercury.DidOps.* import org.hyperledger.identus.pollux.core.model.error.{CredentialServiceError, PresentationError} import org.hyperledger.identus.pollux.core.service.{CredentialService, PresentationService} import org.hyperledger.identus.shared.models.{Failure, StatusCode, WalletAccessContext} diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommEndpoints.scala index 2905ba35a6..646eb18a42 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/didcomm/controller/DIDCommEndpoints.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.didcomm.controller -import org.hyperledger.identus.api.http.EndpointOutputs.{FailureVariant, basicFailuresWith} import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.EndpointOutputs.{basicFailuresWith, FailureVariant} import org.hyperledger.identus.didcomm.controller.http.DIDCommMessage +import sttp.tapir.{endpoint, PublicEndpoint, *} import sttp.tapir.json.zio.jsonBody -import sttp.tapir.{PublicEndpoint, endpoint, *} object DIDCommEndpoints { val handleDIDCommMessage: PublicEndpoint[ diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventController.scala index 08c2a0f425..1039016f2a 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventController.scala @@ -1,23 +1,22 @@ package org.hyperledger.identus.event.controller -import org.hyperledger.identus.agent.walletapi.service.WalletManagementService -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceError -import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.api.http.RequestContext -import org.hyperledger.identus.api.http.model.CollectionStats -import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.agent.walletapi.service.{WalletManagementService, WalletManagementServiceError} +import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.{CollectionStats, PaginationInput} import org.hyperledger.identus.api.util.PaginationUtils -import org.hyperledger.identus.event.controller.http.CreateWebhookNotification -import org.hyperledger.identus.event.controller.http.WebhookNotification -import org.hyperledger.identus.event.controller.http.WebhookNotificationPage +import org.hyperledger.identus.event.controller.http.{ + CreateWebhookNotification, + WebhookNotification, + WebhookNotificationPage +} import org.hyperledger.identus.event.notification.EventNotificationConfig import org.hyperledger.identus.iam.wallet.http.controller.WalletManagementController import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* import java.net.URI -import scala.language.implicitConversions import java.util.UUID +import scala.language.implicitConversions trait EventController { def createWebhookNotification( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventEndpoints.scala index c2d961bde9..6081fd5926 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventEndpoints.scala @@ -1,12 +1,12 @@ package org.hyperledger.identus.event.controller -import org.hyperledger.identus.api.http.EndpointOutputs +import org.hyperledger.identus.api.http.{EndpointOutputs, ErrorResponse, RequestContext} import org.hyperledger.identus.api.http.EndpointOutputs.FailureVariant -import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.api.http.RequestContext -import org.hyperledger.identus.event.controller.http.CreateWebhookNotification -import org.hyperledger.identus.event.controller.http.WebhookNotification -import org.hyperledger.identus.event.controller.http.WebhookNotificationPage +import org.hyperledger.identus.event.controller.http.{ + CreateWebhookNotification, + WebhookNotification, + WebhookNotificationPage +} import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventServerEndpoints.scala index c05d23e22c..d0189b2bbb 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/EventServerEndpoints.scala @@ -1,14 +1,11 @@ package org.hyperledger.identus.event.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* -import org.hyperledger.identus.iam.authentication.SecurityLogic class EventServerEndpoints( eventController: EventController, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/http/CreateWebhookNotification.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/http/CreateWebhookNotification.scala index 4fbef5f1ae..0d716e549c 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/http/CreateWebhookNotification.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/event/controller/http/CreateWebhookNotification.scala @@ -3,7 +3,7 @@ package org.hyperledger.identus.event.controller.http import org.hyperledger.identus.api.http.Annotation import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} final case class CreateWebhookNotification( @description(CreateWebhookNotification.annotations.url.description) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/Authenticator.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/Authenticator.scala index 8b34c79f6c..deb81bb6a9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/Authenticator.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/Authenticator.scala @@ -1,12 +1,8 @@ package org.hyperledger.identus.iam.authentication -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.Entity -import org.hyperledger.identus.agent.walletapi.model.EntityRole +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, Entity, EntityRole} import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext, WalletId} import zio.{IO, ZIO, ZLayer} trait Credentials diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/DefaultAuthenticator.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/DefaultAuthenticator.scala index 2bb447171a..5740a396e0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/DefaultAuthenticator.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/DefaultAuthenticator.scala @@ -1,13 +1,10 @@ package org.hyperledger.identus.iam.authentication -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.Entity +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, Entity} import org.hyperledger.identus.iam.authentication.admin.{AdminApiKeyAuthenticator, AdminApiKeyCredentials} import org.hyperledger.identus.iam.authentication.apikey.{ApiKeyAuthenticator, ApiKeyCredentials} -import org.hyperledger.identus.iam.authentication.oidc.KeycloakEntity -import org.hyperledger.identus.iam.authentication.oidc.{KeycloakAuthenticator, JwtCredentials} -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.iam.authentication.oidc.{JwtCredentials, KeycloakAuthenticator, KeycloakEntity} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import zio.* case class DefaultAuthenticator( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/SecurityLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/SecurityLogic.scala index a98daa970a..253b438fe0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/SecurityLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/SecurityLogic.scala @@ -1,15 +1,12 @@ package org.hyperledger.identus.iam.authentication -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.Entity -import org.hyperledger.identus.agent.walletapi.model.EntityRole +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, Entity, EntityRole} import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.iam.authentication.AuthenticationError.AuthenticationMethodNotEnabled import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.iam.authentication.AuthenticationError.AuthenticationMethodNotEnabled +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import zio.* object SecurityLogic { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeyAuthenticator.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeyAuthenticator.scala index 500873d90b..4b29a1e2fb 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeyAuthenticator.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeyAuthenticator.scala @@ -1,9 +1,12 @@ package org.hyperledger.identus.iam.authentication.admin import org.hyperledger.identus.agent.walletapi.model.Entity -import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ -import org.hyperledger.identus.iam.authentication.EntityAuthorizer -import org.hyperledger.identus.iam.authentication.{AuthenticationError, Credentials} +import org.hyperledger.identus.iam.authentication.{ + AuthenticationError, + AuthenticatorWithAuthZ, + Credentials, + EntityAuthorizer +} import zio.* trait AdminApiKeyAuthenticator extends AuthenticatorWithAuthZ[Entity], EntityAuthorizer { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeySecurityLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeySecurityLogic.scala index 1e351d494c..de30bc3abc 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeySecurityLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/admin/AdminApiKeySecurityLogic.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.iam.authentication.admin +import sttp.tapir.ztapir.* import sttp.tapir.EndpointIO import sttp.tapir.EndpointInput.Auth import sttp.tapir.EndpointInput.AuthType.ApiKey -import sttp.tapir.ztapir.* object AdminApiKeySecurityLogic { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticator.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticator.scala index fea47359e4..7643e5908f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticator.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticator.scala @@ -1,10 +1,13 @@ package org.hyperledger.identus.iam.authentication.apikey import org.hyperledger.identus.agent.walletapi.model.Entity +import org.hyperledger.identus.iam.authentication.{ + AuthenticationError, + AuthenticatorWithAuthZ, + Credentials, + EntityAuthorizer +} import org.hyperledger.identus.iam.authentication.AuthenticationError.* -import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ -import org.hyperledger.identus.iam.authentication.EntityAuthorizer -import org.hyperledger.identus.iam.authentication.{AuthenticationError, Credentials} import zio.{IO, ZIO} import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorImpl.scala index 16d7b14c2c..2c8c214f35 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorImpl.scala @@ -1,18 +1,16 @@ package org.hyperledger.identus.iam.authentication.apikey -import org.hyperledger.identus.agent.walletapi.model.Entity -import org.hyperledger.identus.agent.walletapi.model.Wallet +import org.hyperledger.identus.agent.walletapi.model.{Entity, Wallet} import org.hyperledger.identus.agent.walletapi.service.{EntityService, WalletManagementService} import org.hyperledger.identus.iam.authentication.AuthenticationError import org.hyperledger.identus.iam.authentication.AuthenticationError.* import org.hyperledger.identus.shared.crypto.Sha256Hash -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import zio.{IO, URLayer, ZIO, ZLayer} import java.util.UUID -import scala.util.Try import scala.language.implicitConversions +import scala.util.Try case class ApiKeyAuthenticatorImpl( apiKeyConfig: ApiKeyConfig, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyEndpointSecurityLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyEndpointSecurityLogic.scala index 1821c291a2..2d926506f6 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyEndpointSecurityLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyEndpointSecurityLogic.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.iam.authentication.apikey +import sttp.tapir.ztapir.* import sttp.tapir.EndpointIO import sttp.tapir.EndpointInput.Auth import sttp.tapir.EndpointInput.AuthType.ApiKey -import sttp.tapir.ztapir.* object ApiKeyEndpointSecurityLogic { val apiKeyHeader: Auth[ApiKeyCredentials, ApiKey] = auth diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/AuthenticationRepository.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/AuthenticationRepository.scala index 411847c7f9..ffe24acc44 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/AuthenticationRepository.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/AuthenticationRepository.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.iam.authentication.apikey +import io.getquill.* import io.getquill.context.json.PostgresJsonExtensions import io.getquill.doobie.DoobieContext -import io.getquill.* -import zio.IO -import zio.* +import zio.{IO, *} import zio.interop.catz.* import java.time.OffsetDateTime diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepository.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepository.scala index 55a440b26f..4502fd2492 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepository.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepository.scala @@ -11,8 +11,8 @@ import java.util.UUID case class JdbcAuthenticationRepository(xa: Transactor[Task]) extends AuthenticationRepository { - import AuthenticationRepositorySql.* import AuthenticationRepositoryError.* + import AuthenticationRepositorySql.* override def insert( entityId: UUID, amt: AuthenticationMethodType, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtCredentials.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtCredentials.scala index 099550fdd6..f8936030ec 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtCredentials.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtCredentials.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.iam.authentication.oidc -import org.hyperledger.identus.iam.authentication.AuthenticationError -import org.hyperledger.identus.iam.authentication.Credentials +import org.hyperledger.identus.iam.authentication.{AuthenticationError, Credentials} final case class JwtCredentials(token: Option[String]) extends Credentials diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtSecurityLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtSecurityLogic.scala index 2925d87ba9..0c42ea445c 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtSecurityLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/JwtSecurityLogic.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.iam.authentication.oidc +import sttp.tapir.ztapir.* import sttp.tapir.EndpointInput.Auth import sttp.tapir.EndpointInput.AuthType.Http -import sttp.tapir.ztapir.* object JwtSecurityLogic { val jwtAuthHeader: Auth[JwtCredentials, Http] = auth diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticator.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticator.scala index 9567a53cf1..bf850df93e 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticator.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticator.scala @@ -1,16 +1,13 @@ package org.hyperledger.identus.iam.authentication.oidc -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.EntityRole -import org.hyperledger.identus.iam.authentication.AuthenticationError -import org.hyperledger.identus.iam.authentication.AuthenticationError.AuthenticationMethodNotEnabled -import org.hyperledger.identus.iam.authentication.AuthenticationError.InvalidCredentials -import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ -import org.hyperledger.identus.iam.authentication.Credentials +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, EntityRole} +import org.hyperledger.identus.iam.authentication.{AuthenticationError, AuthenticatorWithAuthZ, Credentials} +import org.hyperledger.identus.iam.authentication.AuthenticationError.{ + AuthenticationMethodNotEnabled, + InvalidCredentials +} import org.hyperledger.identus.shared.utils.Traverse.* -import pdi.jwt.JwtCirce -import pdi.jwt.JwtClaim -import pdi.jwt.JwtOptions +import pdi.jwt.{JwtCirce, JwtClaim, JwtOptions} import zio.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorImpl.scala index 35f46c440d..dc271e8b4b 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorImpl.scala @@ -5,8 +5,7 @@ import org.hyperledger.identus.iam.authentication.AuthenticationError import org.hyperledger.identus.iam.authentication.AuthenticationError.AuthenticationMethodNotEnabled import org.hyperledger.identus.iam.authorization.core.PermissionManagement import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.PermissionNotAvailable -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import zio.* import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakConfig.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakConfig.scala index 463a8751a5..ca7649c1c4 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakConfig.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakConfig.scala @@ -1,7 +1,8 @@ package org.hyperledger.identus.iam.authentication.oidc -import zio.* import org.hyperledger.identus.agent.server.config.AppConfig +import zio.* + import java.net.URL final case class KeycloakConfig( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/DefaultPermissionManagementService.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/DefaultPermissionManagementService.scala index a885e83f5c..53a33371f7 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/DefaultPermissionManagementService.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/DefaultPermissionManagementService.scala @@ -1,12 +1,10 @@ package org.hyperledger.identus.iam.authorization -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.Entity +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, Entity} import org.hyperledger.identus.iam.authentication.oidc.KeycloakEntity import org.hyperledger.identus.iam.authorization.core.PermissionManagement import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import zio.* class DefaultPermissionManagementService( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementService.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementService.scala index b3977b642b..8bf36e7e05 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementService.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementService.scala @@ -3,10 +3,8 @@ package org.hyperledger.identus.iam.authorization.core import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.service.EntityService import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error -import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.ServiceError -import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.WalletNotFoundById -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.{ServiceError, WalletNotFoundById} +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import zio.* import scala.language.implicitConversions diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/PermissionManagement.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/PermissionManagement.scala index c4581dcb5e..7c0b90cdd8 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/PermissionManagement.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/core/PermissionManagement.scala @@ -1,13 +1,14 @@ package org.hyperledger.identus.iam.authorization.core -import org.hyperledger.identus.agent.walletapi.model.BaseEntity import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError -import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.EntityAlreadyExists -import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.EntityNotFound -import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.EntityStorageError -import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.EntityWalletNotFound -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.{ + EntityAlreadyExists, + EntityNotFound, + EntityStorageError, + EntityWalletNotFound +} +import org.hyperledger.identus.agent.walletapi.model.BaseEntity +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import zio.* import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementService.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementService.scala index 771f914911..f1cdb6be37 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementService.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementService.scala @@ -2,13 +2,11 @@ package org.hyperledger.identus.iam.authorization.keycloak.admin import org.hyperledger.identus.agent.walletapi.model.Wallet import org.hyperledger.identus.agent.walletapi.service.WalletManagementService -import org.hyperledger.identus.iam.authentication.oidc.KeycloakClient -import org.hyperledger.identus.iam.authentication.oidc.KeycloakEntity +import org.hyperledger.identus.iam.authentication.oidc.{KeycloakClient, KeycloakEntity} import org.hyperledger.identus.iam.authorization.core.PermissionManagement import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.* -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import org.keycloak.authorization.client.AuthzClient import org.keycloak.representations.idm.authorization.{ResourceRepresentation, UmaPermissionRepresentation} import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityEndpoints.scala index 02c0df8fb8..ce29855cca 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityEndpoints.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.iam.entity.http import org.hyperledger.identus.api.http.* -import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyCredentials import org.hyperledger.identus.iam.authentication.admin.AdminApiKeySecurityLogic.adminApiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials @@ -10,8 +10,8 @@ import org.hyperledger.identus.iam.authentication.oidc.JwtSecurityLogic.jwtAuthH import org.hyperledger.identus.iam.entity.http.model.* import sttp.apispec.Tag import sttp.model.StatusCode +import sttp.tapir.{endpoint, extractFromRequest, path, query, statusCode, stringToPath, Endpoint, EndpointInput} import sttp.tapir.json.zio.jsonBody -import sttp.tapir.{Endpoint, EndpointInput, endpoint, extractFromRequest, path, query, statusCode, stringToPath} import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityServerEndpoints.scala index f6901760c6..fc233bcc77 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/EntityServerEndpoints.scala @@ -1,16 +1,11 @@ package org.hyperledger.identus.iam.entity.http -import org.hyperledger.identus.LogUtils.* -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.EntityRole -import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, EntityRole} import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic -import org.hyperledger.identus.iam.authentication.admin.{AdminApiKeyCredentials} +import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.iam.authentication.{Authenticator, DefaultAuthenticator, SecurityLogic} +import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyCredentials import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials -import org.hyperledger.identus.iam.entity.http.EntityEndpoints.* import org.hyperledger.identus.iam.entity.http.controller.EntityController import org.hyperledger.identus.iam.entity.http.model.{ ApiKeyAuthenticationRequest, @@ -18,6 +13,8 @@ import org.hyperledger.identus.iam.entity.http.model.{ UpdateEntityNameRequest, UpdateEntityWalletIdRequest } +import org.hyperledger.identus.iam.entity.http.EntityEndpoints.* +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.{IO, URIO, ZIO} diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityController.scala index d48dac5486..ffde118052 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityController.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.iam.entity.http.controller import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.iam.entity.http.model.{CreateEntityRequest, EntityResponse, EntityResponsePage} import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityControllerImpl.scala index 1bb20be18e..a0a3200bf5 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/controller/EntityControllerImpl.scala @@ -1,15 +1,15 @@ package org.hyperledger.identus.iam.entity.http.controller -import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError +import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.service.EntityService -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticator import org.hyperledger.identus.iam.authentication.AuthenticationError import org.hyperledger.identus.iam.entity.http.model.{CreateEntityRequest, EntityResponse, EntityResponsePage} -import zio.ZIO.succeed import zio.{IO, URLayer, ZLayer} -import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticator +import zio.ZIO.succeed import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/CreateEntityRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/CreateEntityRequest.scala index 650dfae862..e575eaef8d 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/CreateEntityRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/CreateEntityRequest.scala @@ -2,9 +2,8 @@ package org.hyperledger.identus.iam.entity.http.model import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.iam.entity.http.model.CreateEntityRequest.annotations -import sttp.tapir.Schema +import sttp.tapir.{Schema, Validator} import sttp.tapir.Schema.annotations.{description, encodedExample, validate, validateEach} -import sttp.tapir.Validator import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/UpdateEntityNameRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/UpdateEntityNameRequest.scala index a9c78ec7a1..e44cfc7c73 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/UpdateEntityNameRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/entity/http/model/UpdateEntityNameRequest.scala @@ -2,9 +2,8 @@ package org.hyperledger.identus.iam.entity.http.model import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.iam.entity.http.model.UpdateEntityNameRequest.annotations -import sttp.tapir.Schema +import sttp.tapir.{Schema, Validator} import sttp.tapir.Schema.annotations.{description, encodedExample, validate, validateEach} -import sttp.tapir.Validator import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} case class UpdateEntityNameRequest( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementEndpoints.scala index 1259f43e8d..5bb23c1726 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementEndpoints.scala @@ -1,8 +1,6 @@ package org.hyperledger.identus.iam.wallet.http -import org.hyperledger.identus.api.http.EndpointOutputs -import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.api.http.RequestContext +import org.hyperledger.identus.api.http.{EndpointOutputs, ErrorResponse, RequestContext} import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyCredentials import org.hyperledger.identus.iam.authentication.admin.AdminApiKeySecurityLogic.adminApiKeyHeader @@ -10,10 +8,12 @@ import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials import org.hyperledger.identus.iam.authentication.oidc.JwtSecurityLogic.jwtAuthHeader -import org.hyperledger.identus.iam.wallet.http.model.CreateWalletRequest -import org.hyperledger.identus.iam.wallet.http.model.CreateWalletUmaPermissionRequest -import org.hyperledger.identus.iam.wallet.http.model.WalletDetail -import org.hyperledger.identus.iam.wallet.http.model.WalletDetailPage +import org.hyperledger.identus.iam.wallet.http.model.{ + CreateWalletRequest, + CreateWalletUmaPermissionRequest, + WalletDetail, + WalletDetailPage +} import sttp.apispec.Tag import sttp.model.StatusCode import sttp.tapir.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementServerEndpoints.scala index 066a402489..6b64b4064e 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/WalletManagementServerEndpoints.scala @@ -1,14 +1,11 @@ package org.hyperledger.identus.iam.wallet.http -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.iam.wallet.http.controller.WalletManagementController import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/controller/WalletManagementController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/controller/WalletManagementController.scala index 4ab7cc239d..0660c69b47 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/controller/WalletManagementController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/controller/WalletManagementController.scala @@ -1,26 +1,21 @@ package org.hyperledger.identus.iam.wallet.http.controller -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.model.WalletSeed -import org.hyperledger.identus.agent.walletapi.service.WalletManagementService -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceError +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, Wallet, WalletSeed} +import org.hyperledger.identus.agent.walletapi.service.{WalletManagementService, WalletManagementServiceError} import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceError.TooManyPermittedWallet -import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.api.http.RequestContext -import org.hyperledger.identus.api.http.model.CollectionStats -import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.{CollectionStats, PaginationInput} import org.hyperledger.identus.api.util.PaginationUtils import org.hyperledger.identus.iam.authentication.oidc.KeycloakEntity import org.hyperledger.identus.iam.authorization.core.PermissionManagement -import org.hyperledger.identus.iam.wallet.http.model.CreateWalletRequest -import org.hyperledger.identus.iam.wallet.http.model.CreateWalletUmaPermissionRequest -import org.hyperledger.identus.iam.wallet.http.model.WalletDetail -import org.hyperledger.identus.iam.wallet.http.model.WalletDetailPage -import org.hyperledger.identus.shared.models.HexString -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.iam.wallet.http.model.{ + CreateWalletRequest, + CreateWalletUmaPermissionRequest, + WalletDetail, + WalletDetailPage +} +import org.hyperledger.identus.shared.models.{HexString, WalletAdministrationContext, WalletId} import org.hyperledger.identus.shared.models.WalletAdministrationContext.Admin -import org.hyperledger.identus.shared.models.WalletId import zio.* import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/model/WalletDetail.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/model/WalletDetail.scala index 5fb82b45cc..4ee017ab77 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/model/WalletDetail.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/iam/wallet/http/model/WalletDetail.scala @@ -6,8 +6,8 @@ import sttp.tapir.* import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} -import java.util.UUID import java.time.Instant +import java.util.UUID final case class WalletDetail( @description(WalletDetail.annotations.id.description) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueController.scala index e6b73579b7..be20e4fce7 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueController.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.issue.controller -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.issue.controller.http.{ AcceptCredentialOfferRequest, CreateIssueCredentialRecordRequest, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueControllerImpl.scala index 4a88e5b421..60361e74d1 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueControllerImpl.scala @@ -1,31 +1,31 @@ package org.hyperledger.identus.issue.controller -import org.hyperledger.identus.agent.server.ControllerHelper import org.hyperledger.identus.agent.server.config.AppConfig +import org.hyperledger.identus.agent.server.ControllerHelper +import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError import org.hyperledger.identus.agent.walletapi.model.PublicationState import org.hyperledger.identus.agent.walletapi.model.PublicationState.{Created, PublicationPending, Published} -import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.api.http.model.{CollectionStats, PaginationInput} import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.{CollectionStats, PaginationInput} import org.hyperledger.identus.api.util.PaginationUtils import org.hyperledger.identus.castor.core.model.did.{PrismDID, VerificationRelationship} import org.hyperledger.identus.castor.core.model.error.DIDResolutionError import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.service.ConnectionService -import org.hyperledger.identus.issue.controller.IssueController.toHttpError import org.hyperledger.identus.issue.controller.http.{ AcceptCredentialOfferRequest, CreateIssueCredentialRecordRequest, IssueCredentialRecord, IssueCredentialRecordPage } -import org.hyperledger.identus.pollux.core.model.CredentialFormat.{AnonCreds, JWT, SDJWT} -import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError +import org.hyperledger.identus.issue.controller.IssueController.toHttpError import org.hyperledger.identus.pollux.core.model.{CredentialFormat, DidCommID} -import org.hyperledger.identus.pollux.core.service.CredentialService +import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError +import org.hyperledger.identus.pollux.core.model.CredentialFormat.{AnonCreds, JWT, SDJWT} import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.Role +import org.hyperledger.identus.pollux.core.service.CredentialService import org.hyperledger.identus.shared.models.WalletAccessContext import zio.{URLayer, ZIO, ZLayer} diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueEndpoints.scala index 3c98092582..d97b91eae0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueEndpoints.scala @@ -1,9 +1,8 @@ package org.hyperledger.identus.issue.controller -import org.hyperledger.identus.api.http.EndpointOutputs.* -import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.api.http.RequestContext +import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueServerEndpoints.scala index 3819417d30..f7d9a2a8fc 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/IssueServerEndpoints.scala @@ -1,16 +1,13 @@ package org.hyperledger.identus.issue.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.api.http.model.PaginationInput -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic -import org.hyperledger.identus.issue.controller.IssueEndpoints.* +import org.hyperledger.identus.api.http.RequestContext +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.issue.controller.http.{AcceptCredentialOfferRequest, CreateIssueCredentialRecordRequest} +import org.hyperledger.identus.issue.controller.IssueEndpoints.* import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/AcceptCredentialOfferRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/AcceptCredentialOfferRequest.scala index 3593e8c20e..70c8d7bf88 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/AcceptCredentialOfferRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/AcceptCredentialOfferRequest.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.issue.controller.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.issue.controller.http.AcceptCredentialOfferRequest.annotations -import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import sttp.tapir.{Schema, Validator} +import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} /** A request to accept a credential offer received from an issuer. diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala index fa859c42f9..fb405c38e9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala @@ -2,9 +2,9 @@ package org.hyperledger.identus.issue.controller.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.issue.controller.http.CreateIssueCredentialRecordRequest.annotations -import sttp.tapir.Schema.annotations.{description, encodedExample} -import sttp.tapir.json.zio.schemaForZioJsonValue import sttp.tapir.{Schema, Validator} +import sttp.tapir.json.zio.schemaForZioJsonValue +import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecord.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecord.scala index 2ff17cb402..1207bed5fe 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecord.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecord.scala @@ -4,9 +4,9 @@ import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.issue.controller.http.IssueCredentialRecord.annotations import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, Base64} import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord as PolluxIssueCredentialRecord -import sttp.tapir.Schema.annotations.{description, encodedExample, validate} -import sttp.tapir.json.zio.schemaForZioJsonValue import sttp.tapir.{Schema, Validator} +import sttp.tapir.json.zio.schemaForZioJsonValue +import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import zio.json.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecordPage.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecordPage.scala index 7db33c1f0c..5ca8a55c8f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecordPage.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/IssueCredentialRecordPage.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.issue.controller.http -import sttp.tapir.Schema +import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.issue.controller.http.IssueCredentialRecordPage.annotations +import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} -import org.hyperledger.identus.api.http.Annotation /** @param self * The reference to the connection collection itself. for example: ''https://atala-prism-products.io/dids'' diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/CredentialIssuerServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/CredentialIssuerServerEndpoints.scala index 04eb695a35..11091fee56 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/CredentialIssuerServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/CredentialIssuerServerEndpoints.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.oid4vci -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.oid4vci.controller.CredentialIssuerController import org.hyperledger.identus.oid4vci.http.{CredentialErrorResponse, NonceResponse} +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/controller/CredentialIssuerController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/controller/CredentialIssuerController.scala index 4dfadcb13e..7fcd929ac3 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/controller/CredentialIssuerController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/controller/CredentialIssuerController.scala @@ -1,21 +1,19 @@ package org.hyperledger.identus.oid4vci.controller import org.hyperledger.identus.agent.server.config.AppConfig -import org.hyperledger.identus.api.http.ErrorResponse.badRequest -import org.hyperledger.identus.api.http.ErrorResponse.internalServerError import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.ErrorResponse.{badRequest, internalServerError} import org.hyperledger.identus.api.util.PaginationUtils import org.hyperledger.identus.castor.core.model.did.PrismDID -import org.hyperledger.identus.oid4vci.CredentialIssuerEndpoints.ExtendedErrorResponse import org.hyperledger.identus.oid4vci.http.* import org.hyperledger.identus.oid4vci.http.CredentialErrorCode.* import org.hyperledger.identus.oid4vci.service.OIDCCredentialIssuerService +import org.hyperledger.identus.oid4vci.CredentialIssuerEndpoints.ExtendedErrorResponse import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataService import org.hyperledger.identus.shared.models.WalletAccessContext import zio.{IO, URLayer, ZIO, ZLayer} -import java.net.URI -import java.net.URL +import java.net.{URI, URL} import java.util.UUID import scala.language.implicitConversions diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/domain/IssuanceSession.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/domain/IssuanceSession.scala index f598d55a00..240ab119b3 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/domain/IssuanceSession.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/domain/IssuanceSession.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.oid4vci.domain -import org.hyperledger.identus.castor.core.model.did.DID -import org.hyperledger.identus.castor.core.model.did.PrismDID +import org.hyperledger.identus.castor.core.model.did.{DID, PrismDID} import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/AuthorizationErrors.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/AuthorizationErrors.scala index 4648a738e7..20e8fc96ea 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/AuthorizationErrors.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/AuthorizationErrors.scala @@ -3,10 +3,10 @@ package org.hyperledger.identus.oid4vci.http import org.hyperledger.identus.api.http.EndpointOutputs.statusCodeMatcher import org.hyperledger.identus.api.http.ErrorResponse import sttp.model.StatusCode -import sttp.tapir.Schema.annotations.encodedName +import sttp.tapir.{oneOfVariantValueMatcher, Schema} import sttp.tapir.json.zio.jsonBody -import sttp.tapir.{Schema, oneOfVariantValueMatcher} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder, jsonField} +import sttp.tapir.Schema.annotations.encodedName +import zio.json.{jsonField, DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} // According to OIDC spec and RFC6750, the following errors are expected to be returned by the authorization server // https://www.rfc-editor.org/rfc/rfc6750.html#section-3.1 diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialConfiguration.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialConfiguration.scala index a5347eded0..bcd83bcdd9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialConfiguration.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialConfiguration.scala @@ -4,8 +4,7 @@ import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialConfiguration import sttp.tapir.Schema import zio.json.* -import java.time.OffsetDateTime -import java.time.ZoneOffset +import java.time.{OffsetDateTime, ZoneOffset} import scala.language.implicitConversions final case class CreateCredentialConfigurationRequest( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialOfferRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialOfferRequest.scala index d6c02e9597..eabac5d60d 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialOfferRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/oid4vci/http/CredentialOfferRequest.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.oid4vci.http -import sttp.tapir.Schema import sttp.tapir.json.zio.schemaForZioJsonValue +import sttp.tapir.Schema import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} case class CredentialOfferRequest( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryEndpoints.scala index 6510aae06f..96592dc7d7 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryEndpoints.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.pollux.credentialdefinition import org.hyperledger.identus.api.http.* -import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.api.http.codec.OrderCodec.* import org.hyperledger.identus.api.http.model.{Order, PaginationInput} +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials @@ -16,18 +16,18 @@ import org.hyperledger.identus.pollux.credentialdefinition.http.{ } import sttp.apispec.{ExternalDocumentation, Tag} import sttp.model.StatusCode -import sttp.tapir.json.zio.{jsonBody, schemaForZioJsonValue} import sttp.tapir.{ - Endpoint, - EndpointInput, - PublicEndpoint, endpoint, extractFromRequest, path, query, statusCode, - stringToPath + stringToPath, + Endpoint, + EndpointInput, + PublicEndpoint } +import sttp.tapir.json.zio.{jsonBody, schemaForZioJsonValue} import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryServerEndpoints.scala index cd2ef7be33..16fdbcbff2 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryServerEndpoints.scala @@ -1,17 +1,14 @@ package org.hyperledger.identus.pollux.credentialdefinition -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.api.http.model.{Order, PaginationInput} import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic +import org.hyperledger.identus.api.http.model.{Order, PaginationInput} +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.pollux.credentialdefinition -import org.hyperledger.identus.pollux.credentialdefinition.CredentialDefinitionRegistryEndpoints.* import org.hyperledger.identus.pollux.credentialdefinition.controller.CredentialDefinitionController import org.hyperledger.identus.pollux.credentialdefinition.http.{CredentialDefinitionInput, FilterInput} +import org.hyperledger.identus.pollux.credentialdefinition.CredentialDefinitionRegistryEndpoints.* +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerImpl.scala index 9eceb54fef..56fc7ca087 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerImpl.scala @@ -10,14 +10,14 @@ import org.hyperledger.identus.pollux.core.service.CredentialDefinitionService import org.hyperledger.identus.pollux.core.service.CredentialDefinitionService.Error.* import org.hyperledger.identus.pollux.credentialdefinition import org.hyperledger.identus.pollux.credentialdefinition.controller.CredentialDefinitionController.domainToHttpErrorIO -import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionInput.toDomain -import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionResponse.fromDomain import org.hyperledger.identus.pollux.credentialdefinition.http.{ CredentialDefinitionInput, CredentialDefinitionResponse, CredentialDefinitionResponsePage, FilterInput } +import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionInput.toDomain +import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionResponse.fromDomain import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerLogic.scala index 6a46a7338b..c3158c4a08 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/controller/CredentialDefinitionControllerLogic.scala @@ -1,8 +1,7 @@ package org.hyperledger.identus.pollux.credentialdefinition.controller +import org.hyperledger.identus.api.http.model.{CollectionStats, Pagination} import org.hyperledger.identus.api.http.RequestContext -import org.hyperledger.identus.api.http.model.CollectionStats -import org.hyperledger.identus.api.http.model.Pagination import org.hyperledger.identus.api.util.PaginationUtils import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionResponsePage import sttp.model.Uri diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionInput.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionInput.scala index 462fa11c45..b7600a56ff 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionInput.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionInput.scala @@ -4,10 +4,7 @@ import org.hyperledger.identus.api.http.* import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition.Input import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionResponse.annotations import sttp.tapir.Schema -import sttp.tapir.Schema.annotations.description -import sttp.tapir.Schema.annotations.encodedExample -import sttp.tapir.Schema.annotations.validate -import sttp.tapir.Schema.annotations.validateEach +import sttp.tapir.Schema.annotations.{description, encodedExample, validate, validateEach} import sttp.tapir.Validator.* import zio.json.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponse.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponse.scala index 23a65d25e9..55c6e440e2 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponse.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponse.scala @@ -6,12 +6,9 @@ import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition import org.hyperledger.identus.pollux.credentialdefinition.http.CredentialDefinitionResponse.annotations import sttp.model.Uri import sttp.model.Uri.* -import sttp.tapir.Schema -import sttp.tapir.Schema.annotations.default -import sttp.tapir.Schema.annotations.description -import sttp.tapir.Schema.annotations.encodedExample -import sttp.tapir.Schema.annotations.encodedName import sttp.tapir.json.zio.schemaForZioJsonValue +import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.{default, description, encodedExample, encodedName} import zio.json.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponsePage.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponsePage.scala index 789c810fb6..670928eeb0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponsePage.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/CredentialDefinitionResponsePage.scala @@ -3,12 +3,8 @@ package org.hyperledger.identus.pollux.credentialdefinition.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponsePage.annotations import sttp.tapir.Schema -import sttp.tapir.Schema.annotations.description -import sttp.tapir.Schema.annotations.encodedExample -import zio.json.DeriveJsonDecoder -import zio.json.DeriveJsonEncoder -import zio.json.JsonDecoder -import zio.json.JsonEncoder +import sttp.tapir.Schema.annotations.{description, encodedExample} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} case class CredentialDefinitionResponsePage( @description(annotations.contents.description) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/FilterInput.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/FilterInput.scala index 047817c6e4..cd39afb2b1 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/FilterInput.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/FilterInput.scala @@ -4,8 +4,7 @@ import org.hyperledger.identus.api.http.* import org.hyperledger.identus.pollux.core.model import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition import org.hyperledger.identus.pollux.credentialdefinition.http.FilterInput.annotations -import sttp.tapir.EndpointIO.annotations.example -import sttp.tapir.EndpointIO.annotations.query +import sttp.tapir.EndpointIO.annotations.{example, query} import sttp.tapir.Validator.* case class FilterInput( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/Proof.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/Proof.scala index 638842345f..a0015ae225 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/Proof.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialdefinition/http/Proof.scala @@ -2,14 +2,10 @@ package org.hyperledger.identus.pollux.credentialdefinition.http import org.hyperledger.identus.api.http.* import org.hyperledger.identus.pollux.credentialdefinition.http.Proof.annotations -import sttp.tapir.Schema -import sttp.tapir.Schema.annotations.description -import sttp.tapir.Schema.annotations.encodedExample import sttp.tapir.generic.auto.* -import zio.json.DeriveJsonDecoder -import zio.json.DeriveJsonEncoder -import zio.json.JsonDecoder -import zio.json.JsonEncoder +import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.{description, encodedExample} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import java.time.OffsetDateTime diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryEndpoints.scala index 3f2e42f3ea..26e21ea5c9 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryEndpoints.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.pollux.credentialschema import org.hyperledger.identus.api.http.* -import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.api.http.codec.OrderCodec.* import org.hyperledger.identus.api.http.model.{Order, PaginationInput} +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials @@ -16,19 +16,18 @@ import org.hyperledger.identus.pollux.credentialschema.http.{ } import sttp.apispec.{ExternalDocumentation, Tag} import sttp.model.StatusCode -import sttp.tapir.json.zio.jsonBody -import sttp.tapir.json.zio.schemaForZioJsonValue import sttp.tapir.{ - Endpoint, - EndpointInput, - PublicEndpoint, endpoint, extractFromRequest, path, query, statusCode, - stringToPath + stringToPath, + Endpoint, + EndpointInput, + PublicEndpoint } +import sttp.tapir.json.zio.{jsonBody, schemaForZioJsonValue} import zio.json.ast.Json import java.util.UUID diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryServerEndpoints.scala index 29e5518773..a6be73f5c4 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/SchemaRegistryServerEndpoints.scala @@ -1,14 +1,14 @@ package org.hyperledger.identus.pollux.credentialschema -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.api.http.model.{Order, PaginationInput} +import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} -import org.hyperledger.identus.pollux.credentialschema.SchemaRegistryEndpoints.* import org.hyperledger.identus.pollux.credentialschema.controller.CredentialSchemaController import org.hyperledger.identus.pollux.credentialschema.http.{CredentialSchemaInput, FilterInput} +import org.hyperledger.identus.pollux.credentialschema.SchemaRegistryEndpoints.* import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyEndpoints.scala index b84dd1b4d9..8578cdf7a4 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyEndpoints.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.pollux.credentialschema import org.hyperledger.identus.api.http.* -import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.api.http.codec.OrderCodec.* import org.hyperledger.identus.api.http.model.{Order, PaginationInput} +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyServerEndpoints.scala index 78c79da40d..d288c97e80 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/VerificationPolicyServerEndpoints.scala @@ -1,21 +1,19 @@ package org.hyperledger.identus.pollux.credentialschema -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.api.http.model.{Order, PaginationInput} import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic -import org.hyperledger.identus.pollux.credentialschema.VerificationPolicyEndpoints.* +import org.hyperledger.identus.api.http.model.{Order, PaginationInput} +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.pollux.credentialschema.controller.VerificationPolicyController -import org.hyperledger.identus.pollux.credentialschema.http.{VerificationPolicyResponse, VerificationPolicyInput} +import org.hyperledger.identus.pollux.credentialschema.http.{VerificationPolicyInput, VerificationPolicyResponse} +import org.hyperledger.identus.pollux.credentialschema.VerificationPolicyEndpoints.* import org.hyperledger.identus.shared.models.WalletAccessContext -import java.util.UUID +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* +import java.util.UUID + class VerificationPolicyServerEndpoints( controller: VerificationPolicyController, authenticator: Authenticator[BaseEntity], diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerImpl.scala index eff4eb100f..394f450686 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerImpl.scala @@ -9,14 +9,14 @@ import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema.Filtere import org.hyperledger.identus.pollux.core.service.CredentialSchemaService import org.hyperledger.identus.pollux.core.service.CredentialSchemaService.Error.* import org.hyperledger.identus.pollux.credentialschema.controller.CredentialSchemaController.domainToHttpErrorIO -import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaInput.toDomain -import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponse.fromDomain import org.hyperledger.identus.pollux.credentialschema.http.{ CredentialSchemaInput, CredentialSchemaResponse, CredentialSchemaResponsePage, FilterInput } +import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaInput.toDomain +import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponse.fromDomain import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerLogic.scala index 14ed20b287..a57c5e3186 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/CredentialSchemaControllerLogic.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.pollux.credentialschema.controller -import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.api.http.model.{CollectionStats, Pagination} +import org.hyperledger.identus.api.http.RequestContext +import org.hyperledger.identus.api.util.PaginationUtils import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponsePage import sttp.model.Uri -import org.hyperledger.identus.api.util.PaginationUtils case class CredentialSchemaControllerLogic( ctx: RequestContext, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyController.scala index 43e2624805..86f212dfc8 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyController.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.pollux.credentialschema.controller -import org.hyperledger.identus.api.http.model.{Order, Pagination} import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.{Order, Pagination} import org.hyperledger.identus.pollux.credentialschema.http.{ - VerificationPolicyResponse, VerificationPolicyInput, + VerificationPolicyResponse, VerificationPolicyResponsePage } import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyControllerImpl.scala index ffade947f9..b5ba41e023 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyControllerImpl.scala @@ -3,16 +3,16 @@ package org.hyperledger.identus.pollux.credentialschema.controller import org.hyperledger.identus.api.http.* import org.hyperledger.identus.api.http.model.{CollectionStats, Order, Pagination} import org.hyperledger.identus.pollux.core.model -import org.hyperledger.identus.pollux.core.model.CredentialSchemaAndTrustedIssuersConstraint import org.hyperledger.identus.pollux.core.model.error.VerificationPolicyError import org.hyperledger.identus.pollux.core.model.error.VerificationPolicyError.* +import org.hyperledger.identus.pollux.core.model.CredentialSchemaAndTrustedIssuersConstraint import org.hyperledger.identus.pollux.core.service.VerificationPolicyService -import org.hyperledger.identus.pollux.credentialschema.http.VerificationPolicyResponse.* import org.hyperledger.identus.pollux.credentialschema.http.{ - VerificationPolicyResponse, VerificationPolicyInput, + VerificationPolicyResponse, VerificationPolicyResponsePage } +import org.hyperledger.identus.pollux.credentialschema.http.VerificationPolicyResponse.* import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* import zio.ZIO.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyPageRequestLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyPageRequestLogic.scala index 2495879ec8..10fab27680 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyPageRequestLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/controller/VerificationPolicyPageRequestLogic.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.pollux.credentialschema.controller -import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.api.http.model.{CollectionStats, Pagination} +import org.hyperledger.identus.api.http.RequestContext +import org.hyperledger.identus.api.util.PaginationUtils import org.hyperledger.identus.pollux.credentialschema.http.{VerificationPolicyResponse, VerificationPolicyResponsePage} import sttp.model.Uri -import org.hyperledger.identus.api.util.PaginationUtils case class VerificationPolicyPageRequestLogic( ctx: RequestContext, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaInput.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaInput.scala index e54257f9db..263f2ecc1d 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaInput.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaInput.scala @@ -3,10 +3,10 @@ package org.hyperledger.identus.pollux.credentialschema.http import org.hyperledger.identus.api.http.* import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema.Input import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponse.annotations +import sttp.tapir.json.zio.schemaForZioJsonValue import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample, validate, validateEach} import sttp.tapir.Validator.* -import sttp.tapir.json.zio.schemaForZioJsonValue import zio.json.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponse.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponse.scala index 1d0657cbdf..ccb7e5f3cd 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponse.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponse.scala @@ -6,9 +6,9 @@ import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponse.annotations import sttp.model.Uri import sttp.model.Uri.* +import sttp.tapir.json.zio.schemaForZioJsonValue import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{default, description, encodedExample, encodedName} -import sttp.tapir.json.zio.schemaForZioJsonValue import zio.json.* import zio.json.ast.Json diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponsePage.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponsePage.scala index b5fc076b7a..ac2f0850ea 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponsePage.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaResponsePage.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.pollux.credentialschema.http +import org.hyperledger.identus.api.http.Annotation +import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponsePage.annotations import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} -import org.hyperledger.identus.pollux.credentialschema.http.CredentialSchemaResponsePage.annotations -import org.hyperledger.identus.api.http.Annotation case class CredentialSchemaResponsePage( @description(annotations.contents.description) diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/FilterInput.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/FilterInput.scala index 46f539b53c..48ad4f542b 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/FilterInput.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/FilterInput.scala @@ -4,8 +4,7 @@ import org.hyperledger.identus.api.http.* import org.hyperledger.identus.pollux.core.model import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema import org.hyperledger.identus.pollux.credentialschema.http.FilterInput.annotations -import sttp.tapir.EndpointIO.annotations.example -import sttp.tapir.EndpointIO.annotations.query +import sttp.tapir.EndpointIO.annotations.{example, query} import sttp.tapir.Validator.* case class FilterInput( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/Proof.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/Proof.scala index 602fbb70df..35d7aaa3de 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/Proof.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/pollux/credentialschema/http/Proof.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.pollux.credentialschema.http +import org.hyperledger.identus.api.http.* +import org.hyperledger.identus.pollux.credentialschema.http.Proof.annotations +import sttp.tapir.generic.auto.* import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import sttp.tapir.generic.auto.* import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} -import org.hyperledger.identus.pollux.credentialschema.http.Proof.annotations -import org.hyperledger.identus.api.http.* import java.time.OffsetDateTime diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofController.scala index f1c6dfcf23..ff9445cff6 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofController.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.presentproof.controller -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.pollux.core.model.error.PresentationError import org.hyperledger.identus.presentproof.controller.http.* import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofControllerImpl.scala index ba84b610fc..0019e4eef0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofControllerImpl.scala @@ -1,24 +1,24 @@ package org.hyperledger.identus.presentproof.controller import org.hyperledger.identus.agent.server.ControllerHelper -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.service.ConnectionService import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.presentproof.ProofType +import org.hyperledger.identus.pollux.core.model.{CredentialFormat, DidCommID, PresentationRecord} import org.hyperledger.identus.pollux.core.model.error.PresentationError import org.hyperledger.identus.pollux.core.model.presentation.Options -import org.hyperledger.identus.pollux.core.model.{CredentialFormat, DidCommID, PresentationRecord} import org.hyperledger.identus.pollux.core.service.PresentationService -import org.hyperledger.identus.presentproof.controller.PresentProofController.toDidCommID import org.hyperledger.identus.presentproof.controller.http.* +import org.hyperledger.identus.presentproof.controller.PresentProofController.toDidCommID import org.hyperledger.identus.shared.models.WalletAccessContext -import zio.{URLayer, ZIO, ZLayer} -import java.util.UUID +import zio.{URLayer, ZIO, ZLayer, *} import zio.json.* import zio.json.ast.Json -import zio.* + +import java.util.UUID class PresentProofControllerImpl( presentationService: PresentationService, diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofEndpoints.scala index aa61c68ff4..c393029799 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofEndpoints.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.presentproof.controller -import org.hyperledger.identus.api.http.EndpointOutputs.* -import org.hyperledger.identus.api.http.model.PaginationInput import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.model.PaginationInput +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofServerEndpoints.scala index 903ed8e22d..798902f51c 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/PresentProofServerEndpoints.scala @@ -1,21 +1,18 @@ package org.hyperledger.identus.presentproof.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.api.http.model.PaginationInput -import org.hyperledger.identus.iam.authentication.Authenticator -import org.hyperledger.identus.iam.authentication.Authorizer -import org.hyperledger.identus.iam.authentication.DefaultAuthenticator -import org.hyperledger.identus.iam.authentication.SecurityLogic +import org.hyperledger.identus.api.http.RequestContext +import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} +import org.hyperledger.identus.presentproof.controller.http.{RequestPresentationAction, RequestPresentationInput} import org.hyperledger.identus.presentproof.controller.PresentProofEndpoints.{ getAllPresentations, getPresentation, requestPresentation, updatePresentation } -import org.hyperledger.identus.presentproof.controller.http.{RequestPresentationAction, RequestPresentationInput} import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* 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 14f8b94aff..6624a3857d 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 @@ -4,8 +4,8 @@ import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.mercury.model.Base64 import org.hyperledger.identus.pollux.core.model.PresentationRecord import org.hyperledger.identus.presentproof.controller.http.PresentationStatus.annotations -import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import sttp.tapir.{Schema, Validator} +import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} final case class PresentationStatus( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationAction.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationAction.scala index 402e344f67..09728b406b 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationAction.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationAction.scala @@ -3,9 +3,9 @@ package org.hyperledger.identus.presentproof.controller.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.pollux.core.service.serdes.* import org.hyperledger.identus.presentproof.controller.http.RequestPresentationAction.annotations -import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import sttp.tapir.{Schema, Validator} import sttp.tapir.json.zio.* +import sttp.tapir.Schema.annotations.{description, encodedExample, validate} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} final case class RequestPresentationAction( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationInput.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationInput.scala index 13e1d3e442..a931c8fc8a 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationInput.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/presentproof/controller/http/RequestPresentationInput.scala @@ -3,10 +3,11 @@ package org.hyperledger.identus.presentproof.controller.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.pollux.core.service.serdes.* import org.hyperledger.identus.presentproof.controller.http.RequestPresentationInput.annotations -import sttp.tapir.Schema.annotations.{description, encodedExample} import sttp.tapir.{Schema, Validator} import sttp.tapir.json.zio.* +import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} + import java.util.UUID final case class RequestPresentationInput( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemController.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemController.scala index 21bf841708..777ea759bf 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemController.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemController.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.system.controller -import zio.* import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} import org.hyperledger.identus.system.controller.http.HealthInfo +import zio.* trait SystemController { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemControllerImpl.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemControllerImpl.scala index 7ad16c53a3..3e8850bc68 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemControllerImpl.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemControllerImpl.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.system.controller +import io.micrometer.prometheus.PrometheusMeterRegistry import org.hyperledger.identus.agent.server.buildinfo.BuildInfo import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} import org.hyperledger.identus.system.controller.http.HealthInfo -import io.micrometer.prometheus.PrometheusMeterRegistry import zio.* class SystemControllerImpl( diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemEndpoints.scala index 73cf6a6c85..a30915c5b8 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemEndpoints.scala @@ -1,12 +1,12 @@ package org.hyperledger.identus.system.controller -import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.system.controller.http.HealthInfo import sttp.apispec.Tag -import sttp.tapir.ztapir.stringBody -import sttp.tapir.json.zio.jsonBody import sttp.tapir.* +import sttp.tapir.json.zio.jsonBody +import sttp.tapir.ztapir.stringBody object SystemEndpoints { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemServerEndpoints.scala index 6b693a9553..c3f9673569 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/SystemServerEndpoints.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.system.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.system.controller.SystemEndpoints.* +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.{URIO, ZIO} diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/http/HealthInfo.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/http/HealthInfo.scala index f5eec8783a..dd7ee9791f 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/http/HealthInfo.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/system/controller/http/HealthInfo.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.system.controller.http import org.hyperledger.identus.api.http.Annotation import org.hyperledger.identus.system.controller.http.HealthInfo.annotations -import sttp.tapir.Schema.annotations.{description, encodedExample} import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} /** A class to represent response detailing health of service including version diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationEndpoints.scala index cff7629230..266e24fd20 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationEndpoints.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.verification.controller -import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext} +import org.hyperledger.identus.api.http.EndpointOutputs.* import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials import org.hyperledger.identus.iam.authentication.apikey.ApiKeyEndpointSecurityLogic.apiKeyHeader import org.hyperledger.identus.iam.authentication.oidc.JwtCredentials @@ -21,14 +21,14 @@ object VcVerificationEndpoints { endpoint.post .tag("Verifiable Credentials Verification") .name("verify") - .summary("As a Verifier, verify a set of credentials") - .description("As a Verifier, verify a set of credentials") + .summary("Verify a set of credentials as a Verifier") + .description("Endpoint to verify a set of verifiable credentials as a Verifier.") .securityIn(apiKeyHeader) .securityIn(jwtAuthHeader) .in("verification" / "credential") .in(extractFromRequest[RequestContext](RequestContext.apply)) - .in(jsonBody[List[http.VcVerificationRequest]].description("List of VC to verify")) - .out(statusCode(StatusCode.Ok).description("List of VC verification outcome")) + .in(jsonBody[List[http.VcVerificationRequest]].description("List of verifiable credentials to verify")) + .out(statusCode(StatusCode.Ok).description("List of verifiable credentials verification outcomes")) .out(jsonBody[List[http.VcVerificationResponse]]) .errorOut(basicFailuresAndForbidden) } diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationServerEndpoints.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationServerEndpoints.scala index 7f3a114f9e..b036ea17da 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationServerEndpoints.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/VcVerificationServerEndpoints.scala @@ -1,12 +1,12 @@ package org.hyperledger.identus.verification.controller -import org.hyperledger.identus.LogUtils.* import org.hyperledger.identus.agent.walletapi.model.BaseEntity import org.hyperledger.identus.api.http.RequestContext import org.hyperledger.identus.iam.authentication.{Authenticator, Authorizer, DefaultAuthenticator, SecurityLogic} import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.verification.controller import org.hyperledger.identus.verification.controller.VcVerificationEndpoints.verify +import org.hyperledger.identus.LogUtils.* import sttp.tapir.ztapir.* import zio.* diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/ParameterizableVcVerification.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/ParameterizableVcVerification.scala index 7200824ec0..fc12dca251 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/ParameterizableVcVerification.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/ParameterizableVcVerification.scala @@ -1,12 +1,23 @@ package org.hyperledger.identus.verification.controller.http import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} +/** Represents a parameterizable verification to be performed on a verifiable credential. + * + * @param verification + * The type of verification to perform. + * @param parameter + * Optional parameter for the verification. + */ final case class ParameterizableVcVerification( + @description("The type of verification to perform.") verification: VcVerification, + @description("Optional parameter for the verification.") parameter: Option[VcVerificationParameter] ) + object ParameterizableVcVerification { given encoder: JsonEncoder[ParameterizableVcVerification] = DeriveJsonEncoder.gen[ParameterizableVcVerification] diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerification.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerification.scala index 13e90fd4e1..5d83c81070 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerification.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerification.scala @@ -4,22 +4,36 @@ import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.pollux.core.service.verification.VcVerification as ServiceVcVerification import sttp.tapir.Schema -import zio.json.{JsonDecoder, JsonEncoder} +import sttp.tapir.Schema.annotations.description import zio.{IO, *} +import zio.json.{JsonDecoder, JsonEncoder} +/** Enum representing the various types of verifications that can be performed on a verifiable credential. + */ enum VcVerification { - case SignatureVerification - case IssuerIdentification - case ExpirationCheck - case NotBeforeCheck - case AudienceCheck - case SubjectVerification - case IntegrityOfClaims - case ComplianceWithStandards - case RevocationCheck - case AlgorithmVerification - case SchemaCheck - case SemanticCheckOfClaims + @description("Verify the digital signature of the credential.") case SignatureVerification + + @description("Verify the identity of the issuer of the credential.") case IssuerIdentification + + @description("Check if the credential has expired.") case ExpirationCheck + + @description("Check if the credential is valid before a certain date and time.") case NotBeforeCheck + + @description("Verify the audience for which the credential is intended.") case AudienceCheck + + @description("Verify the subject of the credential.") case SubjectVerification + + @description("Check the integrity of the claims in the credential.") case IntegrityOfClaims + + @description("Ensure the credential complies with required standards.") case ComplianceWithStandards + + @description("Check if the credential has been revoked.") case RevocationCheck + + @description("Verify the algorithm used for creating the credential.") case AlgorithmVerification + + @description("Validate the schema of the credential.") case SchemaCheck + + @description("Perform a semantic check on the claims of the credential.") case SemanticCheckOfClaims } object VcVerification { diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationParameter.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationParameter.scala index 0ceba92f3f..a10a501e00 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationParameter.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationParameter.scala @@ -1,10 +1,16 @@ package org.hyperledger.identus.verification.controller.http import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.{description, encodedExample} import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import java.time.OffsetDateTime +/** Base trait for verification parameters. + * + * @param parameterType + * The type of the parameter. + */ sealed trait VcVerificationParameter(val parameterType: String) object VcVerificationParameter { @@ -31,7 +37,16 @@ object VcVerificationParameter { } -case class DidParameter(did: String) extends VcVerificationParameter("DidParameter") +/** Parameter for DID-based verifications. + * + * @param did + * The DID (Decentralized Identifier) to use for verification. + */ +case class DidParameter( + @description("The DID (Decentralized Identifier) to use for verification.") + @encodedExample("did:prism:issuer") + did: String +) extends VcVerificationParameter("DidParameter") object DidParameter { given encoder: JsonEncoder[DidParameter] = @@ -43,7 +58,16 @@ object DidParameter { given schema: Schema[DidParameter] = Schema.derived } -case class DateTimeParameter(dateTime: OffsetDateTime) extends VcVerificationParameter("DateTimeParameter") +/** Parameter for date-time based verifications. + * + * @param dateTime + * The date and time to use for verification. + */ +case class DateTimeParameter( + @description("The date and time to use for verification.") + @encodedExample("2022-03-10T12:00:00Z") + dateTime: OffsetDateTime +) extends VcVerificationParameter("DateTimeParameter") object DateTimeParameter { given encoder: JsonEncoder[DateTimeParameter] = diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationRequest.scala index fb5b30bbfb..ba0b3529f3 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationRequest.scala @@ -4,8 +4,10 @@ import org.hyperledger.identus.api.http.{Annotation, ErrorResponse} import org.hyperledger.identus.pollux.core.service.verification.VcVerificationRequest as ServiceVcVerificationRequest import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} import zio.{IO, *} +import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder, *} +import zio.json.ast.Json +import zio.json.ast.Json.* import java.time.OffsetDateTime @@ -29,8 +31,9 @@ object VcVerificationRequest { ) object parameterizableVcVerifications - extends Annotation[List[ParameterizableVcVerification]]( - description = "The list of Verifications to verify. All verifications run if Verifications left empty", + extends Annotation[String]( + description = + "The list of verifications to perform on the credential. If the list is empty, all available verifications will be performed.", example = List( ParameterizableVcVerification(VcVerification.SignatureVerification, None), ParameterizableVcVerification(VcVerification.IssuerIdentification, Some(DidParameter("did:prism:issuer"))), @@ -50,7 +53,7 @@ object VcVerificationRequest { ParameterizableVcVerification(VcVerification.AlgorithmVerification, None), ParameterizableVcVerification(VcVerification.SchemaCheck, None), ParameterizableVcVerification(VcVerification.SemanticCheckOfClaims, None) - ) + ).toJson ) } diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResponse.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResponse.scala index f8c71f335e..93a2c82dc0 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResponse.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResponse.scala @@ -3,7 +3,9 @@ package org.hyperledger.identus.verification.controller.http import org.hyperledger.identus.api.http.Annotation import sttp.tapir.Schema import sttp.tapir.Schema.annotations.{description, encodedExample} -import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} +import zio.json.* +import zio.json.ast.Json +import zio.json.ast.Json.* final case class VcVerificationResponse( @description(VcVerificationResponse.annotations.credential.description) @@ -20,14 +22,14 @@ object VcVerificationResponse { object credential extends Annotation[String]( - description = "Encoded Verifiable Credential to verify", + description = "Encoded Verifiable Credential that was verified.", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" ) object vcVerificationResults - extends Annotation[List[VcVerificationResult]]( - description = "The list executed Verifications", + extends Annotation[String]( + description = "The list of verification results for each verification performed on the credential.", example = List( VcVerificationResult(VcVerification.SignatureVerification, true), VcVerificationResult(VcVerification.IssuerIdentification, true), @@ -41,7 +43,7 @@ object VcVerificationResponse { VcVerificationResult(VcVerification.AlgorithmVerification, true), VcVerificationResult(VcVerification.SchemaCheck, true), VcVerificationResult(VcVerification.SemanticCheckOfClaims, true), - ) + ).toJson ) } diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResult.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResult.scala index 3eab310e22..a7024bcc14 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResult.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/verification/controller/http/VcVerificationResult.scala @@ -2,10 +2,20 @@ package org.hyperledger.identus.verification.controller.http import org.hyperledger.identus.pollux.core.service.verification.VcVerificationResult as ServiceVcVerificationResult import sttp.tapir.Schema +import sttp.tapir.Schema.annotations.description import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} +/** Represents the result of a verification performed on a verifiable credential. + * + * @param verification + * The type of verification that was performed. + * @param success + * Indicates whether the verification was successful. + */ final case class VcVerificationResult( + @description("The type of verification that was performed.") verification: VcVerification, + @description("Indicates whether the verification was successful.") success: Boolean ) object VcVerificationResult { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/ZioHttpTest.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/ZioHttpTest.scala index eb28c2cba9..f9fc2db7d7 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/ZioHttpTest.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/ZioHttpTest.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus import zio.* import zio.http.* -import zio.http.ZClient.Config import zio.http.netty.NettyConfig +import zio.http.ZClient.Config import java.net.URI import java.time diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/AgentInitializationSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/AgentInitializationSpec.scala index f1435c44e3..04fe552997 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/AgentInitializationSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/AgentInitializationSpec.scala @@ -1,30 +1,27 @@ package org.hyperledger.identus.agent.server -import org.hyperledger.identus.agent.server.config.AppConfig -import org.hyperledger.identus.agent.server.config.SecretStorageBackend -import org.hyperledger.identus.agent.walletapi.service.EntityServiceImpl -import org.hyperledger.identus.agent.walletapi.service.WalletManagementService -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceImpl -import org.hyperledger.identus.agent.walletapi.sql.JdbcEntityRepository -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage -import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticatorImpl -import org.hyperledger.identus.iam.authentication.apikey.JdbcAuthenticationRepository +import org.hyperledger.identus.agent.server.config.{AppConfig, SecretStorageBackend} +import org.hyperledger.identus.agent.walletapi.service.{ + EntityServiceImpl, + WalletManagementService, + WalletManagementServiceImpl +} +import org.hyperledger.identus.agent.walletapi.sql.{ + JdbcEntityRepository, + JdbcWalletNonSecretStorage, + JdbcWalletSecretStorage +} +import org.hyperledger.identus.agent.walletapi.storage.{WalletNonSecretStorage, WalletSecretStorage} +import org.hyperledger.identus.iam.authentication.apikey.{ApiKeyAuthenticatorImpl, JdbcAuthenticationRepository} import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.DBTestUtils import zio.* -import zio.test.* +import zio.test.{ZIOSpecDefault, *} import zio.test.Assertion.* -import zio.test.ZIOSpecDefault -import java.net.URI -import java.net.URL +import java.net.{URI, URL} object AgentInitializationSpec extends ZIOSpecDefault, PostgresTestContainerSupport, ApolloSpecHelper { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/config/AppConfigSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/config/AppConfigSpec.scala index 1b93104664..4dd08a1157 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/config/AppConfigSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/agent/server/config/AppConfigSpec.scala @@ -1,11 +1,10 @@ package org.hyperledger.identus.agent.server.config -import org.hyperledger.identus.agent.server.SystemModule import monocle.syntax.all.* +import org.hyperledger.identus.agent.server.SystemModule import zio.* -import zio.test.* +import zio.test.{ZIOSpecDefault, *} import zio.test.Assertion.* -import zio.test.ZIOSpecDefault object AppConfigSpec extends ZIOSpecDefault { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/PaginationUtilsSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/PaginationUtilsSpec.scala index b81b64696f..4a779b1657 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/PaginationUtilsSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/PaginationUtilsSpec.scala @@ -1,11 +1,10 @@ package org.hyperledger.identus.api.util +import org.hyperledger.identus.api.http.model.{CollectionStats, Pagination} +import sttp.model.Uri import zio.* import zio.test.* import zio.test.Assertion.* -import sttp.model.Uri -import org.hyperledger.identus.api.http.model.CollectionStats -import org.hyperledger.identus.api.http.model.Pagination object PaginationUtilsSpec extends ZIOSpecDefault { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/Tapir2StaticOAS.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/Tapir2StaticOAS.scala index 1f3c9580d0..0a5939f4d2 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/Tapir2StaticOAS.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/api/util/Tapir2StaticOAS.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.api.util -import org.hyperledger.identus.agent.server.AgentHttpServer import org.hyperledger.identus.agent.server.http.DocModels +import org.hyperledger.identus.agent.server.AgentHttpServer import org.hyperledger.identus.castor.controller.{DIDController, DIDRegistrarController} import org.hyperledger.identus.connect.controller.ConnectionController import org.hyperledger.identus.credential.status.controller.CredentialStatusController diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/container/util/MigrationAspect.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/container/util/MigrationAspect.scala index fe5bf1cbc7..ad5b344908 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/container/util/MigrationAspect.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/container/util/MigrationAspect.scala @@ -2,9 +2,9 @@ package org.hyperledger.identus.container.util import com.dimafeng.testcontainers.PostgreSQLContainer import org.flywaydb.core.Flyway -import zio.ZIO -import zio.test.TestAspect.{beforeAll, before} import zio.test.{TestAspect, TestAspectAtLeastR} +import zio.test.TestAspect.{before, beforeAll} +import zio.ZIO object MigrationAspects { def migrate(schema: String, paths: String*): TestAspectAtLeastR[PostgreSQLContainer] = { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/SecurityLogicSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/SecurityLogicSpec.scala index 3437e896a9..0b1d58e0a1 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/SecurityLogicSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/SecurityLogicSpec.scala @@ -1,9 +1,8 @@ package org.hyperledger.identus.iam.authentication -import org.hyperledger.identus.agent.walletapi.model.Entity -import org.hyperledger.identus.agent.walletapi.model.EntityRole -import org.hyperledger.identus.iam.authentication.AuthenticationError.InvalidCredentials +import org.hyperledger.identus.agent.walletapi.model.{Entity, EntityRole} import org.hyperledger.identus.iam.authentication.apikey.ApiKeyCredentials +import org.hyperledger.identus.iam.authentication.AuthenticationError.InvalidCredentials import zio.* import zio.test.* import zio.test.Assertion.* diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorSpec.scala index 2ee8d718c7..006646d484 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/ApiKeyAuthenticatorSpec.scala @@ -17,14 +17,13 @@ import org.hyperledger.identus.container.util.MigrationAspects.* import org.hyperledger.identus.iam.authentication.AuthenticationError import org.hyperledger.identus.iam.authentication.AuthenticationError.InvalidCredentials import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import zio.Runtime.removeDefaultLoggers +import zio.{Scope, ULayer, ZIO, ZLayer} +import zio.test.{assert, Spec, TestEnvironment, ZIOSpecDefault, *} import zio.test.Assertion.* import zio.test.TestAspect.sequential -import zio.test.{Spec, TestEnvironment, ZIOSpecDefault, assert, *} -import zio.{Scope, ULayer, ZIO, ZLayer} +import zio.Runtime.removeDefaultLoggers object ApiKeyAuthenticatorSpec extends ZIOSpecDefault, PostgresTestContainerSupport { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepositorySpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepositorySpec.scala index 18d14280f8..bee77e273e 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepositorySpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/apikey/JdbcAuthenticationRepositorySpec.scala @@ -3,12 +3,11 @@ package org.hyperledger.identus.iam.authentication.apikey import org.hyperledger.identus.container.util.MigrationAspects.migrate import org.hyperledger.identus.iam.authentication.apikey.AuthenticationMethodType.ApiKey import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import zio.Runtime.removeDefaultLoggers -import zio.ZIO -import zio.test.* +import zio.test.{TestAspect, ZIOSpecDefault, *} import zio.test.Assertion.* import zio.test.TestAspect.* -import zio.test.{TestAspect, ZIOSpecDefault} +import zio.Runtime.removeDefaultLoggers +import zio.ZIO object JdbcAuthenticationRepositorySpec extends ZIOSpecDefault, PostgresTestContainerSupport { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorSpec.scala index 5ccde5e29d..19e9e36962 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authentication/oidc/KeycloakAuthenticatorSpec.scala @@ -1,24 +1,21 @@ package org.hyperledger.identus.iam.authentication.oidc -import org.hyperledger.identus.agent.walletapi.model.EntityRole -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.service.WalletManagementService -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceImpl -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletSecretStorage +import org.hyperledger.identus.agent.walletapi.model.{EntityRole, Wallet} +import org.hyperledger.identus.agent.walletapi.service.{WalletManagementService, WalletManagementServiceImpl} +import org.hyperledger.identus.agent.walletapi.sql.{JdbcWalletNonSecretStorage, JdbcWalletSecretStorage} import org.hyperledger.identus.iam.authentication.AuthenticationError import org.hyperledger.identus.iam.authorization.keycloak.admin.KeycloakPermissionManagementService import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId -import org.hyperledger.identus.sharedtest.containers.KeycloakAdminClient -import org.hyperledger.identus.sharedtest.containers.KeycloakContainerCustom -import org.hyperledger.identus.sharedtest.containers.KeycloakTestContainerSupport -import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} +import org.hyperledger.identus.sharedtest.containers.{ + KeycloakAdminClient, + KeycloakContainerCustom, + KeycloakTestContainerSupport, + PostgresTestContainerSupport +} import org.hyperledger.identus.test.container.DBTestUtils import org.keycloak.authorization.client.AuthzClient -import org.keycloak.representations.idm.authorization.ResourceRepresentation -import org.keycloak.representations.idm.authorization.UmaPermissionRepresentation +import org.keycloak.representations.idm.authorization.{ResourceRepresentation, UmaPermissionRepresentation} import zio.* import zio.http.Client import zio.test.* diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementSpec.scala index 46fc963ca3..d1e1b9e1ac 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/core/EntityPermissionManagementSpec.scala @@ -1,19 +1,20 @@ package org.hyperledger.identus.iam.authorization.core -import org.hyperledger.identus.agent.walletapi.model.Entity -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.service.EntityService -import org.hyperledger.identus.agent.walletapi.service.EntityServiceImpl -import org.hyperledger.identus.agent.walletapi.service.WalletManagementService -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceImpl -import org.hyperledger.identus.agent.walletapi.sql.JdbcEntityRepository -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletSecretStorage -import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.ServiceError -import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.WalletNotFoundById +import org.hyperledger.identus.agent.walletapi.model.{Entity, Wallet} +import org.hyperledger.identus.agent.walletapi.service.{ + EntityService, + EntityServiceImpl, + WalletManagementService, + WalletManagementServiceImpl +} +import org.hyperledger.identus.agent.walletapi.sql.{ + JdbcEntityRepository, + JdbcWalletNonSecretStorage, + JdbcWalletSecretStorage +} +import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.{ServiceError, WalletNotFoundById} import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAdministrationContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.DBTestUtils import zio.* diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakAdminSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakAdminSpec.scala index ed92b74522..2f3639e281 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakAdminSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakAdminSpec.scala @@ -2,10 +2,10 @@ package org.hyperledger.identus.iam.authorization.keycloak.admin import org.hyperledger.identus.sharedtest.containers.{KeycloakContainerCustom, KeycloakTestContainerSupport} import zio.* -import zio.ZIO.* import zio.test.* import zio.test.Assertion.equalTo import zio.test.TestAspect.* +import zio.ZIO.* import scala.util.Try diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala index d27892b017..f80edb6281 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala @@ -1,11 +1,12 @@ package org.hyperledger.identus.iam.authorization.keycloak.admin import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceImpl -import org.hyperledger.identus.agent.walletapi.service.{WalletManagementService, WalletManagementServiceError} -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletSecretStorage -import org.hyperledger.identus.iam.authentication.AuthenticationError.ResourceNotPermitted +import org.hyperledger.identus.agent.walletapi.service.{ + WalletManagementService, + WalletManagementServiceError, + WalletManagementServiceImpl +} +import org.hyperledger.identus.agent.walletapi.sql.{JdbcWalletNonSecretStorage, JdbcWalletSecretStorage} import org.hyperledger.identus.iam.authentication.oidc.{ KeycloakAuthenticator, KeycloakAuthenticatorImpl, @@ -13,21 +14,23 @@ import org.hyperledger.identus.iam.authentication.oidc.{ KeycloakClientImpl, KeycloakEntity } +import org.hyperledger.identus.iam.authentication.AuthenticationError.ResourceNotPermitted import org.hyperledger.identus.iam.authorization.core.PermissionManagement -import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.UnexpectedError -import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.WalletNotFoundById +import org.hyperledger.identus.iam.authorization.core.PermissionManagement.Error.{UnexpectedError, WalletNotFoundById} import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} -import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import org.hyperledger.identus.sharedtest.containers.{KeycloakContainerCustom, KeycloakTestContainerSupport} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext, WalletId} +import org.hyperledger.identus.sharedtest.containers.{ + KeycloakContainerCustom, + KeycloakTestContainerSupport, + PostgresTestContainerSupport +} import org.hyperledger.identus.test.container.DBTestUtils import zio.* -import zio.ZIO.* import zio.http.Client import zio.test.* import zio.test.Assertion.* import zio.test.TestAspect.* +import zio.ZIO.* import java.util.UUID diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerImplSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerImplSpec.scala index 3cf52c8c24..a8f19bd4af 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerImplSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerImplSpec.scala @@ -19,11 +19,11 @@ import org.hyperledger.identus.issue.controller.http.{ import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.connection.ConnectionResponse import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.{ProtocolState, Role} import org.hyperledger.identus.pollux.core.model.{CredentialFormat, DidCommID, IssueCredentialRecord} +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.{ProtocolState, Role} import org.hyperledger.identus.pollux.core.service.MockCredentialService +import sttp.client3.{basicRequest, DeserializationException, UriContext} import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, UriContext, basicRequest} import sttp.model.StatusCode import zio.* import zio.json.EncoderOps diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerSpec.scala index 9dc27f430e..3fb0d20a6b 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerSpec.scala @@ -1,14 +1,14 @@ package org.hyperledger.identus.issue.controller +import io.circe.* import org.hyperledger.identus.api.http.ErrorResponse -import org.hyperledger.identus.pollux.core.model.DidCommID import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError -import org.hyperledger.identus.pollux.vc.jwt.W3cCredentialPayload +import org.hyperledger.identus.pollux.core.model.DidCommID +import org.hyperledger.identus.pollux.vc.jwt.{W3cCredentialPayload, *} import zio.* import zio.test.* import zio.test.Assertion.* -import org.hyperledger.identus.pollux.vc.jwt.* -import io.circe.* + import java.time.Instant object IssueControllerSpec extends ZIOSpecDefault { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerTestTools.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerTestTools.scala index 0d454fcba8..ec5813c04d 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerTestTools.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/issue/controller/IssueControllerTestTools.scala @@ -15,8 +15,8 @@ import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord import org.hyperledger.identus.pollux.core.service.* import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import sttp.client3.testing.SttpBackendStub import sttp.client3.{DeserializationException, Response, UriContext} +import sttp.client3.testing.SttpBackendStub import sttp.monad.MonadError import sttp.tapir.server.interceptor.CustomiseInterceptors import sttp.tapir.server.stub.TapirStubInterpreter diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/oid4vci/domain/OIDCCredentialIssuerServiceSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/oid4vci/domain/OIDCCredentialIssuerServiceSpec.scala index 3f74ba9acd..0fcc1168b3 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/oid4vci/domain/OIDCCredentialIssuerServiceSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/oid4vci/domain/OIDCCredentialIssuerServiceSpec.scala @@ -16,10 +16,10 @@ import org.hyperledger.identus.pollux.core.repository.{ import org.hyperledger.identus.pollux.core.service.* import org.hyperledger.identus.pollux.vc.jwt.PrismDidResolver import org.hyperledger.identus.shared.models.WalletId +import zio.{URLayer, ZIO, ZLayer} import zio.mock.MockSpecDefault import zio.test.* import zio.test.Assertion.* -import zio.{URLayer, ZIO, ZLayer} object OIDCCredentialIssuerServiceSpec extends MockSpecDefault with CredentialServiceSpecHelper { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionBasicSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionBasicSpec.scala index f991a36b63..3ffdc9d43a 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionBasicSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionBasicSpec.scala @@ -20,11 +20,11 @@ import sttp.client3.basicRequest import sttp.client3.ziojson.* import sttp.model.StatusCode import zio.* -import zio.ZIO.* import zio.json.* import zio.test.* import zio.test.Assertion.* import zio.test.TestAspect.* +import zio.ZIO.* import java.util.UUID diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionFailureSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionFailureSpec.scala index ae94a94941..7eac221f70 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionFailureSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionFailureSpec.scala @@ -6,14 +6,14 @@ import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.container.util.MigrationAspects.migrate import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ import org.hyperledger.identus.pollux.credentialdefinition.controller.CredentialDefinitionController +import sttp.client3.{basicRequest, DeserializationException} import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, basicRequest} import sttp.model.StatusCode import zio.* -import zio.ZIO.* import zio.test.* import zio.test.Assertion.* import zio.test.TestAspect.* +import zio.ZIO.* object CredentialDefinitionFailureSpec extends ZIOSpecDefault with CredentialDefinitionTestTools: def spec = (suite("credential-definition-registry bad request spec")( diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionLookupAndPaginationSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionLookupAndPaginationSpec.scala index b295b0a803..cef35227bb 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionLookupAndPaginationSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionLookupAndPaginationSpec.scala @@ -9,8 +9,8 @@ import org.hyperledger.identus.pollux.credentialdefinition.http.{ CredentialDefinitionResponsePage } import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import sttp.client3.{basicRequest, DeserializationException, Response, UriContext} import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, Response, UriContext, basicRequest} import sttp.model.{StatusCode, Uri} import zio.* import zio.json.EncoderOps diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionTestTools.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionTestTools.scala index c39e35749c..71512bfc9a 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionTestTools.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionTestTools.scala @@ -3,14 +3,12 @@ package org.hyperledger.identus.pollux.credentialdefinition import com.dimafeng.testcontainers.PostgreSQLContainer import org.hyperledger.identus.agent.server.http.CustomServerInterceptors import org.hyperledger.identus.agent.walletapi.memory.GenericSecretStorageInMemory -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState} +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, ManagedDIDState, PublicationState} import org.hyperledger.identus.agent.walletapi.service.{ManagedDIDService, MockManagedDIDService} import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation -import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ -import org.hyperledger.identus.iam.authentication.DefaultEntityAuthenticator +import org.hyperledger.identus.iam.authentication.{AuthenticatorWithAuthZ, DefaultEntityAuthenticator} import org.hyperledger.identus.pollux.core.repository.CredentialDefinitionRepository import org.hyperledger.identus.pollux.core.service.{ CredentialDefinitionService, @@ -29,9 +27,9 @@ import org.hyperledger.identus.pollux.credentialdefinition.http.{ import org.hyperledger.identus.pollux.sql.repository.JdbcCredentialDefinitionRepository import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport +import sttp.client3.{basicRequest, DeserializationException, Response, UriContext} import sttp.client3.testing.SttpBackendStub import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, Response, UriContext, basicRequest} import sttp.monad.MonadError import sttp.tapir.server.interceptor.CustomiseInterceptors import sttp.tapir.server.stub.TapirStubInterpreter diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaAnoncredSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaAnoncredSpec.scala index 58aaaacfd9..03ad6e43ed 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaAnoncredSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaAnoncredSpec.scala @@ -4,8 +4,8 @@ import org.hyperledger.identus.agent.walletapi.model.BaseEntity import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.container.util.MigrationAspects.* import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ -import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.model.schema.`type`.{AnoncredSchemaType, CredentialJsonSchemaType} +import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.credentialschema.* import org.hyperledger.identus.pollux.credentialschema.controller.CredentialSchemaController import org.hyperledger.identus.pollux.credentialschema.http.{CredentialSchemaInput, CredentialSchemaResponse} @@ -13,13 +13,13 @@ import sttp.client3.basicRequest import sttp.client3.ziojson.{asJsonAlways, *} import sttp.model.StatusCode import zio.* -import zio.ZIO.* import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* import zio.test.* import zio.test.Assertion.* import zio.test.TestAspect.* +import zio.ZIO.* import java.util.UUID diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaBasicSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaBasicSpec.scala index d5dd2bc21f..ea7cda5e27 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaBasicSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaBasicSpec.scala @@ -14,13 +14,13 @@ import sttp.client3.basicRequest import sttp.client3.ziojson.* import sttp.model.StatusCode import zio.* -import zio.ZIO.* import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* import zio.test.* import zio.test.Assertion.* import zio.test.TestAspect.* +import zio.ZIO.* import java.util.UUID diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaFailureSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaFailureSpec.scala index c2cfd861bc..4069ee5715 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaFailureSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaFailureSpec.scala @@ -8,8 +8,7 @@ import org.hyperledger.identus.container.util.MigrationAspects.migrate import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ import org.hyperledger.identus.pollux.credentialschema.* import org.hyperledger.identus.pollux.credentialschema.controller.CredentialSchemaController -import sttp.client3.DeserializationException -import sttp.client3.basicRequest +import sttp.client3.{basicRequest, DeserializationException} import sttp.client3.ziojson.* import sttp.model.StatusCode import zio.* diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaLookupAndPaginationSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaLookupAndPaginationSpec.scala index f8e3a192a4..6ea8298c80 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaLookupAndPaginationSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaLookupAndPaginationSpec.scala @@ -12,8 +12,8 @@ import org.hyperledger.identus.pollux.credentialschema.http.{ CredentialSchemaResponsePage } import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import sttp.client3.{basicRequest, DeserializationException, Response, UriContext} import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, Response, UriContext, basicRequest} import sttp.model.{StatusCode, Uri} import zio.* import zio.json.EncoderOps diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaMultiTenancySpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaMultiTenancySpec.scala index bead3f57b0..382a5c5661 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaMultiTenancySpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaMultiTenancySpec.scala @@ -3,18 +3,18 @@ package org.hyperledger.identus.pollux.schema import com.dimafeng.testcontainers.PostgreSQLContainer import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.container.util.MigrationAspects.* -import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema import org.hyperledger.identus.pollux.core.model.schema.`type`.CredentialJsonSchemaType +import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema import org.hyperledger.identus.pollux.core.service.{CredentialSchemaService, CredentialSchemaServiceImpl} import org.hyperledger.identus.pollux.sql.repository.JdbcCredentialSchemaRepository import zio.* -import zio.ZIO.* import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* import zio.test.* import zio.test.Assertion.* import zio.test.TestAspect.* +import zio.ZIO.* import java.util.UUID diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaTestTools.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaTestTools.scala index 9236536421..122ec4675e 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaTestTools.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/pollux/schema/CredentialSchemaTestTools.scala @@ -2,17 +2,14 @@ package org.hyperledger.identus.pollux.schema import com.dimafeng.testcontainers.PostgreSQLContainer import org.hyperledger.identus.agent.server.http.CustomServerInterceptors -import org.hyperledger.identus.agent.walletapi.model.BaseEntity -import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState} +import org.hyperledger.identus.agent.walletapi.model.{BaseEntity, ManagedDIDState, PublicationState} import org.hyperledger.identus.agent.walletapi.service.{ManagedDIDService, MockManagedDIDService} import org.hyperledger.identus.api.http.ErrorResponse import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation -import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ -import org.hyperledger.identus.iam.authentication.DefaultEntityAuthenticator +import org.hyperledger.identus.iam.authentication.{AuthenticatorWithAuthZ, DefaultEntityAuthenticator} import org.hyperledger.identus.pollux.core.model.schema.`type`.CredentialJsonSchemaType import org.hyperledger.identus.pollux.core.repository.CredentialSchemaRepository import org.hyperledger.identus.pollux.core.service.{CredentialSchemaService, CredentialSchemaServiceImpl} -import org.hyperledger.identus.pollux.credentialschema.SchemaRegistryServerEndpoints import org.hyperledger.identus.pollux.credentialschema.controller.{ CredentialSchemaController, CredentialSchemaControllerImpl @@ -22,20 +19,21 @@ import org.hyperledger.identus.pollux.credentialschema.http.{ CredentialSchemaResponse, CredentialSchemaResponsePage } +import org.hyperledger.identus.pollux.credentialschema.SchemaRegistryServerEndpoints import org.hyperledger.identus.pollux.sql.repository.JdbcCredentialSchemaRepository import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport +import sttp.client3.{basicRequest, DeserializationException, Response, UriContext} import sttp.client3.testing.SttpBackendStub import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, Response, UriContext, basicRequest} import sttp.monad.MonadError import sttp.tapir.server.interceptor.CustomiseInterceptors import sttp.tapir.server.stub.TapirStubInterpreter import sttp.tapir.ztapir.RIOMonadError import zio.* +import zio.json.{DecoderOps, EncoderOps} import zio.json.ast.Json import zio.json.ast.Json.* -import zio.json.{DecoderOps, EncoderOps} import zio.mock.Expectation import zio.test.{Assertion, Gen, ZIOSpecDefault} diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerImplSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerImplSpec.scala index d1b45f9968..2073e16e04 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerImplSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerImplSpec.scala @@ -1,13 +1,13 @@ package org.hyperledger.identus.system.controller +import org.hyperledger.identus.agent.server.buildinfo.BuildInfo import org.hyperledger.identus.system.controller.http.HealthInfo +import sttp.client3.{asString, basicRequest, DeserializationException, UriContext} import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, UriContext, asString, basicRequest} import sttp.model.StatusCode +import zio.* import zio.test.* import zio.test.Assertion.* -import org.hyperledger.identus.agent.server.buildinfo.BuildInfo -import zio.* object SystemControllerImplSpec extends ZIOSpecDefault with SystemControllerTestTools { diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerTestTools.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerTestTools.scala index 325accbf56..95ed827fec 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerTestTools.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/system/controller/SystemControllerTestTools.scala @@ -1,21 +1,21 @@ package org.hyperledger.identus.system.controller -import sttp.client3.testing.SttpBackendStub +import io.micrometer.prometheus.{PrometheusConfig, PrometheusMeterRegistry} +import org.hyperledger.identus.agent.server.config.AppConfig +import org.hyperledger.identus.agent.server.http.CustomServerInterceptors +import org.hyperledger.identus.agent.server.SystemModule.configLayer +import org.hyperledger.identus.system.controller.http.HealthInfo import sttp.client3.{DeserializationException, Response, UriContext} +import sttp.client3.testing.SttpBackendStub +import sttp.monad.MonadError import sttp.tapir.server.interceptor.CustomiseInterceptors import sttp.tapir.server.stub.TapirStubInterpreter import sttp.tapir.ztapir.RIOMonadError -import zio.metrics.connectors.micrometer import zio.* -import zio.metrics.jvm.DefaultJvmMetrics -import org.hyperledger.identus.system.controller.http.HealthInfo -import org.hyperledger.identus.agent.server.SystemModule.configLayer -import org.hyperledger.identus.agent.server.config.AppConfig -import org.hyperledger.identus.agent.server.http.CustomServerInterceptors -import sttp.monad.MonadError +import zio.metrics.connectors.micrometer import zio.metrics.connectors.micrometer.MicrometerConfig +import zio.metrics.jvm.DefaultJvmMetrics import zio.test.ZIOSpecDefault -import io.micrometer.prometheus.{PrometheusConfig, PrometheusMeterRegistry} trait SystemControllerTestTools { self: ZIOSpecDefault => diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerImplSpec.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerImplSpec.scala index 86ac30be9b..91e4af1d8f 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerImplSpec.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerImplSpec.scala @@ -9,14 +9,14 @@ import org.hyperledger.identus.iam.authentication.AuthenticatorWithAuthZ import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.pollux.vc.jwt.CredentialPayload.Implicits.* import org.hyperledger.identus.verification.controller.http.* +import sttp.client3.{basicRequest, DeserializationException, Response, UriContext} import sttp.client3.ziojson.* -import sttp.client3.{DeserializationException, Response, UriContext, basicRequest} import sttp.model.StatusCode import zio.* -import zio.Config.OffsetDateTime import zio.json.EncoderOps import zio.test.* import zio.test.Assertion.* +import zio.Config.OffsetDateTime import java.time.Instant @@ -77,6 +77,7 @@ object VcVerificationControllerImplSpec extends ZIOSpecDefault with VcVerificati signedJwtCredential.value, List( ParameterizableVcVerification(VcVerification.SignatureVerification, None), + ParameterizableVcVerification(VcVerification.SemanticCheckOfClaims, None), ParameterizableVcVerification(VcVerification.NotBeforeCheck, Some(DateTimeParameter(currentTime))), ParameterizableVcVerification(VcVerification.ExpirationCheck, Some(DateTimeParameter(currentTime))) ) @@ -107,6 +108,7 @@ object VcVerificationControllerImplSpec extends ZIOSpecDefault with VcVerificati signedJwtCredential.value, List( VcVerificationResult(VcVerification.SignatureVerification, false), + VcVerificationResult(VcVerification.SemanticCheckOfClaims, true), VcVerificationResult(VcVerification.NotBeforeCheck, true), VcVerificationResult(VcVerification.ExpirationCheck, true) ) diff --git a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerTestTools.scala b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerTestTools.scala index 666e3de51a..e37c704cdd 100644 --- a/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerTestTools.scala +++ b/cloud-agent/service/server/src/test/scala/org/hyperledger/identus/verification/controller/VcVerificationControllerTestTools.scala @@ -9,11 +9,11 @@ import org.hyperledger.identus.iam.authentication.{AuthenticatorWithAuthZ, Defau import org.hyperledger.identus.pollux.core.service.* import org.hyperledger.identus.pollux.core.service.verification.{VcVerificationService, VcVerificationServiceImpl} import org.hyperledger.identus.pollux.vc.jwt.* -import org.hyperledger.identus.shared.models.WalletId.* import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import org.hyperledger.identus.shared.models.WalletId.* import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import sttp.client3.UriContext import sttp.client3.testing.SttpBackendStub +import sttp.client3.UriContext import sttp.monad.MonadError import sttp.tapir.server.interceptor.CustomiseInterceptors import sttp.tapir.server.stub.TapirStubInterpreter diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/GenericSecretStorageInMemory.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/GenericSecretStorageInMemory.scala index 75d6d93660..1280268a70 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/GenericSecretStorageInMemory.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/GenericSecretStorageInMemory.scala @@ -1,9 +1,7 @@ package org.hyperledger.identus.agent.walletapi.memory -import org.hyperledger.identus.agent.walletapi.storage.GenericSecret -import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.agent.walletapi.storage.{GenericSecret, GenericSecretStorage} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.json.ast.Json diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/WalletSecretStorageInMemory.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/WalletSecretStorageInMemory.scala index a2eef53a13..816e599e39 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/WalletSecretStorageInMemory.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/memory/WalletSecretStorageInMemory.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.agent.walletapi.memory import org.hyperledger.identus.agent.walletapi.model.WalletSeed import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* class WalletSecretStorageInMemory(storeRef: Ref[Map[WalletId, WalletSeed]]) extends WalletSecretStorage { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Entity.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Entity.scala index 182ef7afc1..2ac1c8483e 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Entity.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Entity.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.agent.walletapi.model import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant import java.util.UUID enum EntityRole { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/KeyManagement.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/KeyManagement.scala index 9cc9cc260f..d3aa382dc2 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/KeyManagement.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/KeyManagement.scala @@ -1,12 +1,7 @@ package org.hyperledger.identus.agent.walletapi.model -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.InternalKeyPurpose -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship -import org.hyperledger.identus.shared.crypto.Sha256Hash -import org.hyperledger.identus.shared.crypto.DerivationPath -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.castor.core.model.did.{EllipticCurve, InternalKeyPurpose, VerificationRelationship} +import org.hyperledger.identus.shared.crypto.{DerivationPath, Ed25519KeyPair, Sha256Hash, X25519KeyPair} import scala.collection.immutable.ArraySeq import scala.language.implicitConversions diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Wallet.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Wallet.scala index 8cbb164065..bcdce1e89e 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Wallet.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/Wallet.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.agent.walletapi.model import org.hyperledger.identus.shared.models.WalletId -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant final case class Wallet( id: WalletId, diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/CreateManagedDIDError.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/CreateManagedDIDError.scala index 9dcb20cd4b..88a7a41b61 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/CreateManagedDIDError.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/CreateManagedDIDError.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.agent.walletapi.model.error -import org.hyperledger.identus.castor.core.model.error as castor import org.hyperledger.identus.castor.core.model.error.OperationValidationError +import org.hyperledger.identus.castor.core.model.error as castor sealed trait CreateManagedDIDError extends Throwable diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/UpdateManagedDIDError.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/UpdateManagedDIDError.scala index 59975df2d1..142c58507a 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/UpdateManagedDIDError.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/model/error/UpdateManagedDIDError.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.agent.walletapi.model.error import org.hyperledger.identus.castor.core.model.did.CanonicalPrismDID +import org.hyperledger.identus.castor.core.model.error.{DIDOperationError, DIDResolutionError, OperationValidationError} import org.hyperledger.identus.castor.core.model.error as castor -import org.hyperledger.identus.castor.core.model.error.{OperationValidationError, DIDOperationError, DIDResolutionError} sealed trait UpdateManagedDIDError diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityService.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityService.scala index 1899072ff1..11f75a077a 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityService.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityService.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.agent.walletapi.service -import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError +import org.hyperledger.identus.agent.walletapi.model.Entity import zio.IO import java.util.UUID diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityServiceImpl.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityServiceImpl.scala index 7dad1c1f97..d990c6c299 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityServiceImpl.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/EntityServiceImpl.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.agent.walletapi.service -import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError +import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.sql.EntityRepository import zio.{IO, URLayer, ZIO, ZLayer} diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDService.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDService.scala index 8d58fa4aec..16531e8fa9 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDService.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDService.scala @@ -4,11 +4,9 @@ import org.hyperledger.identus.agent.walletapi.model.* import org.hyperledger.identus.agent.walletapi.model.error.* import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage import org.hyperledger.identus.castor.core.model.did.* -import org.hyperledger.identus.mercury.PeerDID import org.hyperledger.identus.mercury.model.* -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.mercury.PeerDID +import org.hyperledger.identus.shared.crypto.{Ed25519KeyPair, Secp256k1KeyPair, X25519KeyPair} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceImpl.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceImpl.scala index 0fc7657186..e04b5883ac 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceImpl.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceImpl.scala @@ -1,21 +1,19 @@ package org.hyperledger.identus.agent.walletapi.service import org.hyperledger.identus.agent.walletapi.model.* -import org.hyperledger.identus.agent.walletapi.model.error.{*, given} -import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService.DEFAULT_MASTER_KEY_ID +import org.hyperledger.identus.agent.walletapi.model.error.* +import org.hyperledger.identus.agent.walletapi.model.error.given import org.hyperledger.identus.agent.walletapi.service.handler.{DIDCreateHandler, DIDUpdateHandler, PublicationHandler} -import org.hyperledger.identus.agent.walletapi.storage.{DIDSecretStorage, DIDNonSecretStorage, WalletSecretStorage} +import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService.DEFAULT_MASTER_KEY_ID +import org.hyperledger.identus.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage, WalletSecretStorage} import org.hyperledger.identus.agent.walletapi.util.* import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.castor.core.model.error.DIDOperationError import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.castor.core.util.DIDOperationValidator -import org.hyperledger.identus.mercury.PeerDID import org.hyperledger.identus.mercury.model.DidId -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.mercury.PeerDID +import org.hyperledger.identus.shared.crypto.{Apollo, Ed25519KeyPair, Secp256k1KeyPair, X25519KeyPair} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala index 5e5bc4f76a..a0cb4e55e6 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala @@ -1,9 +1,8 @@ package org.hyperledger.identus.agent.walletapi.service -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDDetail import org.hyperledger.identus.agent.walletapi.model.error.CommonWalletStorageError -import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage} +import org.hyperledger.identus.agent.walletapi.model.ManagedDIDDetail +import org.hyperledger.identus.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage, WalletSecretStorage} import org.hyperledger.identus.castor.core.model.did.CanonicalPrismDID import org.hyperledger.identus.castor.core.model.error import org.hyperledger.identus.castor.core.model.error.DIDOperationError diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/MockManagedDIDService.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/MockManagedDIDService.scala index e19677c513..ee29874b80 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/MockManagedDIDService.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/MockManagedDIDService.scala @@ -9,14 +9,12 @@ import org.hyperledger.identus.castor.core.model.did.{ PrismDIDOperation, ScheduleDIDOperationOutcome } -import org.hyperledger.identus.mercury.PeerDID import org.hyperledger.identus.mercury.model.DidId -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.mercury.PeerDID +import org.hyperledger.identus.shared.crypto.{Ed25519KeyPair, Secp256k1KeyPair, X25519KeyPair} +import zio.{mock, *} import zio.mock.* import zio.test.Assertion -import zio.{mock, *} import java.security.{PrivateKey as JavaPrivateKey, PublicKey as JavaPublicKey} diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementService.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementService.scala index 635fd826f3..af36a51bbf 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementService.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementService.scala @@ -1,16 +1,13 @@ package org.hyperledger.identus.agent.walletapi.service -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.model.WalletSeed +import org.hyperledger.identus.agent.walletapi.model.{Wallet, WalletSeed} import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError import org.hyperledger.identus.event.notification.EventNotificationConfig -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext, WalletId} import zio.* import java.util.UUID import scala.language.implicitConversions -import org.hyperledger.identus.shared.models.WalletAdministrationContext sealed trait WalletManagementServiceError { final def toThrowable: Throwable = this diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceImpl.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceImpl.scala index 355eb543b3..b91ab9b2bc 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceImpl.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceImpl.scala @@ -1,14 +1,10 @@ package org.hyperledger.identus.agent.walletapi.service -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.model.WalletSeed -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage +import org.hyperledger.identus.agent.walletapi.model.{Wallet, WalletSeed} +import org.hyperledger.identus.agent.walletapi.storage.{WalletNonSecretStorage, WalletSecretStorage} import org.hyperledger.identus.event.notification.EventNotificationConfig import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext, WalletId} import zio.* import java.util.UUID diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDCreateHandler.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDCreateHandler.scala index 360377f8e8..54ab5f73c4 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDCreateHandler.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDCreateHandler.scala @@ -1,19 +1,17 @@ package org.hyperledger.identus.agent.walletapi.service.handler -import org.hyperledger.identus.agent.walletapi.model.CreateDIDKey -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDState -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDTemplate -import org.hyperledger.identus.agent.walletapi.model.PublicationState -import org.hyperledger.identus.agent.walletapi.model.WalletSeed +import org.hyperledger.identus.agent.walletapi.model.{ + CreateDIDKey, + ManagedDIDState, + ManagedDIDTemplate, + PublicationState, + WalletSeed +} import org.hyperledger.identus.agent.walletapi.model.error.CreateManagedDIDError -import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.DIDSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage +import org.hyperledger.identus.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage, WalletSecretStorage} import org.hyperledger.identus.agent.walletapi.util.OperationFactory import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.shared.crypto.{Apollo, Ed25519KeyPair, X25519KeyPair} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDUpdateHandler.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDUpdateHandler.scala index c55bae5116..30fff6ee88 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDUpdateHandler.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/DIDUpdateHandler.scala @@ -1,28 +1,29 @@ package org.hyperledger.identus.agent.walletapi.service.handler -import org.hyperledger.identus.agent.walletapi.model.DIDUpdateLineage -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDKeyMeta -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDState -import org.hyperledger.identus.agent.walletapi.model.UpdateDIDKey -import org.hyperledger.identus.agent.walletapi.model.UpdateManagedDIDAction -import org.hyperledger.identus.agent.walletapi.model.WalletSeed -import org.hyperledger.identus.agent.walletapi.model.error.UpdateManagedDIDError -import org.hyperledger.identus.agent.walletapi.model.error.{*, given} -import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.DIDSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage +import org.hyperledger.identus.agent.walletapi.model.{ + DIDUpdateLineage, + ManagedDIDKeyMeta, + ManagedDIDState, + UpdateDIDKey, + UpdateManagedDIDAction, + WalletSeed +} +import org.hyperledger.identus.agent.walletapi.model.error.{UpdateManagedDIDError, *} +import org.hyperledger.identus.agent.walletapi.model.error.given +import org.hyperledger.identus.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage, WalletSecretStorage} import org.hyperledger.identus.agent.walletapi.util.OperationFactory -import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation +import org.hyperledger.identus.castor.core.model.did.{ + PrismDIDOperation, + ScheduledDIDOperationStatus, + SignedPrismDIDOperation +} import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation.Update -import org.hyperledger.identus.castor.core.model.did.ScheduledDIDOperationStatus -import org.hyperledger.identus.castor.core.model.did.SignedPrismDIDOperation -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.shared.crypto.{Apollo, Ed25519KeyPair, X25519KeyPair} import org.hyperledger.identus.shared.models.WalletAccessContext -import scala.collection.immutable.ArraySeq import zio.* +import scala.collection.immutable.ArraySeq + private[walletapi] class DIDUpdateHandler( apollo: Apollo, nonSecretStorage: DIDNonSecretStorage, diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/PublicationHandler.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/PublicationHandler.scala index 8eb17c65c0..41014a3c22 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/PublicationHandler.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/service/handler/PublicationHandler.scala @@ -1,19 +1,21 @@ package org.hyperledger.identus.agent.walletapi.service.handler +import org.hyperledger.identus.agent.walletapi.model.error.{CommonCryptographyError, CommonWalletStorageError} import org.hyperledger.identus.agent.walletapi.model.ManagedDIDState -import org.hyperledger.identus.agent.walletapi.model.error.CommonCryptographyError -import org.hyperledger.identus.agent.walletapi.model.error.CommonWalletStorageError import org.hyperledger.identus.agent.walletapi.util.KeyResolver -import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation -import org.hyperledger.identus.castor.core.model.did.ScheduleDIDOperationOutcome -import org.hyperledger.identus.castor.core.model.did.SignedPrismDIDOperation +import org.hyperledger.identus.castor.core.model.did.{ + PrismDIDOperation, + ScheduleDIDOperationOutcome, + SignedPrismDIDOperation +} import org.hyperledger.identus.castor.core.model.error.DIDOperationError import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.* + import scala.collection.immutable.ArraySeq import scala.language.implicitConversions -import zio.* class PublicationHandler(didService: DIDService, keyResolver: KeyResolver)(masterKeyId: String) { def signOperationWithMasterKey[E](state: ManagedDIDState, operation: PrismDIDOperation)(using diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/EntityRepository.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/EntityRepository.scala index 073526e55e..e36f9dc389 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/EntityRepository.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/EntityRepository.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.agent.walletapi.sql import io.getquill.* import io.getquill.doobie.DoobieContext import io.getquill.idiom.* -import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError +import org.hyperledger.identus.agent.walletapi.model.Entity import zio.{IO, ZIO} import java.time.Instant diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDNonSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDNonSecretStorage.scala index 8d3fd2cfbb..c2e3f44611 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDNonSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDNonSecretStorage.scala @@ -14,7 +14,8 @@ import org.hyperledger.identus.castor.core.model.did.{ } import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.Implicits.{*, given} +import org.hyperledger.identus.shared.db.Implicits.* +import org.hyperledger.identus.shared.db.Implicits.given import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.interop.catz.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDSecretStorage.scala index 75a3ff77d3..0ab551a07d 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcDIDSecretStorage.scala @@ -5,10 +5,9 @@ import doobie.* import doobie.implicits.* import doobie.postgres.implicits.* import org.hyperledger.identus.agent.walletapi.storage.DIDSecretStorage -import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.castor.core.model.did.PrismDID -import org.hyperledger.identus.shared.crypto.jwk.FromJWK -import org.hyperledger.identus.shared.crypto.jwk.JWK +import org.hyperledger.identus.mercury.model.DidId +import org.hyperledger.identus.shared.crypto.jwk.{FromJWK, JWK} import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcEntityRepository.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcEntityRepository.scala index d67f250096..6e9156955b 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcEntityRepository.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcEntityRepository.scala @@ -2,7 +2,6 @@ package org.hyperledger.identus.agent.walletapi.sql import doobie.* import doobie.implicits.* -import org.hyperledger.identus.agent.walletapi.model.Entity import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.{ EntityAlreadyExists, @@ -10,6 +9,7 @@ import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.{ EntityStorageError, EntityWalletNotFound } +import org.hyperledger.identus.agent.walletapi.model.Entity import org.postgresql.util.PSQLException import zio.* import zio.interop.catz.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcGenericSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcGenericSecretStorage.scala index bb828565b1..300bf397c5 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcGenericSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcGenericSecretStorage.scala @@ -3,8 +3,7 @@ package org.hyperledger.identus.agent.walletapi.sql import doobie.* import doobie.implicits.* import doobie.postgres.implicits.* -import org.hyperledger.identus.agent.walletapi.storage.GenericSecret -import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage +import org.hyperledger.identus.agent.walletapi.storage.{GenericSecret, GenericSecretStorage} import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletNonSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletNonSecretStorage.scala index 645d716408..2b0ed336d5 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletNonSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletNonSecretStorage.scala @@ -1,5 +1,6 @@ package org.hyperledger.identus.agent.walletapi.sql +import cats.data.NonEmptyList import cats.implicits.* import doobie.* import doobie.implicits.* @@ -7,20 +8,18 @@ import doobie.postgres.implicits.* import doobie.util.transactor.Transactor import org.hyperledger.identus.agent.walletapi.model.Wallet import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage.MAX_WEBHOOK_PER_WALLET -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError +import org.hyperledger.identus.agent.walletapi.storage.{WalletNonSecretStorage, WalletNonSecretStorageError} import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError.TooManyWebhook import org.hyperledger.identus.event.notification.EventNotificationConfig import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.Implicits.{*, given} -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.db.Implicits.* +import org.hyperledger.identus.shared.db.Implicits.given +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import java.net.URL import java.time.Instant import java.util.UUID -import cats.data.NonEmptyList class JdbcWalletNonSecretStorage(xa: Transactor[ContextAwareTask]) extends WalletNonSecretStorage { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletSecretStorage.scala index eee2225312..debd13a18c 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/JdbcWalletSecretStorage.scala @@ -7,12 +7,13 @@ import doobie.util.transactor.Transactor import org.hyperledger.identus.agent.walletapi.model.WalletSeed import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.Implicits.{*, given} -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId -import java.time.Instant +import org.hyperledger.identus.shared.db.Implicits.* +import org.hyperledger.identus.shared.db.Implicits.given +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* +import java.time.Instant + class JdbcWalletSecretStorage(xa: Transactor[ContextAwareTask]) extends WalletSecretStorage { override def setWalletSeed(seed: WalletSeed): RIO[WalletAccessContext, Unit] = { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/package.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/package.scala index 92a2b61ae7..300b262a83 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/package.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/sql/package.scala @@ -7,23 +7,25 @@ import doobie.util.invariant.InvalidEnum import io.circe.* import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState, KeyManagementMode} +import io.iohk.atala.prism.protos.node_models +import org.hyperledger.identus.agent.walletapi.model.{KeyManagementMode, ManagedDIDState, PublicationState, Wallet} +import org.hyperledger.identus.castor.core.model.did.{ + EllipticCurve, + InternalKeyPurpose, + PrismDID, + PrismDIDOperation, + ScheduledDIDOperationStatus, + VerificationRelationship +} import org.hyperledger.identus.castor.core.model.ProtoModelHelper.* -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.InternalKeyPurpose -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship -import org.hyperledger.identus.castor.core.model.did.{PrismDID, PrismDIDOperation, ScheduledDIDOperationStatus} import org.hyperledger.identus.event.notification.EventNotificationConfig -import io.iohk.atala.prism.protos.node_models import org.hyperledger.identus.shared.crypto.jwk.JWK import org.hyperledger.identus.shared.models.WalletId import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* -import java.net.URI -import java.net.URL +import java.net.{URI, URL} import java.time.Instant import java.util.UUID import scala.collection.immutable.ArraySeq diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorage.scala index f9835c0d04..a0becbea46 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorage.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.agent.walletapi.storage import com.nimbusds.jose.jwk.OctetKeyPair -import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.castor.core.model.did.PrismDID -import org.hyperledger.identus.shared.crypto.jwk.FromJWK -import org.hyperledger.identus.shared.crypto.jwk.JWK +import org.hyperledger.identus.mercury.model.DidId +import org.hyperledger.identus.shared.crypto.jwk.{FromJWK, JWK} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/MockDIDNonSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/MockDIDNonSecretStorage.scala index 01c51ab6ac..004660d9ec 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/MockDIDNonSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/MockDIDNonSecretStorage.scala @@ -4,9 +4,9 @@ import org.hyperledger.identus.agent.walletapi.model.* import org.hyperledger.identus.castor.core.model.did.{PrismDID, ScheduledDIDOperationStatus} import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import zio.* import zio.mock.{Expectation, Mock, Proxy} import zio.test.Assertion.equalTo -import zio.* import scala.collection.immutable.ArraySeq diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/WalletNonSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/WalletNonSecretStorage.scala index c0cbda6d72..04f1f3ea2f 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/WalletNonSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/storage/WalletNonSecretStorage.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.agent.walletapi.storage import org.hyperledger.identus.agent.walletapi.model.Wallet import org.hyperledger.identus.event.notification.EventNotificationConfig -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import org.postgresql.util.PSQLException import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/KeyResolver.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/KeyResolver.scala index a8a033db8c..cf1fca29fd 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/KeyResolver.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/KeyResolver.scala @@ -1,18 +1,14 @@ package org.hyperledger.identus.agent.walletapi.util -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDHdKeyPath -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDKeyMeta -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDRandKeyMeta -import org.hyperledger.identus.agent.walletapi.model.WalletSeed -import org.hyperledger.identus.agent.walletapi.storage.DIDNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.DIDSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.PrismDID -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.agent.walletapi.model.{ + ManagedDIDHdKeyPath, + ManagedDIDKeyMeta, + ManagedDIDRandKeyMeta, + WalletSeed +} +import org.hyperledger.identus.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage, WalletSecretStorage} +import org.hyperledger.identus.castor.core.model.did.{EllipticCurve, PrismDID} +import org.hyperledger.identus.shared.crypto.{Apollo, Ed25519KeyPair, Secp256k1KeyPair, X25519KeyPair} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidator.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidator.scala index daa24fd415..82abee2b7f 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidator.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidator.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.agent.walletapi.util import org.hyperledger.identus.agent.walletapi.model.ManagedDIDTemplate import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship +import org.hyperledger.identus.castor.core.model.did.{EllipticCurve, VerificationRelationship} object ManagedDIDTemplateValidator { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidator.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidator.scala index 9bda12f0c4..c972df36aa 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidator.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidator.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.agent.walletapi.util import org.hyperledger.identus.agent.walletapi.model.UpdateManagedDIDAction import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship +import org.hyperledger.identus.castor.core.model.did.{EllipticCurve, VerificationRelationship} object UpdateManagedDIDActionValidator { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultClient.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultClient.scala index 5f2d8a9948..dca470d707 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultClient.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultClient.scala @@ -1,10 +1,7 @@ package org.hyperledger.identus.agent.walletapi.vault -import io.github.jopenlibs.vault.Vault -import io.github.jopenlibs.vault.VaultConfig -import io.github.jopenlibs.vault.VaultException -import io.github.jopenlibs.vault.api.Logical -import io.github.jopenlibs.vault.api.LogicalUtilities +import io.github.jopenlibs.vault.{Vault, VaultConfig, VaultException} +import io.github.jopenlibs.vault.api.{Logical, LogicalUtilities} import io.github.jopenlibs.vault.response.LogicalResponse import zio.* import zio.http.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultDIDSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultDIDSecretStorage.scala index 4b14248393..c40c6f4b57 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultDIDSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultDIDSecretStorage.scala @@ -2,14 +2,11 @@ package org.hyperledger.identus.agent.walletapi.vault import com.nimbusds.jose.jwk.OctetKeyPair import org.hyperledger.identus.agent.walletapi.storage.DIDSecretStorage -import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.castor.core.model.did.PrismDID +import org.hyperledger.identus.mercury.model.DidId +import org.hyperledger.identus.shared.crypto.jwk.{FromJWK, JWK} import org.hyperledger.identus.shared.crypto.Sha256Hash -import org.hyperledger.identus.shared.crypto.jwk.FromJWK -import org.hyperledger.identus.shared.crypto.jwk.JWK -import org.hyperledger.identus.shared.models.HexString -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{HexString, WalletAccessContext, WalletId} import zio.* import java.nio.charset.StandardCharsets diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultGenericSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultGenericSecretStorage.scala index d4a32f940b..93d98cf582 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultGenericSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultGenericSecretStorage.scala @@ -1,10 +1,8 @@ package org.hyperledger.identus.agent.walletapi.vault -import org.hyperledger.identus.agent.walletapi.storage.GenericSecret -import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage +import org.hyperledger.identus.agent.walletapi.storage.{GenericSecret, GenericSecretStorage} import org.hyperledger.identus.shared.crypto.Sha256Hash -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.json.ast.Json diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultWalletSecretStorage.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultWalletSecretStorage.scala index 561080afaa..631f9091b2 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultWalletSecretStorage.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/VaultWalletSecretStorage.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.agent.walletapi.vault import org.hyperledger.identus.agent.walletapi.model.WalletSeed import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* class VaultWalletSecretStorage(vaultKV: VaultKVClient) extends WalletSecretStorage { diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/package.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/package.scala index 4f0c861ce4..cbdd343258 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/package.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/vault/package.scala @@ -3,14 +3,12 @@ package org.hyperledger.identus.agent.walletapi import com.nimbusds.jose.jwk.OctetKeyPair import org.hyperledger.identus.agent.walletapi.model.WalletSeed import org.hyperledger.identus.shared.crypto.jwk.JWK -import org.hyperledger.identus.shared.models.HexString -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{HexString, WalletId} import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* -import scala.util.Failure -import scala.util.Try +import scala.util.{Failure, Try} package object vault { val SEMANTIC_PATH_METADATA_KEY: String = "semanticPath" diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/benchmark/KeyDerivation.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/benchmark/KeyDerivation.scala index 7ab8e40e02..58bf0ee435 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/benchmark/KeyDerivation.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/benchmark/KeyDerivation.scala @@ -1,17 +1,14 @@ package org.hyperledger.identus.agent.walletapi.benchmark -import org.hyperledger.identus.agent.walletapi.vault.KVCodec -import org.hyperledger.identus.agent.walletapi.vault.VaultKVClient -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.DerivationPath -import org.hyperledger.identus.shared.crypto.Secp256k1PrivateKey -import org.hyperledger.identus.shared.models.Base64UrlString -import org.hyperledger.identus.shared.models.HexString +import org.hyperledger.identus.agent.walletapi.vault.{KVCodec, VaultKVClient} +import org.hyperledger.identus.shared.crypto.{Apollo, DerivationPath, Secp256k1PrivateKey} +import org.hyperledger.identus.shared.models.{Base64UrlString, HexString} import org.hyperledger.identus.test.container.VaultTestContainerSupport -import scala.util.Try import zio.* import zio.test.* +import scala.util.Try + object KeyDerivation extends ZIOSpecDefault, VaultTestContainerSupport { private val seedHex = "00" * 64 diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceSpec.scala index 2ab28ebaa0..4ab90ff8e1 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/ManagedDIDServiceSpec.scala @@ -14,12 +14,8 @@ import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.castor.core.model.error import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.castor.core.util.DIDOperationValidator -import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.shared.crypto.{ApolloSpecHelper, Ed25519KeyPair, Secp256k1KeyPair, X25519KeyPair} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.{DBTestUtils, VaultTestContainerSupport} import zio.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceSpec.scala index 86e03e86ff..e4718872b3 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/service/WalletManagementServiceSpec.scala @@ -1,20 +1,17 @@ package org.hyperledger.identus.agent.walletapi.service -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.model.WalletSeed -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceError.DuplicatedWalletSeed -import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceError.TooManyPermittedWallet -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletSecretStorage +import org.hyperledger.identus.agent.walletapi.model.{Wallet, WalletSeed} +import org.hyperledger.identus.agent.walletapi.service.WalletManagementServiceError.{ + DuplicatedWalletSeed, + TooManyPermittedWallet +} +import org.hyperledger.identus.agent.walletapi.sql.{JdbcWalletNonSecretStorage, JdbcWalletSecretStorage} import org.hyperledger.identus.agent.walletapi.storage.WalletSecretStorage import org.hyperledger.identus.agent.walletapi.vault.VaultWalletSecretStorage import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import org.hyperledger.identus.test.container.DBTestUtils -import org.hyperledger.identus.test.container.VaultTestContainerSupport +import org.hyperledger.identus.test.container.{DBTestUtils, VaultTestContainerSupport} import zio.* import zio.test.* import zio.test.Assertion.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorageSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorageSpec.scala index 30ab5dec56..60986e44cf 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorageSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/DIDSecretStorageSpec.scala @@ -1,8 +1,6 @@ package org.hyperledger.identus.agent.walletapi.storage -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDState -import org.hyperledger.identus.agent.walletapi.model.PublicationState -import org.hyperledger.identus.agent.walletapi.model.Wallet +import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState, Wallet} import org.hyperledger.identus.agent.walletapi.service.{WalletManagementService, WalletManagementServiceImpl} import org.hyperledger.identus.agent.walletapi.sql.{ JdbcDIDNonSecretStorage, @@ -13,12 +11,8 @@ import org.hyperledger.identus.agent.walletapi.sql.{ import org.hyperledger.identus.agent.walletapi.vault.{VaultDIDSecretStorage, VaultWalletSecretStorage} import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation import org.hyperledger.identus.mercury.PeerDID -import org.hyperledger.identus.shared.crypto.Apollo -import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.shared.crypto.{Apollo, ApolloSpecHelper, Ed25519KeyPair, X25519KeyPair} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.{DBTestUtils, VaultTestContainerSupport} import zio.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/GenericSecretStorageSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/GenericSecretStorageSpec.scala index 2b7e95a142..f8224510a6 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/GenericSecretStorageSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/GenericSecretStorageSpec.scala @@ -10,8 +10,7 @@ import org.hyperledger.identus.agent.walletapi.sql.{ } import org.hyperledger.identus.agent.walletapi.vault.{VaultGenericSecretStorage, VaultWalletSecretStorage} import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.{DBTestUtils, VaultTestContainerSupport} import zio.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcEntityRepositorySpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcEntityRepositorySpec.scala index 8ab2904559..c5a47d8c93 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcEntityRepositorySpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcEntityRepositorySpec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.agent.walletapi.storage +import org.hyperledger.identus.agent.walletapi.model.{Entity, Wallet} import org.hyperledger.identus.agent.walletapi.model.error.EntityServiceError.{ EntityAlreadyExists, EntityNotFound, EntityWalletNotFound } -import org.hyperledger.identus.agent.walletapi.model.{Entity, Wallet} import org.hyperledger.identus.agent.walletapi.sql.{EntityRepository, JdbcEntityRepository, JdbcWalletNonSecretStorage} import org.hyperledger.identus.shared.models.WalletId import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcWalletNonSecretStorageSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcWalletNonSecretStorageSpec.scala index 9214ac3b1d..2ee9a9d68d 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcWalletNonSecretStorageSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/JdbcWalletNonSecretStorageSpec.scala @@ -2,12 +2,13 @@ package org.hyperledger.identus.agent.walletapi.storage import org.hyperledger.identus.agent.walletapi.model.Wallet import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError.TooManyWebhook -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError.DuplicatedWalletId -import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError.DuplicatedWalletSeed +import org.hyperledger.identus.agent.walletapi.storage.WalletNonSecretStorageError.{ + DuplicatedWalletId, + DuplicatedWalletSeed, + TooManyWebhook +} import org.hyperledger.identus.event.notification.EventNotificationConfig -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.DBTestUtils import zio.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/StorageSpecHelper.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/StorageSpecHelper.scala index 8e4b5fde56..de805aee52 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/StorageSpecHelper.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/StorageSpecHelper.scala @@ -1,21 +1,24 @@ package org.hyperledger.identus.agent.walletapi.storage -import org.hyperledger.identus.agent.walletapi.model.DIDPublicKeyTemplate -import org.hyperledger.identus.agent.walletapi.model.DIDUpdateLineage -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDState -import org.hyperledger.identus.agent.walletapi.model.ManagedDIDTemplate -import org.hyperledger.identus.agent.walletapi.model.PublicationState -import org.hyperledger.identus.agent.walletapi.model.Wallet +import org.hyperledger.identus.agent.walletapi.model.{ + DIDPublicKeyTemplate, + DIDUpdateLineage, + ManagedDIDState, + ManagedDIDTemplate, + PublicationState, + Wallet +} import org.hyperledger.identus.agent.walletapi.service.WalletManagementService import org.hyperledger.identus.agent.walletapi.util.OperationFactory -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.PrismDID -import org.hyperledger.identus.castor.core.model.did.PrismDIDOperation -import org.hyperledger.identus.castor.core.model.did.ScheduledDIDOperationStatus -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship +import org.hyperledger.identus.castor.core.model.did.{ + EllipticCurve, + PrismDID, + PrismDIDOperation, + ScheduledDIDOperationStatus, + VerificationRelationship +} import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletAdministrationContext +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletAdministrationContext} import zio.* import zio.test.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/WalletSecretStorageSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/WalletSecretStorageSpec.scala index de3c005a71..d9b87b2f34 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/WalletSecretStorageSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/storage/WalletSecretStorageSpec.scala @@ -1,14 +1,11 @@ package org.hyperledger.identus.agent.walletapi.storage -import org.hyperledger.identus.agent.walletapi.model.Wallet -import org.hyperledger.identus.agent.walletapi.model.WalletSeed -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletNonSecretStorage -import org.hyperledger.identus.agent.walletapi.sql.JdbcWalletSecretStorage +import org.hyperledger.identus.agent.walletapi.model.{Wallet, WalletSeed} +import org.hyperledger.identus.agent.walletapi.sql.{JdbcWalletNonSecretStorage, JdbcWalletSecretStorage} import org.hyperledger.identus.agent.walletapi.vault.VaultWalletSecretStorage import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import org.hyperledger.identus.test.container.DBTestUtils -import org.hyperledger.identus.test.container.VaultTestContainerSupport +import org.hyperledger.identus.test.container.{DBTestUtils, VaultTestContainerSupport} import zio.* import zio.test.* import zio.test.Assertion.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidatorSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidatorSpec.scala index 0bdef0ea4b..dc04768200 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidatorSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/ManagedDIDTemplateValidatorSpec.scala @@ -2,11 +2,14 @@ package org.hyperledger.identus.agent.walletapi.util import org.hyperledger.identus.agent.walletapi.model.{DIDPublicKeyTemplate, ManagedDIDTemplate} import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint -import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriValue -import org.hyperledger.identus.castor.core.model.did.{Service, ServiceType, VerificationRelationship} +import org.hyperledger.identus.castor.core.model.did.{ + EllipticCurve, + Service, + ServiceEndpoint, + ServiceType, + VerificationRelationship +} +import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.{UriOrJsonEndpoint, UriValue} import zio.* import zio.test.* import zio.test.Assertion.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactorySpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactorySpec.scala index 58daef141c..1e0642fe8f 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactorySpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactorySpec.scala @@ -2,9 +2,7 @@ package org.hyperledger.identus.agent.walletapi.util import org.hyperledger.identus.agent.walletapi.model.* import org.hyperledger.identus.castor.core.model.did.* -import org.hyperledger.identus.shared.crypto.ApolloSpecHelper -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair -import org.hyperledger.identus.shared.crypto.X25519KeyPair +import org.hyperledger.identus.shared.crypto.{ApolloSpecHelper, Ed25519KeyPair, X25519KeyPair} import org.hyperledger.identus.shared.models.HexString import zio.* import zio.test.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidatorSpec.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidatorSpec.scala index 811a30fecd..b2099576e8 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidatorSpec.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/agent/walletapi/util/UpdateManagedDIDActionValidatorSpec.scala @@ -1,10 +1,8 @@ package org.hyperledger.identus.agent.walletapi.util -import org.hyperledger.identus.agent.walletapi.model.DIDPublicKeyTemplate -import org.hyperledger.identus.agent.walletapi.model.UpdateManagedDIDAction +import org.hyperledger.identus.agent.walletapi.model.{DIDPublicKeyTemplate, UpdateManagedDIDAction} import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService -import org.hyperledger.identus.castor.core.model.did.EllipticCurve -import org.hyperledger.identus.castor.core.model.did.VerificationRelationship +import org.hyperledger.identus.castor.core.model.did.{EllipticCurve, VerificationRelationship} import zio.* import zio.test.* import zio.test.Assertion.* diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/DBTestUtils.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/DBTestUtils.scala index 6a6d4da18b..df05587650 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/DBTestUtils.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/DBTestUtils.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.test.container import com.dimafeng.testcontainers.PostgreSQLContainer -import org.flywaydb.core.Flyway import org.flywaydb.core.api.output.MigrateResult +import org.flywaydb.core.Flyway import zio.* object DBTestUtils { diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultLayer.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultLayer.scala index 7c539c463b..9bd820c105 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultLayer.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultLayer.scala @@ -1,8 +1,7 @@ package org.hyperledger.identus.test.container +import org.hyperledger.identus.sharedtest.containers.{VaultContainerCustom, VaultTestContainer} import zio.* -import org.hyperledger.identus.sharedtest.containers.VaultTestContainer -import org.hyperledger.identus.sharedtest.containers.VaultContainerCustom object VaultLayer { diff --git a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultTestContainerSupport.scala b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultTestContainerSupport.scala index b4e9111c5f..1d354812b2 100644 --- a/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultTestContainerSupport.scala +++ b/cloud-agent/service/wallet-api/src/test/scala/org/hyperledger/identus/test/container/VaultTestContainerSupport.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.test.container -import org.hyperledger.identus.agent.walletapi.vault.VaultKVClient -import org.hyperledger.identus.agent.walletapi.vault.VaultKVClientImpl +import org.hyperledger.identus.agent.walletapi.vault.{VaultKVClient, VaultKVClientImpl} import org.hyperledger.identus.sharedtest.containers.VaultContainerCustom import zio.* import zio.http.Client diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/model/ConnectionRecord.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/model/ConnectionRecord.scala index d1e33be574..13eccd9c81 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/model/ConnectionRecord.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/model/ConnectionRecord.scala @@ -4,8 +4,8 @@ import org.hyperledger.identus.connect.core.model.ConnectionRecord.{ProtocolStat import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant import java.util.UUID /** @param id diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepository.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepository.scala index 121371700c..8407d4f751 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepository.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepository.scala @@ -4,8 +4,7 @@ import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.connect.core.model.ConnectionRecord.ProtocolState import org.hyperledger.identus.mercury.protocol.connection.* import org.hyperledger.identus.shared.models.WalletAccessContext -import zio.UIO -import zio.URIO +import zio.{UIO, URIO} import java.util.UUID diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemory.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemory.scala index b9415bc354..0ebb7d0a8c 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemory.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemory.scala @@ -2,10 +2,8 @@ package org.hyperledger.identus.connect.core.repository import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.connect.core.model.ConnectionRecord.ProtocolState -import org.hyperledger.identus.mercury.protocol.connection.ConnectionRequest -import org.hyperledger.identus.mercury.protocol.connection.ConnectionResponse -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import java.time.Instant diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionService.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionService.scala index 27d5c0eb1b..8cab80087f 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionService.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionService.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.connect.core.service -import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.* +import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImpl.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImpl.scala index 175f16ec6a..8fc06d0a63 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImpl.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImpl.scala @@ -1,17 +1,17 @@ package org.hyperledger.identus.connect.core.service -import org.hyperledger.identus.connect.core.model.ConnectionRecord -import org.hyperledger.identus.connect.core.model.ConnectionRecord.* +import org.hyperledger.identus.* import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.* +import org.hyperledger.identus.connect.core.model.ConnectionRecord +import org.hyperledger.identus.connect.core.model.ConnectionRecord.* import org.hyperledger.identus.connect.core.repository.ConnectionRepository -import org.hyperledger.identus.* import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.connection.* import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.utils.Base64Utils import org.hyperledger.identus.shared.utils.aspects.CustomMetricsAspect +import org.hyperledger.identus.shared.utils.Base64Utils import org.hyperledger.identus.shared.validation.ValidationUtils import zio.* import zio.prelude.* diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifier.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifier.scala index 05ebead7b0..6d39f88f6d 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifier.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifier.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.connect.core.service -import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.* +import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.event.notification.{Event, EventNotificationService} import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} diff --git a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/MockConnectionService.scala b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/MockConnectionService.scala index 597460e992..ddcc93828e 100644 --- a/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/MockConnectionService.scala +++ b/connect/core/src/main/scala/org/hyperledger/identus/connect/core/service/MockConnectionService.scala @@ -1,13 +1,13 @@ package org.hyperledger.identus.connect.core.service -import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.* +import org.hyperledger.identus.connect.core.model.ConnectionRecord import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.{mock, UIO, URIO, URLayer, ZIO, ZLayer} import zio.mock.{Mock, Proxy} -import zio.{UIO, URIO, URLayer, ZIO, ZLayer, mock} import java.time.Duration import java.util.UUID diff --git a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositorySpecSuite.scala b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositorySpecSuite.scala index 4aa03b95ab..acb1226c64 100644 --- a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositorySpecSuite.scala +++ b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositorySpecSuite.scala @@ -6,12 +6,12 @@ import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse} import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} -import zio.Exit.Failure -import zio.test.* import zio.{Cause, Exit, ZIO, ZLayer} +import zio.test.* +import zio.Exit.Failure -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant import java.util.UUID object ConnectionRepositorySpecSuite { diff --git a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImplSpec.scala b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImplSpec.scala index fca81c7a9a..b0fa8d43fd 100644 --- a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImplSpec.scala +++ b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceImplSpec.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.connect.core.service import io.circe.syntax.* -import org.hyperledger.identus.connect.core.model.ConnectionRecord -import org.hyperledger.identus.connect.core.model.ConnectionRecord.* import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.InvalidStateForOperation +import org.hyperledger.identus.connect.core.model.ConnectionRecord +import org.hyperledger.identus.connect.core.model.ConnectionRecord.* import org.hyperledger.identus.connect.core.repository.ConnectionRepositoryInMemory import org.hyperledger.identus.mercury.model.{DidId, Message} import org.hyperledger.identus.mercury.protocol.connection.ConnectionResponse diff --git a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifierSpec.scala b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifierSpec.scala index 2f156b0114..a22fa8bb77 100644 --- a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifierSpec.scala +++ b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/service/ConnectionServiceNotifierSpec.scala @@ -9,9 +9,9 @@ import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, C import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* -import zio.ZIO.* import zio.mock.Expectation import zio.test.* +import zio.ZIO.* import java.time.Instant import java.util.UUID diff --git a/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepository.scala b/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepository.scala index 439df93062..7819d1667d 100644 --- a/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepository.scala +++ b/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepository.scala @@ -20,8 +20,8 @@ import zio.* import zio.interop.catz.* import java.time.Instant -import java.util as ju import java.util.UUID +import java.util as ju class JdbcConnectionRepository(xa: Transactor[ContextAwareTask], xb: Transactor[Task]) extends ConnectionRepository { diff --git a/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/Migrations.scala b/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/Migrations.scala index 68f3051e15..5c0c458608 100644 --- a/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/Migrations.scala +++ b/connect/sql-doobie/src/main/scala/org/hyperledger/identus/connect/sql/repository/Migrations.scala @@ -3,10 +3,9 @@ package org.hyperledger.identus.connect.sql.repository import doobie.* import doobie.implicits.* import doobie.util.transactor.Transactor -import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.DbConfig -import org.hyperledger.identus.shared.db.Implicits.* import org.flywaydb.core.Flyway +import org.hyperledger.identus.shared.db.{ContextAwareTask, DbConfig} +import org.hyperledger.identus.shared.db.Implicits.* import zio.* import zio.interop.catz.* diff --git a/event-notification/src/main/scala/org/hyperledger/identus/event/notification/Event.scala b/event-notification/src/main/scala/org/hyperledger/identus/event/notification/Event.scala index edeef57c6f..8d6d22b501 100644 --- a/event-notification/src/main/scala/org/hyperledger/identus/event/notification/Event.scala +++ b/event-notification/src/main/scala/org/hyperledger/identus/event/notification/Event.scala @@ -1,6 +1,7 @@ package org.hyperledger.identus.event.notification import org.hyperledger.identus.shared.models.WalletId + import java.time.Instant import java.util.UUID diff --git a/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationConfig.scala b/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationConfig.scala index 5837ec87d9..0434245790 100644 --- a/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationConfig.scala +++ b/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationConfig.scala @@ -1,13 +1,12 @@ package org.hyperledger.identus.event.notification -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import java.net.URL +import java.time.temporal.ChronoUnit import java.time.Instant import java.util.UUID -import java.time.temporal.ChronoUnit final case class EventNotificationConfig( id: UUID, diff --git a/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImpl.scala b/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImpl.scala index 39450a2931..cd78015679 100644 --- a/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImpl.scala +++ b/event-notification/src/main/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImpl.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.event.notification import org.hyperledger.identus.event.notification.EventNotificationServiceError.EventSendingFailed -import zio.concurrent.ConcurrentMap import zio.{IO, Queue, URLayer, ZIO, ZLayer} +import zio.concurrent.ConcurrentMap class EventNotificationServiceImpl(queueMap: ConcurrentMap[String, Queue[Event[_]]], queueCapacity: Int) extends EventNotificationService: diff --git a/event-notification/src/test/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImplSpec.scala b/event-notification/src/test/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImplSpec.scala index 80bf5bf7db..b6a62c0f04 100644 --- a/event-notification/src/test/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImplSpec.scala +++ b/event-notification/src/test/scala/org/hyperledger/identus/event/notification/EventNotificationServiceImplSpec.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.event.notification +import org.hyperledger.identus.shared.models.WalletId import zio.* import zio.test.* -import org.hyperledger.identus.shared.models.WalletId object EventNotificationServiceImplSpec extends ZIOSpecDefault { diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/AgentPeerService.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/AgentPeerService.scala index 1b71af6e86..af3d9b8cd9 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/AgentPeerService.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/AgentPeerService.scala @@ -1,12 +1,12 @@ package org.hyperledger.identus.mercury -import zio._ - -import org.hyperledger.identus.mercury.model.* import com.nimbusds.jose.jwk.OctetKeyPair +import org.didcommx.didcomm.common.* +import org.didcommx.didcomm.secret.* import org.didcommx.peerdid.core.PeerDIDUtils -import org.didcommx.didcomm.common._ -import org.didcommx.didcomm.secret._ +import org.hyperledger.identus.mercury.model.* +import zio.* + import scala.jdk.CollectionConverters.* case class AgentPeerService( diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/DidCommX.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/DidCommX.scala index f3cbb45aa3..7e8b362eb3 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/DidCommX.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/DidCommX.scala @@ -1,12 +1,12 @@ package org.hyperledger.identus.mercury +import org.didcommx.didcomm.model.* import org.didcommx.didcomm.DIDComm - -import zio._ -import org.didcommx.didcomm.model._ - +import org.hyperledger.identus.mercury.model.* +import org.hyperledger.identus.mercury.model.given import org.hyperledger.identus.resolvers.UniversalDidResolver -import org.hyperledger.identus.mercury.model.{given, _} +import zio.* + import scala.language.implicitConversions object DidCommX { diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/MessagingService.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/MessagingService.scala index 0db166cb47..1e28fbce2d 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/MessagingService.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/MessagingService.scala @@ -1,14 +1,13 @@ package org.hyperledger.identus.mercury -import scala.jdk.CollectionConverters.* -import zio._ - -import io.circe._ -import io.circe.JsonObject -import org.hyperledger.identus.mercury.model._ -import org.hyperledger.identus.mercury.error._ -import org.hyperledger.identus.mercury.protocol.routing._ +import io.circe.{JsonObject, *} +import org.hyperledger.identus.mercury.error.* +import org.hyperledger.identus.mercury.model.* +import org.hyperledger.identus.mercury.protocol.routing.* import org.hyperledger.identus.resolvers.DIDResolver +import zio.* + +import scala.jdk.CollectionConverters.* type HttpOrDID = String //TODO case class ServiceEndpoint(uri: HttpOrDID, accept: Option[Seq[String]], routingKeys: Option[Seq[String]]) diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/PeerDID.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/PeerDID.scala index 3e29ff6b5c..ef947adebe 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/PeerDID.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/PeerDID.scala @@ -1,16 +1,15 @@ package org.hyperledger.identus.mercury -import org.didcommx.peerdid.* - import com.nimbusds.jose.jwk.* import com.nimbusds.jose.jwk.gen.* -import io.circe._ -import io.circe.syntax._ -import io.circe.generic.semiauto._ -import scala.jdk.CollectionConverters.* - +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.didcommx.peerdid.* import org.hyperledger.identus.mercury.model.DidId +import scala.jdk.CollectionConverters.* + final case class PeerDID( did: DidId, jwkForKeyAgreement: OctetKeyPair, diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/Conversions.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/Conversions.scala index b91ced49e3..a5314d4fbc 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/Conversions.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/Conversions.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.mercury.model import io.circe.* -import org.hyperledger.identus.mercury.model.* +import org.didcommx.didcomm.message.{Attachment as XAttachment, MessageBuilder} import org.didcommx.didcomm.message.Attachment.Data -import org.didcommx.didcomm.message.{MessageBuilder, Attachment as XAttachment} import org.didcommx.didcomm.model.* +import org.hyperledger.identus.mercury.model.* import scala.jdk.CollectionConverters.* import scala.language.implicitConversions diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/JsonUtilsForDidCommx.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/JsonUtilsForDidCommx.scala index b25e43f88c..bd826a9fd0 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/JsonUtilsForDidCommx.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/JsonUtilsForDidCommx.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.mercury.model -import scala.jdk.CollectionConverters._ +import io.circe.* +import io.circe.parser.* -import io.circe._ -import io.circe.parser._ +import scala.jdk.CollectionConverters.* object JsonUtilsForDidCommx { private type JsonValue = Boolean | JsonNumber | String | Json.Null.type diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/package.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/package.scala index b4a0a5888d..4a185ab60a 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/package.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/model/package.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.mercury.model -import scala.jdk.CollectionConverters.* +import org.didcommx.didcomm.model.* -import org.didcommx.didcomm.model._ +import scala.jdk.CollectionConverters.* import scala.language.implicitConversions final case class EncryptedMessageImp(private val msg: PackEncryptedResult) extends EncryptedMessage { diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/AliceSecretResolver.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/AliceSecretResolver.scala index fff62a7b22..c20e449706 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/AliceSecretResolver.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/AliceSecretResolver.scala @@ -2,7 +2,8 @@ package org.hyperledger.identus.mercury.resolvers import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType} import org.didcommx.didcomm.secret.{Secret, SecretResolverInMemory} -import scala.jdk.CollectionConverters._ + +import scala.jdk.CollectionConverters.* object AliceSecretResolver { val jwkKey1 = diff --git a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/BobSecretResolver.scala b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/BobSecretResolver.scala index 4a57e4cce7..7b78be301c 100644 --- a/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/BobSecretResolver.scala +++ b/mercury/agent-didcommx/src/main/scala/org/hyperledger/identus/mercury/resolvers/BobSecretResolver.scala @@ -2,7 +2,8 @@ package org.hyperledger.identus.mercury.resolvers import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType} import org.didcommx.didcomm.secret.{Secret, SecretResolverInMemory} -import scala.jdk.CollectionConverters._ + +import scala.jdk.CollectionConverters.* object BobSecretResolver { val jwkKey1 = diff --git a/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/PeerDIDSpec.scala b/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/PeerDIDSpec.scala index e1b3c21326..6a8f4ee9c9 100644 --- a/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/PeerDIDSpec.scala +++ b/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/PeerDIDSpec.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.mercury +import com.nimbusds.jose.jwk.OctetKeyPair import munit.* import org.hyperledger.identus.mercury.model.DidId -import com.nimbusds.jose.jwk.OctetKeyPair class PeerDIDSpec extends ZSuite { diff --git a/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/model/UnpackMessageImpSpec.scala b/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/model/UnpackMessageImpSpec.scala index 1426255b6f..4b5c42673e 100644 --- a/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/model/UnpackMessageImpSpec.scala +++ b/mercury/agent-didcommx/src/test/scala/org/hyperledger/identus/mercury/model/UnpackMessageImpSpec.scala @@ -1,7 +1,8 @@ package org.hyperledger.identus.mercury.model -import munit.* import io.circe.JsonObject +import munit.* + import scala.language.implicitConversions /** agentDidcommx/testOnly org.hyperledger.identus.mercury.UnpackMessageImpSpec */ diff --git a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/CoordinateMediationPrograms.scala b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/CoordinateMediationPrograms.scala index 7e5501a1cf..1210b1fe11 100644 --- a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/CoordinateMediationPrograms.scala +++ b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/CoordinateMediationPrograms.scala @@ -1,14 +1,14 @@ package org.hyperledger.identus.mercury -import scala.util.chaining._ -import zio._ -import io.circe.parser._ +import io.circe.parser.* import io.circe.JsonObject - -import org.hyperledger.identus._ -import org.hyperledger.identus.mercury.model._ -import org.hyperledger.identus.mercury.protocol.coordinatemediation._ +import org.hyperledger.identus.* +import org.hyperledger.identus.mercury.model.* +import org.hyperledger.identus.mercury.protocol.coordinatemediation.* import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation +import zio.* + +import scala.util.chaining.* object CoordinateMediationPrograms { diff --git a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/HttpClient.scala b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/HttpClient.scala index b17a1d86bf..64fae811e8 100644 --- a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/HttpClient.scala +++ b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/HttpClient.scala @@ -1,6 +1,6 @@ package org.hyperledger.identus.mercury -import zio._ +import zio.* opaque type Header = (String, String) object Header: diff --git a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/InvitationPrograms.scala b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/InvitationPrograms.scala index 7e74ea9098..920df65fb9 100644 --- a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/InvitationPrograms.scala +++ b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/InvitationPrograms.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.mercury -import zio.* +import io.circe.syntax.* import org.hyperledger.identus.mercury.protocol.invitation.* import org.hyperledger.identus.mercury.protocol.invitation.v2.* import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation.Body -import io.circe.syntax.* +import zio.* object InvitationPrograms { diff --git a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/OutOfBandLoginPrograms.scala b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/OutOfBandLoginPrograms.scala index e124a58e32..2d267327cb 100644 --- a/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/OutOfBandLoginPrograms.scala +++ b/mercury/agent/src/main/scala/org/hyperledger/identus/mercury/OutOfBandLoginPrograms.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury -import org.hyperledger.identus.mercury.model._ -import org.hyperledger.identus.mercury.protocol.outofbandlogin._ +import org.hyperledger.identus.mercury.model.* +import org.hyperledger.identus.mercury.protocol.outofbandlogin.* object OutOfBandLoginPrograms { diff --git a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/DidOps.scala b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/DidOps.scala index fb9309ff45..ce0c7c54dd 100644 --- a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/DidOps.scala +++ b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/DidOps.scala @@ -1,12 +1,10 @@ package org.hyperledger.identus.mercury -import zio._ +import org.hyperledger.identus.mercury.model.* +import zio.* -import org.hyperledger.identus.mercury.model._ import java.util.Base64 -import scala.util.Try -import scala.util.Failure -import scala.util.Success +import scala.util.{Failure, Success, Try} /** Represents all possible DIDComm operations */ trait DidOps { diff --git a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/AttachmentDescriptor.scala b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/AttachmentDescriptor.scala index ce1d3d09df..db10c4c3a2 100644 --- a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/AttachmentDescriptor.scala +++ b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/AttachmentDescriptor.scala @@ -1,10 +1,11 @@ package org.hyperledger.identus.mercury.model -import java.util.Base64 as JBase64 +import cats.syntax.functor.* import io.circe.{Decoder, Encoder, Json, JsonObject} import io.circe.generic.semiauto.* import io.circe.syntax.* -import cats.syntax.functor.* + +import java.util.Base64 as JBase64 /** @see * data in attachments https://identity.foundation/didcomm-messaging/spec/#attachments diff --git a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/DidId.scala b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/DidId.scala index 696c40637d..3100bc481c 100644 --- a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/DidId.scala +++ b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/DidId.scala @@ -1,7 +1,8 @@ package org.hyperledger.identus.mercury.model -import io.circe._ -import io.circe.generic.semiauto._ +import io.circe.* +import io.circe.generic.semiauto.* + import scala.util.Try final case class DidId(value: String) diff --git a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/EncryptedMessage.scala b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/EncryptedMessage.scala index 83464d5e17..c79b186d4d 100644 --- a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/EncryptedMessage.scala +++ b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/EncryptedMessage.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.model -// import org.didcommx.didcomm.model.PackEncryptedResult //FIXME REMOVE -import java.util.Base64 +import io.circe.* +import io.circe.parser.* -import io.circe._ -import io.circe.parser._ +import java.util.Base64 trait EncryptedMessage { // (private val msg: PackEncryptedResult) { def string: String // = msg.getPackedMessage diff --git a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/Message.scala b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/Message.scala index 190cb802a0..ecd1fbae50 100644 --- a/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/Message.scala +++ b/mercury/models/src/main/scala/org/hyperledger/identus/mercury/model/Message.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.mercury.model -import java.time.LocalDateTime -import java.time.ZoneOffset - -import scala.jdk.CollectionConverters._ -import io.circe._ +import io.circe.* import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} +import java.time.{LocalDateTime, ZoneOffset} +import scala.jdk.CollectionConverters.* + type PIURI = String //type URI or URL? case class Message( `type`: PIURI, diff --git a/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionRequest.scala b/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionRequest.scala index cbb7c942f9..4909f266d1 100644 --- a/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionRequest.scala +++ b/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionRequest.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.mercury.protocol.connection -import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} import io.circe.{Decoder, Encoder} -import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} +import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation object ConnectionRequest { diff --git a/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionResponse.scala b/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionResponse.scala index 86815d124e..47bfc906b8 100644 --- a/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionResponse.scala +++ b/mercury/protocol-connection/src/main/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionResponse.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.mercury.protocol.connection import io.circe.{Decoder, Encoder} import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} -import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} object ConnectionResponse { def `type`: PIURI = "https://atalaprism.io/mercury/connections/1.0/response" diff --git a/mercury/protocol-connection/src/test/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionSpec.scala b/mercury/protocol-connection/src/test/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionSpec.scala index 73f3d34d05..d1b1b0a5e1 100644 --- a/mercury/protocol-connection/src/test/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionSpec.scala +++ b/mercury/protocol-connection/src/test/scala/org/hyperledger/identus/mercury/protocol/connection/ConnectionSpec.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.mercury.protocol.connection -import io.circe._ -import io.circe.parser._ +import io.circe.* +import io.circe.parser.* import munit.* -import org.hyperledger.identus.mercury.model.{Message, DidId} +import org.hyperledger.identus.mercury.model.{DidId, Message} /** protocolConnection/testOnly org.hyperledger.identus.mercury.protocol.connection.CoordinateMediationSpec */ class CoordinateMediationSpec extends ZSuite { diff --git a/mercury/protocol-coordinate-mediation/src/main/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediation.scala b/mercury/protocol-coordinate-mediation/src/main/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediation.scala index 0e92fc9d41..5ccc5713e2 100644 --- a/mercury/protocol-coordinate-mediation/src/main/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediation.scala +++ b/mercury/protocol-coordinate-mediation/src/main/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediation.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.coordinatemediation +import io.circe.* +import io.circe.generic.semiauto.* import org.hyperledger.identus.mercury.model.PIURI -import io.circe._ -import io.circe.generic.semiauto._ - final case class MediateRequest( id: String = java.util.UUID.randomUUID.toString(), `type`: PIURI = MediateRequest.`type` diff --git a/mercury/protocol-coordinate-mediation/src/test/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediationSpec.scala b/mercury/protocol-coordinate-mediation/src/test/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediationSpec.scala index 76e5464f17..aea9d232b3 100644 --- a/mercury/protocol-coordinate-mediation/src/test/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediationSpec.scala +++ b/mercury/protocol-coordinate-mediation/src/test/scala/org/hyperledger/identus/mercury/protocol/coordinatemediation/CoordinateMediationSpec.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury.protocol.coordinatemediation -import io.circe._ -import io.circe.parser._ +import io.circe.* +import io.circe.parser.* import munit.* class CoordinateMediationSpec extends ZSuite { diff --git a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/OutOfBand.scala b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/OutOfBand.scala index 001958f311..2df0414da2 100644 --- a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/OutOfBand.scala +++ b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/OutOfBand.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.mercury.protocol.invitation -import java.net.URI -import java.net.URL -import java.{util => ju} -import org.hyperledger.identus.mercury.protocol.invitation.v2._ -import io.circe._ -import io.circe.parser._ +import io.circe.* +import io.circe.parser.* +import org.hyperledger.identus.mercury.protocol.invitation.v2.* + +import java.net.{URI, URL} +import java.util as ju object OutOfBand { diff --git a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/ServiceType.scala b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/ServiceType.scala index 0ce650c6de..9b6fba8406 100644 --- a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/ServiceType.scala +++ b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/ServiceType.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.mercury.protocol.invitation -import cats.implicits._ -import io.circe.syntax._ -import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} +import cats.implicits.* import io.circe.{Decoder, Encoder} +import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} +import io.circe.syntax.* sealed trait ServiceType diff --git a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/Invitation.scala b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/Invitation.scala index 05245b0d57..568d60ed1f 100644 --- a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/Invitation.scala +++ b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/Invitation.scala @@ -1,10 +1,8 @@ package org.hyperledger.identus.mercury.protocol.invitation.v1 -import io.circe.syntax.* -import io.circe.generic.semiauto.* import io.circe.{Decoder, Encoder, Json} -import org.hyperledger.identus.mercury.model.PIURI - -import org.hyperledger.identus.mercury.model.AttachmentDescriptor +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, PIURI} import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV1 import org.hyperledger.identus.mercury.protocol.invitation.ServiceType diff --git a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/Invitation.scala b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/Invitation.scala index e4105deb8b..3e044813a8 100644 --- a/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/Invitation.scala +++ b/mercury/protocol-invitation/src/main/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/Invitation.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.mercury.protocol.invitation.v2 -import io.circe.syntax.* import io.circe.{Decoder, Encoder} +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, PIURI} import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 -import io.circe.generic.semiauto._ -import org.hyperledger.identus.mercury.model.{PIURI, AttachmentDescriptor, DidId} /** Out-Of-Band invitation * @see diff --git a/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/InvitationV1Spec.scala b/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/InvitationV1Spec.scala index 520d66b5a5..df35d5f0ae 100644 --- a/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/InvitationV1Spec.scala +++ b/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v1/InvitationV1Spec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.mercury.protocol.invitation.v1 -import munit.* -import io.circe.syntax._ +import io.circe.parser.* +import io.circe.syntax.* import io.circe.Json -import io.circe.parser._ -import org.hyperledger.identus.mercury.protocol.invitation._ +import munit.* import org.hyperledger.identus.mercury.model.AttachmentDescriptor +import org.hyperledger.identus.mercury.protocol.invitation.* class InvitationV1Spec extends ZSuite { diff --git a/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/OutOfBandSpec.scala b/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/OutOfBandSpec.scala index 0ab35ce3ff..d6729e8e5a 100644 --- a/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/OutOfBandSpec.scala +++ b/mercury/protocol-invitation/src/test/scala/org/hyperledger/identus/mercury/protocol/invitation/v2/OutOfBandSpec.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.mercury.protocol.invitation.v2 import munit.* -import org.hyperledger.identus.mercury.protocol.invitation.v2._ import org.hyperledger.identus.mercury.model.DidId +import org.hyperledger.identus.mercury.protocol.invitation.v2.* import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation.Body import org.hyperledger.identus.mercury.protocol.invitation.OutOfBand class OutOfBandSpec extends FunSuite { diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/CredentialPreview.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/CredentialPreview.scala index 89a9c70f42..9997acdaf1 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/CredentialPreview.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/CredentialPreview.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.generic.semiauto.* import io.circe.{Decoder, Encoder} +import io.circe.generic.semiauto.* /** @see * https://github.com/decentralized-identity/waci-didcomm/blob/main/issue_credential/README.md#preview-credential diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredential.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredential.scala index bb14f716fe..a3c439a2c5 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredential.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredential.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model.{PIURI, AttachmentDescriptor, Message, DidId} +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} /** ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol * @see diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueFormats.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueFormats.scala index a617cb9db5..933a440bbe 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueFormats.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueFormats.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.generic.semiauto.* import io.circe.{Decoder, Encoder} +import io.circe.generic.semiauto.* /* Issue Credential Formats: diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredential.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredential.scala index 6a8cb76d26..5848e5fe12 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredential.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredential.scala @@ -1,11 +1,9 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model.PIURI -import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, Message, DidId} +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} /** ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol * @see diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredential.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredential.scala index 445a9e5d57..0b9eff9cf7 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredential.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredential.scala @@ -1,11 +1,9 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model.PIURI -import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, Message, DidId} +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} /** ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol * @see diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredential.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredential.scala index 4d40f4da5e..d4843d8a51 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredential.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredential.scala @@ -1,11 +1,9 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model.PIURI -import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, Message, DidId} +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} final case class RequestCredential( id: String = java.util.UUID.randomUUID.toString(), diff --git a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/Utils.scala b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/Utils.scala index d87c49a7e5..a7ec575661 100644 --- a/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/Utils.scala +++ b/mercury/protocol-issue-credential/src/main/scala/org/hyperledger/identus/mercury/protocol/issuecredential/Utils.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.syntax._ -import io.circe.parser._ - +import io.circe.parser.* +import io.circe.syntax.* import io.circe.Decoder -import org.hyperledger.identus.mercury.model.{LinkData, JsonData, AttachmentDescriptor, Base64, JwsData} +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, Base64, JsonData, JwsData, LinkData} private[this] trait ReadAttachmentsUtils { diff --git a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/anotherclasspath/UtilsCredentialSpec.scala b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/anotherclasspath/UtilsCredentialSpec.scala index 8ad4467c9c..3eac012cb5 100644 --- a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/anotherclasspath/UtilsCredentialSpec.scala +++ b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/anotherclasspath/UtilsCredentialSpec.scala @@ -1,21 +1,20 @@ package org.hyperledger.identus.mercury.protocol.anotherclasspath import io.circe.* -import io.circe.syntax.* import io.circe.generic.semiauto.* +import io.circe.syntax.* import munit.* - import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} import org.hyperledger.identus.mercury.protocol.issuecredential.{ + CredentialPreview, IssueCredential, + IssueCredentialIssuedFormat, + IssueCredentialOfferFormat, IssueCredentialProposeFormat, + IssueCredentialRequestFormat, OfferCredential, ProposeCredential, - CredentialPreview, - RequestCredential, - IssueCredentialIssuedFormat, - IssueCredentialOfferFormat, - IssueCredentialRequestFormat + RequestCredential } private[this] case class TestCredentialType(a: String, b: Int, x: Long, name: String, dob: String) diff --git a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredentialSpec.scala b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredentialSpec.scala index d79b9195e8..90502fddd8 100644 --- a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredentialSpec.scala +++ b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/IssueCredentialSpec.scala @@ -1,11 +1,10 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.mercury.model.AttachmentDescriptor +import io.circe.Json import munit.* -import org.hyperledger.identus.mercury.model.DidId +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} class IssueCredentialSpec extends ZSuite { diff --git a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredentialSpec.scala b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredentialSpec.scala index f0c7589a3b..94024d5a58 100644 --- a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredentialSpec.scala +++ b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/OfferCredentialSpec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* +import io.circe.Json +import munit.* import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 -import munit.* class OfferCredentialSpec extends ZSuite { diff --git a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredentialSpec.scala b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredentialSpec.scala index 05615f298a..f8ca7f006a 100644 --- a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredentialSpec.scala +++ b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/ProposeCredentialSpec.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.mercury.model.AttachmentDescriptor -import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 +import io.circe.Json import munit.* -import org.hyperledger.identus.mercury.model.DidId +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} +import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 class ProposeCredentialSpec extends ZSuite { diff --git a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredentialSpec.scala b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredentialSpec.scala index 7a184edb33..e68d20ed0b 100644 --- a/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredentialSpec.scala +++ b/mercury/protocol-issue-credential/src/test/scala/org/hyperledger/identus/mercury/protocol/issuecredential/RequestCredentialSpec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.mercury.protocol.issuecredential -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 -import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} +import io.circe.Json import munit.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} +import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 class RequestCredentialSpec extends ZSuite { test("Holder RequestCredential") { diff --git a/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/OutOfBandLogin.scala b/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/OutOfBandLogin.scala index 49ba39d758..fca6b5ea10 100644 --- a/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/OutOfBandLogin.scala +++ b/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/OutOfBandLogin.scala @@ -1,8 +1,6 @@ package org.hyperledger.identus.mercury.protocol.outofbandlogin -import org.hyperledger.identus.mercury.model.PIURI -import org.hyperledger.identus.mercury.model.DidId -import org.hyperledger.identus.mercury.model.Message +import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} /** Out-Of-Band Login Invitation * @see diff --git a/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/Utils.scala b/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/Utils.scala index 229a6abcf3..1698550fa6 100644 --- a/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/Utils.scala +++ b/mercury/protocol-outofband-login/src/main/scala/org/hyperledger/identus/mercury/protocol/outofbandlogin/Utils.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.mercury.protocol.outofbandlogin -import java.net.URI -import java.net.URL import org.hyperledger.identus.mercury +import java.net.{URI, URL} + object Utils { /** provides new msg id diff --git a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentFormats.scala b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentFormats.scala index 85088572d9..602d46a479 100644 --- a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentFormats.scala +++ b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentFormats.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe.generic.semiauto.* import io.circe.{Decoder, Encoder} +import io.circe.generic.semiauto.* /* Present Credential Formats: diff --git a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/Presentation.scala b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/Presentation.scala index acedadc0aa..4cfa7db744 100644 --- a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/Presentation.scala +++ b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/Presentation.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.mercury.protocol.presentproof import io.circe.{Decoder, Encoder} import io.circe.generic.semiauto.* +import io.circe.syntax.* import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} -import io.circe.syntax._ /** @param attach_id * @param format diff --git a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProofType.scala b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProofType.scala index be90209ff4..94d342e0bc 100644 --- a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProofType.scala +++ b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProofType.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe._ -import io.circe.generic.semiauto._ +import io.circe.* +import io.circe.generic.semiauto.* import org.hyperledger.identus.mercury.model.DidId case class ProofType( diff --git a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentation.scala b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentation.scala index faf310ca3d..2172186118 100644 --- a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentation.scala +++ b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentation.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model._ +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.* /** ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol * @see diff --git a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentation.scala b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentation.scala index f787cdecbf..bc522377b5 100644 --- a/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentation.scala +++ b/mercury/protocol-present-proof/src/main/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentation.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model._ +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.* final case class RequestPresentation( id: String = java.util.UUID.randomUUID.toString(), diff --git a/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentationSpec.scala b/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentationSpec.scala index 43a12c46c7..284dbeccf9 100644 --- a/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentationSpec.scala +++ b/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/PresentationSpec.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.mercury.model.AttachmentDescriptor -import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 +import io.circe.Json import munit.* -import org.hyperledger.identus.mercury.model.{LinkData, DidId} +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, LinkData} +import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 class PresentationSpec extends ZSuite { diff --git a/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentationProofSpec.scala b/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentationProofSpec.scala index c87618d489..6fd9d05eb9 100644 --- a/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentationProofSpec.scala +++ b/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/ProposePresentationProofSpec.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.mercury.model.AttachmentDescriptor -import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 +import io.circe.Json import munit.* -import org.hyperledger.identus.mercury.model.{LinkData, DidId} +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, LinkData} +import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 class ProposePresentationSpec extends ZSuite { diff --git a/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentationSpec.scala b/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentationSpec.scala index 4e2ba8525a..7f8458fe99 100644 --- a/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentationSpec.scala +++ b/mercury/protocol-present-proof/src/test/scala/org/hyperledger/identus/mercury/protocol/presentproof/RequestPresentationSpec.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.mercury.protocol.presentproof -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* -import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 -import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} +import io.circe.Json import munit.* -import org.hyperledger.identus.mercury.model.LinkData +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, LinkData} +import org.hyperledger.identus.mercury.model.AttachmentDescriptor.attachmentDescriptorEncoderV2 class RequestCredentialSpec extends ZSuite { diff --git a/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v1/ReportProblem.scala b/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v1/ReportProblem.scala index 6a4e9e4e15..1cb90df8ca 100644 --- a/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v1/ReportProblem.scala +++ b/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v1/ReportProblem.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.mercury.protocol.reportproblem.v1 -import org.hyperledger.identus.mercury.model.Message -import org.hyperledger.identus.mercury.model.PIURI +import org.hyperledger.identus.mercury.model.{Message, PIURI} /** ReportProblem * diff --git a/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblem.scala b/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblem.scala index 2c621a4d16..562b8b7d69 100644 --- a/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblem.scala +++ b/mercury/protocol-report-problem/src/main/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblem.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.reportproblem.v2 -import io.circe._ -import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} +import io.circe.{Decoder, Encoder, *} import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} -import io.circe.{Decoder, Encoder} import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} object ReportProblem { /** {{{ diff --git a/mercury/protocol-report-problem/src/test/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblemSpec.scala b/mercury/protocol-report-problem/src/test/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblemSpec.scala index d40eb86604..ee8b2a8575 100644 --- a/mercury/protocol-report-problem/src/test/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblemSpec.scala +++ b/mercury/protocol-report-problem/src/test/scala/org/hyperledger/identus/mercury/protocol/reportproblem/v2/ReportProblemSpec.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.mercury.protocol.reportproblem.v2 -import io.circe.Json +import io.circe.{Json, *} +import io.circe.parser.* import io.circe.syntax.* import munit.* -import io.circe.* -import io.circe.parser.* import org.hyperledger.identus.mercury.model.DidId -import org.hyperledger.identus.mercury.protocol.reportproblem.v2._ +import org.hyperledger.identus.mercury.protocol.reportproblem.v2.* class ReportProblemSpec extends ZSuite { test("ReportProblem") { diff --git a/mercury/protocol-revocation-notification/src/main/scala/org/hyperledger/identus/mercury/protocol/revocationnotificaiton/RevocationNotification.scala b/mercury/protocol-revocation-notification/src/main/scala/org/hyperledger/identus/mercury/protocol/revocationnotificaiton/RevocationNotification.scala index 5dfc001bc2..cecdcc7360 100644 --- a/mercury/protocol-revocation-notification/src/main/scala/org/hyperledger/identus/mercury/protocol/revocationnotificaiton/RevocationNotification.scala +++ b/mercury/protocol-revocation-notification/src/main/scala/org/hyperledger/identus/mercury/protocol/revocationnotificaiton/RevocationNotification.scala @@ -1,10 +1,9 @@ package org.hyperledger.identus.mercury.protocol.revocationnotificaiton -import io.circe._ -import io.circe.generic.semiauto._ -import io.circe.syntax._ - -import org.hyperledger.identus.mercury.model.{PIURI, Message, DidId} +import io.circe.* +import io.circe.generic.semiauto.* +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} final case class RevocationNotification( id: String = java.util.UUID.randomUUID.toString(), diff --git a/mercury/protocol-routing/src/main/scala/org/hyperledger/identus/mercury/protocol/routing/ForwardMessage.scala b/mercury/protocol-routing/src/main/scala/org/hyperledger/identus/mercury/protocol/routing/ForwardMessage.scala index 1024c7bd0f..3744a4c984 100644 --- a/mercury/protocol-routing/src/main/scala/org/hyperledger/identus/mercury/protocol/routing/ForwardMessage.scala +++ b/mercury/protocol-routing/src/main/scala/org/hyperledger/identus/mercury/protocol/routing/ForwardMessage.scala @@ -1,8 +1,7 @@ package org.hyperledger.identus.mercury.protocol.routing -import io.circe._ - -import org.hyperledger.identus.mercury.model.{PIURI, AttachmentDescriptor, Message, DidId} +import io.circe.* +import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId, Message, PIURI} type ForwardAttachment = AttachmentDescriptor diff --git a/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPing.scala b/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPing.scala index 16166c856c..39733f6298 100644 --- a/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPing.scala +++ b/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPing.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.mercury.protocol.trustping -import io.circe._ -import io.circe.syntax._ +import io.circe.* import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} -import org.hyperledger.identus.mercury.model.{PIURI, Message, DidId} +import io.circe.syntax.* +import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} /** https://identity.foundation/didcomm-messaging/spec/#trust-ping-protocol-20 */ final case class TrustPing( diff --git a/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPingResponse.scala b/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPingResponse.scala index 1020d67a95..d5dd40d192 100644 --- a/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPingResponse.scala +++ b/mercury/protocol-trust-ping/src/main/scala/org/hyperledger/identus/mercury/protocol/trustping/TrustPingResponse.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.mercury.protocol.trustping -import io.circe._ -import org.hyperledger.identus.mercury.model.{PIURI, Message, DidId} +import io.circe.* +import org.hyperledger.identus.mercury.model.{DidId, Message, PIURI} final case class TrustPingResponse( `type`: PIURI = TrustPingResponse.`type`, diff --git a/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/PeerDidResolver.scala b/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/PeerDidResolver.scala index e881bc50da..2d34b50a84 100644 --- a/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/PeerDidResolver.scala +++ b/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/PeerDidResolver.scala @@ -1,14 +1,14 @@ package org.hyperledger.identus.resolvers +import io.circe.{Decoder, HCursor, Json} +import io.circe.parser.* +import org.didcommx.didcomm.common.* import org.didcommx.didcomm.diddoc.{DIDCommService, DIDDoc, VerificationMethod} import org.didcommx.peerdid.PeerDIDResolver.resolvePeerDID import org.didcommx.peerdid.VerificationMaterialFormatPeerDID -import io.circe.{HCursor, Json} -import io.circe.parser.* import zio.* -import org.didcommx.didcomm.common._ + import scala.jdk.CollectionConverters.* -import io.circe.Decoder trait PeerDidResolver { def resolve(did: String): UIO[String] diff --git a/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/UniversalDidResolver.scala b/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/UniversalDidResolver.scala index 3e543f0380..d50b5fcee1 100644 --- a/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/UniversalDidResolver.scala +++ b/mercury/resolver/src/main/scala/org/hyperledger/identus/resolvers/UniversalDidResolver.scala @@ -1,13 +1,12 @@ package org.hyperledger.identus.resolvers -import org.didcommx.didcomm.diddoc._ +import org.didcommx.didcomm.diddoc.* +import org.hyperledger.identus.mercury.model.DidId +import zio.* import java.util.Optional -import scala.jdk.CollectionConverters._ -import scala.jdk.OptionConverters._ - -import zio._ -import org.hyperledger.identus.mercury.model.DidId +import scala.jdk.CollectionConverters.* +import scala.jdk.OptionConverters.* trait DIDResolver { def resolveDID(did: DidId): Task[DIDDoc] // TODO return Task[DIDDocument] diff --git a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/AliceDidDoc.scala b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/AliceDidDoc.scala index ffd47519f9..e87586c4b9 100644 --- a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/AliceDidDoc.scala +++ b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/AliceDidDoc.scala @@ -2,7 +2,8 @@ package org.hyperledger.identus.resolvers import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType} import org.didcommx.didcomm.diddoc.{DIDCommService, DIDDoc, VerificationMethod} -import scala.jdk.CollectionConverters._ + +import scala.jdk.CollectionConverters.* object AliceDidDoc { val did = "did:example:alice" diff --git a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/BobDidDoc.scala b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/BobDidDoc.scala index 86eafe4c7b..ad003129d9 100644 --- a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/BobDidDoc.scala +++ b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/BobDidDoc.scala @@ -2,7 +2,8 @@ package org.hyperledger.identus.resolvers import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType} import org.didcommx.didcomm.diddoc.{DIDCommService, DIDDoc, VerificationMethod} -import scala.jdk.CollectionConverters._ + +import scala.jdk.CollectionConverters.* object BobDidDoc { val did = "did:example:bob" diff --git a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/MediatorDidDoc.scala b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/MediatorDidDoc.scala index cd145a962b..17ddb52a07 100644 --- a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/MediatorDidDoc.scala +++ b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/MediatorDidDoc.scala @@ -2,7 +2,8 @@ package org.hyperledger.identus.resolvers import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType} import org.didcommx.didcomm.diddoc.{DIDCommService, DIDDoc, VerificationMethod} -import scala.jdk.CollectionConverters._ + +import scala.jdk.CollectionConverters.* object MediatorDidDoc { val did = "did:example:mediator" diff --git a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/PeerDidResolverSpec.scala b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/PeerDidResolverSpec.scala index 56ee214bd8..a95efd03e0 100644 --- a/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/PeerDidResolverSpec.scala +++ b/mercury/resolver/src/test/scala/org/hyperledger/identus/resolvers/PeerDidResolverSpec.scala @@ -1,10 +1,11 @@ package org.hyperledger.identus.resolvers +import io.circe.parser.* import io.circe.Json -import zio.* import munit.* -import io.circe.parser.* -import org.didcommx.peerdid._ -import scala.jdk.CollectionConverters._ +import org.didcommx.peerdid.* +import zio.* + +import scala.jdk.CollectionConverters.* class PeerDidResolverSpec extends ZSuite { diff --git a/pollux/anoncreds/src/main/scala/org/hyperledger/identus/pollux/anoncreds/Models.scala b/pollux/anoncreds/src/main/scala/org/hyperledger/identus/pollux/anoncreds/Models.scala index 180aa19949..3fbec36177 100644 --- a/pollux/anoncreds/src/main/scala/org/hyperledger/identus/pollux/anoncreds/Models.scala +++ b/pollux/anoncreds/src/main/scala/org/hyperledger/identus/pollux/anoncreds/Models.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.pollux.anoncreds import uniffi.anoncreds_wrapper.{ - Nonce, Credential as UniffiCredential, CredentialDefinition as UniffiCredentialDefinition, CredentialDefinitionPrivate as UniffiCredentialDefinitionPrivate, @@ -11,6 +10,7 @@ import uniffi.anoncreds_wrapper.{ CredentialRequestMetadata as UniffiCredentialRequestMetadata, CredentialRequests as UniffiCredentialRequests, LinkSecret as UniffiLinkSecret, + Nonce, Presentation as UniffiPresentation, PresentationRequest as UniffiPresentationRequest, Schema as UniffiSchema diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialOfferAttachment.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialOfferAttachment.scala index 101d528b8e..ad1537f49d 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialOfferAttachment.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialOfferAttachment.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.model -import io.circe._ -import io.circe.generic.semiauto._ +import io.circe.* +import io.circe.generic.semiauto.* import org.hyperledger.identus.pollux.core.model.presentation.{Options, PresentationDefinition} final case class CredentialOfferAttachment(options: Options, presentation_definition: PresentationDefinition) diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialStatusList.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialStatusList.scala index 748d6f0512..64d4975f3e 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialStatusList.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/CredentialStatusList.scala @@ -3,6 +3,7 @@ package org.hyperledger.identus.pollux.core.model import org.hyperledger.identus.castor.core.model.did.CanonicalPrismDID import org.hyperledger.identus.pollux.vc.jwt.StatusPurpose import org.hyperledger.identus.shared.models.WalletId + import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/IssueCredentialRecord.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/IssueCredentialRecord.scala index 10a6b15644..3cba90a95b 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/IssueCredentialRecord.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/IssueCredentialRecord.scala @@ -12,8 +12,8 @@ import org.hyperledger.identus.mercury.protocol.issuecredential.{ import org.hyperledger.identus.pollux.anoncreds.AnoncredCredentialRequestMetadata import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.* -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant import java.util.UUID final case class IssueCredentialRecord( diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/PresentationRecord.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/PresentationRecord.scala index 5a1eb1761a..92ba7a493c 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/PresentationRecord.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/PresentationRecord.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.pollux.core.model import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.presentproof.{Presentation, ProposePresentation, RequestPresentation} -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant type AnoncredCredentialProofs = zio.json.ast.Json type SdJwtCredentialToDisclose = zio.json.ast.Json.Obj diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialConfiguration.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialConfiguration.scala index 6ffb1aa283..fe48297132 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialConfiguration.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialConfiguration.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.pollux.core.model.oid4vci import org.hyperledger.identus.pollux.core.model.CredentialFormat import java.net.URI -import java.time.Instant import java.time.temporal.ChronoUnit +import java.time.Instant final case class CredentialConfiguration( configurationId: String, diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialIssuer.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialIssuer.scala index c153700c5d..c06d258dff 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialIssuer.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/oid4vci/CredentialIssuer.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.pollux.core.model.oid4vci import java.net.URL +import java.time.temporal.ChronoUnit import java.time.Instant import java.util.UUID -import java.time.temporal.ChronoUnit case class CredentialIssuer(id: UUID, authorizationServer: URL, createdAt: Instant, updatedAt: Instant) { def withTruncatedTimestamp(unit: ChronoUnit = ChronoUnit.MICROS): CredentialIssuer = copy( diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachment.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachment.scala index 1086a6f15a..7ee15e682b 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachment.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachment.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.model.presentation -import io.circe._ -import io.circe.generic.semiauto._ +import io.circe.* +import io.circe.generic.semiauto.* case class Field( id: Option[String] = None, diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/SdJwtPresentationPayload.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/SdJwtPresentationPayload.scala index 5f53b52da1..5b67a8c27d 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/SdJwtPresentationPayload.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/presentation/SdJwtPresentationPayload.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.pollux.core.model.presentation -import zio.json.* import org.hyperledger.identus.pollux.core.model.presentation.Options import org.hyperledger.identus.pollux.sdjwt.PresentationJson +import zio.json.* case class SdJwtPresentationPayload( claimsToDisclose: ast.Json.Obj, diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialDefinition.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialDefinition.scala index 4fa741851a..4193073032 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialDefinition.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialDefinition.scala @@ -5,8 +5,7 @@ import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.* import zio.* import zio.json.* -import java.time.OffsetDateTime -import java.time.ZoneOffset +import java.time.{OffsetDateTime, ZoneOffset} import java.util.UUID import scala.util.Try diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchema.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchema.scala index ba072b79f7..c6138e9629 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchema.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchema.scala @@ -2,12 +2,12 @@ package org.hyperledger.identus.pollux.core.model.schema import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.* -import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.model.schema.`type`.{ AnoncredSchemaType, CredentialJsonSchemaType, CredentialSchemaType } +import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.model.schema.validator.{JsonSchemaValidator, JsonSchemaValidatorImpl} import org.hyperledger.identus.pollux.core.service.URIDereferencer import zio.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/AnoncredSchemaType.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/AnoncredSchemaType.scala index 68b8b134c2..b8a699d957 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/AnoncredSchemaType.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/AnoncredSchemaType.scala @@ -1,13 +1,15 @@ package org.hyperledger.identus.pollux.core.model.schema.`type` import com.networknt.schema.* -import org.hyperledger.identus.pollux.core.model.schema.Schema import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1.* -import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError -import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaUtils -import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaValidatorImpl -import org.hyperledger.identus.pollux.core.model.schema.validator.SchemaSerDes +import org.hyperledger.identus.pollux.core.model.schema.validator.{ + JsonSchemaError, + JsonSchemaUtils, + JsonSchemaValidatorImpl, + SchemaSerDes +} +import org.hyperledger.identus.pollux.core.model.schema.Schema import zio.* import zio.json.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialJsonSchemaType.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialJsonSchemaType.scala index dba94c421c..0efa26528c 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialJsonSchemaType.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialJsonSchemaType.scala @@ -1,8 +1,7 @@ package org.hyperledger.identus.pollux.core.model.schema.`type` +import org.hyperledger.identus.pollux.core.model.schema.validator.{JsonSchemaError, JsonSchemaValidatorImpl} import org.hyperledger.identus.pollux.core.model.schema.Schema -import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError -import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaValidatorImpl import zio.* import zio.json.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialSchemaType.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialSchemaType.scala index a63a363be0..5dee559af8 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialSchemaType.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/type/CredentialSchemaType.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.model.schema.`type` -import org.hyperledger.identus.pollux.core.model.schema.Schema import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError +import org.hyperledger.identus.pollux.core.model.schema.Schema import zio.IO trait CredentialSchemaType { diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/JsonSchemaUtils.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/JsonSchemaUtils.scala index b19f4a5da8..db76a7439a 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/JsonSchemaUtils.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/JsonSchemaUtils.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.pollux.core.model.schema.validator -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper} import com.networknt.schema.* import com.networknt.schema.SpecVersion.VersionFlag import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/SchemaSerDes.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/SchemaSerDes.scala index be7010e055..982a91ff8e 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/SchemaSerDes.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/schema/validator/SchemaSerDes.scala @@ -2,10 +2,10 @@ package org.hyperledger.identus.pollux.core.model.schema.validator import com.networknt.schema.JsonSchema import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError.* +import zio.{IO, ZIO} import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* -import zio.{IO, ZIO} class SchemaSerDes[S](jsonSchemaSchemaStr: String) { diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemory.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemory.scala index a407ba898e..e1b34efdc2 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemory.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemory.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.pollux.core.repository import org.hyperledger.identus.mercury.protocol.issuecredential.{IssueCredential, RequestCredential} import org.hyperledger.identus.pollux.anoncreds.AnoncredCredentialRequestMetadata import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.ProtocolState import org.hyperledger.identus.pollux.core.model.error.CredentialRepositoryError.* +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.ProtocolState import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialStatusListRepositoryInMemory.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialStatusListRepositoryInMemory.scala index 7b0c95f5d6..96771f9ad1 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialStatusListRepositoryInMemory.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/CredentialStatusListRepositoryInMemory.scala @@ -1,18 +1,17 @@ package org.hyperledger.identus.pollux.core.repository -import org.hyperledger.identus.pollux.core.model.CredentialStatusList -import org.hyperledger.identus.pollux.vc.jwt.{Issuer, StatusPurpose, revocation} -import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} -import zio.* -import org.hyperledger.identus.pollux.core.model.* +import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDID} +import org.hyperledger.identus.pollux.core.model.{CredentialStatusList, *} +import org.hyperledger.identus.pollux.vc.jwt.{revocation, Issuer, StatusPurpose} +import org.hyperledger.identus.pollux.vc.jwt.revocation.{BitString, VCStatusList2021} import org.hyperledger.identus.pollux.vc.jwt.revocation.BitStringError.{ DecodingError, EncodingError, IndexOutOfBounds, InvalidSize } -import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDID} -import org.hyperledger.identus.pollux.vc.jwt.revocation.{BitString, VCStatusList2021} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import zio.* import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepository.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepository.scala index 1b3fb9a9d6..2c072fdcf9 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepository.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepository.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.pollux.core.repository -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialConfiguration -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialIssuer +import org.hyperledger.identus.pollux.core.model.oid4vci.{CredentialConfiguration, CredentialIssuer} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemory.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemory.scala index 5fdca1b025..c746c22965 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemory.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemory.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.pollux.core.repository import org.hyperledger.identus.mercury.protocol.presentproof.* import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.PresentationRecord.ProtocolState import org.hyperledger.identus.pollux.core.model.error.PresentationError.* +import org.hyperledger.identus.pollux.core.model.PresentationRecord.ProtocolState import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceImpl.scala index fd49b15378..263d4d139f 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceImpl.scala @@ -5,21 +5,21 @@ import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage import org.hyperledger.identus.pollux.anoncreds.{AnoncredLib, AnoncredSchemaDef} import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.{SchemaError, URISyntaxError} -import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition -import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition.{Filter, FilteredEntries} import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError +import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition +import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition.{Filter, FilteredEntries} import org.hyperledger.identus.pollux.core.model.secret.CredentialDefinitionSecret import org.hyperledger.identus.pollux.core.repository.CredentialDefinitionRepository import org.hyperledger.identus.pollux.core.repository.Repository.SearchQuery -import org.hyperledger.identus.pollux.core.service.CredentialDefinitionService.Error.* import org.hyperledger.identus.pollux.core.service.serdes.{ PrivateCredentialDefinitionSchemaSerDesV1, ProofKeyCredentialDefinitionSchemaSerDesV1, PublicCredentialDefinitionSerDesV1 } -import zio.ZIO.getOrFailWith +import org.hyperledger.identus.pollux.core.service.CredentialDefinitionService.Error.* import zio.{IO, URLayer, ZIO, ZLayer} +import zio.ZIO.getOrFailWith import java.net.URI import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaService.scala index 7066f87bcf..dbe40c6115 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaService.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema.* -import zio.{IO, ZIO} import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.{IO, ZIO} import java.util.UUID trait CredentialSchemaService { diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaServiceImpl.scala index d99475344c..fc29d9b80a 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialSchemaServiceImpl.scala @@ -6,9 +6,8 @@ import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema.Filtere import org.hyperledger.identus.pollux.core.repository.CredentialSchemaRepository import org.hyperledger.identus.pollux.core.repository.Repository.SearchQuery import org.hyperledger.identus.pollux.core.service.CredentialSchemaService.Error.* +import zio.{IO, URLayer, ZLayer} import zio.ZIO.{fail, getOrFailWith, succeed} -import zio.{URLayer, ZLayer} -import zio.IO import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialService.scala index ff0e407a9c..313fc07e1c 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialService.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.service -import io.circe.syntax.* import io.circe.{Json, JsonObject} +import io.circe.syntax.* import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDID, VerificationRelationship} import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.issuecredential.{ 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 1d62c1339b..8e53ba4982 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 @@ -1,16 +1,21 @@ package org.hyperledger.identus.pollux.core.service import com.nimbusds.jose.jwk.OctetKeyPair -import io.circe.Json import io.circe.syntax.* +import io.circe.Json import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState} import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage -import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDID, VerificationRelationship} +import org.hyperledger.identus.castor.core.model.did.{ + CanonicalPrismDID, + EllipticCurve, + PrismDID, + VerificationRelationship +} import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.mercury.model.* import org.hyperledger.identus.mercury.protocol.issuecredential.* -import org.hyperledger.identus.pollux.* +import org.hyperledger.identus.pollux.{sdjwt, *} import org.hyperledger.identus.pollux.anoncreds.{ AnoncredCreateCredentialDefinition, AnoncredCredential, @@ -18,32 +23,30 @@ import org.hyperledger.identus.pollux.anoncreds.{ AnoncredLib } import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.CredentialFormat.AnonCreds -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.ProtocolState.OfferReceived import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError.* import org.hyperledger.identus.pollux.core.model.presentation.* import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema import org.hyperledger.identus.pollux.core.model.secret.CredentialDefinitionSecret +import org.hyperledger.identus.pollux.core.model.CredentialFormat.AnonCreds +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.ProtocolState.OfferReceived import org.hyperledger.identus.pollux.core.repository.{CredentialRepository, CredentialStatusListRepository} -import org.hyperledger.identus.pollux.vc.jwt.{ES256KSigner, Issuer as JwtIssuer, *} +import org.hyperledger.identus.pollux.sdjwt.* +import org.hyperledger.identus.pollux.vc.jwt.{ES256KSigner, *} +import org.hyperledger.identus.pollux.vc.jwt.Issuer as JwtIssuer +import org.hyperledger.identus.shared.crypto.{Ed25519KeyPair, Ed25519PublicKey} import org.hyperledger.identus.shared.http.{DataUrlResolver, GenericUriResolver} import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.shared.utils.aspects.CustomMetricsAspect import zio.* import zio.prelude.ZValidation -import org.hyperledger.identus.castor.core.model.did.EllipticCurve import java.net.URI import java.rmi.UnexpectedException import java.time.{Instant, ZoneId} +import java.time.temporal.ChronoUnit import java.util.UUID import scala.language.implicitConversions -import org.hyperledger.identus.pollux.sdjwt -import org.hyperledger.identus.pollux.sdjwt.* -import org.hyperledger.identus.shared.crypto.{Ed25519KeyPair, Ed25519PublicKey} - -import java.time.temporal.ChronoUnit object CredentialServiceImpl { val layer: URLayer[ diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifier.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifier.scala index 84cd183d3b..cd398a962f 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifier.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifier.scala @@ -5,8 +5,8 @@ import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDI import org.hyperledger.identus.event.notification.* import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.issuecredential.{IssueCredential, OfferCredential, RequestCredential} -import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.core.model.{DidCommID, IssueCredentialRecord} +import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.vc.jwt.Issuer import org.hyperledger.identus.shared.models.WalletAccessContext import zio.{IO, URLayer, ZIO, ZLayer} diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListService.scala index 59c96f37bc..62d8e76bfc 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListService.scala @@ -2,8 +2,8 @@ package org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.pollux.core.model.{CredentialStatusList, CredentialStatusListWithCreds, DidCommID} import org.hyperledger.identus.pollux.core.model.error.CredentialStatusListServiceError -import zio.* import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.* import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListServiceImpl.scala index 1b6e7c0b13..448d177082 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialStatusListServiceImpl.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.pollux.core.model.{CredentialStatusList, CredentialStatusListWithCreds, DidCommID} -import org.hyperledger.identus.pollux.core.repository.CredentialStatusListRepository -import zio.* import org.hyperledger.identus.pollux.core.model.error.CredentialStatusListServiceError import org.hyperledger.identus.pollux.core.model.error.CredentialStatusListServiceError.* +import org.hyperledger.identus.pollux.core.repository.CredentialStatusListRepository import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.* import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/HttpURIDereferencerImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/HttpURIDereferencerImpl.scala index 3e6afcd3e4..738ad3d36f 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/HttpURIDereferencerImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/HttpURIDereferencerImpl.scala @@ -7,6 +7,7 @@ import org.hyperledger.identus.pollux.core.service.URIDereferencerError.{ } import zio.* import zio.http.* + import java.net.URI import java.nio.charset.StandardCharsets diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockCredentialService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockCredentialService.scala index d7b1a826bb..d1e8fbc194 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockCredentialService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockCredentialService.scala @@ -4,12 +4,12 @@ import io.circe.Json import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDID, VerificationRelationship} import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.issuecredential.{IssueCredential, OfferCredential, RequestCredential} -import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.core.model.{DidCommID, IssueCredentialRecord} +import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.vc.jwt.Issuer import org.hyperledger.identus.shared.models.WalletAccessContext +import zio.{mock, IO, URLayer, ZIO, ZLayer} import zio.mock.{Mock, Proxy} -import zio.{IO, URLayer, ZIO, ZLayer, mock} import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockPresentationService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockPresentationService.scala index fa82ec51fb..79ecf9d689 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockPresentationService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/MockPresentationService.scala @@ -8,17 +8,17 @@ import org.hyperledger.identus.mercury.protocol.presentproof.{ RequestPresentation } import org.hyperledger.identus.pollux.anoncreds.AnoncredPresentation -import org.hyperledger.identus.pollux.core.model.error.PresentationError -import org.hyperledger.identus.pollux.core.model.presentation.Options import org.hyperledger.identus.pollux.core.model.{DidCommID, PresentationRecord} +import org.hyperledger.identus.pollux.core.model.error.PresentationError +import org.hyperledger.identus.pollux.core.model.presentation.{Options, SdJwtPresentationPayload} import org.hyperledger.identus.pollux.core.service.serdes.{AnoncredCredentialProofsV1, AnoncredPresentationRequestV1} -import org.hyperledger.identus.pollux.core.model.presentation.SdJwtPresentationPayload import org.hyperledger.identus.pollux.sdjwt.PresentationJson import org.hyperledger.identus.pollux.vc.jwt.{Issuer, PresentationPayload, W3cCredentialPayload} import org.hyperledger.identus.shared.models.WalletAccessContext -import zio.mock.{Mock, Proxy} -import zio.{IO, URLayer, ZIO, ZLayer, mock} +import zio.{mock, IO, URLayer, ZIO, ZLayer} import zio.json.* +import zio.mock.{Mock, Proxy} + import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala index d5f6b8975f..7aa4231e90 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala @@ -1,25 +1,25 @@ package org.hyperledger.identus.pollux.core.service -import org.hyperledger.identus.pollux.core.model.CredentialFormat -import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.CredentialSchemaParsingError -import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.SchemaError -import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.URISyntaxError -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialConfiguration -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialIssuer +import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.{ + CredentialSchemaParsingError, + SchemaError, + URISyntaxError +} +import org.hyperledger.identus.pollux.core.model.oid4vci.{CredentialConfiguration, CredentialIssuer} import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema +import org.hyperledger.identus.pollux.core.model.CredentialFormat import org.hyperledger.identus.pollux.core.repository.OID4VCIIssuerMetadataRepository -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.CredentialConfigurationNotFound -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.InvalidSchemaId -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.IssuerIdNotFound -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.UnsupportedCredentialFormat +import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.{ + CredentialConfigurationNotFound, + InvalidSchemaId, + IssuerIdNotFound, + UnsupportedCredentialFormat +} import org.hyperledger.identus.shared.db.Errors.UnexpectedAffectedRow -import org.hyperledger.identus.shared.models.Failure -import org.hyperledger.identus.shared.models.StatusCode -import org.hyperledger.identus.shared.models.WalletAccessContext +import org.hyperledger.identus.shared.models.{Failure, StatusCode, WalletAccessContext} import zio.* -import java.net.URI -import java.net.URL +import java.net.{URI, URL} import java.util.UUID sealed trait OID4VCIIssuerMetadataServiceError( diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationService.scala index 9dcf6a3a06..de8fc87ffa 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationService.scala @@ -14,8 +14,8 @@ import zio.* import zio.json.ast import java.time.Instant -import java.util as ju import java.util.UUID +import java.util as ju trait PresentationService { def extractIdFromCredential(credential: W3cCredentialPayload): Option[UUID] 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 224f0aac4f..388b736a8b 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 @@ -16,20 +16,20 @@ import org.hyperledger.identus.pollux.core.model.presentation.{SdJwtPresentation import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.repository.{CredentialRepository, PresentationRepository} import org.hyperledger.identus.pollux.core.service.serdes.* +import org.hyperledger.identus.pollux.sdjwt.{CredentialJson, PresentationJson, SDJWT} import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.shared.models.WalletAccessContext import org.hyperledger.identus.shared.utils.aspects.CustomMetricsAspect import zio.* import zio.json.* -import org.hyperledger.identus.pollux.sdjwt.{CredentialJson, PresentationJson, SDJWT} import java.net.URI import java.rmi.UnexpectedException import java.time.Instant +import java.util.{Base64 as JBase64, UUID} import java.util as ju -import java.util.{UUID, Base64 as JBase64} +import scala.util.chaining.* import scala.util.Try -import scala.util.chaining._ private class PresentationServiceImpl( uriDereferencer: URIDereferencer, diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifier.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifier.scala index 1555e5dd09..b78b6841e4 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifier.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifier.scala @@ -9,16 +9,16 @@ import org.hyperledger.identus.mercury.protocol.presentproof.{ RequestPresentation } import org.hyperledger.identus.pollux.anoncreds.AnoncredPresentation -import org.hyperledger.identus.pollux.core.model.error.PresentationError -import org.hyperledger.identus.pollux.core.model.presentation.Options import org.hyperledger.identus.pollux.core.model.{DidCommID, PresentationRecord} +import org.hyperledger.identus.pollux.core.model.error.PresentationError +import org.hyperledger.identus.pollux.core.model.presentation.{Options, SdJwtPresentationPayload} import org.hyperledger.identus.pollux.core.service.serdes.{AnoncredCredentialProofsV1, AnoncredPresentationRequestV1} -import org.hyperledger.identus.pollux.core.model.presentation.SdJwtPresentationPayload import org.hyperledger.identus.pollux.sdjwt.PresentationJson import org.hyperledger.identus.pollux.vc.jwt.{Issuer, PresentationPayload, W3cCredentialPayload} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.{IO, URLayer, ZIO, ZLayer} import zio.json.* + import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyService.scala index 20da0f5ad6..b8df8aeb09 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyService.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.service -import org.hyperledger.identus.pollux.core.model.error.VerificationPolicyError import org.hyperledger.identus.pollux.core.model.{VerificationPolicy, VerificationPolicyConstraint} +import org.hyperledger.identus.pollux.core.model.error.VerificationPolicyError import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyServiceImpl.scala index 70ddce207d..e47f8ca734 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/VerificationPolicyServiceImpl.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.service -import org.hyperledger.identus.pollux.core.model.error.VerificationPolicyError import org.hyperledger.identus.pollux.core.model.{VerificationPolicy, VerificationPolicyConstraint} +import org.hyperledger.identus.pollux.core.model.error.VerificationPolicyError import org.hyperledger.identus.pollux.core.repository.VerificationPolicyRepository import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/serdes/SDJwtPresentationRequest.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/serdes/SDJwtPresentationRequest.scala index 5e1c53bc92..a602fb5937 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/serdes/SDJwtPresentationRequest.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/serdes/SDJwtPresentationRequest.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.service.serdes -import zio.json.* import org.hyperledger.identus.pollux.core.model.presentation.Options +import zio.json.* case class SDJwtPresentation(options: Options, claims: ast.Json.Obj) diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImpl.scala index f32099b66b..5350db594b 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImpl.scala @@ -216,7 +216,7 @@ class VcVerificationServiceImpl(didResolver: DidResolver, uriDereferencer: URIDe .as( VcVerificationResult( credential = credential, - verification = VcVerification.SubjectVerification, + verification = VcVerification.SemanticCheckOfClaims, success = true ) ) @@ -224,7 +224,7 @@ class VcVerificationServiceImpl(didResolver: DidResolver, uriDereferencer: URIDe ZIO.succeed( VcVerificationResult( credential = credential, - verification = VcVerification.SubjectVerification, + verification = VcVerification.SemanticCheckOfClaims, success = false ) ) diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachmentSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachmentSpec.scala index b7532faa79..52109d1a8c 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachmentSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/presentation/PresentationAttachmentSpec.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.pollux.core.model.presentation -import io.circe.Json import io.circe.parser.* import io.circe.syntax.* +import io.circe.Json import munit.* class PresentationAttachmentSpec extends ZSuite { diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/AnoncredSchemaTypeSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/AnoncredSchemaTypeSpec.scala index 6668608db2..b8e2dfb9f3 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/AnoncredSchemaTypeSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/AnoncredSchemaTypeSpec.scala @@ -6,9 +6,8 @@ import zio.* import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* -import zio.test.* +import zio.test.{assertZIO, *} import zio.test.Assertion.* -import zio.test.assertZIO import scala.util.Random diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchemaSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchemaSpec.scala index 91875493ae..d34ae1cef6 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchemaSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/model/schema/CredentialSchemaSpec.scala @@ -2,21 +2,16 @@ package org.hyperledger.identus.pollux.core.model.schema import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError.SchemaError -import org.hyperledger.identus.pollux.core.model.schema.AnoncredSchemaTypeSpec.test -import org.hyperledger.identus.pollux.core.model.schema.`type`.AnoncredSchemaType -import org.hyperledger.identus.pollux.core.model.schema.`type`.CredentialJsonSchemaType +import org.hyperledger.identus.pollux.core.model.schema.`type`.{AnoncredSchemaType, CredentialJsonSchemaType} import org.hyperledger.identus.pollux.core.model.schema.`type`.anoncred.AnoncredSchemaSerDesV1 import org.hyperledger.identus.pollux.core.model.schema.validator.JsonSchemaError.JsonValidationErrors -import zio.Scope +import org.hyperledger.identus.pollux.core.model.schema.AnoncredSchemaTypeSpec.test import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* -import zio.test.Assertion +import zio.test.{assertZIO, Assertion, Spec, TestEnvironment, ZIOSpecDefault} import zio.test.Assertion.* -import zio.test.Spec -import zio.test.TestEnvironment -import zio.test.ZIOSpecDefault -import zio.test.assertZIO +import zio.Scope import java.time.OffsetDateTime import java.util.UUID diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemorySpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemorySpec.scala index 4693dbdb87..e2c9ceeb9b 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemorySpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositoryInMemorySpec.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.repository -import zio._ -import zio.test._ +import zio.* +import zio.test.* /** core/testOnly org.hyperledger.identus.pollux.core.repository.CredentialRepositoryInMemorySpec */ object CredentialRepositoryInMemorySpec extends ZIOSpecDefault { diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositorySpecSuite.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositorySpecSuite.scala index 4935966a79..f365f0d441 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositorySpecSuite.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/CredentialRepositorySpecSuite.scala @@ -4,12 +4,12 @@ import org.hyperledger.identus.castor.core.model.did.PrismDID import org.hyperledger.identus.mercury.model.DidId import org.hyperledger.identus.mercury.protocol.issuecredential.{IssueCredential, RequestCredential} import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.* import org.hyperledger.identus.pollux.core.model.error.CredentialRepositoryError.* +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.* import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import zio.{Exit, ZIO, ZLayer} import zio.test.* import zio.test.Assertion.* -import zio.{Exit, ZIO, ZLayer} import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepositorySpecSuite.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepositorySpecSuite.scala index 866e153267..ce642d45be 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepositorySpecSuite.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/OID4VCIIssuerMetadataRepositorySpecSuite.scala @@ -1,14 +1,12 @@ package org.hyperledger.identus.pollux.core.repository +import org.hyperledger.identus.pollux.core.model.oid4vci.{CredentialConfiguration, CredentialIssuer} import org.hyperledger.identus.pollux.core.model.CredentialFormat -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialConfiguration -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialIssuer import org.hyperledger.identus.shared.db.Errors.UnexpectedAffectedRow -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import zio.{ZIO, ZLayer} import zio.test.* import zio.test.Assertion.* -import zio.{ZIO, ZLayer} import java.net.URI import java.time.Instant diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemorySpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemorySpec.scala index 3cf53f45e1..9df1d7825b 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemorySpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositoryInMemorySpec.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.core.repository -import zio._ -import zio.test._ +import zio.* +import zio.test.* object PresentationRepositoryInMemorySpec extends ZIOSpecDefault { diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositorySpecSuite.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositorySpecSuite.scala index 36b3d92206..c2d5140b54 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositorySpecSuite.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/repository/PresentationRepositorySpecSuite.scala @@ -6,9 +6,9 @@ import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.core.model.PresentationRecord.* import org.hyperledger.identus.pollux.core.service.serdes.{AnoncredCredentialProofV1, AnoncredCredentialProofsV1} import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import zio.{ZIO, ZLayer} import zio.test.* import zio.test.Assertion.* -import zio.{ZIO, ZLayer} import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceSpecHelper.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceSpecHelper.scala index c952ae38c1..35353652ab 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceSpecHelper.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceSpecHelper.scala @@ -4,8 +4,8 @@ import org.hyperledger.identus.agent.walletapi.memory.GenericSecretStorageInMemo import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition import org.hyperledger.identus.pollux.core.repository.CredentialDefinitionRepositoryInMemory -import org.hyperledger.identus.shared.models.WalletId.* import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import org.hyperledger.identus.shared.models.WalletId.* import zio.* import java.time.OffsetDateTime diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImplSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImplSpec.scala index 6e41874de8..cdfa2bc1ba 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImplSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImplSpec.scala @@ -1,19 +1,19 @@ package org.hyperledger.identus.pollux.core.service -import io.circe.Json import io.circe.syntax.* +import io.circe.Json import org.hyperledger.identus.agent.walletapi.service.MockManagedDIDService import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.castor.core.model.did.VerificationRelationship.AssertionMethod import org.hyperledger.identus.castor.core.service.MockDIDService -import org.hyperledger.identus.mercury.model.{Base64 => MyBase64, *} +import org.hyperledger.identus.mercury.model.{Base64 as MyBase64, *} import org.hyperledger.identus.mercury.protocol.issuecredential.* import org.hyperledger.identus.pollux.anoncreds.AnoncredCredential import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.{ProtocolState, Role} import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError.* import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.{ProtocolState, Role} import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.mock.MockSpecDefault diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifierSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifierSpec.scala index db8e8a3c77..7610760cef 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifierSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceNotifierSpec.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.event.notification.{EventNotificationService, EventNotificationServiceImpl} import org.hyperledger.identus.mercury.protocol.issuecredential.* import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.ProtocolState import org.hyperledger.identus.pollux.core.model.error.CredentialServiceError +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.ProtocolState import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.mock.{Expectation, MockSpecDefault} diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/LinkSecretServiceImplSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/LinkSecretServiceImplSpec.scala index 49b4fa59fe..db56e42797 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/LinkSecretServiceImplSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/LinkSecretServiceImplSpec.scala @@ -3,8 +3,8 @@ package org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.agent.walletapi.memory.GenericSecretStorageInMemory import org.hyperledger.identus.agent.walletapi.storage.GenericSecretStorage import org.hyperledger.identus.pollux.anoncreds.AnoncredLinkSecret -import org.hyperledger.identus.shared.models.WalletId.* import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import org.hyperledger.identus.shared.models.WalletId.* import zio.* import zio.test.* import zio.test.TestAspect.* diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataServiceSpecSuite.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataServiceSpecSuite.scala index 2893203b05..8813cb8f2c 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataServiceSpecSuite.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataServiceSpecSuite.scala @@ -1,14 +1,15 @@ package org.hyperledger.identus.pollux.core.service import org.hyperledger.identus.pollux.core.model.CredentialFormat -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.CredentialConfigurationNotFound -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.InvalidSchemaId -import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.IssuerIdNotFound -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.pollux.core.service.OID4VCIIssuerMetadataServiceError.{ + CredentialConfigurationNotFound, + InvalidSchemaId, + IssuerIdNotFound +} +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import zio.{ZIO, ZLayer} import zio.test.* import zio.test.Assertion.* -import zio.{ZIO, ZLayer} import java.net.URI diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifierSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifierSpec.scala index 9aa4e6f7f0..3c39901dbd 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifierSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceNotifierSpec.scala @@ -7,15 +7,14 @@ import org.hyperledger.identus.mercury.protocol.presentproof.{ Presentation, RequestPresentation } -import org.hyperledger.identus.pollux.core.model.PresentationRecord.ProtocolState import org.hyperledger.identus.pollux.core.model.{CredentialFormat, DidCommID, PresentationRecord} -import zio.mock.Expectation -import zio.test.{Assertion, Spec, TestEnvironment, ZIOSpecDefault, assertTrue} +import org.hyperledger.identus.pollux.core.model.PresentationRecord.ProtocolState +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.{Scope, ZIO, ZLayer} +import zio.mock.Expectation +import zio.test.{assertTrue, Assertion, Spec, TestEnvironment, ZIOSpecDefault} import java.time.Instant -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId object PresentationServiceNotifierSpec extends ZIOSpecDefault with PresentationServiceSpecHelper { diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpec.scala index b647cfd993..008694b6ae 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpec.scala @@ -8,13 +8,13 @@ import org.hyperledger.identus.mercury.protocol.issuecredential.{IssueCredential import org.hyperledger.identus.mercury.protocol.presentproof.* import org.hyperledger.identus.pollux.anoncreds.* import org.hyperledger.identus.pollux.core.model.* -import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.* -import org.hyperledger.identus.pollux.core.model.PresentationRecord.* import org.hyperledger.identus.pollux.core.model.error.PresentationError import org.hyperledger.identus.pollux.core.model.error.PresentationError.* import org.hyperledger.identus.pollux.core.model.presentation.Options import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition.Input import org.hyperledger.identus.pollux.core.model.secret.CredentialDefinitionSecret +import org.hyperledger.identus.pollux.core.model.IssueCredentialRecord.* +import org.hyperledger.identus.pollux.core.model.PresentationRecord.* import org.hyperledger.identus.pollux.core.repository.{CredentialRepository, PresentationRepository} import org.hyperledger.identus.pollux.core.service.serdes.{ AnoncredCredentialProofV1, @@ -31,7 +31,7 @@ import zio.test.Assertion.* import java.nio.charset.StandardCharsets import java.nio.file.{Files, Path, Paths} import java.time.{Instant, OffsetDateTime} -import java.util.{UUID, Base64 as JBase64} +import java.util.{Base64 as JBase64, UUID} object PresentationServiceSpec extends ZIOSpecDefault with PresentationServiceSpecHelper { diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpecHelper.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpecHelper.scala index 7938a84631..7e7a0c8abd 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpecHelper.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/PresentationServiceSpecHelper.scala @@ -2,17 +2,18 @@ package org.hyperledger.identus.pollux.core.service import com.nimbusds.jose.jwk.* import org.hyperledger.identus.agent.walletapi.memory.GenericSecretStorageInMemory +import org.hyperledger.identus.mercury.{AgentPeerService, PeerDID} import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, DidId} import org.hyperledger.identus.mercury.protocol.presentproof.* -import org.hyperledger.identus.mercury.{AgentPeerService, PeerDID} import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.core.model.error.PresentationError import org.hyperledger.identus.pollux.core.repository.* import org.hyperledger.identus.pollux.core.service.serdes.* import org.hyperledger.identus.pollux.vc.jwt.* -import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import org.hyperledger.identus.shared.crypto.KmpSecp256k1KeyOps +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* + import java.time.Instant import java.util.UUID diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImplSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImplSpec.scala index 53cb5ba626..a182ed5824 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImplSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceImplSpec.scala @@ -9,8 +9,8 @@ import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.pollux.vc.jwt.CredentialPayload.Implicits.* import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* -import zio.Config.OffsetDateTime import zio.test.* +import zio.Config.OffsetDateTime import java.time.Instant diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceSpecHelper.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceSpecHelper.scala index 0febf9aded..e132307c2d 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceSpecHelper.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/verification/VcVerificationServiceSpecHelper.scala @@ -5,8 +5,8 @@ import org.hyperledger.identus.castor.core.model.did.VerificationRelationship import org.hyperledger.identus.castor.core.service.{DIDService, MockDIDService} import org.hyperledger.identus.pollux.core.service.{ResourceURIDereferencerImpl, URIDereferencer} import org.hyperledger.identus.pollux.vc.jwt.* -import org.hyperledger.identus.shared.models.WalletId.* import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} +import org.hyperledger.identus.shared.models.WalletId.* import zio.* import zio.mock.Expectation diff --git a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/Models.scala b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/Models.scala index bf0e7d225c..9181d77177 100644 --- a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/Models.scala +++ b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/Models.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.pollux.sdjwt -import sdjwtwrapper.* +import org.bouncycastle.crypto.params.{Ed25519PrivateKeyParameters, Ed25519PublicKeyParameters} +import org.bouncycastle.crypto.util.{PrivateKeyInfoFactory, SubjectPublicKeyInfoFactory} import org.hyperledger.identus.shared.crypto.* -import org.bouncycastle.crypto.params.Ed25519PrivateKeyParameters -import org.bouncycastle.crypto.util.PrivateKeyInfoFactory -import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters -import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory +import sdjwtwrapper.* import zio.json.* + import java.util.Base64 opaque type IssuerPublicKey = String diff --git a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/ModelsExtensionMethods.scala b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/ModelsExtensionMethods.scala index 65a2c65bd8..230c745aa9 100644 --- a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/ModelsExtensionMethods.scala +++ b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/ModelsExtensionMethods.scala @@ -1,6 +1,7 @@ package org.hyperledger.identus.pollux.sdjwt import zio.json.* + import java.util.Base64 private[sdjwt] object ModelsExtensionMethods { diff --git a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/QueryUtils.scala b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/QueryUtils.scala index 7d13b8f982..508453a23c 100644 --- a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/QueryUtils.scala +++ b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/QueryUtils.scala @@ -1,9 +1,8 @@ package org.hyperledger.identus.pollux.sdjwt import zio.json.* -import zio.json.ast.Json +import zio.json.ast.{Json, JsonCursor} import zio.json.ast.Json.* -import zio.json.ast.JsonCursor private[sdjwt] object QueryUtils { diff --git a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/SDJWT.scala b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/SDJWT.scala index 30cfce2016..ca0124a8a5 100644 --- a/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/SDJWT.scala +++ b/pollux/sd-jwt/src/main/scala/org/hyperledger/identus/pollux/sdjwt/SDJWT.scala @@ -1,12 +1,11 @@ package org.hyperledger.identus.pollux.sdjwt import sdjwtwrapper.* -import scala.util.Try -import scala.util.Failure -import scala.util.Success import zio.json.* import zio.json.ast.Json +import scala.util.{Failure, Success, Try} + object SDJWT { sealed trait ClaimsValidationResult diff --git a/pollux/sd-jwt/src/test/scala/org/hyperledger/identus/pollux/sdjwt/SDJWTSpec.scala b/pollux/sd-jwt/src/test/scala/org/hyperledger/identus/pollux/sdjwt/SDJWTSpec.scala index cfa5d41072..a17b07a5ad 100644 --- a/pollux/sd-jwt/src/test/scala/org/hyperledger/identus/pollux/sdjwt/SDJWTSpec.scala +++ b/pollux/sd-jwt/src/test/scala/org/hyperledger/identus/pollux/sdjwt/SDJWTSpec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.pollux.sdjwt +import org.hyperledger.identus.pollux.sdjwt.* +import org.hyperledger.identus.shared.crypto.* import zio.* import zio.json.* import zio.test.* import zio.test.Assertion.* -import org.hyperledger.identus.pollux.sdjwt.* -import org.hyperledger.identus.shared.crypto.* def ISSUER_KEY = IssuerPrivateKey.fromEcPem( """-----BEGIN PRIVATE KEY----- diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialDefinition.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialDefinition.scala index 6fa9d39679..8f82f8e1e8 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialDefinition.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialDefinition.scala @@ -7,8 +7,8 @@ import io.getquill.idiom.* import org.hyperledger.identus.pollux.core.model.schema.{CorrectnessProof, Definition} import org.hyperledger.identus.shared.models.WalletId -import java.time.OffsetDateTime import java.time.temporal.ChronoUnit +import java.time.OffsetDateTime import java.util.UUID case class CredentialDefinition( diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialSchema.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialSchema.scala index 4649497d25..358a175d70 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialSchema.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/CredentialSchema.scala @@ -7,8 +7,8 @@ import io.getquill.idiom.* import org.hyperledger.identus.pollux.core.model.schema.Schema import org.hyperledger.identus.shared.models.WalletId -import java.time.OffsetDateTime import java.time.temporal.ChronoUnit +import java.time.OffsetDateTime import java.util.UUID case class CredentialSchema( diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/VerificationPolicy.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/VerificationPolicy.scala index b2d59df531..d4a7005f89 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/VerificationPolicy.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/VerificationPolicy.scala @@ -3,9 +3,9 @@ package org.hyperledger.identus.pollux.sql.model.db import io.getquill.* import io.getquill.doobie.DoobieContext import org.hyperledger.identus.shared.models.WalletId -import java.util.UUID import java.time.OffsetDateTime +import java.util.UUID case class VerificationPolicy( id: UUID, diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/package.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/package.scala index 413cc7b6d3..652b137fc4 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/package.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/model/db/package.scala @@ -1,9 +1,10 @@ package org.hyperledger.identus.pollux.sql.model import io.getquill.MappedEncoding -import java.util.UUID import org.hyperledger.identus.shared.models.WalletId +import java.util.UUID + package object db { given MappedEncoding[WalletId, UUID] = MappedEncoding(_.toUUID) diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Implicits.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Implicits.scala index 665bf8cf30..db884407a3 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Implicits.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Implicits.scala @@ -5,8 +5,7 @@ import org.hyperledger.identus.castor.core.model.did.{CanonicalPrismDID, PrismDI import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.vc.jwt.StatusPurpose -import java.net.URI -import java.net.URL +import java.net.{URI, URL} given didCommIDGet: Get[DidCommID] = Get[String].map(DidCommID(_)) given didCommIDPut: Put[DidCommID] = Put[String].contramap(_.value) diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialDefinitionRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialDefinitionRepository.scala index 580c335bd9..dd69969de2 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialDefinitionRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialDefinitionRepository.scala @@ -3,11 +3,11 @@ package org.hyperledger.identus.pollux.sql.repository import doobie.* import doobie.implicits.* import org.hyperledger.identus.pollux.core.model.schema.CredentialDefinition -import org.hyperledger.identus.pollux.core.repository.Repository.* import org.hyperledger.identus.pollux.core.repository.{CredentialDefinitionRepository, Repository} +import org.hyperledger.identus.pollux.core.repository.Repository.* import org.hyperledger.identus.pollux.sql.model.db.{ - CredentialDefinitionSql, - CredentialDefinition as CredentialDefinitionRow + CredentialDefinition as CredentialDefinitionRow, + CredentialDefinitionSql } import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialSchemaRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialSchemaRepository.scala index 9fc7872121..e624cf4800 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialSchemaRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialSchemaRepository.scala @@ -3,9 +3,9 @@ package org.hyperledger.identus.pollux.sql.repository import doobie.* import doobie.implicits.* import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema -import org.hyperledger.identus.pollux.core.repository.Repository.* import org.hyperledger.identus.pollux.core.repository.{CredentialSchemaRepository, Repository} -import org.hyperledger.identus.pollux.sql.model.db.{CredentialSchemaSql, CredentialSchema as CredentialSchemaRow} +import org.hyperledger.identus.pollux.core.repository.Repository.* +import org.hyperledger.identus.pollux.sql.model.db.{CredentialSchema as CredentialSchemaRow, CredentialSchemaSql} import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* import org.hyperledger.identus.shared.models.WalletAccessContext diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialStatusListRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialStatusListRepository.scala index ba463f7082..d6552ffad2 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialStatusListRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialStatusListRepository.scala @@ -4,17 +4,18 @@ import doobie.* import doobie.implicits.* import doobie.postgres.* import doobie.postgres.implicits.* -import org.hyperledger.identus.pollux.vc.jwt.{Issuer, StatusPurpose} -import org.hyperledger.identus.pollux.vc.jwt.revocation.{BitString, BitStringError, VCStatusList2021} import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.core.repository.CredentialStatusListRepository -import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.Implicits.{*, given} +import org.hyperledger.identus.pollux.vc.jwt.{Issuer, StatusPurpose} +import org.hyperledger.identus.pollux.vc.jwt.revocation.{BitString, BitStringError, VCStatusList2021} import org.hyperledger.identus.pollux.vc.jwt.revocation.BitStringError.* +import org.hyperledger.identus.shared.db.ContextAwareTask +import org.hyperledger.identus.shared.db.Implicits.* +import org.hyperledger.identus.shared.db.Implicits.given +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.interop.catz.* -import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import java.time.Instant import java.util.UUID diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepository.scala index 00e2c92839..7acf14f102 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepository.scala @@ -4,8 +4,7 @@ import doobie.* import doobie.implicits.* import doobie.postgres.implicits.* import doobie.util.transactor.Transactor -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialConfiguration -import org.hyperledger.identus.pollux.core.model.oid4vci.CredentialIssuer +import org.hyperledger.identus.pollux.core.model.oid4vci.{CredentialConfiguration, CredentialIssuer} import org.hyperledger.identus.pollux.core.repository.OID4VCIIssuerMetadataRepository import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepository.scala index ee52d9fa0a..ae0bcac0da 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepository.scala @@ -5,8 +5,8 @@ import doobie.* import doobie.free.connection import doobie.implicits.* import doobie.postgres.* +import doobie.postgres.circe.json.implicits.* import doobie.postgres.implicits.* -import doobie.postgres.circe.json.implicits._ import io.circe import io.circe.* import io.circe.parser.* @@ -23,6 +23,7 @@ import zio.interop.catz.* import zio.json.* import zio.json.ast.Json import zio.json.ast.Json.* + import java.time.Instant // TODO: replace with actual implementation class JdbcPresentationRepository( diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcVerificationPolicyRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcVerificationPolicyRepository.scala index 5de7415d14..86e9dfb025 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcVerificationPolicyRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcVerificationPolicyRepository.scala @@ -8,8 +8,7 @@ import org.hyperledger.identus.pollux.core.repository.VerificationPolicyReposito import org.hyperledger.identus.pollux.sql.model.db import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import java.time.{OffsetDateTime, ZoneOffset} @@ -70,8 +69,8 @@ object JdbcVerificationPolicyRepository { } class JdbcVerificationPolicyRepository(xa: Transactor[ContextAwareTask]) extends VerificationPolicyRepository { - import VerificationPolicyExtensions.* import org.hyperledger.identus.pollux.sql.model.db.VerificationPolicySql + import VerificationPolicyExtensions.* override def create( verificationPolicy: model.VerificationPolicy diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Migrations.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Migrations.scala index 1a3bf6369b..13d2e5f32d 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Migrations.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/Migrations.scala @@ -3,10 +3,9 @@ package org.hyperledger.identus.pollux.sql.repository import doobie.* import doobie.implicits.* import doobie.util.transactor.Transactor -import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.DbConfig -import org.hyperledger.identus.shared.db.Implicits.* import org.flywaydb.core.Flyway +import org.hyperledger.identus.shared.db.{ContextAwareTask, DbConfig} +import org.hyperledger.identus.shared.db.Implicits.* import zio.* import zio.interop.catz.* diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialSchemaSqlIntegrationSpec.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialSchemaSqlIntegrationSpec.scala index ae379a6f9f..b27ece79b1 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialSchemaSqlIntegrationSpec.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialSchemaSqlIntegrationSpec.scala @@ -7,8 +7,7 @@ import io.getquill.* import org.hyperledger.identus.pollux.sql.model.db.{CredentialSchema, CredentialSchemaSql} import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.MigrationAspects.* import zio.* diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/VerificationPolicySqlIntegrationSpec.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/VerificationPolicySqlIntegrationSpec.scala index 57387b8415..0f7b867855 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/VerificationPolicySqlIntegrationSpec.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/VerificationPolicySqlIntegrationSpec.scala @@ -13,8 +13,7 @@ import org.hyperledger.identus.pollux.sql.model.db.VerificationPolicySql import org.hyperledger.identus.pollux.sql.repository.JdbcVerificationPolicyRepository import org.hyperledger.identus.shared.db.ContextAwareTask import org.hyperledger.identus.shared.db.Implicits.* -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.MigrationAspects.* import zio.* diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepositorySpec.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepositorySpec.scala index b91608a6d0..bbcf60f05d 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepositorySpec.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepositorySpec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.pollux.sql.repository import com.dimafeng.testcontainers.PostgreSQLContainer -import org.hyperledger.identus.pollux.core.repository._ +import org.hyperledger.identus.pollux.core.repository.* import org.hyperledger.identus.shared.db.DbConfig import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import zio._ -import zio.test._ +import zio.* +import zio.test.* object JdbcCredentialRepositorySpec extends ZIOSpecDefault, PostgresTestContainerSupport { diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepositorySpec.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepositorySpec.scala index db0e9578eb..36390023d1 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepositorySpec.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcOID4VCIIssuerMetadataRepositorySpec.scala @@ -1,7 +1,9 @@ package org.hyperledger.identus.pollux.sql.repository -import org.hyperledger.identus.pollux.core.repository.OID4VCIIssuerMetadataRepository -import org.hyperledger.identus.pollux.core.repository.OID4VCIIssuerMetadataRepositorySpecSuite +import org.hyperledger.identus.pollux.core.repository.{ + OID4VCIIssuerMetadataRepository, + OID4VCIIssuerMetadataRepositorySpecSuite +} import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport import org.hyperledger.identus.test.container.MigrationAspects import zio.* diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepositorySpec.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepositorySpec.scala index b4ababcef4..f91e5a65d9 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepositorySpec.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/repository/JdbcPresentationRepositorySpec.scala @@ -1,11 +1,11 @@ package org.hyperledger.identus.pollux.sql.repository import com.dimafeng.testcontainers.PostgreSQLContainer -import org.hyperledger.identus.pollux.core.repository._ +import org.hyperledger.identus.pollux.core.repository.* import org.hyperledger.identus.shared.db.DbConfig import org.hyperledger.identus.sharedtest.containers.PostgresTestContainerSupport -import zio._ -import zio.test._ +import zio.* +import zio.test.* object JdbcPresentationRepositorySpec extends ZIOSpecDefault, PostgresTestContainerSupport { diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/test/container/MigrationAspect.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/test/container/MigrationAspect.scala index 881afaccff..f98872beea 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/test/container/MigrationAspect.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/test/container/MigrationAspect.scala @@ -2,9 +2,9 @@ package org.hyperledger.identus.test.container import com.dimafeng.testcontainers.PostgreSQLContainer import org.flywaydb.core.Flyway -import zio.ZIO import zio.test.{TestAspect, TestAspectAtLeastR} -import zio.test.TestAspect.{beforeAll, before} +import zio.test.TestAspect.{before, beforeAll} +import zio.ZIO object MigrationAspects { def migrate(schema: String, paths: String*): TestAspectAtLeastR[PostgreSQLContainer] = { diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/DidResolver.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/DidResolver.scala index df8f5dad6b..99af6549ee 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/DidResolver.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/DidResolver.scala @@ -1,20 +1,20 @@ package org.hyperledger.identus.pollux.vc.jwt +import io.circe.Json import org.hyperledger.identus.castor.core.model.did.w3c.{ + makeW3CResolver, DIDDocumentRepr, DIDResolutionErrorRepr, PublicKeyJwk, PublicKeyRepr, PublicKeyReprOrRef, - ServiceRepr, - makeW3CResolver + ServiceRepr } import org.hyperledger.identus.castor.core.service.DIDService import zio.* import java.time.Instant import scala.annotation.unused -import io.circe.Json trait DidResolver { def resolve(didUrl: String): UIO[DIDResolutionResult] diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerification.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerification.scala index a4013ae812..e0080ecb0a 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerification.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerification.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.pollux.vc.jwt -import com.nimbusds.jose.JWSVerifier import com.nimbusds.jose.crypto.{ECDSAVerifier, Ed25519Verifier} import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton import com.nimbusds.jose.jwk.* import com.nimbusds.jose.util.Base64URL +import com.nimbusds.jose.JWSVerifier import com.nimbusds.jwt.SignedJWT import io.circe import io.circe.generic.auto.* @@ -17,9 +17,9 @@ import pdi.jwt.* import zio.* import zio.prelude.* +import java.security.{KeyFactory, PublicKey} import java.security.interfaces.{ECPublicKey, EdECPublicKey} import java.security.spec.X509EncodedKeySpec -import java.security.{KeyFactory, PublicKey} import scala.util.{Failure, Success, Try} object JWTVerification { diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/Proof.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/Proof.scala index db7daf1127..471ca1fb16 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/Proof.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/Proof.scala @@ -1,18 +1,18 @@ package org.hyperledger.identus.pollux.vc.jwt +import cats.implicits.* import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton import io.circe.* import io.circe.syntax.* -import cats.implicits.* -import java.time.{Instant, ZoneOffset} -import zio.* -import org.hyperledger.identus.shared.utils.Json as JsonUtils -import org.hyperledger.identus.shared.utils.Base64Utils +import org.hyperledger.identus.shared.crypto.Ed25519KeyPair +import org.hyperledger.identus.shared.utils.{Base64Utils, Json as JsonUtils} import scodec.bits.ByteVector -import scala.util.Try +import zio.* + import java.security.* import java.security.spec.X509EncodedKeySpec -import org.hyperledger.identus.shared.crypto.Ed25519KeyPair +import java.time.{Instant, ZoneOffset} +import scala.util.Try sealed trait Proof { val id: Option[String] = None diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiableCredentialPayload.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiableCredentialPayload.scala index 73d94fb3ed..232661d1b0 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiableCredentialPayload.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiableCredentialPayload.scala @@ -1,5 +1,6 @@ package org.hyperledger.identus.pollux.vc.jwt +import com.nimbusds.jwt.SignedJWT import io.circe import io.circe.* import io.circe.generic.auto.* @@ -8,18 +9,16 @@ import io.circe.syntax.* import org.hyperledger.identus.castor.core.model.did.VerificationRelationship import org.hyperledger.identus.pollux.vc.jwt.revocation.BitString import org.hyperledger.identus.pollux.vc.jwt.schema.{SchemaResolver, SchemaValidator} +import org.hyperledger.identus.shared.crypto.PublicKey as ApolloPublicKey import org.hyperledger.identus.shared.http.UriResolver import pdi.jwt.* import zio.* import zio.prelude.* import java.security.PublicKey -import java.time.temporal.TemporalAmount import java.time.{Clock, Instant, OffsetDateTime, ZoneId} -import scala.util.Try -import com.nimbusds.jwt.SignedJWT -import scala.util.Failure -import org.hyperledger.identus.shared.crypto.{PublicKey => ApolloPublicKey} +import java.time.temporal.TemporalAmount +import scala.util.{Failure, Try} opaque type DID = String object DID { def apply(value: String): DID = value diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiablePresentationPayload.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiablePresentationPayload.scala index fa7e98ae2c..122027cbc2 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiablePresentationPayload.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/VerifiablePresentationPayload.scala @@ -12,8 +12,8 @@ import zio.* import zio.prelude.* import java.security.PublicKey -import java.time.temporal.TemporalAmount import java.time.{Clock, Instant} +import java.time.temporal.TemporalAmount import scala.util.Try sealed trait VerifiablePresentationPayload diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/BitString.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/BitString.scala index 21ca1009ae..9013bef295 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/BitString.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/BitString.scala @@ -5,8 +5,8 @@ import zio.{IO, UIO, ZIO} import java.io.{ByteArrayInputStream, ByteArrayOutputStream} import java.util -import java.util.Base64 import java.util.zip.{GZIPInputStream, GZIPOutputStream} +import java.util.Base64 class BitString private (val bitSet: util.BitSet, val size: Int) { def setRevokedInPlace(index: Int, value: Boolean): IO[IndexOutOfBounds, Unit] = diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021.scala index 8634947837..47682410d4 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.vc.jwt.revocation -import io.circe.syntax.* import io.circe.{Json, JsonObject} +import io.circe.syntax.* import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.pollux.vc.jwt.revocation.VCStatusList2021Error.{DecodingError, EncodingError} import zio.* diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/ReactiveCoreSchemaValidator.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/ReactiveCoreSchemaValidator.scala index e57ef5299e..a10ec28fce 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/ReactiveCoreSchemaValidator.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/ReactiveCoreSchemaValidator.scala @@ -1,12 +1,12 @@ package org.hyperledger.identus.pollux.vc.jwt.schema import io.circe +import io.circe.{Encoder, Json} import io.circe.generic.auto.* import io.circe.syntax.* -import io.circe.{Encoder, Json} import net.reactivecore.cjs.{DocumentValidator, Loader} -import zio.NonEmptyChunk import zio.prelude.* +import zio.NonEmptyChunk class ReactiveCoreSchemaValidator(documentValidator: DocumentValidator) extends SchemaValidator { override def validate(payloadToValidate: Json): Validation[String, Json] = diff --git a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/SchemaValidator.scala b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/SchemaValidator.scala index 8cef04a10a..470dfb110f 100644 --- a/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/SchemaValidator.scala +++ b/pollux/vc-jwt/src/main/scala/org/hyperledger/identus/pollux/vc/jwt/schema/SchemaValidator.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.pollux.vc.jwt.schema -import zio.prelude.Validation; import io.circe.Json +import zio.prelude.Validation trait SchemaValidator { def validate(payloadToValidate: Json): Validation[String, Json] diff --git a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ECDSAVerifierTest.scala b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ECDSAVerifierTest.scala index 10e3467227..597e27c045 100644 --- a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ECDSAVerifierTest.scala +++ b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ECDSAVerifierTest.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.pollux.vc.jwt import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton -import com.nimbusds.jose.jwk.Curve import com.nimbusds.jose.jwk.gen.ECKeyGenerator +import com.nimbusds.jose.jwk.Curve import org.bouncycastle.jce.provider.BouncyCastleProvider import org.scalatest.funsuite.AnyFunSuite import org.scalatest.matchers.must.Matchers.mustBe diff --git a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ES256KSignerTest.scala b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ES256KSignerTest.scala index 118a4e9156..c342cbf09a 100644 --- a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ES256KSignerTest.scala +++ b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/ES256KSignerTest.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.pollux.vc.jwt import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton -import com.nimbusds.jose.jwk.Curve import com.nimbusds.jose.jwk.gen.ECKeyGenerator +import com.nimbusds.jose.jwk.Curve import org.bouncycastle.jce.provider.BouncyCastleProvider import org.scalatest.funsuite.AnyFunSuite import org.scalatest.matchers.must.Matchers.mustBe diff --git a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerificationTest.scala b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerificationTest.scala index bd4bd545e8..2489fbc0e2 100644 --- a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerificationTest.scala +++ b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/JWTVerificationTest.scala @@ -1,16 +1,17 @@ package org.hyperledger.identus.pollux.vc.jwt import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton -import com.nimbusds.jose.jwk.gen.ECKeyGenerator import com.nimbusds.jose.jwk.{Curve, ECKey} +import com.nimbusds.jose.jwk.gen.ECKeyGenerator import io.circe.* import io.circe.syntax.* import org.hyperledger.identus.castor.core.model.did.VerificationRelationship import org.hyperledger.identus.pollux.vc.jwt.CredentialPayload.Implicits.* +import org.hyperledger.identus.shared.http.* import zio.* import zio.test.* import zio.test.Assertion.* -import org.hyperledger.identus.shared.http.* + import java.security.Security import java.time.Instant diff --git a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021Spec.scala b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021Spec.scala index a6f4be663f..8a62c5f6b1 100644 --- a/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021Spec.scala +++ b/pollux/vc-jwt/src/test/scala/org/hyperledger/identus/pollux/vc/jwt/revocation/VCStatusList2021Spec.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.pollux.vc.jwt.revocation import org.hyperledger.identus.pollux.vc.jwt.{DID, ES256KSigner, Issuer, JwtCredential} -import zio.test.{Spec, ZIOSpecDefault, assertTrue} -import zio.{UIO, ZIO} import org.hyperledger.identus.shared.crypto.KmpSecp256k1KeyOps +import zio.{UIO, ZIO} +import zio.test.{assertTrue, Spec, ZIOSpecDefault} object VCStatusList2021Spec extends ZIOSpecDefault { diff --git a/project/plugins.sbt b/project/plugins.sbt index 018df38b39..c157ceb5a6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0") diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/db/ContextAwareTask.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/db/ContextAwareTask.scala index 7d3aa5a9ee..f6c52c96f2 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/db/ContextAwareTask.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/db/ContextAwareTask.scala @@ -4,8 +4,7 @@ import doobie.* import doobie.postgres.implicits.* import doobie.syntax.ConnectionIOOps import doobie.util.transactor.Transactor -import org.hyperledger.identus.shared.models.WalletAccessContext -import org.hyperledger.identus.shared.models.WalletId +import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId} import zio.* import zio.interop.catz.* diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/db/TransactorLayer.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/db/TransactorLayer.scala index f4fa1e8380..39dfc6be04 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/db/TransactorLayer.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/db/TransactorLayer.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.shared.db -import cats.effect.Async import cats.effect.kernel.Resource import cats.effect.std.Dispatcher +import cats.effect.Async import com.zaxxer.hikari.HikariConfig import doobie.hikari.HikariTransactor import doobie.util.transactor.Transactor diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/http/GenericUriResolver.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/http/GenericUriResolver.scala index 46d1b57e3c..f8b5741f3a 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/http/GenericUriResolver.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/http/GenericUriResolver.scala @@ -1,7 +1,7 @@ package org.hyperledger.identus.shared.http -import zio.* import io.lemonlabs.uri.{DataUrl, Uri, Url, Urn} +import zio.* trait UriResolver { diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/models/Base64UrlString.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/models/Base64UrlString.scala index ca418cc426..73a28891a1 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/models/Base64UrlString.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/models/Base64UrlString.scala @@ -1,6 +1,7 @@ package org.hyperledger.identus.shared.models import org.hyperledger.identus.shared.utils.Base64Utils + import scala.util.Try opaque type Base64UrlString = String diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/models/HexString.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/models/HexString.scala index 92dc6641f6..26435d5fc5 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/models/HexString.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/models/HexString.scala @@ -1,6 +1,7 @@ package org.hyperledger.identus.shared.models import org.hyperledger.identus.shared.utils.BytesOps + import scala.util.Try opaque type HexString = String diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/Json.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/Json.scala index 3fe5ce97c8..fff678af68 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/Json.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/Json.scala @@ -1,6 +1,7 @@ package org.hyperledger.identus.shared.utils import org.erdtman.jcs.JsonCanonicalizer + import java.io.IOException object Json { diff --git a/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/aspects/CustomMetricsAspect.scala b/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/aspects/CustomMetricsAspect.scala index 946888ebea..38a35b55be 100644 --- a/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/aspects/CustomMetricsAspect.scala +++ b/shared/core/src/main/scala/org/hyperledger/identus/shared/utils/aspects/CustomMetricsAspect.scala @@ -1,10 +1,11 @@ package org.hyperledger.identus.shared.utils.aspects +import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds import zio.* -import scala.collection.mutable.{Map => MutMap} import zio.metrics.* -import java.time.{Instant, Clock, Duration} -import org.hyperledger.identus.shared.utils.DurationOps.toMetricsSeconds + +import java.time.{Clock, Duration, Instant} +import scala.collection.mutable.Map as MutMap object CustomMetricsAspect { private val checkpoints: MutMap[String, Instant] = MutMap.empty diff --git a/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/Apollo.scala b/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/Apollo.scala index 15ddfdf3ae..ccade3471b 100644 --- a/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/Apollo.scala +++ b/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/Apollo.scala @@ -5,15 +5,15 @@ import com.nimbusds.jose.util.Base64URL import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory -import org.bouncycastle.jce.ECNamedCurveTable import org.bouncycastle.jce.provider.BouncyCastleProvider import org.bouncycastle.jce.spec.ECNamedCurveSpec +import org.bouncycastle.jce.ECNamedCurveTable import org.hyperledger.identus.shared.models.HexString import zio.* +import java.security.{KeyFactory, PublicKey} import java.security.interfaces.EdECPublicKey import java.security.spec.* -import java.security.{KeyFactory, PublicKey} import scala.util.Try trait Apollo { diff --git a/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/KmpApollo.scala b/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/KmpApollo.scala index 8bc1a03f18..3df7157a04 100644 --- a/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/KmpApollo.scala +++ b/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/KmpApollo.scala @@ -4,14 +4,16 @@ import io.iohk.atala.prism.apollo.derivation import io.iohk.atala.prism.apollo.derivation.MnemonicHelper import io.iohk.atala.prism.apollo.secp256k1.Secp256k1Lib import io.iohk.atala.prism.apollo.securerandom.SecureRandom -import io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PrivateKey -import io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PublicKey -import io.iohk.atala.prism.apollo.utils.KMMEdKeyPair -import io.iohk.atala.prism.apollo.utils.KMMEdPrivateKey -import io.iohk.atala.prism.apollo.utils.KMMEdPublicKey -import io.iohk.atala.prism.apollo.utils.KMMX25519KeyPair -import io.iohk.atala.prism.apollo.utils.KMMX25519PrivateKey -import io.iohk.atala.prism.apollo.utils.KMMX25519PublicKey +import io.iohk.atala.prism.apollo.utils.{ + KMMECSecp256k1PrivateKey, + KMMECSecp256k1PublicKey, + KMMEdKeyPair, + KMMEdPrivateKey, + KMMEdPublicKey, + KMMX25519KeyPair, + KMMX25519PrivateKey, + KMMX25519PublicKey +} import zio.* import scala.jdk.CollectionConverters.* diff --git a/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/jwk/JWK.scala b/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/jwk/JWK.scala index fb6e7167e4..cd8f11380f 100644 --- a/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/jwk/JWK.scala +++ b/shared/crypto/src/main/scala/org/hyperledger/identus/shared/crypto/jwk/JWK.scala @@ -1,7 +1,6 @@ package org.hyperledger.identus.shared.crypto.jwk -import com.nimbusds.jose.jwk.Curve -import com.nimbusds.jose.jwk.OctetKeyPair +import com.nimbusds.jose.jwk.{Curve, OctetKeyPair} import com.nimbusds.jose.util.Base64URL import org.hyperledger.identus.shared.crypto.* import zio.json.* diff --git a/shared/crypto/src/test/scala/org/hyperledger/identus/shared/crypto/ApolloSpec.scala b/shared/crypto/src/test/scala/org/hyperledger/identus/shared/crypto/ApolloSpec.scala index 94cd37ca2b..860d035fb6 100644 --- a/shared/crypto/src/test/scala/org/hyperledger/identus/shared/crypto/ApolloSpec.scala +++ b/shared/crypto/src/test/scala/org/hyperledger/identus/shared/crypto/ApolloSpec.scala @@ -1,9 +1,9 @@ package org.hyperledger.identus.shared.crypto +import org.hyperledger.identus.shared.models.HexString import zio.* import zio.test.* import zio.test.Assertion.* -import org.hyperledger.identus.shared.models.HexString object ApolloSpec extends ZIOSpecDefault { diff --git a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupportSpec.scala b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupportSpec.scala index 599209341f..0d701216cb 100644 --- a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupportSpec.scala +++ b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupportSpec.scala @@ -1,10 +1,10 @@ package org.hyperledger.identus.sharedtest.containers -import zio.ZIO import zio.test.* import zio.test.TestAspect.* -import scala.jdk.CollectionConverters._ +import zio.ZIO +import scala.jdk.CollectionConverters.* import scala.util.Try object KeycloakTestContainerSupportSpec extends ZIOSpecDefault with KeycloakTestContainerSupport { diff --git a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala index 0530a619d9..067ab8d00a 100644 --- a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala +++ b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala @@ -2,8 +2,7 @@ package org.hyperledger.identus.sharedtest.containers import com.dimafeng.testcontainers.PostgreSQLContainer import doobie.util.transactor.Transactor -import org.hyperledger.identus.shared.db.ContextAwareTask -import org.hyperledger.identus.shared.db.TransactorLayer +import org.hyperledger.identus.shared.db.{ContextAwareTask, TransactorLayer} import zio.* trait PostgresTestContainerSupport { diff --git a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala index b5bc783506..f0cd61c36f 100644 --- a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala +++ b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala @@ -1,8 +1,8 @@ package org.hyperledger.identus.sharedtest.containers import com.dimafeng.testcontainers.{SingleContainer, VaultContainer} -import org.testcontainers.vault.{VaultContainer => JavaVaultContainer} import org.testcontainers.utility.DockerImageName +import org.testcontainers.vault.VaultContainer as JavaVaultContainer /** See PostgreSQLContainerCustom for explanation */ class VaultContainerCustom(