Cryptura/Cryptura/Password.cs
WeeXnes 7717e63d04
All checks were successful
Java CI / test (push) Successful in 1m28s
impoved ui
2025-05-06 20:16:16 +02:00

36 lines
No EOL
951 B
C#

using System;
using System.IO;
using System.Net;
using Avalonia.Data.Core;
namespace Cryptura;
public class Password
{
public string Name { get; set; }
public string Value { get; set; }
public string CensoredValue { get; set; } = "**********";
public WXFile WxFile { get; set; }
public string DisplayValue
{
get => MainWindow.censorPasswords ? CensoredValue : Value;
}
public Password(string name, string value)
{
this.Name = name;
this.Value = value;
this.WxFile = new WXFile(Path.Combine(Globals.GetKeyDirectory(), Globals.GenerateUuidFilename()));
this.WxFile.CreateFromPassword(this);
}
public Password(string filepath)
{
this.WxFile = new WXFile(filepath);
if (!this.WxFile.Verify())
throw new FormatException("Invalid WX File");
this.Name = this.WxFile.GetName();
this.Value = this.WxFile.GetValue();
}
}