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

Changes for v1.0-beta-08 #24

Merged
merged 31 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e03fac2
Finish migration of Android source set.
KotlinGeekDev Feb 11, 2025
1781757
Configure the default OkHttp engine with ping interval support.
KotlinGeekDev Feb 11, 2025
4a47c76
Expose function for making a single filter request.
KotlinGeekDev Feb 11, 2025
ba0983c
Use varargs for the different Filter builder functions.
KotlinGeekDev Feb 11, 2025
72eb9fe
Add Kind 1111(comment) to list of kinds. Update README to show new AP…
KotlinGeekDev Feb 11, 2025
14422c1
Remove Ktor-OkHttp engine ping config, until we find a reliable one.
KotlinGeekDev Feb 11, 2025
eb00315
NostrService refactor: Remove questionable and useless code. Move Eos…
KotlinGeekDev Feb 11, 2025
81f8712
Add custom Ktor HTTP client support. Update and make adjustments to R…
KotlinGeekDev Feb 11, 2025
ec4e442
Re-enable Maven publish plugin.
KotlinGeekDev Feb 11, 2025
14a0126
Add config for Jitpack CI builds.
KotlinGeekDev Feb 11, 2025
5a2ff43
Tests: Migrate to new APi definitions.
KotlinGeekDev Feb 11, 2025
43c2d7a
Disable publish at the module level.
KotlinGeekDev Feb 12, 2025
b418944
Rename project to Ballast. Refactor accordingly.
KotlinGeekDev Feb 12, 2025
93acacf
Move to vanniktech publish plugin. Add a publish release workflow.
KotlinGeekDev Feb 12, 2025
a6e2131
Enable Jitpack support and automate release publication.
KotlinGeekDev Feb 12, 2025
3855c30
Rename Tag properties to align with meaning in protocol specs.
KotlinGeekDev Feb 12, 2025
008137c
New release: v.10-beta-07
KotlinGeekDev Feb 12, 2025
f4fdb29
Update publish workflow.
KotlinGeekDev Feb 12, 2025
f39145d
Update publish workflow(again).
KotlinGeekDev Feb 12, 2025
103efac
Update README and disable build on push.
KotlinGeekDev Feb 12, 2025
ad7d4c5
Add shields badge for maven central.
KotlinGeekDev Feb 12, 2025
a879440
Clarify jitpack section in README.
KotlinGeekDev Feb 12, 2025
901e06a
Make slight adjustments to the customClient parameter.
KotlinGeekDev Feb 13, 2025
8b87d36
NIP-05 support, using the NostrUtils.getProfileInfoFromAddress() API,…
KotlinGeekDev Feb 13, 2025
4e17a62
Make adjustments and add convenience functions for relay pool managem…
KotlinGeekDev Feb 13, 2025
9bd1806
Add new API: clearRelayPool().
KotlinGeekDev Feb 13, 2025
98cbeb3
Use hex conversion for Uuid in singleRequestFilter, until Kotlin UUID…
KotlinGeekDev Feb 13, 2025
52d443a
Introduce new API: getMetadataFor(profile, relays). Fix requestFromRe…
KotlinGeekDev Feb 13, 2025
63e75a7
Move to new name: Rhodium
KotlinGeekDev Feb 13, 2025
ce0955f
Prepare new version: v1.0-beta-08. Adjust README to new version and n…
KotlinGeekDev Feb 14, 2025
5478108
Merge branch 'main' into develop
KotlinGeekDev Feb 14, 2025
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
13 changes: 10 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@

name: Publish
on:
# push:
# branches: ["develop"]
release:
types: [released, prereleased]
types: [released]

#concurrency:
# cancel-in-progress: true

jobs:
publish:
name: Release build and publish
runs-on: macOS-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up JDK 21

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Publish to MavenCentral
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
run: ./gradlew publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kostr
# Rhodium

[![Kotlin](https://img.shields.io/badge/Kotlin-2.0.20-blue?style=flat&logo=kotlin)](https://kotlinlang.org)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.kotlingeekdev/ballast?color=blue)](https://search.maven.org/search?q=g:io.github.kotlingeekdev)

![badge-jvm](http://img.shields.io/badge/platform-jvm-DB413D.svg?style=flat)
![badge-android](http://img.shields.io/badge/platform-android-6EDB8D.svg?style=flat)
Expand All @@ -18,6 +19,17 @@ Note: This is still in development and very incomplete.
* The Nostr protocol specs can be found [here](https://github.com/nostr-protocol/nips).

## How to include the libary
You can include the library from either Maven Central or Jitpack.

### Maven
You can include the library in the common source set like this:
```kotlin
dependencies {
implementation("io.github.kotlingeekdev:rhodium:1.0-beta-08")
}
```

### Jitpack
Inside your root-level `build.gradle(.kts)` file, you should add `jitpack`:
``` kotlin
// build.gradle.kts
Expand Down Expand Up @@ -61,7 +73,7 @@ then, in your module's `build.gradle(.kts)`, you need to add:
// build.gradle.kts
dependencies {
//...
implementation("com.github.KotlinGeekDev.kostr:kostr-core:v1.0-beta-06")
implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-08")

}

Expand All @@ -71,15 +83,15 @@ If you're including it in an Android app, you can just add:
// app/build.gradle.kts
dependencies {
//...
implementation("com.github.KotlinGeekDev.kostr:kostr-core-android:v1.0-beta-06")
implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-08")

}
```

## Usage
When publishing an event, or making a subscription/close request to a relay,
[`ClientMessage`](kostr-core/src/commonMain/kotlin/ktnostr/nostr/client/ClientMessage.kt) is used to encode the request/event,
and anything sent by a relay is encoded as a [`RelayMessage`](kostr-core/src/commonMain/kotlin/ktnostr/nostr/relay/RelayMessage.kt).</p>
[`ClientMessage`](rhodium-core/src/commonMain/kotlin/rhodium/nostr/client/ClientMessage.kt) is used to encode the request/event,
and anything sent by a relay is encoded as a [`RelayMessage`](rhodium-core/src/commonMain/kotlin/rhodium/nostr/relay/RelayMessage.kt).</p>
Relays can be configured using a `RelayPool`,
and actual communication with relays is done with the `NostrService`.</p>
You can setup the NostrService with/without a custom relay pool as follows:
Expand Down
14 changes: 9 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ allprojects {
val isJitpack = System.getenv("JITPACK") == "true"

group = "io.github.kotlingeekdev"
version = "1.0-beta-07"
version = "1.0-beta-08"


// val javadocJar = tasks.register<Jar>("javadocJar") {
// archiveClassifier.set("javadoc")
Expand All @@ -43,14 +44,16 @@ allprojects {
signAllPublications()
}

coordinates(group.toString(), "ballast", version.toString())

coordinates(group.toString(), "rhodium", version.toString())

// configure(KotlinMultiplatform(
// javadocJar = JavadocJar.Javadoc(),
// sourcesJar = true
// ))

pom {
name = "Ballast"
name = "Rhodium"
description = " A Kotlin Multiplatform library for Nostr"
url = "https://github.com/KotlinGeekDev/Ballast"

Expand All @@ -71,8 +74,9 @@ allprojects {
}

scm {
connection = "scm:git:git://github.com/KotlinGeekDev/Ballast.git"
url = "https://github.com/KotlinGeekDev/Ballast"
connection = "scm:git:git://github.com/KotlinGeekDev/Rhodium.git"
url = "https://github.com/KotlinGeekDev/Rhodium"

}
}
}
Expand Down
1 change: 1 addition & 0 deletions rhodium-core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
244 changes: 244 additions & 0 deletions rhodium-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile

val kotlinVersion = "2.0.20"
val ktorVersion = "3.0.1"
val kotlinCryptoVersion = "0.4.0"

val junitJupiterVersion = "5.10.1"

plugins {
//`java-library`
kotlin("multiplatform")
id("com.android.library")

kotlin("plugin.serialization")
// `maven-publish`
}


kotlin {
//explicitApi()
jvmToolchain(17)

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_8)
languageVersion.set(KotlinVersion.KOTLIN_1_8)
}

jvm("baseJvm") {

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)


testRuns["test"].executionTask.configure {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
}


androidTarget {

publishAllLibraryVariants()
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}


linuxX64("linux") {
// compilations.all {
// cinterops {
// val libs by creating {
// defFile("src/linuxMain/cinterop/libs.def")
// }
// }
// }
//
// binaries {
// sharedLib {
//
// }
// }
}

//Apple targets
macosX64()
macosArm64()
iosX64()
iosArm64()
iosSimulatorArm64()


applyDefaultHierarchyTemplate()

sourceSets {
commonMain.dependencies {
//Ktor
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-websockets:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")

//Kotlin base
implementation("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")

//Crypto(Secp256k1-utils, SecureRandom, Hashing, etc.)
implementation("fr.acinq.secp256k1:secp256k1-kmp:0.15.0")
implementation("dev.whyoleg.cryptography:cryptography-core:$kotlinCryptoVersion")
implementation("dev.whyoleg.cryptography:cryptography-random:$kotlinCryptoVersion")

//Serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
//Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
//Atomics
implementation("org.jetbrains.kotlinx:atomicfu:0.25.0")
//Date-time
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
//UUID
implementation("com.benasher44:uuid:0.8.4")
}

commonTest.dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}

val commonJvmMain = create("commonJvmMain") {
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")
}

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")
}

val baseJvmMain by getting {
dependsOn(commonJvmMain)

dependencies {
//implementation("fr.acinq.secp256k1:secp256k1-kmp-jvm:0.6.4")
implementation("fr.acinq.secp256k1:secp256k1-kmp-jni-jvm:0.15.0")
}
}



val androidMain by getting {
dependsOn(commonJvmMain)

dependencies {
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("fr.acinq.secp256k1:secp256k1-kmp-jni-android:0.15.0")
}
}

androidInstrumentedTest.configure {
//dependsOn(commonJvmTest)
}

val androidUnitTest by getting {
dependsOn(commonJvmTest)
}



val baseJvmTest by getting {
dependsOn(commonJvmTest)
}

linuxMain.configure {
dependencies {
implementation("io.ktor:ktor-client-cio:$ktorVersion")
//implementation("io.ktor:ktor-client-curl:$ktorVersion")
implementation("dev.whyoleg.cryptography:cryptography-provider-openssl3-prebuilt:$kotlinCryptoVersion")
}
}

linuxTest.configure {
dependencies {

}

}

appleMain.configure {
dependencies {
implementation("io.ktor:ktor-client-darwin:$ktorVersion")
implementation("dev.whyoleg.cryptography:cryptography-provider-apple:$kotlinCryptoVersion")
}
}
macosMain.get().dependsOn(appleMain.get())
iosMain.get().dependsOn(appleMain.get())

}
}

android {
namespace = "io.github.kotlingeekdev.rhodium.android"
compileSdk = 34
defaultConfig {
minSdk = 21
targetSdk = 34
compileSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
aarMetadata {

}
isMinifyEnabled = false
}
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
}

}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}

tasks.withType<KotlinNativeCompile>().configureEach {
compilerOptions.freeCompilerArgs.add("-opt-in=kotlinx.cinterop.ExperimentalForeignApi")
}
Loading