Example #1
0
        public static string GetMnemonicFromEncrypted(PrivateKeyNotWallet key, Wordlist wordlist, string password, Network network)
        {
            var encryptedString = EncryptedPrivateKeyFormat.Encrypt(key, password, network);
            var encrypted       = Encoders.Base58Check.DecodeData(encryptedString);
            var mnemonic        = new Mnemonic(wordlist, encrypted);

            Debug.Assert(mnemonic.Words.Length == 28);
            return(mnemonic.ToString());
        }
Example #2
0
        public static PrivateKey FromMnemonicEncrypted(string mnemonic, string password, Network network)
        {
            var mnem = new Mnemonic(mnemonic);

            Debug.Assert(mnem.Words.Length == 28);
            var encrypted = Encoders.Base58Check.EncodeData(mnem.DeriveData());

            return(EncryptedPrivateKeyFormat.Decrypt(encrypted, password, network));
        }