Skip to content

Commit

Permalink
chore: scalafmt import rewrite (#1120)
Browse files Browse the repository at this point in the history
Signed-off-by: Pat Losoponkul <[email protected]>
  • Loading branch information
patlo-iog authored May 31, 2024
1 parent efba1aa commit 24c62f4
Show file tree
Hide file tree
Showing 405 changed files with 1,162 additions and 1,322 deletions.
5 changes: 5 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rules = [ OrganizeImports ]

OrganizeImports.groupedImports = Merge
OrganizeImports.removeUnused = false
OrganizeImports.targetDialect = Scala3
8 changes: 8 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ runner.dialect = scala3

maxColumn = 120
trailingCommas = preserve

rewrite.rules = [Imports]
rewrite.imports.expand = false
rewrite.imports.sort = original
rewrite.imports.groups = [
[".*"],
["java\\..*", "scala\\..*"]
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package org.hyperledger.identus.castor.core.model

import com.google.protobuf.ByteString
import io.circe.Json
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint
import io.iohk.atala.prism.protos.{common_models, node_api, node_models}
import io.iohk.atala.prism.protos.common_models.OperationStatus
import io.iohk.atala.prism.protos.node_models.KeyUsage
import io.iohk.atala.prism.protos.node_models.PublicKey.KeyData
import org.hyperledger.identus.castor.core.model.did.{
DIDData,
EllipticCurve,
Expand All @@ -21,15 +24,13 @@ import org.hyperledger.identus.castor.core.model.did.{
UpdateDIDAction,
VerificationRelationship
}
import io.iohk.atala.prism.protos.common_models.OperationStatus
import io.iohk.atala.prism.protos.node_models.KeyUsage
import io.iohk.atala.prism.protos.node_models.PublicKey.KeyData
import io.iohk.atala.prism.protos.{common_models, node_api, node_models}
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint
import org.hyperledger.identus.shared.models.Base64UrlString
import org.hyperledger.identus.shared.utils.Traverse.*
import zio.*

import java.time.Instant
import scala.language.implicitConversions
import zio.*

object ProtoModelHelper extends ProtoModelHelper

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.hyperledger.identus.castor.core.model.did

import org.hyperledger.identus.castor.core.model.ProtoModelHelper
import org.hyperledger.identus.shared.crypto.Sha256Hash
import io.iohk.atala.prism.protos.node_models
import io.iohk.atala.prism.protos.node_models.AtalaOperation.Operation
import org.hyperledger.identus.shared.models.Base64UrlString
import org.hyperledger.identus.shared.models.HexString
import scala.util.Try
import org.hyperledger.identus.castor.core.model.ProtoModelHelper
import org.hyperledger.identus.shared.crypto.Sha256Hash
import org.hyperledger.identus.shared.models.{Base64UrlString, HexString}

import scala.util.matching.Regex
import scala.util.Try

/** Represents a [Did] used in PRISM with prism-specific method and keys as [PrismDid]
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.hyperledger.identus.castor.core.model.did

import io.iohk.atala.prism.protos.node_models
import org.hyperledger.identus.castor.core.model.ProtoModelHelper
import org.hyperledger.identus.shared.crypto.Sha256Hash

import scala.collection.compat.immutable.ArraySeq
import io.iohk.atala.prism.protos.node_models

sealed trait PrismDIDOperation {
def did: CanonicalPrismDID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import io.circe.Json
import org.hyperledger.identus.castor.core.model.did.*
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint
import org.hyperledger.identus.shared.crypto.Apollo
import org.hyperledger.identus.shared.models.Base64UrlString
import org.hyperledger.identus.shared.models.HexString
import org.hyperledger.identus.shared.models.{Base64UrlString, HexString}

import java.time.Instant
import java.time.ZoneOffset
import java.time.{Instant, ZoneOffset}
import java.time.format.DateTimeFormatter

object W3CModelHelper extends W3CModelHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.hyperledger.identus.castor.core.service

import org.hyperledger.identus.castor.core.model.ProtoModelHelper
import io.iohk.atala.prism.protos.{node_api, node_models}
import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc.NodeService
import io.iohk.atala.prism.protos.node_models.OperationOutput.OperationMaybe
import org.hyperledger.identus.castor.core.model.did.{
CanonicalPrismDID,
DIDData,
Expand All @@ -13,16 +15,14 @@ import org.hyperledger.identus.castor.core.model.did.{
ScheduledDIDOperationDetail,
SignedPrismDIDOperation
}
import org.hyperledger.identus.castor.core.model.error.OperationValidationError
import org.hyperledger.identus.castor.core.model.error.{DIDOperationError, DIDResolutionError}
import org.hyperledger.identus.castor.core.model.error.{DIDOperationError, DIDResolutionError, OperationValidationError}
import org.hyperledger.identus.castor.core.model.ProtoModelHelper
import org.hyperledger.identus.castor.core.util.DIDOperationValidator
import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc.NodeService
import io.iohk.atala.prism.protos.node_models.OperationOutput.OperationMaybe
import io.iohk.atala.prism.protos.{node_api, node_models}
import org.hyperledger.identus.shared.models.HexString
import zio.*

import java.time.Instant
import scala.collection.immutable.ArraySeq
import zio.*

trait DIDService {
def scheduleOperation(operation: SignedPrismDIDOperation): IO[DIDOperationError, ScheduleDIDOperationOutcome]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package org.hyperledger.identus.castor.core.service

import org.hyperledger.identus.castor.core.model.did.*
import org.hyperledger.identus.castor.core.model.error
import org.hyperledger.identus.shared.crypto.Apollo
import org.hyperledger.identus.shared.crypto.Secp256k1KeyPair
import org.hyperledger.identus.shared.crypto.{Apollo, Secp256k1KeyPair}
import org.hyperledger.identus.shared.models.Base64UrlString
import zio.{mock, IO, URLayer, ZIO, ZLayer}
import zio.mock.{Expectation, Mock, Proxy}
import zio.test.Assertion
import zio.{IO, URLayer, ZIO, ZLayer, mock}

import scala.collection.immutable.ArraySeq

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.hyperledger.identus.castor.core.util

import io.lemonlabs.uri.{Uri, Url, Urn, QueryString}
import io.lemonlabs.uri.{QueryString, Uri, Url, Urn}
import io.lemonlabs.uri.config.UriConfig
import io.lemonlabs.uri.encoding.PercentEncoder
import io.lemonlabs.uri.decoding.UriDecodeException
import io.lemonlabs.uri.encoding.PercentEncoder

// TODO: unify with the logic used in Node
// https://github.com/input-output-hk/atala-prism/blob/ba7b3e3ef307f6bd06734af2bf8fed9b119ee98e/prism-backend/common/src/main/scala/io/iohk/atala/prism/utils/UriUtils.scala
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package org.hyperledger.identus.castor.core.model

import com.google.protobuf.timestamp.Timestamp
import io.circe.Json
import io.circe.JsonObject
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriValue
import org.hyperledger.identus.castor.core.model.did.ServiceType
import org.hyperledger.identus.castor.core.util.GenUtils
import io.circe.{Json, JsonObject}
import io.iohk.atala.prism.protos.common_models.Ledger
import io.iohk.atala.prism.protos.node_models
import java.time.Instant
import scala.language.implicitConversions
import org.hyperledger.identus.castor.core.model.did.{ServiceEndpoint, ServiceType}
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.{UriOrJsonEndpoint, UriValue}
import org.hyperledger.identus.castor.core.util.GenUtils
import zio.*
import zio.test.*
import zio.test.Assertion.*

import java.time.Instant
import scala.language.implicitConversions

object ProtoModelHelperSpec extends ZIOSpecDefault {

import ProtoModelHelper.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.hyperledger.identus.castor.core.model.did

import org.hyperledger.identus.castor.core.util.GenUtils
import zio.*
import zio.test.*
import zio.test.Assertion.*
import org.hyperledger.identus.castor.core.util.GenUtils

object DIDSpec extends ZIOSpecDefault {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.hyperledger.identus.castor.core.model.did

import com.google.protobuf.ByteString
import org.hyperledger.identus.shared.crypto.Sha256Hash
import io.iohk.atala.prism.protos.node_models
import org.hyperledger.identus.shared.crypto.Sha256Hash
import org.hyperledger.identus.shared.models.Base64UrlString
import zio.*
import zio.test.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.hyperledger.identus.castor.core.service

import com.google.protobuf.ByteString
import org.hyperledger.identus.castor.core.model.did.{DIDData, PrismDID, PrismDIDOperation}
import org.hyperledger.identus.castor.core.model.error.DIDResolutionError
import org.hyperledger.identus.castor.core.util.{GenUtils}
import org.hyperledger.identus.castor.core.util.DIDOperationValidator
import io.iohk.atala.prism.protos.{node_api, node_models}
import io.iohk.atala.prism.protos.common_models.{HealthCheckRequest, HealthCheckResponse}
import io.iohk.atala.prism.protos.node_api
import io.iohk.atala.prism.protos.node_models
import io.iohk.atala.prism.protos.node_api.{
GetBatchStateRequest,
GetBatchStateResponse,
Expand All @@ -27,6 +22,9 @@ import io.iohk.atala.prism.protos.node_api.{
ScheduleOperationsRequest,
ScheduleOperationsResponse
}
import org.hyperledger.identus.castor.core.model.did.{DIDData, PrismDID, PrismDIDOperation}
import org.hyperledger.identus.castor.core.model.error.DIDResolutionError
import org.hyperledger.identus.castor.core.util.{DIDOperationValidator, GenUtils}
import zio.*
import zio.test.*
import zio.test.Assertion.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package org.hyperledger.identus.castor.core.util

import io.circe.Json
import org.hyperledger.identus.castor.core.model.did.*
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriOrJsonEndpoint
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.UriValue
import org.hyperledger.identus.castor.core.model.did.ServiceEndpoint.{UriOrJsonEndpoint, UriValue}
import org.hyperledger.identus.shared.crypto.Apollo
import org.hyperledger.identus.shared.models.Base64UrlString
import zio.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.hyperledger.identus

import zio.*
import org.hyperledger.identus.api.http.RequestContext
import sttp.model.Header
import zio.*

object LogUtils {
inline val headerName = "X-Request-ID"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import org.hyperledger.identus.agent.server.config.AppConfig
import org.hyperledger.identus.agent.walletapi.model.ManagedDIDDetail
import org.hyperledger.identus.agent.walletapi.service.WalletManagementService
import org.hyperledger.identus.connect.core.model.ConnectionRecord
import org.hyperledger.identus.event.notification.EventNotificationConfig
import org.hyperledger.identus.event.notification.{Event, EventConsumer, EventNotificationService}
import org.hyperledger.identus.event.notification.{
Event,
EventConsumer,
EventNotificationConfig,
EventNotificationService
}
import org.hyperledger.identus.pollux.core.model.{IssueCredentialRecord, PresentationRecord}
import org.hyperledger.identus.shared.models.WalletAccessContext
import org.hyperledger.identus.shared.models.WalletId
import org.hyperledger.identus.shared.models.{WalletAccessContext, WalletId}
import zio.*
import zio.http.*
import zio.json.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.hyperledger.identus.agent.server

import org.hyperledger.identus.agent.walletapi.model.PublicationState.Published
import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError
import org.hyperledger.identus.agent.walletapi.model.{ManagedDIDState, PublicationState}
import org.hyperledger.identus.agent.walletapi.model.error.GetManagedDIDError
import org.hyperledger.identus.agent.walletapi.model.PublicationState.Published
import org.hyperledger.identus.agent.walletapi.service.ManagedDIDService
import org.hyperledger.identus.api.http.ErrorResponse
import org.hyperledger.identus.castor.core.model.did.{LongFormPrismDID, PrismDID}
import org.hyperledger.identus.connect.core.model.ConnectionRecord
import org.hyperledger.identus.connect.core.model.ConnectionRecord.{ProtocolState, Role}
import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError
import org.hyperledger.identus.connect.core.model.error.ConnectionServiceError.{
InvalidStateForOperation,
RecordIdNotFound
}
import org.hyperledger.identus.connect.core.model.ConnectionRecord
import org.hyperledger.identus.connect.core.model.ConnectionRecord.{ProtocolState, Role}
import org.hyperledger.identus.connect.core.service.ConnectionService
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.shared.models.WalletAccessContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.hyperledger.identus.agent.server

import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton
import io.micrometer.prometheus.{PrometheusConfig, PrometheusMeterRegistry}
import org.hyperledger.identus.agent.server.config.AppConfig
import org.hyperledger.identus.agent.server.http.ZioHttpClient
import org.hyperledger.identus.agent.server.sql.Migrations as AgentMigrations
Expand All @@ -23,12 +24,13 @@ import org.hyperledger.identus.connect.controller.ConnectionControllerImpl
import org.hyperledger.identus.connect.core.service.{ConnectionServiceImpl, ConnectionServiceNotifier}
import org.hyperledger.identus.connect.sql.repository.{JdbcConnectionRepository, Migrations as ConnectMigrations}
import org.hyperledger.identus.credential.status.controller.CredentialStatusControllerImpl
import org.hyperledger.identus.didcomm.controller.DIDCommControllerImpl
import org.hyperledger.identus.event.controller.EventControllerImpl
import org.hyperledger.identus.event.notification.EventNotificationServiceImpl
import org.hyperledger.identus.iam.authentication.DefaultAuthenticator
import org.hyperledger.identus.iam.authentication.apikey.JdbcAuthenticationRepository
import org.hyperledger.identus.iam.authorization.DefaultPermissionManagementService
import org.hyperledger.identus.iam.authentication.DefaultAuthenticator
import org.hyperledger.identus.iam.authorization.core.EntityPermissionManagementService
import org.hyperledger.identus.iam.authorization.DefaultPermissionManagementService
import org.hyperledger.identus.iam.entity.http.controller.{EntityController, EntityControllerImpl}
import org.hyperledger.identus.iam.wallet.http.controller.WalletManagementControllerImpl
import org.hyperledger.identus.issue.controller.IssueControllerImpl
Expand All @@ -54,15 +56,13 @@ import org.hyperledger.identus.presentproof.controller.PresentProofControllerImp
import org.hyperledger.identus.resolvers.DIDResolver
import org.hyperledger.identus.system.controller.SystemControllerImpl
import org.hyperledger.identus.verification.controller.VcVerificationControllerImpl
import io.micrometer.prometheus.{PrometheusConfig, PrometheusMeterRegistry}
import org.hyperledger.identus.didcomm.controller.DIDCommControllerImpl
import zio.*
import zio.logging.*
import zio.logging.backend.SLF4J
import zio.logging.LogFormat.*
import zio.metrics.connectors.micrometer
import zio.metrics.connectors.micrometer.MicrometerConfig
import zio.metrics.jvm.DefaultJvmMetrics
import zio.logging.*
import zio.logging.LogFormat.*
import zio.logging.backend.SLF4J

import java.security.Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,44 @@ package org.hyperledger.identus.agent.server
import com.typesafe.config.ConfigFactory
import doobie.util.transactor.Transactor
import io.grpc.ManagedChannelBuilder
import org.hyperledger.identus.agent.server.config.AppConfig
import org.hyperledger.identus.agent.server.config.SecretStorageBackend
import org.hyperledger.identus.agent.server.config.ValidatedVaultConfig
import org.hyperledger.identus.agent.walletapi.service.EntityService
import org.hyperledger.identus.agent.walletapi.service.WalletManagementService
import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc
import org.hyperledger.identus.agent.server.config.{AppConfig, SecretStorageBackend, ValidatedVaultConfig}
import org.hyperledger.identus.agent.walletapi.service.{EntityService, WalletManagementService}
import org.hyperledger.identus.agent.walletapi.sql.{
JdbcDIDSecretStorage,
JdbcGenericSecretStorage,
JdbcWalletSecretStorage
}
import org.hyperledger.identus.agent.walletapi.storage.{DIDSecretStorage, GenericSecretStorage, WalletSecretStorage}
import org.hyperledger.identus.agent.walletapi.vault.*
import org.hyperledger.identus.agent.walletapi.vault.{
VaultDIDSecretStorage,
VaultKVClient,
VaultKVClientImpl,
VaultWalletSecretStorage
VaultWalletSecretStorage,
*
}
import org.hyperledger.identus.castor.core.service.DIDService
import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyAuthenticator
import org.hyperledger.identus.iam.authentication.admin.AdminApiKeyAuthenticatorImpl
import org.hyperledger.identus.iam.authentication.admin.AdminConfig
import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticator
import org.hyperledger.identus.iam.authentication.apikey.ApiKeyAuthenticatorImpl
import org.hyperledger.identus.iam.authentication.apikey.ApiKeyConfig
import org.hyperledger.identus.iam.authentication.apikey.AuthenticationRepository
import org.hyperledger.identus.iam.authentication.oidc.KeycloakAuthenticator
import org.hyperledger.identus.iam.authentication.oidc.KeycloakAuthenticatorImpl
import org.hyperledger.identus.iam.authentication.oidc.KeycloakClientImpl
import org.hyperledger.identus.iam.authentication.oidc.KeycloakConfig
import org.hyperledger.identus.iam.authentication.oidc.KeycloakEntity
import org.hyperledger.identus.iam.authentication.admin.{
AdminApiKeyAuthenticator,
AdminApiKeyAuthenticatorImpl,
AdminConfig
}
import org.hyperledger.identus.iam.authentication.apikey.{
ApiKeyAuthenticator,
ApiKeyAuthenticatorImpl,
ApiKeyConfig,
AuthenticationRepository
}
import org.hyperledger.identus.iam.authentication.oidc.{
KeycloakAuthenticator,
KeycloakAuthenticatorImpl,
KeycloakClientImpl,
KeycloakConfig,
KeycloakEntity
}
import org.hyperledger.identus.iam.authorization.core.PermissionManagement
import org.hyperledger.identus.iam.authorization.keycloak.admin.KeycloakPermissionManagementService
import org.hyperledger.identus.pollux.vc.jwt.{PrismDidResolver, DidResolver as JwtDidResolver}
import io.iohk.atala.prism.protos.node_api.NodeServiceGrpc
import org.hyperledger.identus.pollux.vc.jwt.{DidResolver as JwtDidResolver, PrismDidResolver}
import org.hyperledger.identus.shared.crypto.Apollo
import org.hyperledger.identus.shared.db.{ContextAwareTask, DbConfig, TransactorLayer}
import org.keycloak.authorization.client.AuthzClient
Expand Down
Loading

0 comments on commit 24c62f4

Please sign in to comment.