Mnemonic

class Mnemonic(mnemonic: String)

Mnemonic phrases are a human-readable version of the private keys. Supported number of words are 12, 15, 18, 21 and 24.

Samples


fun main() { 
   //sampleStart 
   val mnemonic0: Mnemonic = Mnemonic(WordCount.WORDS12)

val mnemonic1: Mnemonic = Mnemonic.fromString("scene change clap smart together mind wheel knee clip normal trial unusual")

val entropy: List<UByte> = listOf<UByte>(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)
val mnemonic2: Mnemonic = Mnemonic.fromEntropy(entropy)

println(mnemonic0.asString(), mnemonic1.asString(), mnemonic2.asString()) 
   //sampleEnd
}

Parameters

mnemonic

The mnemonic as a string of space-separated words.

Constructors

Link copied to clipboard
fun Mnemonic(mnemonic: String)

Generates Mnemonic with a random entropy.

Functions

Link copied to clipboard
fun asString(): String
Link copied to clipboard
fun fromEntropy(): Mnemonic
Link copied to clipboard
fun fromString(): Mnemonic