Riccardo Montagnin
03/11/2019, 8:39 AMcommonMain
module:
fun String.asCharArray(): CharArray {
return (this as CharSequence).toList().toCharArray()
}
This is used inside the following function:
fun MnemonicWords.toSeed(password: String = ""): Seed {
val pass = words.joinToString(" ")
val salt = "mnemonic$password"
return Seed(PBKDF2.derive(pass.asCharArray(), salt.toByteArray()))
}
Then I have a test inside my commonTest
module as follows:
testData.forEach {
val expectedSeed = Seed(it.seed.hexToByteArray())
val actualSeed = MnemonicWords(it.phrase).toSeed("TREZOR")
assertEquals(expectedSeed.seed, actualSeed.seed)
}
When I try running it, I get the following error:
com.example.StringKt.asCharArray(Ljava/lang/String;)[C
java.lang.NoSuchMethodError: com.example.StringKt.asCharArray(Ljava/lang/String;)[C
How can I fix this?