Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Upgrade gradle #140

Merged
merged 7 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
45 changes: 17 additions & 28 deletions atala-prism-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
kotlin("plugin.serialization")
id("com.android.library")
id("org.jetbrains.dokka")
id("org.jetbrains.kotlinx.kover") version "0.7.3"
id("org.jetbrains.kotlinx.kover") version "0.7.6"
}

kover {
Expand Down Expand Up @@ -75,7 +75,7 @@ kotlin {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
}
testRuns["test"].executionTask.configure {
Expand All @@ -93,25 +93,22 @@ kotlin {

sourceSets {
val commonMain by getting {
kotlin.srcDir("${project(":protosLib").buildDir}/generated/source/proto/main/kotlin")
kotlin.srcDir("${project(":protosLib").layout.buildDirectory.asFile.get()}/generated/source/proto/main/kotlin")
resources.srcDir("${project(":protosLib").projectDir}/src/main")
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")

implementation("io.ktor:ktor-client-core:2.3.4")
implementation("io.ktor:ktor-client-content-negotiation:2.3.4")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.4")
implementation("io.ktor:ktor-client-logging:2.3.4")

implementation("io.iohk.atala.prism.didcomm:didpeer:$didpeerVersion") {
exclude("io.iohk.atala.prism.apollo")
}
implementation("io.iohk.atala.prism.didcomm:didpeer:$didpeerVersion")

implementation("io.iohk.atala.prism.apollo:apollo:$apolloVersion")

// implementation("com.nimbusds:nimbus-jose-jwt:9.31") // We are going to use the `nimbus-jose-jwt` that resides in `didcomm` lib
implementation("org.kotlincrypto.hash:sha2:0.4.0")

implementation("pro.streem.pbandk:pbandk-runtime:0.14.2")

Expand All @@ -125,15 +122,15 @@ kotlin {

api("org.lighthousegames:logging:1.1.2")

implementation("io.iohk.atala.prism.anoncredskmp:anoncreds-kmp:0.4.2")
implementation("com.ionspin.kotlin:bignum:0.3.8")
implementation("io.iohk.atala.prism.anoncredskmp:anoncreds-kmp:0.4.6")
implementation("com.ionspin.kotlin:bignum:0.3.9")
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.0")
implementation("io.ktor:ktor-client-mock:2.3.4")
implementation("junit:junit:4.13.2")
}
Expand All @@ -147,7 +144,7 @@ kotlin {
val jvmTest by getting
val androidMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0")
implementation("io.ktor:ktor-client-okhttp:2.3.4")
implementation("app.cash.sqldelight:android-driver:2.0.1")
}
Expand Down Expand Up @@ -175,18 +172,16 @@ kotlin {
}

android {
compileSdk = 33
compileSdk = 34
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
namespace = "io.iohk.atala.prism.walletsdk"
defaultConfig {
minSdk = 21
targetSdk = 33

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
/**
* Because Software Components will not be created automatically for Maven publishing from
Expand All @@ -202,7 +197,7 @@ android {
}
}

packagingOptions {
packaging {
resources {
merges += "**/**.proto"
}
Expand All @@ -225,7 +220,7 @@ tasks.withType<DokkaTask>().configureEach {
description = "This is a Kotlin Multiplatform implementation of AtalaPrismSDK"
dokkaSourceSets {
configureEach {
jdkVersion.set(11)
jdkVersion.set(17)
languageVersion.set("1.9.22")
apiVersion.set("2.0")
includes.from(
Expand Down Expand Up @@ -268,12 +263,6 @@ val buildProtoLibsGen: Task by tasks.creating {
}

afterEvaluate {
tasks.named("lintAnalyzeDebug") {
this.enabled = false
}
tasks.named("lintAnalyzeRelease") {
this.enabled = false
}
tasks.getByName("runKtlintCheckOverCommonMainSourceSet") {
dependsOn(buildProtoLibsGen)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package io.iohk.atala.prism.walletsdk.castor.shared
import io.iohk.atala.prism.apollo.base64.base64Encoded
import io.iohk.atala.prism.apollo.base64.base64UrlDecodedBytes
import io.iohk.atala.prism.apollo.base64.base64UrlEncoded
import io.iohk.atala.prism.apollo.hashing.SHA256
import io.iohk.atala.prism.apollo.hashing.internal.toHexString
import io.iohk.atala.prism.didcomm.didpeer.DIDCommServicePeerDID
import io.iohk.atala.prism.didcomm.didpeer.DIDDocPeerDID
import io.iohk.atala.prism.didcomm.didpeer.MalformedPeerDIDException
Expand Down Expand Up @@ -52,6 +50,7 @@ import io.iohk.atala.prism.walletsdk.logger.PrismLoggerImpl
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import org.kotlincrypto.hash.sha2.SHA256
import pbandk.decodeFromByteArray
import pbandk.encodeToByteArray
import kotlin.jvm.Throws
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,9 @@ constructor(
customUnderlyingErrors: Array<Error>
) : MercuryError(
message = "DIDComm error has occurred with message: $customMessage\nErrors: ${
customUnderlyingErrors.joinToString(
separator = "\n"
) { it.errorDescription ?: "" }
customUnderlyingErrors.joinToString(
separator = "\n"
) { it.errorDescription ?: "" }
}"
) {
override val code: Int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.iohk.atala.prism.walletsdk.domain.models

import io.iohk.atala.prism.apollo.uuid.UUID
import io.iohk.atala.prism.walletsdk.domain.buildingblocks.Mercury
import kotlinx.datetime.Clock
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import java.util.UUID
import kotlin.jvm.JvmOverloads
import kotlin.time.Duration.Companion.days

Expand All @@ -22,7 +22,7 @@ data class Message
@JvmOverloads
constructor(
@EncodeDefault
val id: String = UUID.randomUUID4().toString(),
val id: String = UUID.randomUUID().toString(),
val piuri: String,
@EncodeDefault val from: DID? = null,
@EncodeDefault val to: DID? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.iohk.atala.prism.walletsdk.domain.models

import io.iohk.atala.prism.apollo.uuid.UUID
import kotlinx.serialization.Serializable
import java.util.UUID
import kotlin.jvm.JvmOverloads

/**
Expand Down Expand Up @@ -102,12 +102,13 @@ data class AttachmentJsonData(
*/
@Serializable
data class AttachmentDescriptor @JvmOverloads constructor(
val id: String = UUID.randomUUID4().toString(),
val id: String = UUID.randomUUID().toString(),
val mediaType: String? = null,
val data: AttachmentData,
val filename: Array<String>? = 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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.iohk.atala.prism.walletsdk.domain.models

import io.iohk.atala.prism.apollo.uuid.UUID
import java.util.UUID
import kotlin.jvm.JvmOverloads

/**
Expand All @@ -11,6 +11,6 @@ import kotlin.jvm.JvmOverloads
* @constructor Creates a Session object with the specified [uuid] and [seed].
*/
data class Session @JvmOverloads constructor(
val uuid: UUID = UUID.randomUUID4(),
val uuid: UUID = UUID.randomUUID(),
val seed: Seed
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.iohk.atala.prism.walletsdk.logger

import io.iohk.atala.prism.apollo.hashing.SHA256
import io.iohk.atala.prism.apollo.uuid.UUID
import org.kotlincrypto.hash.sha2.SHA256
import org.lighthousegames.logging.logging
import java.util.UUID

/**
* Constant value used to represent the privacy of metadata.
Expand All @@ -19,9 +19,9 @@ private const val METADATA_PRIVACY_STR = "------"
* Property representing the unique identifier for the hashing log.
* The value is generated as a random UUID string.
*
* @see UUID.randomUUID4
* @see UUID.randomUUID
*/
private val hashingLog = UUID.randomUUID4().toString()
private val hashingLog = UUID.randomUUID().toString()

/**
* PrismLogger is an interface that defines methods for logging messages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.iohk.atala.prism.walletsdk.mercury.resolvers

import io.iohk.atala.prism.apollo.multibase.MultiBase
import io.iohk.atala.prism.didcomm.didpeer.core.fromMulticodec
import io.iohk.atala.prism.didcomm.didpeer.core.toJwk
import io.iohk.atala.prism.didcomm.didpeer.multibase.MultiBase
import io.iohk.atala.prism.walletsdk.domain.buildingblocks.Castor
import io.iohk.atala.prism.walletsdk.domain.models.CastorError
import io.iohk.atala.prism.walletsdk.domain.models.Curve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import app.cash.sqldelight.coroutines.mapToList
import app.cash.sqldelight.db.AfterVersion
import io.iohk.atala.prism.apollo.base64.base64UrlDecodedBytes
import io.iohk.atala.prism.apollo.base64.base64UrlEncoded
import io.iohk.atala.prism.apollo.uuid.UUID
import io.iohk.atala.prism.walletsdk.PrismPlutoDb
import io.iohk.atala.prism.walletsdk.apollo.utils.Ed25519PrivateKey
import io.iohk.atala.prism.walletsdk.apollo.utils.Secp256k1PrivateKey
Expand All @@ -31,6 +30,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapLatest
import kotlinx.serialization.json.Json
import java.util.UUID
import io.iohk.atala.prism.walletsdk.pluto.data.AvailableClaims as AvailableClaimsDB
import io.iohk.atala.prism.walletsdk.pluto.data.DID as DIDDB
import io.iohk.atala.prism.walletsdk.pluto.data.DIDPair as DIDPairDB
Expand Down Expand Up @@ -265,7 +265,7 @@ class PlutoImpl(private val connection: DbConnection) : Pluto {
} ?: run {
getInstance().privateKeyQueries.insert(
PrivateKeyDB(
UUID.randomUUID4().toString(),
UUID.randomUUID().toString(),
storableKey.restorationIdentifier,
storableKey.storableData.base64UrlEncoded,
keyPathIndex,
Expand Down Expand Up @@ -315,7 +315,7 @@ class PlutoImpl(private val connection: DbConnection) : Pluto {
)
instance.mediatorQueries.insert(
MediatorDB(
UUID.randomUUID4().toString(),
UUID.randomUUID().toString(),
mediator.methodId,
host.methodId,
routing.methodId
Expand Down Expand Up @@ -367,7 +367,7 @@ class PlutoImpl(private val connection: DbConnection) : Pluto {
*/
override fun storeCredentialMetadata(metadata: CredentialRequestMeta) {
getInstance().credentialMetadataQueries.insert(
id = UUID.randomUUID4().toString(),
id = UUID.randomUUID().toString(),
linkSecretName = metadata.linkSecretName,
json = metadata.json
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@file:Suppress("ktlint:standard:import-ordering")

package io.iohk.atala.prism.walletsdk.prismagent

/* ktlint-disable import-ordering */
import anoncreds_wrapper.CredentialOffer
import anoncreds_wrapper.CredentialRequestMetadata
import anoncreds_wrapper.LinkSecret
Expand Down Expand Up @@ -84,8 +85,6 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject

/* ktlint-disable import-ordering */

/**
* Check if the passed URL is valid or not.
* @param str string to check its URL validity
Expand Down Expand Up @@ -1015,6 +1014,9 @@ class PrismAgent {
* Enumeration representing the current state of the agent.
*/
enum class State {
STOPPED, STARTING, RUNNING, STOPPING
STOPPED,
STARTING,
RUNNING,
STOPPING
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.iohk.atala.prism.walletsdk.prismagent.helpers

import io.iohk.atala.prism.apollo.base64.base64UrlEncoded
import io.iohk.atala.prism.apollo.uuid.UUID
import io.iohk.atala.prism.walletsdk.domain.models.AttachmentBase64
import io.iohk.atala.prism.walletsdk.domain.models.AttachmentDescriptor
import io.ktor.http.ContentType
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import java.util.UUID

/**
* Builds an AttachmentDescriptor object with the specified parameters.
Expand All @@ -19,7 +19,7 @@ import kotlinx.serialization.json.Json
*/
@JvmOverloads
inline fun <reified T : Serializable> AttachmentDescriptor.Companion.build(
id: String = UUID.randomUUID4().toString(),
id: String = UUID.randomUUID().toString(),
payload: T,
mediaType: String? = ContentType.Application.Json.toString()
): AttachmentDescriptor {
Expand Down
Loading
Loading