From 9a664b583b72e460cf620f8e5e66973a30fd45a0 Mon Sep 17 00:00:00 2001 From: TheXamlGuy Date: Sat, 8 Jun 2024 20:42:29 +0100 Subject: [PATCH] Added a lot more configrations --- Bitvault.Avalonia/App.axaml.cs | 12 + Bitvault/AttachmentEntryConfiguration.cs | 7 + Bitvault/CurrencyEntryConfiguration.cs | 7 + Bitvault/DateEntryConfiguration.cs | 7 + Bitvault/HyperlinkEntryConfiguration.cs | 7 + Bitvault/IItemEntryConfiguration.cs | 8 + Bitvault/ImageEntryConfiguration.cs | 7 + Bitvault/ItemConfiguration.cs | 855 +++++++++++++++++++- Bitvault/ItemEntryConfiguration.cs | 17 +- Bitvault/MultilineTextEntryConfiguration.cs | 8 + Bitvault/NumberEntryConfiguration.cs | 4 +- Bitvault/PinEntryConfiguration.cs | 10 + 12 files changed, 929 insertions(+), 20 deletions(-) create mode 100644 Bitvault/AttachmentEntryConfiguration.cs create mode 100644 Bitvault/CurrencyEntryConfiguration.cs create mode 100644 Bitvault/DateEntryConfiguration.cs create mode 100644 Bitvault/HyperlinkEntryConfiguration.cs create mode 100644 Bitvault/IItemEntryConfiguration.cs create mode 100644 Bitvault/ImageEntryConfiguration.cs create mode 100644 Bitvault/MultilineTextEntryConfiguration.cs create mode 100644 Bitvault/PinEntryConfiguration.cs diff --git a/Bitvault.Avalonia/App.axaml.cs b/Bitvault.Avalonia/App.axaml.cs index e99ed39..872b829 100644 --- a/Bitvault.Avalonia/App.axaml.cs +++ b/Bitvault.Avalonia/App.axaml.cs @@ -36,6 +36,18 @@ public partial class App : Application .AddConfiguration("Item:Login", ItemConfiguration.Login) .AddConfiguration("Item:Note", ItemConfiguration.Note) .AddConfiguration("Item:Password", ItemConfiguration.Password) + .AddConfiguration("Item:Passport", ItemConfiguration.Passport) + .AddConfiguration("Item:Api Credentials", ItemConfiguration.ApiCredentials) + .AddConfiguration("Item:Software License", ItemConfiguration.SoftwareLicense) + .AddConfiguration("Item:Crypto", ItemConfiguration.CryptoWallet) + .AddConfiguration("Item:Database", ItemConfiguration.Database) + .AddConfiguration("Item:Membership", ItemConfiguration.Membership) + .AddConfiguration("Item:Insurance Documents", ItemConfiguration.InsuranceDocuments) + .AddConfiguration("Item:Utility", ItemConfiguration.Utility) + .AddConfiguration("Item:Server", ItemConfiguration.Server) + .AddConfiguration("Item:Education Record", ItemConfiguration.EducationRecord) + .AddConfiguration("Item:Travel Documents", ItemConfiguration.TravelDocuments) + .ConfigureServices((context, services) => { services.AddAvalonia(); diff --git a/Bitvault/AttachmentEntryConfiguration.cs b/Bitvault/AttachmentEntryConfiguration.cs new file mode 100644 index 0000000..d54701a --- /dev/null +++ b/Bitvault/AttachmentEntryConfiguration.cs @@ -0,0 +1,7 @@ +namespace Bitvault; + +public record AttachmentEntryConfiguration : + ItemEntryConfiguration +{ + +} \ No newline at end of file diff --git a/Bitvault/CurrencyEntryConfiguration.cs b/Bitvault/CurrencyEntryConfiguration.cs new file mode 100644 index 0000000..2d74d3e --- /dev/null +++ b/Bitvault/CurrencyEntryConfiguration.cs @@ -0,0 +1,7 @@ +namespace Bitvault; + +public record CurrencyEntryConfiguration : + ItemEntryConfiguration +{ + +} \ No newline at end of file diff --git a/Bitvault/DateEntryConfiguration.cs b/Bitvault/DateEntryConfiguration.cs new file mode 100644 index 0000000..ec3ac23 --- /dev/null +++ b/Bitvault/DateEntryConfiguration.cs @@ -0,0 +1,7 @@ +namespace Bitvault; + +public record DateEntryConfiguration : + ItemEntryConfiguration +{ + +} \ No newline at end of file diff --git a/Bitvault/HyperlinkEntryConfiguration.cs b/Bitvault/HyperlinkEntryConfiguration.cs new file mode 100644 index 0000000..6103f4e --- /dev/null +++ b/Bitvault/HyperlinkEntryConfiguration.cs @@ -0,0 +1,7 @@ +namespace Bitvault; + +public record HyperlinkEntryConfiguration : + ItemEntryConfiguration +{ + +} \ No newline at end of file diff --git a/Bitvault/IItemEntryConfiguration.cs b/Bitvault/IItemEntryConfiguration.cs new file mode 100644 index 0000000..6cef570 --- /dev/null +++ b/Bitvault/IItemEntryConfiguration.cs @@ -0,0 +1,8 @@ +namespace Bitvault; + +public interface IItemEntryConfiguration +{ + string? Label { get; set; } + + object? Value { get; set; } +} diff --git a/Bitvault/ImageEntryConfiguration.cs b/Bitvault/ImageEntryConfiguration.cs new file mode 100644 index 0000000..8524b4d --- /dev/null +++ b/Bitvault/ImageEntryConfiguration.cs @@ -0,0 +1,7 @@ +namespace Bitvault; + +public record ImageEntryConfiguration : + ItemEntryConfiguration +{ + +} diff --git a/Bitvault/ItemConfiguration.cs b/Bitvault/ItemConfiguration.cs index 666dd8a..ce35321 100644 --- a/Bitvault/ItemConfiguration.cs +++ b/Bitvault/ItemConfiguration.cs @@ -8,7 +8,65 @@ public record ItemConfiguration { Sections = new List { - + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "First name" + }, + new TextEntryConfiguration + { + Label = "Last name" + }, + new DateEntryConfiguration + { + Label = "Date of birth" + }, + new DropdownEntryConfiguration + { + Label = "Gender", + Values = ["Male", "Female", "Non-binary", "Prefer not to say", "Other"] + }, + new TextEntryConfiguration + { + Label = "Address" + }, + new TextEntryConfiguration + { + Label = "City" + }, + new TextEntryConfiguration + { + Label = "State/Province/Region" + }, + new TextEntryConfiguration + { + Label = "Postal code" + }, + new TextEntryConfiguration + { + Label = "Country" + }, + new TextEntryConfiguration + { + Label = "Email address" + }, + new TextEntryConfiguration + { + Label = "Phone number" + }, + new TextEntryConfiguration + { + Label = "National ID number" + }, + new TextEntryConfiguration + { + Label = "Nationality" + } + } + } } }; @@ -16,7 +74,78 @@ public record ItemConfiguration { Sections = new List { - + new() + { + Entries = new List + { + new NumberEntryConfiguration + { + Label = "Name on account" + }, + new DropdownEntryConfiguration + { + Label = "Type", + Values = [ + "Checking Account", + "Savings Account", + "Money Market Account", + "Certificate of Deposit (CD)", + "Individual Retirement Account (IRA)", + "Joint Account", + "Student Account", + "Senior Account", + "Business Checking Account", + "Business Savings Account", + "Merchant Account", + "Escrow Account", + "Trust Account", + "Estate Account", + "Custodial Account", + "Offshore Account", + "Online-Only Account", + "High-Yield Savings Account", + "Health Savings Account (HSA)", + "Foreign Currency Account", + "Non-Resident External (NRE) Account", + "Non-Resident Ordinary (NRO) Account" + ] + }, + new NumberEntryConfiguration + { + Label = "Sort code", + MaxLength = 6 + }, + new NumberEntryConfiguration + { + Label = "Account number", + MaxLength = 12 + }, + new TextEntryConfiguration + { + Label = "Bank name" + }, + new TextEntryConfiguration + { + Label = "Branch address" + }, + new DateEntryConfiguration + { + Label = "Date opened" + }, + new CurrencyEntryConfiguration + { + Label = "Current balance" + }, + new HyperlinkEntryConfiguration + { + Label = "Website" + }, + new TextEntryConfiguration + { + Label = "Phone number" + } + } + } } }; @@ -24,16 +153,33 @@ public record ItemConfiguration { Sections = new List { - + new() + { + Entries = new List + { + new NumberEntryConfiguration + { + Label = "Notes" + } + } + } } }; - public static ItemConfiguration Document => new() { Sections = new List { - + new() + { + Entries = new List + { + new AttachmentEntryConfiguration + { + Label = "Attachments" + } + } + } } }; @@ -41,10 +187,59 @@ public record ItemConfiguration { Sections = new List { - + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Surname" + }, + new TextEntryConfiguration + { + Label = "Given Names" + }, + new DateEntryConfiguration + { + Label = "Date of Birth" + }, + new TextEntryConfiguration + { + Label = "Address" + }, + new TextEntryConfiguration + { + Label = "Country" + }, + new TextEntryConfiguration + { + Label = "Number" + }, + new TextEntryConfiguration + { + Label = "Class" + }, + new DateEntryConfiguration + { + Label = "Expiry Date" + }, + new DateEntryConfiguration + { + Label = "Issue Date" + }, + new TextEntryConfiguration + { + Label = "Issuing Authority" + }, + new TextEntryConfiguration + { + Label = "Restrictions/Endorsements" + } + } + } } }; - + public static ItemConfiguration Login => new() { Sections = new List @@ -60,6 +255,22 @@ public record ItemConfiguration new PasswordEntryConfiguration { Label = "Password" + }, + new HyperlinkEntryConfiguration + { + Label = "Website" + }, + new TextEntryConfiguration + { + Label = "Security Questions" + }, + new TextEntryConfiguration + { + Label = "Two-factor Authentication (2FA)" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" } } } @@ -73,10 +284,414 @@ public record ItemConfiguration new() { Entries = new List - { + { new PasswordEntryConfiguration { Label = "Password" + }, + new DateEntryConfiguration + { + Label = "Expiration Date" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration ApiCredentials => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "API Name" + }, + new TextEntryConfiguration + { + Label = "API Key" + }, + new TextEntryConfiguration + { + Label = "API Secret" + }, + new TextEntryConfiguration + { + Label = "API Token" + }, + new TextEntryConfiguration + { + Label = "Description" + }, + new TextEntryConfiguration + { + Label = "Environment" + }, + new HyperlinkEntryConfiguration + { + Label = "Endpoint URL" + }, + new HyperlinkEntryConfiguration + { + Label = "Documentation URL" + }, + new MultilineTextEntryConfiguration + { + Label = "Additional Notes" + } + } + } + } + }; + + public static ItemConfiguration EducationRecord => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Degree/Certificate" + }, + new TextEntryConfiguration + { + Label = "Institution" + }, + new TextEntryConfiguration + { + Label = "Date Awarded" + }, + new TextEntryConfiguration + { + Label = "GPA/Grade" + }, + new TextEntryConfiguration + { + Label = "Major/Field of Study" + }, + new AttachmentEntryConfiguration + { + Label = "Attachments" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration Utility => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Service Provider" + }, + new TextEntryConfiguration + { + Label = "Account Number" + }, + new TextEntryConfiguration + { + Label = "Billing Address" + }, + new TextEntryConfiguration + { + Label = "Contact Phone Number" + }, + new TextEntryConfiguration + { + Label = "Account Balance" + }, + new TextEntryConfiguration + { + Label = "Due Date" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration Membership => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Membership Type" + }, + new TextEntryConfiguration + { + Label = "Membership Number" + }, + new TextEntryConfiguration + { + Label = "Organization" + }, + new DateEntryConfiguration + { + Label = "Join Date" + }, + new DateEntryConfiguration + { + Label = "Renewal Date" + }, + new TextEntryConfiguration + { + Label = "Membership Benefits" + }, + new TextEntryConfiguration + { + Label = "Contact Information" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration InsuranceDocuments => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Policy Holder" + }, + new TextEntryConfiguration + { + Label = "Policy Number" + }, + new TextEntryConfiguration + { + Label = "Insurance Company" + }, + new TextEntryConfiguration + { + Label = "Type of Insurance" + }, + new DateEntryConfiguration + { + Label = "Policy Start Date" + }, + new DateEntryConfiguration + { + Label = "Policy End Date" + }, + new TextEntryConfiguration + { + Label = "Coverage Details" + }, + new TextEntryConfiguration + { + Label = "Contact Information" + }, + new AttachmentEntryConfiguration + { + Label = "Attachments" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration TravelDocuments => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Document Type" + }, + new TextEntryConfiguration + { + Label = "Document Number" + }, + new TextEntryConfiguration + { + Label = "Issuing Country" + }, + new DateEntryConfiguration + { + Label = "Issue Date" + }, + new DateEntryConfiguration + { + Label = "Expiration Date" + }, + new TextEntryConfiguration + { + Label = "Issuing Authority" + }, + new TextEntryConfiguration + { + Label = "Purpose/Details" + }, + new AttachmentEntryConfiguration + { + Label = "Attachments" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration CryptoWallet => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Wallet Name" + }, + new TextEntryConfiguration + { + Label = "Wallet Type" + }, + new TextEntryConfiguration + { + Label = "Wallet Address" + }, + new PasswordEntryConfiguration + { + Label = "Private Key" + }, + new PasswordEntryConfiguration + { + Label = "Mnemonic Phrase" + }, + new TextEntryConfiguration + { + Label = "Public Key" + }, + new TextEntryConfiguration + { + Label = "Exchange Address" + }, + new TextEntryConfiguration + { + Label = "Backup Seed Phrase" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration Passport => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Passport Number" + }, + new TextEntryConfiguration + { + Label = "Issuing Country" + }, + new TextEntryConfiguration + { + Label = "Nationality" + }, + new TextEntryConfiguration + { + Label = "Surname" + }, + new TextEntryConfiguration + { + Label = "Given Names" + }, + new DateEntryConfiguration + { + Label = "Date of Birth" + }, + new TextEntryConfiguration + { + Label = "Sex" + }, + new TextEntryConfiguration + { + Label = "Place of Birth" + }, + new DateEntryConfiguration + { + Label = "Issue Date" + }, + new DateEntryConfiguration + { + Label = "Expiration Date" + }, + new TextEntryConfiguration + { + Label = "Issuing Authority" + }, + new TextEntryConfiguration + { + Label = "Observations" + }, + new ImageEntryConfiguration + { + Label = "Passport Photo" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" } } } @@ -93,7 +708,7 @@ public record ItemConfiguration { new TextEntryConfiguration { - Label = "Cardholder name" + Label = "Cardholder" }, new DropdownEntryConfiguration { @@ -102,13 +717,19 @@ public record ItemConfiguration }, new MaskedTextEntryConfiguration { - Label = "Card number", + Label = "Card Number", Pattern = "0000-0000-0000-0000", Value = "____-____-____-____", }, new MaskedTextEntryConfiguration { - Label = "Expiry date", + Label = "Expiry Date", + Pattern = "00/00", + Value = "__/__", + }, + new MaskedTextEntryConfiguration + { + Label = "Valid From", Pattern = "00/00", Value = "__/__", }, @@ -119,7 +740,219 @@ public record ItemConfiguration Value = "___", }, } + }, + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Pin" + }, + new PinEntryConfiguration + { + Label = "Credit Limit", + }, + new TextEntryConfiguration + { + Label = "Interest Rates", + }, + new MultilineTextEntryConfiguration + { + Label = "Rewards" + } + } + }, + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Card Issuer" + }, + new NumberEntryConfiguration + { + Label = "Phone", + }, + new HyperlinkEntryConfiguration + { + Label = "Website", + } + } } } }; + + public static ItemConfiguration Server => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "IP Address" + }, + new TextEntryConfiguration + { + Label = "Hostname" + }, + new TextEntryConfiguration + { + Label = "Port" + }, + new TextEntryConfiguration + { + Label = "Protocol" + }, + new TextEntryConfiguration + { + Label = "Username" + }, + new PasswordEntryConfiguration + { + Label = "Password" + }, + new TextEntryConfiguration + { + Label = "SSH Key Path" + }, + new TextEntryConfiguration + { + Label = "Connection URL" + }, + new TextEntryConfiguration + { + Label = "Remote Desktop URL" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration Database => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "Database Name" + }, + new TextEntryConfiguration + { + Label = "Database Type" + }, + new TextEntryConfiguration + { + Label = "Host" + }, + new TextEntryConfiguration + { + Label = "Port" + }, + new TextEntryConfiguration + { + Label = "Username" + }, + new PasswordEntryConfiguration + { + Label = "Password" + }, + new TextEntryConfiguration + { + Label = "Connection URL" + }, + new TextEntryConfiguration + { + Label = "Admin URL" + }, + new TextEntryConfiguration + { + Label = "Admin Username" + }, + new PasswordEntryConfiguration + { + Label = "Admin Password" + }, + new TextEntryConfiguration + { + Label = "Backup Location" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + + public static ItemConfiguration SoftwareLicense => new() + { + Sections = new List + { + new() + { + Entries = new List + { + new TextEntryConfiguration + { + Label = "License Key/Serial Number" + }, + new TextEntryConfiguration + { + Label = "Licensed To" + }, + new TextEntryConfiguration + { + Label = "License Type" + }, + new DateEntryConfiguration + { + Label = "Purchase Date" + }, + new DateEntryConfiguration + { + Label = "Expiration Date" + }, + new TextEntryConfiguration + { + Label = "Vendor/Supplier" + }, + new TextEntryConfiguration + { + Label = "Support Contact" + }, + new TextEntryConfiguration + { + Label = "Support Email" + }, + new NumberEntryConfiguration + { + Label = "Support Phone" + }, + new TextEntryConfiguration + { + Label = "Usage Restrictions" + }, + new MultilineTextEntryConfiguration + { + Label = "Notes" + } + } + } + } + }; + } \ No newline at end of file diff --git a/Bitvault/ItemEntryConfiguration.cs b/Bitvault/ItemEntryConfiguration.cs index fae44f6..5bf2005 100644 --- a/Bitvault/ItemEntryConfiguration.cs +++ b/Bitvault/ItemEntryConfiguration.cs @@ -2,20 +2,21 @@ namespace Bitvault; -public interface IItemEntryConfiguration -{ - string? Label { get; set; } - - object? Value { get; set; } -} - [JsonDerivedType(typeof(DropdownEntryConfiguration), typeDiscriminator: "Dropdown")] [JsonDerivedType(typeof(MaskedTextEntryConfiguration), typeDiscriminator: "MaskedText")] [JsonDerivedType(typeof(NoteEntryConfiguration), typeDiscriminator: "Note")] [JsonDerivedType(typeof(NumberEntryConfiguration), typeDiscriminator: "Number")] [JsonDerivedType(typeof(PasswordEntryConfiguration), typeDiscriminator: "Password")] [JsonDerivedType(typeof(TextEntryConfiguration), typeDiscriminator: "Text")] -public record ItemEntryConfiguration : IItemEntryConfiguration +[JsonDerivedType(typeof(ImageEntryConfiguration), typeDiscriminator: "Image")] +[JsonDerivedType(typeof(AttachmentEntryConfiguration), typeDiscriminator: "Attachment")] +[JsonDerivedType(typeof(MultilineTextEntryConfiguration), typeDiscriminator: "MultilineText")] +[JsonDerivedType(typeof(CurrencyEntryConfiguration), typeDiscriminator: "Currency")] +[JsonDerivedType(typeof(DateEntryConfiguration), typeDiscriminator: "Date")] +[JsonDerivedType(typeof(HyperlinkEntryConfiguration), typeDiscriminator: "Hyperlink")] +[JsonDerivedType(typeof(PinEntryConfiguration), typeDiscriminator: "Pin")] +public record ItemEntryConfiguration : + IItemEntryConfiguration { [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? Label { get; set; } diff --git a/Bitvault/MultilineTextEntryConfiguration.cs b/Bitvault/MultilineTextEntryConfiguration.cs new file mode 100644 index 0000000..df56b88 --- /dev/null +++ b/Bitvault/MultilineTextEntryConfiguration.cs @@ -0,0 +1,8 @@ +namespace Bitvault; + +public record MultilineTextEntryConfiguration : + ItemEntryConfiguration +{ + + +} diff --git a/Bitvault/NumberEntryConfiguration.cs b/Bitvault/NumberEntryConfiguration.cs index 6e4aaa5..9ad43c8 100644 --- a/Bitvault/NumberEntryConfiguration.cs +++ b/Bitvault/NumberEntryConfiguration.cs @@ -3,5 +3,7 @@ public record NumberEntryConfiguration : ItemEntryConfiguration { + public int MinLength { get; set; } -} + public int MaxLength { get; set; } +} \ No newline at end of file diff --git a/Bitvault/PinEntryConfiguration.cs b/Bitvault/PinEntryConfiguration.cs new file mode 100644 index 0000000..50c33fe --- /dev/null +++ b/Bitvault/PinEntryConfiguration.cs @@ -0,0 +1,10 @@ +namespace Bitvault; + +public record PinEntryConfiguration : + ItemEntryConfiguration +{ + public int Minimum { get; set; } + + public int Maximum { get; set; } +} +