From 6396b51dea8a8d9e76481fcdc95ba00bd844dd5a Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Tue, 18 Feb 2025 15:18:39 +0100 Subject: [PATCH 1/3] Fix bug whereby the nip05 code did not take into account "_@domain". It only took into account "domain". --- .../src/commonMain/kotlin/rhodium/net/NostrUtils.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rhodium-core/src/commonMain/kotlin/rhodium/net/NostrUtils.kt b/rhodium-core/src/commonMain/kotlin/rhodium/net/NostrUtils.kt index 2ad18a6..a051d44 100644 --- a/rhodium-core/src/commonMain/kotlin/rhodium/net/NostrUtils.kt +++ b/rhodium-core/src/commonMain/kotlin/rhodium/net/NostrUtils.kt @@ -1,8 +1,5 @@ package rhodium.net -import rhodium.nostr.Nip05ValidationError -import rhodium.nostr.arraySerializer -import rhodium.nostr.eventMapper import io.ktor.client.* import io.ktor.client.plugins.* import io.ktor.client.request.* @@ -10,6 +7,9 @@ import io.ktor.client.statement.* import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive +import rhodium.nostr.Nip05ValidationError +import rhodium.nostr.arraySerializer +import rhodium.nostr.eventMapper object NostrUtils { @@ -21,7 +21,7 @@ object NostrUtils { if (nameWithDomain.size > 2 || nameWithDomain.isEmpty()) { throw Nip05ValidationError("Likely a malformed address.") } - else if (nameWithDomain.size == 1 || nameWithDomain[0].contentEquals("_")) { + else if (nameWithDomain.size == 1) { val domain = nameWithDomain[0] if (!UrlUtil.isValidUrl(domain)) throw Nip05ValidationError("Invalid identifier.") val urlToUse = "https://${domain}/.well-known/nostr.json?name=_" From 491baaf842da12f9785083425a76aa4fac2583e0 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Tue, 18 Feb 2025 15:22:06 +0100 Subject: [PATCH 2/3] Fix Gradle source-set issues. Harmonize naming. --- rhodium-core/build.gradle.kts | 52 ++++++++++++++--------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 6a23dbb..7716307 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -30,7 +30,7 @@ kotlin { languageVersion.set(KotlinVersion.KOTLIN_1_8) } - jvm("baseJvm") { + jvm("commonJvm") { @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions.jvmTarget.set(JvmTarget.JVM_17) @@ -118,37 +118,31 @@ kotlin { implementation(kotlin("test-annotations-common")) } - val commonJvmMain = create("commonJvmMain") { + val commonJvmMain by getting { dependsOn(commonMain.get()) - } - commonJvmMain.dependencies { - implementation("dev.whyoleg.cryptography:cryptography-provider-jdk:$kotlinCryptoVersion") - implementation("com.squareup.okhttp3:okhttp:4.12.0") - implementation("io.ktor:ktor-client-okhttp:$ktorVersion") - implementation("ch.qos.logback:logback-classic:1.4.14") - } + dependencies { + implementation("dev.whyoleg.cryptography:cryptography-provider-jdk:$kotlinCryptoVersion") - val commonJvmTest = create("commonJvmTest") { - dependsOn(commonTest.get()) - } - commonJvmTest.dependencies { - implementation(kotlin("test-junit5")) - - implementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion") - implementation("org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion") - implementation("org.assertj:assertj-core:3.23.1") - runtimeOnly("fr.acinq.secp256k1:secp256k1-kmp-jni-jvm-linux:0.15.0") - runtimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion") - runtimeOnly("org.junit.vintage:junit-vintage-engine:$junitJupiterVersion") + implementation("com.squareup.okhttp3:okhttp:4.12.0") + implementation("io.ktor:ktor-client-okhttp:$ktorVersion") + //implementation("fr.acinq.secp256k1:secp256k1-kmp-jvm:0.6.4") + implementation("fr.acinq.secp256k1:secp256k1-kmp-jni-jvm:0.15.0") + } } - val baseJvmMain by getting { - dependsOn(commonJvmMain) + val commonJvmTest by getting { + dependsOn(commonTest.get()) dependencies { - //implementation("fr.acinq.secp256k1:secp256k1-kmp-jvm:0.6.4") - implementation("fr.acinq.secp256k1:secp256k1-kmp-jni-jvm:0.15.0") + implementation(kotlin("test-junit5")) + + implementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion") + implementation("org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion") + implementation("org.assertj:assertj-core:3.23.1") + runtimeOnly("fr.acinq.secp256k1:secp256k1-kmp-jni-jvm-linux:0.15.0") + runtimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion") + runtimeOnly("org.junit.vintage:junit-vintage-engine:$junitJupiterVersion") } } @@ -164,16 +158,10 @@ kotlin { } androidInstrumentedTest.configure { - //dependsOn(commonJvmTest) - } - - val androidUnitTest by getting { dependsOn(commonJvmTest) } - - - val baseJvmTest by getting { + val androidUnitTest by getting { dependsOn(commonJvmTest) } From 40ae67107738a91ee8773436262f6b6d0d9ca205 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Tue, 18 Feb 2025 15:24:15 +0100 Subject: [PATCH 3/3] Move to new version: v1.0-beta-12. --- README.md | 6 +++--- build.gradle.kts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9efe287..0b952ec 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can include the library from either Maven Central or Jitpack. You can include the library in the common source set like this: ```kotlin dependencies { - implementation("io.github.kotlingeekdev:rhodium:1.0-beta-11") + implementation("io.github.kotlingeekdev:rhodium:1.0-beta-12") } ``` @@ -74,7 +74,7 @@ then, in your module's `build.gradle(.kts)`, you need to add: // build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-11") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-12") } @@ -85,7 +85,7 @@ If you're including it in an Android app, you can just add: // app/build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-11") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-12") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 8f3942e..7f5d11e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,7 +31,7 @@ allprojects { val isJitpack = System.getenv("JITPACK") == "true" group = "io.github.kotlingeekdev" - version = "1.0-beta-11" + version = "1.0-beta-12" // val javadocJar = tasks.register("javadocJar") {