diff --git a/.editorconfig b/.editorconfig index 3e22a6088..90ef09fdf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,10 @@ root = true [*.{kt,kts}] +ktlint_experimental = disabled ktlint_code_style = intellij_idea ktlint_standard_no_semi = disabled ktlint_standard_trailing-comma-on-call-site = disabled ktlint_standard_trailing-comma-on-declaration-site = disabled +ktlint_standard_no-empty-file = disabled +ktlint_standard_backing-property-naming = disabled diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/MessageAttachment.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/MessageAttachment.kt index 89862b5c8..06fb12d59 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/MessageAttachment.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/MessageAttachment.kt @@ -107,7 +107,8 @@ data class AttachmentDescriptor @JvmOverloads constructor( val data: AttachmentData, val filename: Array? = null, val format: String? = null, - val lastModTime: String? = null, // TODO(Date format) + // TODO(Date format) + val lastModTime: String? = null, val byteCount: Int? = null, val description: String? = null ) : AttachmentData { diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/pollux/models/CredentialRequest.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/pollux/models/CredentialRequest.kt index 8bfce8f15..a709312f7 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/pollux/models/CredentialRequest.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/pollux/models/CredentialRequest.kt @@ -15,6 +15,7 @@ import kotlinx.serialization.Serializable * @property entropy The entropy for the credential request. * @property nonce The nonce for the credential request. */ +@Suppress("ktlint:standard:property-naming") interface CredentialRequest { val cred_def_id: String val blinded_ms: CredentialRequestBlindedMS @@ -38,6 +39,7 @@ interface CredentialRequestBlindedMS { * @property v_dash_cap The value used in the proof calculation. * @property m_caps The map of attribute names to their corresponding blinded value commitments. */ +@Suppress("ktlint:standard:property-naming") interface CredentialRequestBlindedMSCorrectnessProof { val c: String val v_dash_cap: String diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentError.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentError.kt index 0876eeeb7..c6b241f28 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentError.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentError.kt @@ -84,7 +84,7 @@ sealed class PrismAgentError : KnownPrismError() { get() = "Failed to onboard.\nStatus code: $statusCode\nResponse: $response" } - class InvalidCredentialError @JvmOverloads constructor(private val credential: Credential) : + class InvalidCredentialError constructor(private val credential: Credential) : PrismAgentError() { override val code: Int get() = 120 @@ -93,7 +93,7 @@ sealed class PrismAgentError : KnownPrismError() { get() = "Invalid credential type, ${credential::class} is not supported" } - class InvalidCredentialFormatError @JvmOverloads constructor(private val expectedFormat: CredentialType) : + class InvalidCredentialFormatError constructor(private val expectedFormat: CredentialType) : PrismAgentError() { override val code: Int get() = 121 diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionAccept.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionAccept.kt index ad83d70d9..5e5109ebf 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionAccept.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionAccept.kt @@ -118,17 +118,31 @@ class ConnectionAccept { * @return true if this [Body] object is equal to the specified [other] object, false otherwise. */ override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false + if (this === other) { + return true + } + if (other == null || this::class != other::class) { + return false + } other as Body - if (goalCode != other.goalCode) return false - if (goal != other.goal) return false + if (goalCode != other.goalCode) { + return false + } + if (goal != other.goal) { + return false + } if (accept != null) { - if (other.accept == null) return false - if (!accept.contentEquals(other.accept)) return false - } else if (other.accept != null) return false + if (other.accept == null) { + return false + } + if (!accept.contentEquals(other.accept)) { + return false + } + } else if (other.accept != null) { + return false + } return true } diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionRequest.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionRequest.kt index 9b609d955..fc9d07637 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionRequest.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/connection/ConnectionRequest.kt @@ -143,17 +143,31 @@ class ConnectionRequest { * @return true if the objects are equal, false otherwise. */ override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false + if (this === other) { + return true + } + if (other == null || this::class != other::class) { + return false + } other as Body - if (goalCode != other.goalCode) return false - if (goal != other.goal) return false + if (goalCode != other.goalCode) { + return false + } + if (goal != other.goal) { + return false + } if (accept != null) { - if (other.accept == null) return false - if (!accept.contentEquals(other.accept)) return false - } else if (other.accept != null) return false + if (other.accept == null) { + return false + } + if (!accept.contentEquals(other.accept)) { + return false + } + } else if (other.accept != null) { + return false + } return true } diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/outOfBand/OutOfBandInvitation.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/outOfBand/OutOfBandInvitation.kt index 6c2a90c0f..7fc8ff1ce 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/outOfBand/OutOfBandInvitation.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/outOfBand/OutOfBandInvitation.kt @@ -29,8 +29,9 @@ constructor( /** * Represents the body of the out-of-band invitation message. */ + @OptIn(ExperimentalSerializationApi::class) @Serializable - data class Body( + data class Body constructor( @SerialName(GOAL_CODE) @EncodeDefault val goalCode: String? = null, diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/proofOfPresentation/Presentation.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/proofOfPresentation/Presentation.kt index 54835958d..ae46ba9a8 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/proofOfPresentation/Presentation.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/proofOfPresentation/Presentation.kt @@ -30,20 +30,38 @@ data class ProofTypes( * @return true if the objects are equal, false otherwise. */ override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false + if (this === other) { + return true + } + if (other == null || this::class != other::class) { + return false + } other as ProofTypes - if (schema != other.schema) return false + if (schema != other.schema) { + return false + } if (requiredFields != null) { - if (other.requiredFields == null) return false - if (!requiredFields.contentEquals(other.requiredFields)) return false - } else if (other.requiredFields != null) return false + if (other.requiredFields == null) { + return false + } + if (!requiredFields.contentEquals(other.requiredFields)) { + return false + } + } else if (other.requiredFields != null) { + return false + } if (trustIssuers != null) { - if (other.trustIssuers == null) return false - if (!trustIssuers.contentEquals(other.trustIssuers)) return false - } else if (other.trustIssuers != null) return false + if (other.trustIssuers == null) { + return false + } + if (!trustIssuers.contentEquals(other.trustIssuers)) { + return false + } + } else if (other.trustIssuers != null) { + return false + } return true } diff --git a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/MercuryTests.kt b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/MercuryTests.kt index f8c5d88bf..5bb836eee 100644 --- a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/MercuryTests.kt +++ b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/MercuryTests.kt @@ -59,7 +59,8 @@ class MercuryTests { fun testSendMessage_shouldThrowError_whenServiceAbsent() = runTest { val idDid = DID("did", "prism", "123") val allAuthentication = DIDDocument.Authentication(arrayOf(), arrayOf()) - val resolveDIDReturn = DIDDocument(idDid, arrayOf(/*service,*/ allAuthentication)) + // val resolveDIDReturn = DIDDocument(idDid, arrayOf(/*service,*/ allAuthentication)) + val resolveDIDReturn = DIDDocument(idDid, arrayOf(allAuthentication)) castorMock.resolveDIDReturn = resolveDIDReturn val msg = Message(piuri = "", body = "", from = DID("test", "method", "id"), to = DID("test", "method", "id")) assertFailsWith { sut.sendMessage(msg) } diff --git a/build.gradle.kts b/build.gradle.kts index 02a5e59af..6e7bf8fd5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ +import org.gradle.internal.os.OperatingSystem import java.util.Base64 val publishedMavenId = "io.iohk.atala.prism.walletsdk" +val os: OperatingSystem = OperatingSystem.current() plugins { id("com.android.library") version "8.1.4" apply false @@ -61,6 +63,11 @@ allprojects { } else if (requested.group == "com.nimbusds") { // Making sure we are using the latest version of `nimbus-jose-jwt` instead if 9.25.6 useTarget("com.nimbusds:nimbus-jose-jwt:9.31") + } else if (requested.group == "com.google.protobuf") { + // Because of Duplicate Classes issue happening on the sampleapp module + if (requested.name == "protobuf-javalite" || requested.name == "protobuf-java") { + useTarget("com.google.protobuf:protobuf-java:3.14.0") + } } } } diff --git a/protosLib/build.gradle.kts b/protosLib/build.gradle.kts index 3c9e8086d..d78216670 100644 --- a/protosLib/build.gradle.kts +++ b/protosLib/build.gradle.kts @@ -18,7 +18,7 @@ val jarPathConf: Configuration by configurations.creating { dependencies { // This is needed for includes, ref: https://github.com/google/protobuf-gradle-plugin/issues/41#issuecomment-143884188 - compileOnly("com.google.protobuf:protobuf-java:3.12.0") + compileOnly("com.google.protobuf:protobuf-java:3.14.0") } sourceSets { diff --git a/sampleapp/build.gradle.kts b/sampleapp/build.gradle.kts index 8fa7e217d..fbccaf58b 100644 --- a/sampleapp/build.gradle.kts +++ b/sampleapp/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("com.android.application") id("org.jetbrains.kotlin.android") - id("com.google.devtools.ksp") version("1.9.22-1.0.16") + id("com.google.devtools.ksp") version "1.9.22-1.0.16" } apply(plugin = "kotlinx-atomicfu") diff --git a/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesFragment.kt b/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesFragment.kt index b2e0c8968..8b656d557 100644 --- a/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesFragment.kt +++ b/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesFragment.kt @@ -52,7 +52,7 @@ class MessagesFragment : Fragment() { // Set up the spinner with the options context?.let { - val adapter = CustomArrayAdapter(it, R.layout.support_simple_spinner_dropdown_item, credentials) + val adapter = CustomArrayAdapter(it, android.R.layout.simple_spinner_dropdown_item, credentials) adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) dialogBinding.spinner.adapter = adapter