6 Commits

Author SHA1 Message Date
Fabrice Drouin
7bc3aafd08 Set version to 0.5.2 (#22) 2021-06-28 11:30:05 +02:00
Fabrice Drouin
9c1afc715a Fix Android build (#23)
* Upgrade Android NDK

* Use Android emulator 30.7.3 on macos
2021-06-28 10:31:57 +02:00
Fabrice Drouin
b544b24cc3 Fix memory leak in pubkeyCreate() (#20) 2021-06-22 16:16:08 +02:00
Fabrice Drouin
2b0254affb Update secp256k1 sources (#19)
We're now at efad350, the same commit that bitcoin core is using
2021-06-17 11:42:50 +02:00
Fabrice Drouin
b23733d5d4 Use kotlin 1.4.32, set version to 0.5.2-SNAPSHOT, remove bintray settings. (#18) 2021-04-08 10:12:36 +02:00
Fabrice Drouin
0751d7c103 Update README.md 2021-03-26 14:35:15 +01:00
8 changed files with 22 additions and 86 deletions

View File

@@ -32,7 +32,7 @@ jobs:
shell: bash
run: |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=21.3.6528147" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=21.4.7075529" >> $GITHUB_ENV
- name: Cached Android NDK
uses: actions/cache@v2
with:
@@ -80,6 +80,8 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
emulator-build: 7425822 # workaround to emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ndk: ${{ env.ANDROID_NDK_VERSION }}
cmake: 3.10.2.4988404
script: ./gradlew connectedCheck

View File

@@ -41,7 +41,7 @@ jobs:
shell: bash
run: |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=21.3.6528147" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=21.4.7075529" >> $GITHUB_ENV
- name: Cached Android NDK
uses: actions/cache@v2
with:
@@ -89,6 +89,8 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
-build: 7425822 # workaround to emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ndk: ${{ env.ANDROID_NDK_VERSION }}
cmake: 3.10.2.4988404
script: ./gradlew connectedCheck
@@ -157,4 +159,4 @@ jobs:
# env:
# BINTRAY_USER: ${{ secrets.bintray_user }}
# BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
# run: ./gradlew postBintrayPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
# run: ./gradlew postBintrayPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}

View File

@@ -47,7 +47,7 @@ jobs:
shell: bash
run: |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=21.3.6528147" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=21.4.7075529" >> $GITHUB_ENV
- name: Cached Android NDK
uses: actions/cache@v2
with:
@@ -95,6 +95,8 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
emulator-build: 7425822 # workaround to emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ndk: ${{ env.ANDROID_NDK_VERSION }}
cmake: 3.10.2.4988404
script: ./gradlew connectedCheck

View File

@@ -1,19 +1,15 @@
[![Kotlin](https://img.shields.io/badge/Kotlin-1.4.31-blue.svg?style=flat&logo=kotlin)](http://kotlinlang.org)
[![Maven Central](https://img.shields.io/maven-central/v/fr.acinq.secp256k1/secp256k1-kmp)](https://search.maven.org/search?q=g:fr.acinq.secp256k1%20a:secp256k1-kmp*)
![Github Actions](https://github.com/ACINQ/secp256k1-kmp/actions/workflows/test.yml/badge.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ACINQ/secp256k1-kmp/blob/master/LICENSE)
# Secp256k1 for Kotlin/Multiplatform
Kotlin/Multiplatform wrapper for Bitcoin Core's secp256k1 library. Targets: JVM, Android, iOS & Linux.
## Installation
[ ![Download](https://api.bintray.com/packages/acinq/libs/secp256k1/images/download.svg) ](https://bintray.com/acinq/libs/secp256k1-kmp/)
First, you need to add the ACINQ libraries repository:
```kotlin
// build.gradle.kts
repositories {
maven(url = "https://dl.bintray.com/acinq/libs")
}
```
secp256k1-kmp is available on [maven central](https://search.maven.org/search?q=g:fr.acinq.secp256k1%20a:secp256k1-kmp*)
Then, the actual dependency depends on your targeted platform(s):

View File

@@ -9,8 +9,8 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.dokka.Platform
plugins {
kotlin("multiplatform") version "1.4.31"
id("org.jetbrains.dokka") version "1.4.20"
kotlin("multiplatform") version "1.4.32"
id("org.jetbrains.dokka") version "1.4.30"
`maven-publish`
}
@@ -23,13 +23,13 @@ buildscript {
dependencies {
classpath("com.android.tools.build:gradle:4.0.2")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.30")
}
}
allprojects {
group = "fr.acinq.secp256k1"
version = "0.5.1"
version = "0.5.2"
repositories {
jcenter()
@@ -112,19 +112,6 @@ allprojects {
}
}
// Publication
val bintrayRepo = if (project.version.toString().contains("SNAPSHOT")) "snapshots" else "libs"
val bintrayUsername: String? = (properties["bintrayUsername"] as String?) ?: System.getenv("BINTRAY_USER")
val bintrayApiKey: String? = (properties["bintrayApiKey"] as String?) ?: System.getenv("BINTRAY_APIKEY")
val hasBintray = bintrayUsername != null && bintrayApiKey != null
if (!hasBintray) logger.warn("Skipping bintray configuration as bintrayUsername or bintrayApiKey is not defined")
val sonatypeUsername: String? = (properties["sonatypeUsername"] as String?) ?: System.getenv("SONATYPE_USERNAME")
val sonatypePassword: String? = (properties["sonatypePassword"] as String?) ?: System.getenv("SONATYPE_PASSWORD")
val hasSonatype = sonatypeUsername != null && sonatypePassword != null
if (!hasSonatype) logger.warn("Skipping sonatype snapshot configuration as sonatypeUsername or sonatypePassword is not defined")
allprojects {
val javadocJar = tasks.create<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
@@ -134,30 +121,6 @@ allprojects {
// Publication
plugins.withId("maven-publish") {
publishing {
repositories {
if (hasBintray) {
maven {
name = "bintray"
setUrl("https://api.bintray.com/maven/acinq/$bintrayRepo/${rootProject.name}/;publish=0")
credentials {
username = bintrayUsername
password = bintrayApiKey
}
}
}
if (hasSonatype) {
maven {
name = "snapshot"
setUrl("https://oss.sonatype.org/content/repositories/snapshots")
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
publications.withType<MavenPublication>().configureEach {
version = project.version.toString()
artifact(javadocJar)
@@ -224,32 +187,6 @@ allprojects {
}
}
if (hasBintray) {
val postBintrayPublish by tasks.creating {
doLast {
HttpClients.createDefault().use { client ->
val post = HttpPost("https://api.bintray.com/content/acinq/$bintrayRepo/${rootProject.name}/${project.version.toString()}/publish").apply {
entity = StringEntity("{}", ContentType.APPLICATION_JSON)
addHeader(BasicScheme().authenticate(UsernamePasswordCredentials(bintrayUsername, bintrayApiKey), this, null))
}
client.execute(post)
}
}
}
val postBintrayDiscard by tasks.creating {
doLast {
HttpClients.createDefault().use { client ->
val post = HttpPost("https://api.bintray.com/content/acinq/$bintrayRepo/${rootProject.name}/${project.version.toString()}/publish").apply {
entity = StringEntity("{ \"discard\": true }", ContentType.APPLICATION_JSON)
addHeader(BasicScheme().authenticate(UsernamePasswordCredentials(bintrayUsername, bintrayApiKey), this, null))
}
client.execute(post)
}
}
}
}
allprojects {
afterEvaluate {
tasks.withType<AbstractTestTask>() {

View File

@@ -35,7 +35,7 @@ android {
setPath("src/main/CMakeLists.txt")
}
}
ndkVersion = "21.3.6528147"
ndkVersion = "21.4.7075529"
afterEvaluate {
tasks.withType<com.android.build.gradle.tasks.factory.AndroidUnitTest>().all {

View File

@@ -133,11 +133,8 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
CHECKRESULT((*penv)->GetArrayLength(penv, jseckey) != 32, "secret key must be 32 bytes");
seckey = (*penv)->GetByteArrayElements(penv, jseckey, 0);
jpubkey = (*penv)->NewByteArray(penv, 65);
pubkey = (*penv)->GetByteArrayElements(penv, jpubkey, 0);
result = secp256k1_ec_pubkey_create(ctx, &pub, (unsigned char*)seckey);
(*penv)->ReleaseByteArrayElements(penv, jseckey, seckey, 0);
(*penv)->ReleaseByteArrayElements(penv, jpubkey, pubkey, 0);
CHECKRESULT(!result, "secp256k1_ec_pubkey_create failed");
jpubkey = (*penv)->NewByteArray(penv, 65);
pubkey = (*penv)->GetByteArrayElements(penv, jpubkey, 0);