public override bool VerifyPassword(string password) { lock (accounts) { NEP6Account account = accounts.Values.FirstOrDefault(p => !p.Decrypted); if (account == null) { account = accounts.Values.FirstOrDefault(p => p.HasKey); } if (account == null) { return(true); } if (account.Decrypted) { return(account.VerifyPassword(password)); } else { try { account.GetKey(password); return(true); } catch (FormatException) { return(false); } } } }
/// <summary> /// 验证密码是否有效 /// </summary> /// <param name="password"></param> /// <returns></returns> public override bool VerifyPassword(string password) { lock (accounts) { NEP6Account account = accounts.Values.FirstOrDefault(p => !p.Decrypted); if (account == null) { account = accounts.Values.FirstOrDefault(p => p.HasKey); } if (account == null) { return(true); } //Console.WriteLine($"NEP6 VerifyPassword password: {password}"); if (account.Decrypted) { //Console.WriteLine($"NEP6 VerifyPassword password1: {password}"); return(account.VerifyPassword(password)); } else { try { //Console.WriteLine($"NEP6Wallet account: {account.ToJson().AsString()}"); //Console.WriteLine($"Account Key: {account.Address}"); //Console.WriteLine($"NEP6 VerifyPassword password2: {password}"); //Console.WriteLine($"WIFKey: {account.GetWIFKey()}"); account.GetKey(password); // 获取私钥 //Console.WriteLine($"WIFKey: {account.GetWIFKey()}"); return(true); } catch (FormatException) { //Console.WriteLine($"NEP6 VerifyPassword password2 Exception: {password}"); return(false); } } } }