2022-10-04 05:25:13 -07:00
|
|
|
package cash.z.ecc.android.sdk.tool
|
|
|
|
|
|
|
|
import cash.z.ecc.android.bip39.Mnemonics
|
|
|
|
import cash.z.ecc.android.sdk.fixture.WalletFixture
|
|
|
|
import cash.z.ecc.android.sdk.model.Account
|
2022-12-13 05:25:09 -08:00
|
|
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
2022-10-04 05:25:13 -07:00
|
|
|
import kotlinx.coroutines.test.runTest
|
|
|
|
import org.junit.Test
|
|
|
|
import kotlin.test.assertContentEquals
|
|
|
|
|
|
|
|
class DerivationToolTest {
|
|
|
|
@Test
|
2022-12-13 05:25:09 -08:00
|
|
|
@OptIn(ExperimentalCoroutinesApi::class)
|
2022-10-04 05:25:13 -07:00
|
|
|
fun create_spending_key_does_not_mutate_passed_bytes() = runTest {
|
|
|
|
val bytesOne = Mnemonics.MnemonicCode(WalletFixture.SEED_PHRASE).toEntropy()
|
|
|
|
val bytesTwo = Mnemonics.MnemonicCode(WalletFixture.SEED_PHRASE).toEntropy()
|
|
|
|
|
|
|
|
DerivationTool.deriveUnifiedSpendingKey(bytesOne, WalletFixture.NETWORK, Account.DEFAULT)
|
|
|
|
|
|
|
|
assertContentEquals(bytesTwo, bytesOne)
|
|
|
|
}
|
|
|
|
}
|