From dbe3e708682632deb5fd3ca7a95692f6e822eb69 Mon Sep 17 00:00:00 2001 From: FabioPinheiro Date: Mon, 3 Jun 2024 13:02:04 +0100 Subject: [PATCH 1/4] style: remove deprecated Scala syntax Signed-off-by: FabioPinheiro --- .../castor/core/model/ProtoModelHelper.scala | 10 ++-- .../core/model/did/w3c/W3CModelHelper.scala | 2 +- .../agent/notification/WebhookPublisher.scala | 6 +-- .../agent/server/ControllerHelper.scala | 2 +- .../server/jobs/ConnectBackgroundJobs.scala | 2 +- .../server/jobs/IssueBackgroundJobs.scala | 4 +- .../server/jobs/PresentBackgroundJobs.scala | 8 +-- .../identus/agent/server/sql/Migrations.scala | 2 +- .../identus/api/http/EndpointOutputs.scala | 2 +- .../controller/DIDCommControllerImpl.scala | 16 +++--- .../iam/authentication/SecurityLogic.scala | 4 +- .../CredentialDefinitionControllerImpl.scala | 4 +- .../CredentialSchemaControllerImpl.scala | 4 +- .../agent/walletapi/model/Entity.scala | 2 +- .../sql/JdbcWalletNonSecretStorage.scala | 2 +- .../agent/walletapi/util/KeyResolver.scala | 2 +- .../walletapi/util/OperationFactory.scala | 2 +- .../core/service/ConnectionServiceImpl.scala | 14 +++--- .../service/ConnectionServiceNotifier.scala | 8 +-- .../repository/JdbcConnectionRepository.scala | 6 +-- .../connect/sql/repository/Migrations.scala | 2 +- .../EventNotificationServiceImpl.scala | 6 +-- .../protocol/issuecredential/Utils.scala | 2 +- .../core/service/CredentialServiceImpl.scala | 50 +++++++++---------- .../service/CredentialServiceNotifier.scala | 8 +-- .../service/PresentationServiceImpl.scala | 20 ++++---- .../service/PresentationServiceNotifier.scala | 8 +-- .../identus/pollux/sdjwt/QueryUtils.scala | 2 +- .../repository/JdbcCredentialRepository.scala | 10 ++-- .../JdbcPresentationRepository.scala | 6 +-- .../pollux/sql/repository/Migrations.scala | 2 +- .../identus/shared/db/ContextAwareTask.scala | 2 +- 32 files changed, 110 insertions(+), 110 deletions(-) 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 2a498df319..f2ef3f156d 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 @@ -192,7 +192,7 @@ private[castor] trait ProtoModelHelper { case ServiceType.Single(name) => name.value case ts: ServiceType.Multiple => val names = ts.values.map(_.value).map(Json.fromString) - Json.arr(names: _*).noSpaces + Json.arr(names*).noSpaces } } } @@ -210,7 +210,7 @@ private[castor] trait ProtoModelHelper { case UriOrJsonEndpoint.Uri(uri) => Json.fromString(uri.value) case UriOrJsonEndpoint.Json(json) => Json.fromJsonObject(json) } - Json.arr(uris: _*).noSpaces + Json.arr(uris*).noSpaces } } } @@ -250,10 +250,10 @@ private[castor] trait ProtoModelHelper { Clock.instant.map { now => didData .withPublicKeys(didData.publicKeys.filter { publicKey => - publicKey.revokedOn.flatMap(_.toInstant).forall(revokeTime => revokeTime isAfter now) + publicKey.revokedOn.flatMap(_.toInstant).forall(revokeTime => revokeTime `isAfter` now) }) .withServices(didData.services.filter { service => - service.deletedOn.flatMap(_.toInstant).forall(revokeTime => revokeTime isAfter now) + service.deletedOn.flatMap(_.toInstant).forall(revokeTime => revokeTime `isAfter` now) }) } } @@ -370,7 +370,7 @@ private[castor] trait ProtoModelHelper { case Nil => Left("the service type cannot be an empty JSON array") } .filterOrElse( - _ => s == io.circe.Json.arr(jsonArr: _*).noSpaces, + _ => s == io.circe.Json.arr(jsonArr*).noSpaces, "the service type is a valid JSON array of strings, but not conform to the ABNF" ) } 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 8668d00cf0..47cc7265a2 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 @@ -103,7 +103,7 @@ private[castor] trait W3CModelHelper { case UriOrJsonEndpoint.Uri(uri) => Json.fromString(uri.value) case UriOrJsonEndpoint.Json(json) => Json.fromJsonObject(json) } - Json.arr(uris: _*) + Json.arr(uris*) } } } 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 850fa685bc..c4af9c4016 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 @@ -56,7 +56,7 @@ class WebhookPublisher( } yield () } - private[this] def pollAndNotify[A](consumer: EventConsumer[A])(implicit encoder: JsonEncoder[A]) = { + private def pollAndNotify[A](consumer: EventConsumer[A])(implicit encoder: JsonEncoder[A]) = { for { _ <- ZIO.log(s"Polling $parallelism event(s)") events <- consumer.poll(parallelism).mapError(e => UnexpectedError(e.toString)) @@ -80,7 +80,7 @@ class WebhookPublisher( } yield () } - private[this] def generateNotifyWebhookTasks[A]( + private def generateNotifyWebhookTasks[A]( event: Event[A], webhooks: Seq[EventNotificationConfig] )(implicit encoder: JsonEncoder[A]): Seq[ZIO[Client, UnexpectedError, Unit]] = { @@ -94,7 +94,7 @@ class WebhookPublisher( .map { case (url, headers) => notifyWebhook(event, url.toString, headers) } } - private[this] def notifyWebhook[A](event: Event[A], url: String, headers: Headers)(implicit + private def notifyWebhook[A](event: Event[A], url: String, headers: Headers)(implicit encoder: JsonEncoder[A] ): ZIO[Client, UnexpectedError, Unit] = { val result = for { 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 55e0a23b74..8a5aa712ec 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 @@ -25,7 +25,7 @@ trait ControllerHelper { protected case class DidIdPair(myDID: DidId, theirDid: DidId) - private[this] def extractDidIdPairFromEstablishedConnection( + private def extractDidIdPairFromEstablishedConnection( record: ConnectionRecord ): IO[InvalidStateForOperation, DidIdPair] = { (record.protocolState, record.connectionResponse, record.role) match { 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 882c6ae990..483a7a6d87 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 @@ -34,7 +34,7 @@ object ConnectBackgroundJobs extends BackgroundJobsHelper { } yield () } - private[this] def performExchange( + private def performExchange( record: ConnectionRecord ): URIO[ DidOps & DIDResolver & HttpClient & ConnectionService & ManagedDIDService & DIDNonSecretStorage & AppConfig, 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 882fd92953..a0a772775c 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 @@ -42,7 +42,7 @@ object IssueBackgroundJobs extends BackgroundJobsHelper { .counterInt(key) .fromConst(1) - private[this] def performIssueCredentialExchange(record: IssueCredentialRecord) = { + private def performIssueCredentialExchange(record: IssueCredentialRecord) = { import IssueCredentialRecord.* import IssueCredentialRecord.ProtocolState.* @@ -634,7 +634,7 @@ object IssueBackgroundJobs extends BackgroundJobsHelper { } - private[this] def handleCredentialErrors + private def handleCredentialErrors : PartialFunction[Throwable | CredentialServiceError, CredentialServiceError] = { case e: CredentialServiceError => e case t: Throwable => CredentialServiceError.UnexpectedError(t.getMessage()) 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 363b356a52..fa66430eca 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 @@ -67,7 +67,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper { .counterInt(key) .fromConst(1) - private[this] def createPrismDIDIssuerFromPresentationCredentials( + private def createPrismDIDIssuerFromPresentationCredentials( presentationId: DidCommID, credentialsToUse: Seq[String] ) = @@ -104,7 +104,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper { // Holder / Prover Get the Holder/Prover PrismDID from the IssuedCredential // When holder accepts offer he provides the subjectdid - private[this] def getPrismDIDForHolderFromCredentials( + private def getPrismDIDForHolderFromCredentials( presentationId: DidCommID, credentialsToUse: Seq[String] ) = @@ -139,7 +139,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper { jwtIssuer <- getSDJwtIssuer(longFormPrismDID, VerificationRelationship.Authentication) } yield jwtIssuer - private[this] def performPresentProofExchange(record: PresentationRecord): URIO[ + private def performPresentProofExchange(record: PresentationRecord): URIO[ AppConfig & DidOps & DIDResolver & JwtDidResolver & HttpClient & PresentationService & CredentialService & DIDNonSecretStorage & DIDService & ManagedDIDService, Unit @@ -1093,7 +1093,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper { } - private[this] def handlePresentationErrors: PartialFunction[ + private def handlePresentationErrors: PartialFunction[ Throwable | CredentialServiceError | PresentationError | BackgroundJobError, PresentationError | CredentialServiceError | BackgroundJobError ] = { 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 253a2497a9..725d9b984f 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 @@ -34,7 +34,7 @@ final case class Migrations(config: DbConfig) { object Migrations { val layer: URLayer[DbConfig, Migrations] = - ZLayer.fromFunction(Migrations.apply _) + ZLayer.fromFunction(Migrations.apply) /** Fail if the RLS is not enabled from a sample table */ def validateRLS: RIO[Transactor[ContextAwareTask], Unit] = { 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 1e4c9a8ecc..819ce88451 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 @@ -15,7 +15,7 @@ object EndpointOutputs { def basicFailuresWith(extraFailures: OneOfVariant[ErrorResponse]*) = { oneOf( FailureVariant.badRequest, - (FailureVariant.internalServerError +: extraFailures): _* + (FailureVariant.internalServerError +: extraFailures)* ) } 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 f822561bf8..b1e4b7ac4d 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 @@ -42,12 +42,12 @@ class DIDCommControllerImpl( } yield () } - private[this] def validateContentType(contentType: Option[String]) = { + private def validateContentType(contentType: Option[String]) = { if (contentType.contains(MediaTypes.contentTypeEncrypted)) ZIO.unit else ZIO.fail(InvalidContentType(contentType)) } - private[this] def handleMessage(msg: DIDCommMessage) = { + private def handleMessage(msg: DIDCommMessage) = { ZIO.logAnnotate("request-id", UUID.randomUUID.toString) { for { msgAndContext <- unpackMessage(msg) @@ -70,7 +70,7 @@ class DIDCommControllerImpl( revocationNotification orElse handleUnknownMessage - private[this] def unpackMessage(msg: DIDCommMessage): IO[DIDCommControllerError, (Message, WalletAccessContext)] = + private def unpackMessage(msg: DIDCommMessage): IO[DIDCommControllerError, (Message, WalletAccessContext)] = for { recipientDid <- ZIO .fromOption(msg.recipients.headOption.map(_.header.kid.split("#")(0))) @@ -92,7 +92,7 @@ class DIDCommControllerImpl( /* * Connect */ - private[this] val handleConnect: PartialFunction[Message, ZIO[ + private val handleConnect: PartialFunction[Message, ZIO[ WalletAccessContext, DIDCommMessageParsingError | ConnectionServiceError, Unit @@ -122,7 +122,7 @@ class DIDCommControllerImpl( /* * Issue Credential */ - private[this] val handleIssueCredential + private val handleIssueCredential : PartialFunction[Message, ZIO[WalletAccessContext, CredentialServiceError, Unit]] = { case msg if msg.piuri == OfferCredential.`type` => for { @@ -147,7 +147,7 @@ class DIDCommControllerImpl( /* * Present Proof */ - private[this] val handlePresentProof: PartialFunction[Message, ZIO[WalletAccessContext, PresentationError, Unit]] = { + private val handlePresentProof: PartialFunction[Message, ZIO[WalletAccessContext, PresentationError, Unit]] = { case msg if msg.piuri == ProposePresentation.`type` => for { proposePresentation <- ZIO.succeed(ProposePresentation.readFromMessage(msg)) @@ -168,7 +168,7 @@ class DIDCommControllerImpl( } yield () } - private[this] val revocationNotification: PartialFunction[Message, ZIO[Any, Throwable, Unit]] = { + private val revocationNotification: PartialFunction[Message, ZIO[Any, Throwable, Unit]] = { case msg if msg.piuri == RevocationNotification.`type` => for { revocationNotification <- ZIO.attempt(RevocationNotification.readFromMessage(msg)) @@ -179,7 +179,7 @@ class DIDCommControllerImpl( /* * Unknown Message */ - private[this] val handleUnknownMessage: PartialFunction[Message, UIO[String]] = { case _ => + private val handleUnknownMessage: PartialFunction[Message, UIO[String]] = { case _ => ZIO.succeed("Unknown Message Type") } } 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 253b438fe0..4443f26de2 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 @@ -45,7 +45,7 @@ object SecurityLogic { authenticator: Authenticator[E], authorizer: Authorizer[E] ): IO[ErrorResponse, WalletAccessContext] = - authenticate[E](credentials, others: _*)(authenticator) + authenticate[E](credentials, others*)(authenticator) .flatMap { case Left(entity) => authorizeWalletAccess(entity)(EntityAuthorizer) case Right(entity) => authorizeWalletAccess(entity)(authorizer) @@ -79,7 +79,7 @@ object SecurityLogic { def authorizeRole[E <: BaseEntity](credentials: Credentials, others: Credentials*)( authenticator: Authenticator[E], )(permittedRole: EntityRole): IO[ErrorResponse, BaseEntity] = { - authenticate[E](credentials, others: _*)(authenticator) + authenticate[E](credentials, others*)(authenticator) .flatMap { ee => val entity = ee.fold(identity, identity) for { 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 56fc7ca087..124fecee43 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 @@ -93,7 +93,7 @@ class CredentialDefinitionControllerImpl(service: CredentialDefinitionService, m } yield CredentialDefinitionControllerLogic(rc, pagination, page, stats).result } - private[this] def validatePrismDID(author: String) = + private def validatePrismDID(author: String) = for { authorDID <- ZIO .fromEither(PrismDID.fromString(author)) @@ -101,7 +101,7 @@ class CredentialDefinitionControllerImpl(service: CredentialDefinitionService, m longFormPrismDID <- getLongForm(authorDID, true) } yield longFormPrismDID - private[this] def getLongForm( + private def getLongForm( did: PrismDID, allowUnpublishedIssuingDID: Boolean = false ): ZIO[WalletAccessContext, ErrorResponse, LongFormPrismDID] = { 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 394f450686..30bb53e064 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 @@ -108,7 +108,7 @@ class CredentialSchemaControllerImpl(service: CredentialSchemaService, managedDI } yield CredentialSchemaControllerLogic(rc, pagination, page, stats).result } - private[this] def validatePrismDID(author: String) = + private def validatePrismDID(author: String) = for { authorDID <- ZIO .fromEither(PrismDID.fromString(author)) @@ -116,7 +116,7 @@ class CredentialSchemaControllerImpl(service: CredentialSchemaService, managedDI longFormPrismDID <- getLongForm(authorDID, true) } yield longFormPrismDID - private[this] def getLongForm( + private def getLongForm( did: PrismDID, allowUnpublishedIssuingDID: Boolean = false ): ZIO[WalletAccessContext, ErrorResponse, LongFormPrismDID] = { 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 2ac1c8483e..d8c104895b 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 @@ -20,7 +20,7 @@ trait BaseEntity { case class Entity(id: UUID, name: String, walletId: UUID, createdAt: Instant, updatedAt: Instant) extends BaseEntity { def withUpdatedAt(updatedAt: Instant = Instant.now()): Entity = copy(updatedAt = updatedAt) def withTruncatedTimestamp(unit: ChronoUnit = ChronoUnit.MICROS): Entity = - copy(createdAt = createdAt.truncatedTo(unit), updatedAt.truncatedTo(unit)) + copy(createdAt = createdAt.truncatedTo(unit), updatedAt = updatedAt.truncatedTo(unit)) def role: Either[String, EntityRole] = if (this == Entity.Admin) Right(EntityRole.Admin) 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 2b0ed336d5..853b053433 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 @@ -72,7 +72,7 @@ class JdbcWalletNonSecretStorage(xa: Transactor[ContextAwareTask]) extends Walle walletIds match case Nil => ZIO.succeed(Nil) case head +: tail => - val nel = NonEmptyList.of(head, tail: _*) + val nel = NonEmptyList.of(head, tail*) val conditionFragment = Fragments.in(fr"wallet_id", nel) val cxnIO = sql""" 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 cf1fca29fd..038752f898 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 @@ -31,7 +31,7 @@ class KeyResolver( private def deriveHdKey(path: ManagedDIDHdKeyPath): RIO[WalletAccessContext, Option[Secp256k1KeyPair]] = walletSecretStorage.getWalletSeed.flatMap { case None => ZIO.none - case Some(seed) => apollo.secp256k1.deriveKeyPair(seed.toByteArray)(path.derivationPath: _*).asSome + case Some(seed) => apollo.secp256k1.deriveKeyPair(seed.toByteArray)(path.derivationPath*).asSome } private def getRandKey( diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala index 2973014bf3..e9f740ac04 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala @@ -196,7 +196,7 @@ class OperationFactory(apollo: Apollo) { } private def deriveSecp256k1KeyPair(seed: Array[Byte], path: ManagedDIDHdKeyPath): UIO[Secp256k1KeyPair] = - apollo.secp256k1.deriveKeyPair(seed)(path.derivationPath: _*) + apollo.secp256k1.deriveKeyPair(seed)(path.derivationPath*) private def toPublicKeyData(publicKey: Secp256k1PublicKey | Ed25519PublicKey | X25519PublicKey): PublicKeyData = publicKey match { 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 8fc06d0a63..08f4bafb53 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 @@ -55,7 +55,7 @@ private class ConnectionServiceImpl( count <- connectionRepository.create(record) } yield record - private[this] def validateInputs( + private def validateInputs( label: Option[String], goalCode: Option[String], goal: Option[String] @@ -78,14 +78,14 @@ private class ConnectionServiceImpl( limit: Int, states: ProtocolState* ): URIO[WalletAccessContext, Seq[ConnectionRecord]] = - connectionRepository.findByStates(ignoreWithZeroRetries, limit, states: _*) + connectionRepository.findByStates(ignoreWithZeroRetries, limit, states*) override def findRecordsByStatesForAllWallets( ignoreWithZeroRetries: Boolean, limit: Int, states: ProtocolState* ): UIO[Seq[ConnectionRecord]] = - connectionRepository.findByStatesForAllWallets(ignoreWithZeroRetries, limit, states: _*) + connectionRepository.findByStatesForAllWallets(ignoreWithZeroRetries, limit, states*) override def findRecordById( recordId: UUID @@ -256,7 +256,7 @@ private class ConnectionServiceImpl( record <- connectionRepository.getById(record.id) } yield record - private[this] def getRecordByIdAndStates( + private def getRecordByIdAndStates( recordId: UUID, states: ProtocolState* ): ZIO[WalletAccessContext, RecordIdNotFound | InvalidStateForOperation, ConnectionRecord] = { @@ -267,7 +267,7 @@ private class ConnectionServiceImpl( } yield record } - private[this] def getRecordByThreadIdAndStates( + private def getRecordByThreadIdAndStates( thid: String, states: ProtocolState* ): ZIO[WalletAccessContext, ThreadIdNotFound | InvalidStateForOperation, ConnectionRecord] = { @@ -278,13 +278,13 @@ private class ConnectionServiceImpl( } yield record } - private[this] def ensureRecordHasExpectedState(record: ConnectionRecord, states: ProtocolState*) = + private def ensureRecordHasExpectedState(record: ConnectionRecord, states: ProtocolState*) = record.protocolState match { case s if states.contains(s) => ZIO.unit case state => ZIO.fail(InvalidStateForOperation(state)) } - private[this] def updateConnectionProtocolState( + private def updateConnectionProtocolState( recordId: UUID, from: ProtocolState, to: ProtocolState, 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 6d39f88f6d..4aeec45ac5 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 @@ -73,13 +73,13 @@ class ConnectionServiceNotifier( ] = notifyOnSuccess(svc.receiveConnectionResponse(response)) - private[this] def notifyOnSuccess[E](effect: ZIO[WalletAccessContext, E, ConnectionRecord]) = + private def notifyOnSuccess[E](effect: ZIO[WalletAccessContext, E, ConnectionRecord]) = for { record <- effect _ <- notify(record) } yield record - private[this] def notify(record: ConnectionRecord) = { + private def notify(record: ConnectionRecord) = { val result = for { walletId <- ZIO.serviceWith[WalletAccessContext](_.walletId) producer <- eventNotificationService.producer[ConnectionRecord]("Connect") @@ -115,14 +115,14 @@ class ConnectionServiceNotifier( limit: Int, states: ConnectionRecord.ProtocolState* ): URIO[WalletAccessContext, Seq[ConnectionRecord]] = - svc.findRecordsByStates(ignoreWithZeroRetries, limit, states: _*) + svc.findRecordsByStates(ignoreWithZeroRetries, limit, states*) override def findRecordsByStatesForAllWallets( ignoreWithZeroRetries: Boolean, limit: Int, states: ConnectionRecord.ProtocolState* ): UIO[Seq[ConnectionRecord]] = - svc.findRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states: _*) + svc.findRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states*) } object ConnectionServiceNotifier { 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 7819d1667d..def56b6df9 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 @@ -119,7 +119,7 @@ class JdbcConnectionRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ limit: Int, states: ConnectionRecord.ProtocolState* ): URIO[WalletAccessContext, Seq[ConnectionRecord]] = { - getRecordsByStates(ignoreWithZeroRetries, limit, states: _*) + getRecordsByStates(ignoreWithZeroRetries, limit, states*) .transactWallet(xa) .orDie } @@ -129,7 +129,7 @@ class JdbcConnectionRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ limit: Int, states: ConnectionRecord.ProtocolState* ): UIO[Seq[ConnectionRecord]] = { - getRecordsByStates(ignoreWithZeroRetries, limit, states: _*) + getRecordsByStates(ignoreWithZeroRetries, limit, states*) .transact(xb) .orDie } @@ -143,7 +143,7 @@ class JdbcConnectionRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ case Nil => connection.pure(Nil) case head +: tail => - val nel = NonEmptyList.of(head, tail: _*) + val nel = NonEmptyList.of(head, tail*) val inClauseFragment = Fragments.in(fr"protocol_state", nel) val conditionFragment = Fragments.whereAndOpt( Some(inClauseFragment), 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 5c0c458608..68755a3fef 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 @@ -34,7 +34,7 @@ final case class Migrations(config: DbConfig) { object Migrations { val layer: URLayer[DbConfig, Migrations] = - ZLayer.fromFunction(Migrations.apply _) + ZLayer.fromFunction(Migrations.apply) /** Fail if the RLS is not enabled from a sample table */ def validateRLS: RIO[Transactor[ContextAwareTask], Unit] = { 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 cd78015679..12b48fb1c0 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 @@ -4,10 +4,10 @@ import org.hyperledger.identus.event.notification.EventNotificationServiceError. import zio.{IO, Queue, URLayer, ZIO, ZLayer} import zio.concurrent.ConcurrentMap -class EventNotificationServiceImpl(queueMap: ConcurrentMap[String, Queue[Event[_]]], queueCapacity: Int) +class EventNotificationServiceImpl(queueMap: ConcurrentMap[String, Queue[Event[?]]], queueCapacity: Int) extends EventNotificationService: - private[this] def getOrCreateQueue(topic: String): IO[EventNotificationServiceError, Queue[Event[_]]] = { + private def getOrCreateQueue(topic: String): IO[EventNotificationServiceError, Queue[Event[?]]] = { for { maybeQueue <- queueMap.get(topic) queue <- maybeQueue match @@ -43,7 +43,7 @@ object EventNotificationServiceImpl { val layer: URLayer[Int, EventNotificationServiceImpl] = ZLayer.fromZIO( for { - map <- ConcurrentMap.make[String, Queue[Event[_]]]() + map <- ConcurrentMap.make[String, Queue[Event[?]]]() capacity <- ZIO.service[Int] } yield new EventNotificationServiceImpl(map, capacity) ) 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 a7ec575661..dbc057e55a 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 @@ -5,7 +5,7 @@ import io.circe.syntax.* import io.circe.Decoder import org.hyperledger.identus.mercury.model.{AttachmentDescriptor, Base64, JsonData, JwsData, LinkData} -private[this] trait ReadAttachmentsUtils { +private trait ReadAttachmentsUtils { def attachments: Seq[AttachmentDescriptor] 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 0e6f364c31..301c5127da 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 @@ -335,7 +335,7 @@ private class CredentialServiceImpl( ): ZIO[WalletAccessContext, CredentialServiceError, Seq[IssueCredentialRecord]] = { for { records <- credentialRepository - .getIssueCredentialRecordsByStates(ignoreWithZeroRetries, limit, states: _*) + .getIssueCredentialRecordsByStates(ignoreWithZeroRetries, limit, states*) .mapError(RepositoryError.apply) } yield records } @@ -347,7 +347,7 @@ private class CredentialServiceImpl( ): IO[CredentialServiceError, Seq[IssueCredentialRecord]] = { for { records <- credentialRepository - .getIssueCredentialRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states: _*) + .getIssueCredentialRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states*) .mapError(RepositoryError.apply) } yield records } @@ -405,7 +405,7 @@ private class CredentialServiceImpl( } yield record } - private[this] def validateCredentialOfferAttachment( + private def validateCredentialOfferAttachment( credentialFormat: CredentialFormat, attachment: AttachmentDescriptor ) = for { @@ -502,7 +502,7 @@ private class CredentialServiceImpl( } yield record } - private[this] def createPresentationPayload( + private def createPresentationPayload( record: IssueCredentialRecord, subject: JwtIssuer ): ZIO[WalletAccessContext, CredentialServiceError, PresentationPayload] = { @@ -522,7 +522,7 @@ private class CredentialServiceImpl( } } - private[this] def getLongForm( + private def getLongForm( did: PrismDID, allowUnpublishedIssuingDID: Boolean = false ) = { @@ -539,7 +539,7 @@ private class CredentialServiceImpl( } yield longFormPrismDID } - private[this] def createJwtIssuer( + private def createJwtIssuer( jwtIssuerDID: PrismDID, verificationRelationship: VerificationRelationship ) = { @@ -568,7 +568,7 @@ private class CredentialServiceImpl( } yield jwtIssuer } - private[this] def getEd25519SigningKeyPair( + private def getEd25519SigningKeyPair( jwtIssuerDID: PrismDID, verificationRelationship: VerificationRelationship ) = { @@ -600,7 +600,7 @@ private class CredentialServiceImpl( * @see * org.hyperledger.identus.pollux.vc.jwt.Issuer */ - private[this] def getSDJwtIssuer( + private def getSDJwtIssuer( jwtIssuerDID: PrismDID, verificationRelationship: VerificationRelationship ): ZIO[WalletAccessContext, UnexpectedError, JwtIssuer] = { @@ -741,7 +741,7 @@ private class CredentialServiceImpl( } yield record } - private[this] def createAnonCredsRequestCredential(offerCredential: OfferCredential) = { + private def createAnonCredsRequestCredential(offerCredential: OfferCredential) = { for { attachmentData <- ZIO .fromOption( @@ -893,7 +893,7 @@ private class CredentialServiceImpl( .mapError(RepositoryError.apply) } - private[this] def processAnonCredsCredential( + private def processAnonCredsCredential( record: IssueCredentialRecord, credentialBytes: Array[Byte] ): ZIO[WalletAccessContext, CredentialServiceError, anoncreds.AnoncredCredential] = { @@ -943,7 +943,7 @@ private class CredentialServiceImpl( "issuance_flow_holder_req_generated_to_sent_ms_gauge" ) - private[this] def markCredentialGenerated( + private def markCredentialGenerated( record: IssueCredentialRecord, issueCredential: IssueCredential ): ZIO[WalletAccessContext, CredentialServiceError, IssueCredentialRecord] = { @@ -996,7 +996,7 @@ private class CredentialServiceImpl( case n => ZIO.fail(UnexpectedError(s"Invalid number of records updated: $n")) } - private[this] def getRecordWithState( + private def getRecordWithState( recordId: DidCommID, state: ProtocolState ): ZIO[WalletAccessContext, CredentialServiceError, IssueCredentialRecord] = { @@ -1014,7 +1014,7 @@ private class CredentialServiceImpl( } yield record } - private[this] def getRecordFromThreadIdWithState( + private def getRecordFromThreadIdWithState( thid: Option[DidCommID], ignoreWithZeroRetries: Boolean, states: ProtocolState* @@ -1036,7 +1036,7 @@ private class CredentialServiceImpl( } yield record } - private[this] def createJWTDidCommOfferCredential( + private def createJWTDidCommOfferCredential( pairwiseIssuerDID: DidId, pairwiseHolderDID: DidId, maybeSchemaId: Option[String], @@ -1072,7 +1072,7 @@ private class CredentialServiceImpl( ) } - private[this] def createSDJWTDidCommOfferCredential( + private def createSDJWTDidCommOfferCredential( pairwiseIssuerDID: DidId, pairwiseHolderDID: DidId, maybeSchemaId: Option[String], @@ -1108,7 +1108,7 @@ private class CredentialServiceImpl( ) } - private[this] def createAnonCredsDidCommOfferCredential( + private def createAnonCredsDidCommOfferCredential( pairwiseIssuerDID: DidId, pairwiseHolderDID: DidId, schemaUri: String, @@ -1141,7 +1141,7 @@ private class CredentialServiceImpl( ) } - private[this] def createAnonCredsCredentialOffer(credentialDefinitionGUID: UUID, credentialDefinitionId: String) = + private def createAnonCredsCredentialOffer(credentialDefinitionGUID: UUID, credentialDefinitionId: String) = for { credentialDefinition <- credentialDefinitionService .getByGUID(credentialDefinitionGUID) @@ -1159,7 +1159,7 @@ private class CredentialServiceImpl( offer = AnoncredLib.createOffer(createCredentialDefinition, credentialDefinitionId) } yield offer - private[this] def createDidCommRequestCredential( + private def createDidCommRequestCredential( format: IssueCredentialOfferFormat, offer: OfferCredential, signedPresentation: JWT @@ -1184,7 +1184,7 @@ private class CredentialServiceImpl( ) } - private[this] def createDidCommIssueCredential(request: RequestCredential): IssueCredential = { + private def createDidCommIssueCredential(request: RequestCredential): IssueCredential = { IssueCredential( body = IssueCredential.Body( goal_code = request.body.goal_code, @@ -1207,7 +1207,7 @@ private class CredentialServiceImpl( * * TODO: this should be improved to behave exactly like atomic operation. */ - private[this] def updateCredentialRecordProtocolState( + private def updateCredentialRecordProtocolState( id: DidCommID, from: IssueCredentialRecord.ProtocolState, to: IssueCredentialRecord.ProtocolState @@ -1391,7 +1391,7 @@ private class CredentialServiceImpl( } - private[this] def allocateNewCredentialInStatusListForWallet( + private def allocateNewCredentialInStatusListForWallet( record: IssueCredentialRecord, statusListRegistryUrl: String, jwtIssuer: JwtIssuer @@ -1457,7 +1457,7 @@ private class CredentialServiceImpl( } yield record } - private[this] def createAnonCredsCredential(record: IssueCredentialRecord) = { + private def createAnonCredsCredential(record: IssueCredentialRecord) = { for { credentialDefinitionId <- ZIO .fromOption(record.credentialDefinitionId) @@ -1517,7 +1517,7 @@ private class CredentialServiceImpl( } yield credential } - private[this] def getOptionsFromOfferCredentialData(record: IssueCredentialRecord) = { + private def getOptionsFromOfferCredentialData(record: IssueCredentialRecord) = { for { offer <- ZIO .fromOption(record.offerCredentialData) @@ -1534,7 +1534,7 @@ private class CredentialServiceImpl( } yield maybeOptions } - private[this] def getJwtFromRequestCredentialData(record: IssueCredentialRecord) = { + private def getJwtFromRequestCredentialData(record: IssueCredentialRecord) = { for { request <- ZIO .fromOption(record.requestCredentialData) @@ -1552,7 +1552,7 @@ private class CredentialServiceImpl( } yield jwt } - private[this] def validateRequestCredentialDataProof(maybeOptions: Option[Options], jwt: JWT) = { + private def validateRequestCredentialDataProof(maybeOptions: Option[Options], jwt: JWT) = { for { _ <- maybeOptions match case None => ZIO.unit 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 1cce3dc880..045ef198a4 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 @@ -160,13 +160,13 @@ class CredentialServiceNotifier( ): ZIO[WalletAccessContext, CredentialServiceError, IssueCredentialRecord] = notifyOnSuccess(svc.generateAnonCredsCredential(recordId)) - private[this] def notifyOnSuccess[R](effect: ZIO[R, CredentialServiceError, IssueCredentialRecord]) = + private def notifyOnSuccess[R](effect: ZIO[R, CredentialServiceError, IssueCredentialRecord]) = for { record <- effect _ <- notify(record) } yield record - private[this] def notify(record: IssueCredentialRecord) = { + private def notify(record: IssueCredentialRecord) = { val result = for { walletId <- ZIO.serviceWith[WalletAccessContext](_.walletId) producer <- eventNotificationService.producer[IssueCredentialRecord]("Issue") @@ -204,14 +204,14 @@ class CredentialServiceNotifier( limit: Int, states: IssueCredentialRecord.ProtocolState* ): ZIO[WalletAccessContext, CredentialServiceError, Seq[IssueCredentialRecord]] = - svc.getIssueCredentialRecordsByStates(ignoreWithZeroRetries, limit, states: _*) + svc.getIssueCredentialRecordsByStates(ignoreWithZeroRetries, limit, states*) override def getIssueCredentialRecordsByStatesForAllWallets( ignoreWithZeroRetries: Boolean, limit: Int, states: IssueCredentialRecord.ProtocolState* ): IO[CredentialServiceError, Seq[IssueCredentialRecord]] = - svc.getIssueCredentialRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states: _*) + svc.getIssueCredentialRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states*) } object CredentialServiceNotifier { 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 388b736a8b..7ffb6a1326 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 @@ -429,7 +429,7 @@ private class PresentationServiceImpl( ): ZIO[WalletAccessContext, PresentationError, Seq[PresentationRecord]] = { for { records <- presentationRepository - .getPresentationRecordsByStates(ignoreWithZeroRetries, limit, states: _*) + .getPresentationRecordsByStates(ignoreWithZeroRetries, limit, states*) .mapError(RepositoryError.apply) } yield records } @@ -441,7 +441,7 @@ private class PresentationServiceImpl( ): IO[PresentationError, Seq[PresentationRecord]] = { for { records <- presentationRepository - .getPresentationRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states: _*) + .getPresentationRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, states*) .mapError(RepositoryError.apply) } yield records } @@ -1012,7 +1012,7 @@ private class PresentationServiceImpl( } yield record } - private[this] def getRecordWithState( + private def getRecordWithState( recordId: DidCommID, state: ProtocolState ): ZIO[WalletAccessContext, PresentationError, PresentationRecord] = { @@ -1170,7 +1170,7 @@ private class PresentationServiceImpl( case n => ZIO.fail(UnexpectedError(s"Invalid number of records updated: $n")) } - private[this] def getRecordFromThreadId( + private def getRecordFromThreadId( thid: Option[String] ): ZIO[WalletAccessContext, PresentationError, PresentationRecord] = { for { @@ -1187,14 +1187,14 @@ private class PresentationServiceImpl( } yield record } - private[this] def toJWTAttachment(options: Options): AttachmentDescriptor = { + private def toJWTAttachment(options: Options): AttachmentDescriptor = { AttachmentDescriptor.buildJsonAttachment( payload = PresentationAttachment.build(Some(options)), format = Some(PresentCredentialRequestFormat.JWT.name) ) } - private[this] def toSDJWTAttachment( + private def toSDJWTAttachment( options: Options, claimsToDsiclose: ast.Json.Obj ): AttachmentDescriptor = { @@ -1205,7 +1205,7 @@ private class PresentationServiceImpl( ) } - private[this] def toAnoncredAttachment( + private def toAnoncredAttachment( presentationRequest: AnoncredPresentationRequestV1 ): AttachmentDescriptor = { AttachmentDescriptor.buildBase64Attachment( @@ -1215,7 +1215,7 @@ private class PresentationServiceImpl( ) } - private[this] def createDidCommRequestPresentation( + private def createDidCommRequestPresentation( proofTypes: Seq[ProofType], thid: DidCommID, pairwiseVerifierDID: DidId, @@ -1234,7 +1234,7 @@ private class PresentationServiceImpl( ) } - private[this] def createDidCommRequestPresentationFromProposal( + private def createDidCommRequestPresentationFromProposal( proposePresentation: ProposePresentation ): RequestPresentation = { // TODO to review what is needed @@ -1249,7 +1249,7 @@ private class PresentationServiceImpl( ) } - private[this] def updatePresentationRecordProtocolState( + private def updatePresentationRecordProtocolState( id: DidCommID, from: PresentationRecord.ProtocolState, to: PresentationRecord.ProtocolState 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 b78b6841e4..b1c9a1ae8e 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 @@ -172,13 +172,13 @@ class PresentationServiceNotifier( ): ZIO[WalletAccessContext, PresentationError, PresentationRecord] = notifyOnSuccess(svc.rejectPresentation(recordId)) - private[this] def notifyOnSuccess[R](effect: ZIO[R, PresentationError, PresentationRecord]) = + private def notifyOnSuccess[R](effect: ZIO[R, PresentationError, PresentationRecord]) = for { record <- effect _ <- notify(record) } yield record - private[this] def notify(record: PresentationRecord) = { + private def notify(record: PresentationRecord) = { val result = for { walletId <- ZIO.serviceWith[WalletAccessContext](_.walletId) producer <- eventNotificationService.producer[PresentationRecord]("Presentation") @@ -235,14 +235,14 @@ class PresentationServiceNotifier( limit: Int, state: PresentationRecord.ProtocolState* ): ZIO[WalletAccessContext, PresentationError, Seq[PresentationRecord]] = - svc.getPresentationRecordsByStates(ignoreWithZeroRetries, limit, state: _*) + svc.getPresentationRecordsByStates(ignoreWithZeroRetries, limit, state*) override def getPresentationRecordsByStatesForAllWallets( ignoreWithZeroRetries: Boolean, limit: Int, state: PresentationRecord.ProtocolState* ): IO[PresentationError, Seq[PresentationRecord]] = - svc.getPresentationRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, state: _*) + svc.getPresentationRecordsByStatesForAllWallets(ignoreWithZeroRetries, limit, state*) override def getPresentationRecord( recordId: DidCommID 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 508453a23c..93a9ac0cfd 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 @@ -7,7 +7,7 @@ import zio.json.ast.Json.* private[sdjwt] object QueryUtils { type AUX = Bool | Str | Num | Json.Null | None.type - def getCursors(queryJson: Json, cursor: JsonCursor[_, _]): Seq[(JsonCursor[_, ast.Json], AUX)] = { + def getCursors(queryJson: Json, cursor: JsonCursor[?, ?]): Seq[(JsonCursor[?, ast.Json], AUX)] = { queryJson match case Obj(fields) if fields.isEmpty => Seq((cursor, None)) // especial case for SD-JDT lib case value: Bool => Seq((cursor, value)) diff --git a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepository.scala b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepository.scala index a301b7ccb8..ecba399df0 100644 --- a/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepository.scala +++ b/pollux/sql-doobie/src/main/scala/org/hyperledger/identus/pollux/sql/repository/JdbcCredentialRepository.scala @@ -189,7 +189,7 @@ class JdbcCredentialRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ connection.pure(Nil) case head +: tail => val conditionFragment = { - val nel = NonEmptyList.of(head, tail: _*) + val nel = NonEmptyList.of(head, tail*) val inClauseFragment = Fragments.in(fr"protocol_state", nel) if (!ignoreWithZeroRetries) inClauseFragment else Fragments.and(inClauseFragment, fr"meta_retries > 0") @@ -232,7 +232,7 @@ class JdbcCredentialRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ limit: Int, states: IssueCredentialRecord.ProtocolState* ): RIO[WalletAccessContext, Seq[IssueCredentialRecord]] = { - getRecordsByStates(ignoreWithZeroRetries, limit, states: _*).transactWallet(xa) + getRecordsByStates(ignoreWithZeroRetries, limit, states*).transactWallet(xa) } override def getIssueCredentialRecordsByStatesForAllWallets( @@ -240,7 +240,7 @@ class JdbcCredentialRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ limit: Int, states: IssueCredentialRecord.ProtocolState* ): Task[Seq[IssueCredentialRecord]] = { - getRecordsByStates(ignoreWithZeroRetries, limit, states: _*).transact(xb) + getRecordsByStates(ignoreWithZeroRetries, limit, states*).transact(xb) } override def getIssueCredentialRecord( recordId: DidCommID @@ -426,7 +426,7 @@ class JdbcCredentialRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ recordIds: Seq[DidCommID] ): RIO[WalletAccessContext, Seq[ValidIssuedCredentialRecord]] = { val idAsStrings = recordIds.map(_.toString) - val nel = NonEmptyList.of(idAsStrings.head, idAsStrings.tail: _*) + val nel = NonEmptyList.of(idAsStrings.head, idAsStrings.tail*) val inClauseFragment = Fragments.in(fr"id", nel) val cxnIO = sql""" @@ -452,7 +452,7 @@ class JdbcCredentialRepository(xa: Transactor[ContextAwareTask], xb: Transactor[ recordIds: Seq[DidCommID] ): RIO[WalletAccessContext, Seq[ValidFullIssuedCredentialRecord]] = { val idAsStrings = recordIds.map(_.toString) - val nel = NonEmptyList.of(idAsStrings.head, idAsStrings.tail: _*) + val nel = NonEmptyList.of(idAsStrings.head, idAsStrings.tail*) val inClauseFragment = Fragments.in(fr"id", nel) val cxnIO = sql""" 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 ae0bcac0da..16e51df8ae 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 @@ -257,7 +257,7 @@ class JdbcPresentationRepository( case Nil => connection.pure(Nil) case head +: tail => - val nel = NonEmptyList.of(head, tail: _*) + val nel = NonEmptyList.of(head, tail*) val inClauseFragment = Fragments.in(fr"protocol_state", nel) val conditionFragment = Fragments.whereAndOpt( Some(inClauseFragment), @@ -300,14 +300,14 @@ class JdbcPresentationRepository( limit: Int, states: PresentationRecord.ProtocolState* ): RIO[WalletAccessContext, Seq[PresentationRecord]] = { - getRecordsByStates(ignoreWithZeroRetries, limit, states: _*).transactWallet(xa) + getRecordsByStates(ignoreWithZeroRetries, limit, states*).transactWallet(xa) } override def getPresentationRecordsByStatesForAllWallets( ignoreWithZeroRetries: Boolean, limit: Int, states: PresentationRecord.ProtocolState* ): Task[Seq[PresentationRecord]] = { - getRecordsByStates(ignoreWithZeroRetries, limit, states: _*).transact(xb) + getRecordsByStates(ignoreWithZeroRetries, limit, states*).transact(xb) } override def getPresentationRecord(recordId: DidCommID): RIO[WalletAccessContext, Option[PresentationRecord]] = { 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 13d2e5f32d..8b74727aa0 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 @@ -35,7 +35,7 @@ final case class Migrations(config: DbConfig) { object Migrations { val layer: URLayer[DbConfig, Migrations] = - ZLayer.fromFunction(Migrations.apply _) + ZLayer.fromFunction(Migrations.apply) /** Fail if the RLS is not enabled from a sample table */ def validateRLS: RIO[Transactor[ContextAwareTask], Unit] = { 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 2343e0660a..c42fc9a684 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 @@ -11,7 +11,7 @@ import zio.interop.catz.* import java.util.UUID trait ContextAware -type ContextAwareTask[T] = Task[T] with ContextAware +type ContextAwareTask[T] = Task[T] & ContextAware object Implicits { From c2c148b3c0b1a06489133d0aff3fc6043fb6281c Mon Sep 17 00:00:00 2001 From: FabioPinheiro Date: Mon, 3 Jun 2024 13:30:51 +0100 Subject: [PATCH 2/4] style: remove deprecated Scala syntax in test Signed-off-by: FabioPinheiro --- .../hyperledger/identus/api/util/Tapir2StaticOAS.scala | 2 +- .../identus/container/util/MigrationAspect.scala | 6 +++--- .../authentication/apikey/ApiKeyAuthenticatorSpec.scala | 2 +- .../issue/controller/IssueControllerImplSpec.scala | 2 +- .../issue/controller/IssueControllerTestTools.scala | 2 +- .../CredentialDefinitionTestTools.scala | 2 +- .../identus/pollux/schema/CredentialSchemaTestTools.scala | 2 +- .../controller/VcVerificationControllerTestTools.scala | 2 +- .../identus/agent/walletapi/benchmark/KeyDerivation.scala | 4 ++-- .../hyperledger/identus/test/container/DBTestUtils.scala | 4 ++-- .../repository/ConnectionRepositoryInMemorySpec.scala | 2 +- .../core/service/ConnectionServiceNotifierSpec.scala | 4 ++-- .../sql/repository/JdbcConnectionRepositorySpec.scala | 2 +- .../notification/EventNotificationServiceImplSpec.scala | 2 +- .../mercury/protocol/invitation/v2/OutOfBandSpec.scala | 2 +- .../protocol/anotherclasspath/UtilsCredentialSpec.scala | 4 ++-- .../pollux/core/model/schema/AnoncredSchemaTypeSpec.scala | 2 +- .../pollux/core/model/schema/CredentialSchemaSpec.scala | 2 +- .../repository/CredentialRepositoryInMemorySpec.scala | 2 +- .../repository/PresentationRepositoryInMemorySpec.scala | 2 +- .../core/service/CredentialServiceNotifierSpec.scala | 2 +- .../core/service/PresentationServiceNotifierSpec.scala | 2 +- .../service/serdes/AnoncredPresentationRequestSpec.scala | 2 +- .../core/service/serdes/AnoncredPresentationSpec.scala | 2 +- .../PublicCredentialDefinitionSchemaSerDesSpec.scala | 2 +- .../verification/VcVerificationServiceSpecHelper.scala | 2 +- .../sql/CredentialDefinitionSqlIntegrationSpec.scala | 4 ++-- .../pollux/sql/CredentialSchemaSqlIntegrationSpec.scala | 2 +- .../identus/test/container/MigrationAspect.scala | 6 +++--- .../hyperledger/identus/shared/crypto/ApolloSpec.scala | 4 ++-- .../sharedtest/containers/KeycloakContainerCustom.scala | 6 +++--- .../sharedtest/containers/VaultContainerCustom.scala | 8 ++++---- 32 files changed, 47 insertions(+), 47 deletions(-) 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 01cf032b11..4913910d9b 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 @@ -28,7 +28,7 @@ import scala.util.Using object Tapir2StaticOAS extends ZIOAppDefault { - @main override def run: ZIO[Any with ZIOAppArgs with Scope, Any, Any] = { + @main override def run: ZIO[Any & ZIOAppArgs & Scope, Any, Any] = { val effect = for { args <- getArgs _ <- ZIO.when(args.length != 2)(ZIO.fail("Usage: Tapir2StaticOAS ")) 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 ad5b344908..d425b89a4c 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 @@ -10,7 +10,7 @@ object MigrationAspects { def migrate(schema: String, paths: String*): TestAspectAtLeastR[PostgreSQLContainer] = { val migration = for { pg <- ZIO.service[PostgreSQLContainer] - _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths: _*) + _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths*) } yield () beforeAll(migration.orDie) @@ -19,7 +19,7 @@ object MigrationAspects { def migrateEach(schema: String, paths: String*): TestAspectAtLeastR[PostgreSQLContainer] = { val migration = for { pg <- ZIO.service[PostgreSQLContainer] - _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths: _*) + _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths*) } yield () before(migration.orDie) @@ -37,7 +37,7 @@ object MigrationAspects { .configure() .dataSource(url, username, password) .schemas(schema) - .locations(locations: _*) + .locations(locations*) .load() .migrate() } 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 006646d484..8720e26af3 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 @@ -63,7 +63,7 @@ object ApiKeyAuthenticatorSpec extends ZIOSpecDefault, PostgresTestContainerSupp pgContainerLayer ) - override def spec: Spec[TestEnvironment with Scope, Any] = { + override def spec: Spec[TestEnvironment & Scope, Any] = { val testSuite = suite("ApiKeyAuthenticatorSpec")( authenticationDisabledSpec, authenticationEnabledSingleTenantSpec, 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 a8f19bd4af..b1853aef64 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 @@ -108,7 +108,7 @@ object IssueControllerImplSpec extends ZIOSpecDefault with IssueControllerTestTo None, ConnectionRecord.Role.Inviter, ConnectionRecord.ProtocolState.ConnectionResponseSent, - Invitation(from = DidId("did:peer:INVITER"), Invitation.Body(None, None, Nil)), + Invitation(from = DidId("did:peer:INVITER"), body = Invitation.Body(None, None, Nil)), None, Some(connectionResponse), 5, 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 ec5813c04d..bcc8e989ab 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 @@ -44,7 +44,7 @@ trait IssueControllerTestTools extends PostgresTestContainerSupport { .load(AppConfig.config) ) - private[this] def makeResolver(lookup: Map[String, DIDDocument]): DidResolver = (didUrl: String) => { + private def makeResolver(lookup: Map[String, DIDDocument]): DidResolver = (didUrl: String) => { lookup .get(didUrl) .fold( 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 71512bfc9a..0d3bedc7aa 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 @@ -128,7 +128,7 @@ trait CredentialDefinitionTestTools extends PostgresTestContainerSupport { } trait CredentialDefinitionGen { - self: ZIOSpecDefault with CredentialDefinitionTestTools => + self: ZIOSpecDefault & CredentialDefinitionTestTools => object Generator { val credentialDefinitionName = Gen.alphaNumericStringBounded(4, 12) val majorVersion = Gen.int(1, 9) 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 122ec4675e..91965a9dc3 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 @@ -122,7 +122,7 @@ trait CredentialSchemaTestTools extends PostgresTestContainerSupport { } trait CredentialSchemaGen { - self: ZIOSpecDefault with CredentialSchemaTestTools => + self: ZIOSpecDefault & CredentialSchemaTestTools => object Generator { val schemaName = Gen.alphaNumericStringBounded(4, 12) val majorVersion = Gen.int(1, 9) 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 e37c704cdd..96b5d7cabf 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 @@ -36,7 +36,7 @@ trait VcVerificationControllerTestTools extends PostgresTestContainerSupport { val didResolverLayer = ZLayer.fromZIO(ZIO.succeed(makeResolver(Map.empty))) - private[this] def makeResolver(lookup: Map[String, DIDDocument]): DidResolver = (didUrl: String) => { + private def makeResolver(lookup: Map[String, DIDDocument]): DidResolver = (didUrl: String) => { lookup .get(didUrl) .fold( 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 58bf0ee435..5a1c62c0bc 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 @@ -58,7 +58,7 @@ object KeyDerivation extends ZIOSpecDefault, VaultTestContainerSupport { .foreachPar(1 to 50_000) { i => Live.live { apollo.secp256k1 - .deriveKeyPair(seed)(derivationPath(keyIndex = i): _*) + .deriveKeyPair(seed)(derivationPath(keyIndex = i)*) .timed .map(_._1) } @@ -97,7 +97,7 @@ object KeyDerivation extends ZIOSpecDefault, VaultTestContainerSupport { apollo <- ZIO.service[Apollo] _ <- ZIO .foreach(1 to n) { i => - apollo.secp256k1.deriveKeyPair(seed)(derivationPath(keyIndex = i): _*) + apollo.secp256k1.deriveKeyPair(seed)(derivationPath(keyIndex = i)*) } } yield () } 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 df05587650..95e08b1a8c 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 @@ -13,7 +13,7 @@ object DBTestUtils { def runMigrationPgContainer(schema: String, paths: String*): RIO[PostgreSQLContainer, MigrateResult] = for { pg <- ZIO.service[PostgreSQLContainer] - result <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths: _*) + result <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths*) } yield result def runMigration( @@ -28,7 +28,7 @@ object DBTestUtils { .configure() .dataSource(url, username, password) .schemas(schema) - .locations(locations: _*) + .locations(locations*) .load() .migrate() } diff --git a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemorySpec.scala b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemorySpec.scala index 38751293bc..9726ceca42 100644 --- a/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemorySpec.scala +++ b/connect/core/src/test/scala/org/hyperledger/identus/connect/core/repository/ConnectionRepositoryInMemorySpec.scala @@ -5,7 +5,7 @@ import zio.test.* object ConnectionRepositoryInMemorySpec extends ZIOSpecDefault { - override def spec: Spec[TestEnvironment with Scope, Any] = + override def spec: Spec[TestEnvironment & Scope, Any] = suite("In Memory Connection Repository test suite")( ConnectionRepositorySpecSuite.testSuite, ConnectionRepositorySpecSuite.multitenantTestSuite 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 a22fa8bb77..966be4919e 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 @@ -28,7 +28,7 @@ object ConnectionServiceNotifierSpec extends ZIOSpecDefault { None, ConnectionRecord.Role.Inviter, ProtocolState.InvitationGenerated, - Invitation(from = DidId("did:peer:INVITER"), Invitation.Body(None, None, Nil)), + Invitation(from = DidId("did:peer:INVITER"), body = Invitation.Body(None, None, Nil)), None, None, 5, @@ -66,7 +66,7 @@ object ConnectionServiceNotifierSpec extends ZIOSpecDefault { result = Expectation.value(record.copy(protocolState = ProtocolState.ConnectionResponseReceived)) ) - override def spec: Spec[TestEnvironment with Scope, Any] = { + override def spec: Spec[TestEnvironment & Scope, Any] = { suite("ConnectionServiceWithEventNotificationImpl")( test("should send relevant events during flow execution on the inviter side") { for { diff --git a/connect/sql-doobie/src/test/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepositorySpec.scala b/connect/sql-doobie/src/test/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepositorySpec.scala index 13d10d6663..ade1191617 100644 --- a/connect/sql-doobie/src/test/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepositorySpec.scala +++ b/connect/sql-doobie/src/test/scala/org/hyperledger/identus/connect/sql/repository/JdbcConnectionRepositorySpec.scala @@ -24,7 +24,7 @@ object JdbcConnectionRepositorySpec extends ZIOSpecDefault, PostgresTestContaine systemTransactorLayer ) - override def spec: Spec[TestEnvironment with Scope, Any] = + override def spec: Spec[TestEnvironment & Scope, Any] = (suite("JDBC Connection Repository test suite")( ConnectionRepositorySpecSuite.testSuite, ConnectionRepositorySpecSuite.multitenantTestSuite 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 b6a62c0f04..8556828fe8 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 @@ -8,7 +8,7 @@ object EventNotificationServiceImplSpec extends ZIOSpecDefault { private val eventNotificationServiceLayer = ZLayer.succeed(10) >>> EventNotificationServiceImpl.layer - override def spec: Spec[TestEnvironment with Scope, Any] = { + override def spec: Spec[TestEnvironment & Scope, Any] = { suite("EventNotificationServiceImpl")( test("should send events between a producer and a consumer of the same topic") { for { 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 d6729e8e5a..182dbacb43 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 @@ -13,7 +13,7 @@ class OutOfBandSpec extends FunSuite { val ret = OutOfBand.parseInvitation(link) - assert(ret.isInstanceOf[Right[_, Invitation]]) + assert(ret.isInstanceOf[Right[?, Invitation]]) val expected = Invitation( "421dbbc8-57ca-4341-aa3a-f5b4215c568f", 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 3eac012cb5..670320daf2 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 @@ -17,8 +17,8 @@ import org.hyperledger.identus.mercury.protocol.issuecredential.{ RequestCredential } -private[this] case class TestCredentialType(a: String, b: Int, x: Long, name: String, dob: String) -private[this] object TestCredentialType { +private case class TestCredentialType(a: String, b: Int, x: Long, name: String, dob: String) +private object TestCredentialType { given Encoder[TestCredentialType] = deriveEncoder[TestCredentialType] given Decoder[TestCredentialType] = deriveDecoder[TestCredentialType] } 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 b8e2dfb9f3..365d266a06 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 @@ -12,7 +12,7 @@ import zio.test.Assertion.* import scala.util.Random object AnoncredSchemaTypeSpec extends ZIOSpecDefault { - override def spec: Spec[TestEnvironment with Scope, Any] = suite("AnoncredSchemaTypeTest")( + override def spec: Spec[TestEnvironment & Scope, Any] = suite("AnoncredSchemaTypeTest")( test("should validate a correct schema") { val jsonSchema = """ 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 d34ae1cef6..a7c580765c 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 @@ -48,7 +48,7 @@ object CredentialSchemaSpec extends ZIOSpecDefault { ) } - override def spec: Spec[TestEnvironment with Scope, Any] = suite("CredentialSchemaTest")( + override def spec: Spec[TestEnvironment & Scope, Any] = suite("CredentialSchemaTest")( suite("resolveCredentialSchemaType")( test("should return AnoncredSchemaType for a supported schema type") { 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 e2c9ceeb9b..fe5d351af2 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 @@ -6,7 +6,7 @@ import zio.test.* /** core/testOnly org.hyperledger.identus.pollux.core.repository.CredentialRepositoryInMemorySpec */ object CredentialRepositoryInMemorySpec extends ZIOSpecDefault { - override def spec: Spec[TestEnvironment with Scope, Any] = + override def spec: Spec[TestEnvironment & Scope, Any] = suite("Credential Repository In Memory test suite")( CredentialRepositorySpecSuite.testSuite, CredentialRepositorySpecSuite.multitenantTestSuite 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 9df1d7825b..dade416b6b 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 @@ -5,7 +5,7 @@ import zio.test.* object PresentationRepositoryInMemorySpec extends ZIOSpecDefault { - override def spec: Spec[TestEnvironment with Scope, Any] = + override def spec: Spec[TestEnvironment & Scope, Any] = suite("Presentation Repository In Memory test suite")( PresentationRepositorySpecSuite.testSuite, PresentationRepositorySpecSuite.multitenantTestSuite 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 7610760cef..e90af8ed4c 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 @@ -86,7 +86,7 @@ object CredentialServiceNotifierSpec extends MockSpecDefault with CredentialServ result = Expectation.value(issueCredentialRecord.copy(protocolState = ProtocolState.CredentialReceived)) ) - override def spec: Spec[TestEnvironment with Scope, Any] = { + override def spec: Spec[TestEnvironment & Scope, Any] = { suite("CredentialServiceWithEventNotificationImpl")( test("Happy flow generates relevant events on issuer side") { for { 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 3c39901dbd..608e92305b 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 @@ -100,7 +100,7 @@ object PresentationServiceNotifierSpec extends ZIOSpecDefault with PresentationS result = Expectation.value(record.copy(protocolState = ProtocolState.RequestRejected)) ) - override def spec: Spec[TestEnvironment with Scope, Any] = + override def spec: Spec[TestEnvironment & Scope, Any] = suite("PresentationServiceWithEventNotificationImpl")( test("Happy flow generates relevant events on the verifier side") { for { diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationRequestSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationRequestSpec.scala index 3abbb9f4db..a865cbd9a3 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationRequestSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationRequestSpec.scala @@ -43,7 +43,7 @@ object AnoncredPresentationRequestSpec extends ZIOSpecDefault { |} |""".stripMargin - override def spec: Spec[TestEnvironment with Scope, Any] = suite("AnoncredPresentationRequestSerDes")( + override def spec: Spec[TestEnvironment & Scope, Any] = suite("AnoncredPresentationRequestSerDes")( test("should validate a correct schema") { assertZIO(AnoncredPresentationRequestV1.schemaSerDes.validate(json))(isUnit) }, diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationSpec.scala index d3795f378c..6845a08e5e 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/AnoncredPresentationSpec.scala @@ -102,7 +102,7 @@ object AnoncredPresentationSpec extends ZIOSpecDefault { | |""".stripMargin - override def spec: Spec[TestEnvironment with Scope, Any] = suite("AnoncredPresentationRequestSerDes")( + override def spec: Spec[TestEnvironment & Scope, Any] = suite("AnoncredPresentationRequestSerDes")( test("should validate a correct schema") { assertZIO(AnoncredPresentationV1.schemaSerDes.validate(json))(isUnit) }, diff --git a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/PublicCredentialDefinitionSchemaSerDesSpec.scala b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/PublicCredentialDefinitionSchemaSerDesSpec.scala index e3de5b4407..67e2c53c0b 100644 --- a/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/PublicCredentialDefinitionSchemaSerDesSpec.scala +++ b/pollux/core/src/test/scala/org/hyperledger/identus/pollux/core/service/serdes/PublicCredentialDefinitionSchemaSerDesSpec.scala @@ -44,7 +44,7 @@ object PublicCredentialDefinitionSchemaSerDesSpec extends ZIOSpecDefault { |} |""".stripMargin - override def spec: Spec[TestEnvironment with Scope, Any] = suite("PublicCredentialDefinitionSerDes")( + override def spec: Spec[TestEnvironment & Scope, Any] = suite("PublicCredentialDefinitionSerDes")( test("should validate a correct schema") { assertZIO(PublicCredentialDefinitionSerDesV1.schemaSerDes.validate(json))(isUnit) }, 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 e132307c2d..ed178729fd 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 @@ -36,7 +36,7 @@ trait VcVerificationServiceSpecHelper { protected val emptyDidResolverLayer: ZLayer[Any, Nothing, PrismDidResolver] = MockDIDService.empty ++ MockManagedDIDService.empty >>> ZLayer.fromFunction(PrismDidResolver(_)) - protected val vcVerificationServiceLayer: ZLayer[Any, Nothing, VcVerificationService with WalletAccessContext] = + protected val vcVerificationServiceLayer: ZLayer[Any, Nothing, VcVerificationService & WalletAccessContext] = emptyDidResolverLayer ++ ResourceURIDereferencerImpl.layer >>> VcVerificationServiceImpl.layer ++ defaultWalletLayer diff --git a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialDefinitionSqlIntegrationSpec.scala b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialDefinitionSqlIntegrationSpec.scala index c6ffccdadc..87f290aee7 100644 --- a/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialDefinitionSqlIntegrationSpec.scala +++ b/pollux/sql-doobie/src/test/scala/org/hyperledger/identus/pollux/sql/CredentialDefinitionSqlIntegrationSpec.scala @@ -55,13 +55,13 @@ object CredentialDefinitionSqlIntegrationSpec extends ZIOSpecDefault with Postgr Gen.fromIterable(Vocabulary.verifiableCredentialClaims) val credentialDefinitionAttributes = Gen.setOfBounded(1, 4)(credentialDefinitionAttribute).map(_.toList) val jsonCredentialDefinition = - credentialDefinitionAttributes.map(attributes => Json.Arr(attributes.map(Json.Str(_)): _*)) + credentialDefinitionAttributes.map(attributes => Json.Arr(attributes.map(Json.Str(_))*)) val keyCorrectnessProofAttribute = Gen.fromIterable(Vocabulary.verifiableCredentialClaims) val keyCorrectnessProofAttributes = Gen.setOfBounded(1, 4)(credentialDefinitionAttribute).map(_.toList) val jsonCorrectnessProof = - credentialDefinitionAttributes.map(attributes => Json.Arr(attributes.map(Json.Str(_)): _*)) + credentialDefinitionAttributes.map(attributes => Json.Arr(attributes.map(Json.Str(_))*)) val credentialDefinitionAuthor = Gen.int(1000000, 9999999).map(i => s"did:prism:4fb06243213500578f59588de3e1dd9b266ec1b61e43b0ff86ad0712f$i") 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 b27ece79b1..e26b6d5193 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 @@ -55,7 +55,7 @@ object CredentialSchemaSqlIntegrationSpec extends ZIOSpecDefault, PostgresTestCo Gen.fromIterable(Vocabulary.verifiableCredentialClaims) val schemaAttributes = Gen.setOfBounded(1, 4)(schemaAttribute).map(_.toList) val jsonSchema = - schemaAttributes.map(attributes => Json.Arr(attributes.map(Json.Str(_)): _*)) + schemaAttributes.map(attributes => Json.Arr(attributes.map(Json.Str(_))*)) val schemaAuthor = Gen.int(1000000, 9999999).map(i => s"did:prism:4fb06243213500578f59588de3e1dd9b266ec1b61e43b0ff86ad0712f$i") val schemaAuthored = Gen.offsetDateTime 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 f98872beea..9100f74f15 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 @@ -10,7 +10,7 @@ object MigrationAspects { def migrate(schema: String, paths: String*): TestAspectAtLeastR[PostgreSQLContainer] = { val migration = for { pg <- ZIO.service[PostgreSQLContainer] - _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths: _*) + _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths*) } yield () beforeAll(migration.orDie) @@ -19,7 +19,7 @@ object MigrationAspects { def migrateEach(schema: String, paths: String*): TestAspectAtLeastR[PostgreSQLContainer] = { val migration = for { pg <- ZIO.service[PostgreSQLContainer] - _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths: _*) + _ <- runMigration(pg.jdbcUrl, pg.username, pg.password, schema, paths*) } yield () before(migration.orDie) @@ -37,7 +37,7 @@ object MigrationAspects { .configure() .dataSource(url, username, password) .schemas(schema) - .locations(locations: _*) + .locations(locations*) .load() .migrate() } 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 860d035fb6..c44b1b574a 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 @@ -14,7 +14,7 @@ object ApolloSpec extends ZIOSpecDefault { secp256k1OpsSpec, bip32Spec, ) - suite("Apollo - KMP implementation")(tests: _*).provideLayer(Apollo.layer) + suite("Apollo - KMP implementation")(tests*).provideLayer(Apollo.layer) } private val secp256k1PublicKeySpec = suite("Secp256k1PublicKey")( @@ -224,7 +224,7 @@ object ApolloSpec extends ZIOSpecDefault { val seed = HexString.fromStringUnsafe(seedHex).toByteArray for { apollo <- ZIO.service[Apollo] - keyPair <- apollo.secp256k1.deriveKeyPair(seed)(path: _*) + keyPair <- apollo.secp256k1.deriveKeyPair(seed)(path*) } yield assert(keyPair.privateKey.getEncoded)( equalTo(HexString.fromStringUnsafe(expectedPrivateKeyHex).toByteArray) ) diff --git a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala index ab8344f56d..ba94fc1704 100644 --- a/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala +++ b/shared/test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala @@ -9,9 +9,9 @@ import zio.{TaskLayer, ZIO, ZLayer} final class KeycloakContainerCustom( dockerImageNameOverride: DockerImageName, isOnGithubRunner: Boolean = false -) extends SingleContainer[ExtendableKeycloakContainer[_]] { +) extends SingleContainer[ExtendableKeycloakContainer[?]] { - private val keycloakContainer: ExtendableKeycloakContainer[_] = new ExtendableKeycloakContainer( + private val keycloakContainer: ExtendableKeycloakContainer[?] = new ExtendableKeycloakContainer( dockerImageNameOverride.toString ) { override def getHost: String = { @@ -25,7 +25,7 @@ final class KeycloakContainerCustom( } } - override val container: ExtendableKeycloakContainer[_] = keycloakContainer + override val container: ExtendableKeycloakContainer[?] = keycloakContainer } object KeycloakContainerCustom { 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 f0cd61c36f..9768c6828e 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 @@ -11,7 +11,7 @@ class VaultContainerCustom( secrets: Option[VaultContainer.Secrets] = None, isOnGithubRunner: Boolean = false, useFileBackend: Boolean = false -) extends SingleContainer[JavaVaultContainer[_]] { +) extends SingleContainer[JavaVaultContainer[?]] { private val vaultFSBackendConfig: String = """{ @@ -29,7 +29,7 @@ class VaultContainerCustom( |} """.stripMargin - private val vaultContainer: JavaVaultContainer[_] = new JavaVaultContainer(dockerImageNameOverride) { + private val vaultContainer: JavaVaultContainer[?] = new JavaVaultContainer(dockerImageNameOverride) { override def getHost: String = { if (isOnGithubRunner) super.getContainerId().take(12) else super.getHost() @@ -42,10 +42,10 @@ class VaultContainerCustom( if (vaultToken.isDefined) vaultContainer.withVaultToken(vaultToken.get) secrets.foreach { x => - vaultContainer.withSecretInVault(x.path, x.firstSecret, x.secrets: _*) + vaultContainer.withSecretInVault(x.path, x.firstSecret, x.secrets*) } - override val container: JavaVaultContainer[_] = { + override val container: JavaVaultContainer[?] = { val con = vaultContainer if (useFileBackend) con.addEnv("VAULT_LOCAL_CONFIG", vaultFSBackendConfig) else con.addEnv("VAULT_LOCAL_CONFIG", vaultMemBackendConfig) From 7e51956d1ac8b77f9cdbf28533073e0878a303be Mon Sep 17 00:00:00 2001 From: FabioPinheiro Date: Mon, 3 Jun 2024 15:15:59 +0100 Subject: [PATCH 3/4] style: Remove unused imports Signed-off-by: FabioPinheiro --- .../CredentialDefinitionLookupAndPaginationSpec.scala | 2 +- .../schema/CredentialSchemaLookupAndPaginationSpec.scala | 2 +- .../identus/agent/walletapi/util/OperationFactory.scala | 2 -- .../core/model/presentation/SdJwtPresentationPayload.scala | 1 - .../identus/pollux/core/service/CredentialServiceImpl.scala | 3 +-- .../pollux/core/service/MockPresentationService.scala | 1 - .../identus/pollux/core/service/PresentationService.scala | 1 - .../pollux/core/service/PresentationServiceNotifier.scala | 1 - .../org/hyperledger/identus/pollux/sdjwt/SDJWTSpec.scala | 2 +- .../hyperledger/identus/pollux/vc/jwt/JWTVerification.scala | 6 +----- 10 files changed, 5 insertions(+), 16 deletions(-) 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 cef35227bb..f4d844dd54 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,7 +9,7 @@ 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.{basicRequest, Response, UriContext} import sttp.client3.ziojson.* import sttp.model.{StatusCode, Uri} 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 6ea8298c80..a348ae5254 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,7 +12,7 @@ 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.{basicRequest, Response, UriContext} import sttp.client3.ziojson.* import sttp.model.{StatusCode, Uri} import zio.* diff --git a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala index e9f740ac04..5eb2d4614c 100644 --- a/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala +++ b/cloud-agent/service/wallet-api/src/main/scala/org/hyperledger/identus/agent/walletapi/util/OperationFactory.scala @@ -5,11 +5,9 @@ import org.hyperledger.identus.agent.walletapi.model.error.{CreateManagedDIDErro import org.hyperledger.identus.castor.core.model.did.* import org.hyperledger.identus.shared.crypto.{ Apollo, - Ed25519KeyPair, Ed25519PublicKey, Secp256k1KeyPair, Secp256k1PublicKey, - X25519KeyPair, X25519PublicKey } import org.hyperledger.identus.shared.models.Base64UrlString 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 5b67a8c27d..ea834776f1 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,6 +1,5 @@ package org.hyperledger.identus.pollux.core.model.presentation -import org.hyperledger.identus.pollux.core.model.presentation.Options import org.hyperledger.identus.pollux.sdjwt.PresentationJson import zio.json.* 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 301c5127da..b2f83536ec 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 @@ -8,7 +8,6 @@ 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, - EllipticCurve, PrismDID, VerificationRelationship } @@ -611,7 +610,7 @@ private class CredentialServiceImpl( val d = java.util.Base64.getUrlEncoder.withoutPadding().encodeToString(ed25519keyPair.privateKey.getEncoded) val x = java.util.Base64.getUrlEncoder.withoutPadding().encodeToString(ed25519keyPair.publicKey.getEncoded) val okpJson = s"""{"kty":"OKP","crv":"Ed25519","d":"$d","x":"$x"}""" - val octetKeyPair = OctetKeyPair.parse(okpJson) + OctetKeyPair.parse(okpJson) JwtIssuer( org.hyperledger.identus.pollux.vc.jwt.DID(jwtIssuerDID.toString), EdSigner(ed25519keyPair), 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 79ecf9d689..1866cf7dd5 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 @@ -12,7 +12,6 @@ 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.sdjwt.PresentationJson import org.hyperledger.identus.pollux.vc.jwt.{Issuer, PresentationPayload, W3cCredentialPayload} import org.hyperledger.identus.shared.models.WalletAccessContext import zio.{mock, IO, URLayer, ZIO, ZLayer} 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 de8fc87ffa..8231795fe5 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 @@ -7,7 +7,6 @@ import org.hyperledger.identus.pollux.core.model.* import org.hyperledger.identus.pollux.core.model.error.PresentationError import org.hyperledger.identus.pollux.core.model.presentation.* import org.hyperledger.identus.pollux.core.service.serdes.{AnoncredCredentialProofsV1, AnoncredPresentationRequestV1} -import org.hyperledger.identus.pollux.sdjwt.PresentationJson import org.hyperledger.identus.pollux.vc.jwt.* import org.hyperledger.identus.shared.models.WalletAccessContext import zio.* 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 b1c9a1ae8e..d6cb828be4 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 @@ -13,7 +13,6 @@ 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.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} 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 a17b07a5ad..b94dc96403 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 @@ -280,7 +280,7 @@ object SDJWTSpec extends ZIOSpecDefault { test("get iss field from PresentationJson") { val ed25519KeyPair = KmpEd25519KeyOps.generateKeyPair val issuerKey = IssuerPrivateKey(ed25519KeyPair.privateKey) - val issuerPublicKey = IssuerPublicKey(ed25519KeyPair.publicKey) + IssuerPublicKey(ed25519KeyPair.publicKey) val credential = SDJWT.issueCredential(issuerKey, CLAIMS) val presentation = SDJWT.createPresentation(credential, CLAIMS_PRESENTED) 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 e0080ecb0a..fe97b91153 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 @@ -8,18 +8,14 @@ import com.nimbusds.jose.JWSVerifier import com.nimbusds.jwt.SignedJWT import io.circe import io.circe.generic.auto.* -import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo -import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters -import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory import org.hyperledger.identus.castor.core.model.did.VerificationRelationship import org.hyperledger.identus.shared.crypto.Ed25519PublicKey import pdi.jwt.* import zio.* import zio.prelude.* -import java.security.{KeyFactory, PublicKey} +import java.security.PublicKey import java.security.interfaces.{ECPublicKey, EdECPublicKey} -import java.security.spec.X509EncodedKeySpec import scala.util.{Failure, Success, Try} object JWTVerification { From c3ae316f6430c6ea0cdfa6d1e8fde9ed498503a1 Mon Sep 17 00:00:00 2001 From: FabioPinheiro Date: Tue, 4 Jun 2024 12:14:19 +0100 Subject: [PATCH 4/4] run scalafmt Signed-off-by: FabioPinheiro --- .../identus/agent/server/jobs/IssueBackgroundJobs.scala | 3 +-- .../identus/pollux/core/service/CredentialServiceImpl.scala | 6 +----- .../hyperledger/identus/pollux/vc/jwt/JWTVerification.scala | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) 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 a0a772775c..9010760465 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 @@ -634,8 +634,7 @@ object IssueBackgroundJobs extends BackgroundJobsHelper { } - private def handleCredentialErrors - : PartialFunction[Throwable | CredentialServiceError, CredentialServiceError] = { + private def handleCredentialErrors: PartialFunction[Throwable | CredentialServiceError, CredentialServiceError] = { case e: CredentialServiceError => e case t: Throwable => CredentialServiceError.UnexpectedError(t.getMessage()) } 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 b2f83536ec..f42e4549d2 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 @@ -6,11 +6,7 @@ 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, PrismDID, VerificationRelationship} import org.hyperledger.identus.castor.core.service.DIDService import org.hyperledger.identus.mercury.model.* import org.hyperledger.identus.mercury.protocol.issuecredential.* 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 fe97b91153..2ffb16eab6 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 @@ -14,8 +14,8 @@ import pdi.jwt.* import zio.* import zio.prelude.* -import java.security.PublicKey import java.security.interfaces.{ECPublicKey, EdECPublicKey} +import java.security.PublicKey import scala.util.{Failure, Success, Try} object JWTVerification {