Switch to LazySodium for Android

This commit is contained in:
nielsandriesse 2020-10-29 10:56:21 +11:00
parent edc0b43cbe
commit 4b2607a2d4
3 changed files with 15 additions and 5 deletions

View File

@ -55,6 +55,12 @@ repositories {
includeGroupByRegex "com\\.amulyakhare.*" includeGroupByRegex "com\\.amulyakhare.*"
} }
} }
maven {
url "https://dl.bintray.com/terl/lazysodium-maven"
content {
includeGroupByRegex "com\\.goterl\\.lazycode.*"
}
}
google() google()
jcenter() jcenter()
maven { url "https://jitpack.io" } 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:signal-service-android:2.13.2" // Run ./gradlew install from session-android-service to install
implementation "org.whispersystems:curve25519-java:0.5.0" implementation "org.whispersystems:curve25519-java:0.5.0"
// Remote: // Remote:
implementation "com.goterl.lazycode:lazysodium-java:4.3.0" implementation "com.goterl.lazycode:lazysodium-android:4.2.0@aar"
implementation "net.java.dev.jna:jna:5.6.0" implementation "net.java.dev.jna:jna:5.5.0@aar"
implementation "com.google.protobuf:protobuf-java:2.5.0" implementation "com.google.protobuf:protobuf-java:2.5.0"
implementation "com.fasterxml.jackson.core:jackson-databind:2.9.8" implementation "com.fasterxml.jackson.core:jackson-databind:2.9.8"
implementation "com.squareup.okhttp3:okhttp:3.12.1" implementation "com.squareup.okhttp3:okhttp:3.12.1"
@ -266,6 +272,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-dagger.pro', 'proguard-dagger.pro',
'proguard-jackson.pro', 'proguard-jackson.pro',
'proguard-jna.pro',
'proguard-sqlite.pro', 'proguard-sqlite.pro',
'proguard-appcompat-v7.pro', 'proguard-appcompat-v7.pro',
'proguard-square-okhttp.pro', 'proguard-square-okhttp.pro',

3
proguard-jna.pro Normal file
View File

@ -0,0 +1,3 @@
-dontwarn java.awt.*
-keep class com.sun.jna.* { *; }
-keepclassmembers class * extends com.sun.jna.* { public *; }

View File

@ -15,8 +15,8 @@ import android.text.style.ClickableSpan
import android.text.style.StyleSpan import android.text.style.StyleSpan
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import com.goterl.lazycode.lazysodium.LazySodiumJava import com.goterl.lazycode.lazysodium.LazySodiumAndroid
import com.goterl.lazycode.lazysodium.SodiumJava import com.goterl.lazycode.lazysodium.SodiumAndroid
import com.goterl.lazycode.lazysodium.utils.KeyPair import com.goterl.lazycode.lazysodium.utils.KeyPair
import kotlinx.android.synthetic.main.activity_register.* import kotlinx.android.synthetic.main.activity_register.*
import network.loki.messenger.R import network.loki.messenger.R
@ -36,7 +36,7 @@ import org.whispersystems.libsignal.util.KeyHelper
import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey
class RegisterActivity : BaseActionBarActivity() { class RegisterActivity : BaseActionBarActivity() {
private val sodium = LazySodiumJava(SodiumJava()) private val sodium = LazySodiumAndroid(SodiumAndroid())
private var seed: ByteArray? = null private var seed: ByteArray? = null
private var ed25519KeyPair: KeyPair? = null private var ed25519KeyPair: KeyPair? = null
private var x25519KeyPair: ECKeyPair? = null private var x25519KeyPair: ECKeyPair? = null