[#708] Fix seed byte generation
This commit is contained in:
parent
193b376fe3
commit
4f144405c1
|
@ -1,5 +1,10 @@
|
|||
package cash.z.ecc.sdk.model
|
||||
|
||||
import cash.z.ecc.android.bip39.Mnemonics
|
||||
import cash.z.ecc.android.bip39.toSeed
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
// Consider using ImmutableList here
|
||||
data class SeedPhrase(val split: List<String>) {
|
||||
init {
|
||||
|
@ -13,7 +18,7 @@ data class SeedPhrase(val split: List<String>) {
|
|||
|
||||
fun joinToString() = split.joinToString(DEFAULT_DELIMITER)
|
||||
|
||||
fun toByteArray() = joinToString().encodeToByteArray()
|
||||
suspend fun toByteArray() = withContext(Dispatchers.IO) { Mnemonics.MnemonicCode(joinToString()).toSeed() }
|
||||
|
||||
companion object {
|
||||
const val SEED_PHRASE_SIZE = 24
|
||||
|
|
Loading…
Reference in New Issue