Refactor to add support for SDK plugins.

This commit is contained in:
Kevin Gorham 2020-02-12 07:59:47 -05:00
parent b630b9fa78
commit f02021709a
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
4 changed files with 10 additions and 2 deletions

View File

@ -42,6 +42,9 @@ dependencies {
implementation Deps.AndroidX.APPCOMPAT
implementation Deps.AndroidX.CORE_KTX
// Zcash
implementation 'com.github.zcash:zcash-android-wallet-plugins:1.0.0'
implementation "de.adorsys.android:securestoragelibrary:1.2.2"
androidTestImplementation Deps.Test.Android.JUNIT

View File

@ -1,6 +1,7 @@
package cash.z.ecc.android.lockbox
import android.content.Context
import cash.z.android.plugin.LockBoxPlugin
import de.adorsys.android.securestoragelibrary.SecurePreferences
import java.nio.ByteBuffer
import java.nio.CharBuffer
@ -8,7 +9,7 @@ import java.nio.charset.StandardCharsets
import java.util.*
import javax.inject.Inject
class LockBox @Inject constructor(private val appContext: Context) : LockBoxProvider {
class LockBox @Inject constructor(private val appContext: Context) : LockBoxPlugin {
override fun setBoolean(key: String, value: Boolean) {
SecurePreferences.setValue(appContext, key, value)

View File

@ -6,6 +6,9 @@ dependencies {
implementation Deps.JavaX.INJECT
implementation Deps.Kotlin.STDLIB
// Zcash
implementation 'com.github.zcash:zcash-android-wallet-plugins:1.0.0'
implementation 'com.madgag.spongycastle:core:1.58.0.0'
implementation 'io.github.novacrypto:BIP39:2019.01.27'
implementation 'io.github.novacrypto:securestring:2019.01.27'

View File

@ -1,5 +1,6 @@
package cash.z.ecc.kotlin.mnemonic
import cash.z.android.plugin.MnemonicPlugin
import io.github.novacrypto.bip39.MnemonicGenerator
import io.github.novacrypto.bip39.SeedCalculator
import io.github.novacrypto.bip39.Words
@ -10,7 +11,7 @@ import javax.inject.Inject
// TODO: either find another library that allows for doing this without strings or modify this code
// to leverage SecureCharBuffer (which doesn't work well with SeedCalculator.calculateSeed,
// which expects a string so for that reason, we just use Strings here)
class Mnemonics @Inject constructor(): MnemonicProvider {
class Mnemonics @Inject constructor(): MnemonicPlugin {
override fun nextEntropy(): ByteArray {
return ByteArray(Words.TWENTY_FOUR.byteLength()).apply {