private static void CreateWallet(out Safe safe) { Network network = null; safe = null; CommonWalletHelper.SelectNetwork(out network); string filePath = string.Empty; string password = string.Empty; bool shouldContinue = true; do { Console.WriteLine("Please enter valid folder file path where .json file should be saved\n"); filePath = Console.ReadLine(); CommonWalletHelper.CheckForSpecialCommand(filePath.ToLower()); shouldContinue = !CommonWalletHelper.CheckDirectory(filePath); } while (shouldContinue); CreateWalletHelper.GetPassword(out password); Mnemonic mnemonic; CreateWalletHelper.CreateJsonFile(password, filePath, network, out mnemonic, out safe); Console.WriteLine("File Successfuly Created!\nAfter 2 second full information will be presented\n"); _safe = safe; Thread.Sleep(2000); Console.Clear(); CreateWalletHelper.PrintInformation(safe, filePath, mnemonic, password); var sha256PublicKey = CryptoHelper.GetSHA256(safe.GetBitcoinExtPubKey().ToString()); CommonWalletHelper.AddNewRecordInWalletConfig(_config, sha256PublicKey); }
/// <summary> /// Get Entered Password and encryp with SHA256 /// </summary> /// <param name="password"></param> public static void GetPassword(out string password) { password = string.Empty; string inputPassword = string.Empty; string confirmPassword = string.Empty; bool shouldContinue = true; do { Console.WriteLine("Plase Enter Password: "******"Incorect password. Passwords for this wallet are at least 6 symbols log"); } } while (shouldContinue); password = CryptoHelper.GetSHA256(inputPassword); }
static void Main(string[] args) { GetConfig(out _config); Safe safe = null; FirstMessages(); string input = string.Empty; while (true) { input = Console.ReadLine(); if (input.ToLower() == "\\exit") { Console.WriteLine("Exiting Wallet..."); Thread.Sleep(1000); Console.Clear(); break; } switch (input.ToLower()) { case "\\help": GetCommandsInfo(); break; case "\\create": CreateWallet(out safe); break; case "\\recover": RecoverWallet(out safe); break; case "\\get-address": break; case "\\load": LoadWallet(out safe); break; default: if (!CommonWalletHelper.CheckForSpecialCommand(input)) { Console.WriteLine("Unknow Command!\n"); } break; } } }