diff --git a/src/KeyKeeper/PasswordDialog.axaml b/src/KeyKeeper/PasswordDialog.axaml
new file mode 100644
index 0000000..5435275
--- /dev/null
+++ b/src/KeyKeeper/PasswordDialog.axaml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/KeyKeeper/PasswordDialog.axaml.cs b/src/KeyKeeper/PasswordDialog.axaml.cs
new file mode 100644
index 0000000..9374128
--- /dev/null
+++ b/src/KeyKeeper/PasswordDialog.axaml.cs
@@ -0,0 +1,36 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace KeyKeeper.Views
+{
+ public partial class PasswordDialog : Window
+ {
+ public string Password { get; private set; } = "";
+ public bool Created { get; private set; } = false;
+
+ public PasswordDialog()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private void OnCreateClick(object sender, Avalonia.Interactivity.RoutedEventArgs e)
+ {
+ var passwordBox = this.FindControl("PasswordBox");
+ Password = passwordBox?.Text ?? "";
+ Created = true;
+ Close();
+ }
+
+ private void OnCancelClick(object sender, Avalonia.Interactivity.RoutedEventArgs e)
+ {
+ Created = false;
+ Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/KeyKeeper/Views/MainWindow.axaml.cs b/src/KeyKeeper/Views/MainWindow.axaml.cs
index b55c457..58f1cb7 100644
--- a/src/KeyKeeper/Views/MainWindow.axaml.cs
+++ b/src/KeyKeeper/Views/MainWindow.axaml.cs
@@ -21,6 +21,7 @@ namespace KeyKeeper.Views
private async void CreateNewVault_Click(object sender, RoutedEventArgs e)
{
+ // 1. Открываем проводник
var file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{
Title = "Создать новое хранилище паролей",
@@ -39,12 +40,24 @@ namespace KeyKeeper.Views
{
if (file.TryGetLocalPath() is string path)
{
- (DataContext as MainWindowViewModel)!.CreateVault(path);
- OpenRepositoryWindow(new PassStoreFileAccessor(path, true, new StoreCreationOptions()
+ // 2. Открываем окно с паролем
+ var passwordDialog = new PasswordDialog();
+ await passwordDialog.ShowDialog(this);
+
+ // 3. Если нажали "Создать"
+ if (passwordDialog.Created)
{
- Key = new PasswordStore.Crypto.CompositeKey("blablabla", null),
- LockTimeoutSeconds = 800,
- }));
+ // 4. Создаем хранилище с паролем
+ var compositeKey = new PasswordStore.Crypto.CompositeKey(passwordDialog.Password, null);
+ (DataContext as MainWindowViewModel)!.CreateVault(path);
+
+ // 5. Открываем окно хранилища
+ OpenRepositoryWindow(new PassStoreFileAccessor(path, true, new StoreCreationOptions()
+ {
+ Key = compositeKey,
+ LockTimeoutSeconds = 800,
+ }));
+ }
}
}
}