From 4b2607a2d4d3a3018d039473fe623a6c05be90ce Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Thu, 29 Oct 2020 10:56:21 +1100 Subject: [PATCH] Switch to LazySodium for Android --- build.gradle | 11 +++++++++-- proguard-jna.pro | 3 +++ .../securesms/loki/activities/RegisterActivity.kt | 6 +++--- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 proguard-jna.pro diff --git a/build.gradle b/build.gradle index f3fe570b03..9b21884457 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,12 @@ repositories { includeGroupByRegex "com\\.amulyakhare.*" } } + maven { + url "https://dl.bintray.com/terl/lazysodium-maven" + content { + includeGroupByRegex "com\\.goterl\\.lazycode.*" + } + } google() jcenter() maven { url "https://jitpack.io" } @@ -145,8 +151,8 @@ dependencies { implementation "org.whispersystems:signal-service-android:2.13.2" // Run ./gradlew install from session-android-service to install implementation "org.whispersystems:curve25519-java:0.5.0" // Remote: - implementation "com.goterl.lazycode:lazysodium-java:4.3.0" - implementation "net.java.dev.jna:jna:5.6.0" + implementation "com.goterl.lazycode:lazysodium-android:4.2.0@aar" + implementation "net.java.dev.jna:jna:5.5.0@aar" implementation "com.google.protobuf:protobuf-java:2.5.0" implementation "com.fasterxml.jackson.core:jackson-databind:2.9.8" implementation "com.squareup.okhttp3:okhttp:3.12.1" @@ -266,6 +272,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-dagger.pro', 'proguard-jackson.pro', + 'proguard-jna.pro', 'proguard-sqlite.pro', 'proguard-appcompat-v7.pro', 'proguard-square-okhttp.pro', diff --git a/proguard-jna.pro b/proguard-jna.pro new file mode 100644 index 0000000000..e80831221c --- /dev/null +++ b/proguard-jna.pro @@ -0,0 +1,3 @@ +-dontwarn java.awt.* +-keep class com.sun.jna.* { *; } +-keepclassmembers class * extends com.sun.jna.* { public *; } \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/loki/activities/RegisterActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/RegisterActivity.kt index a254a42dc1..eaf7e72408 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/RegisterActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/RegisterActivity.kt @@ -15,8 +15,8 @@ import android.text.style.ClickableSpan import android.text.style.StyleSpan import android.view.View import android.widget.Toast -import com.goterl.lazycode.lazysodium.LazySodiumJava -import com.goterl.lazycode.lazysodium.SodiumJava +import com.goterl.lazycode.lazysodium.LazySodiumAndroid +import com.goterl.lazycode.lazysodium.SodiumAndroid import com.goterl.lazycode.lazysodium.utils.KeyPair import kotlinx.android.synthetic.main.activity_register.* import network.loki.messenger.R @@ -36,7 +36,7 @@ import org.whispersystems.libsignal.util.KeyHelper import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey class RegisterActivity : BaseActionBarActivity() { - private val sodium = LazySodiumJava(SodiumJava()) + private val sodium = LazySodiumAndroid(SodiumAndroid()) private var seed: ByteArray? = null private var ed25519KeyPair: KeyPair? = null private var x25519KeyPair: ECKeyPair? = null