From 935c118d356b7d97d2c13dde882a4260c58f05ff Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Tue, 1 Jul 2025 20:43:51 +0100 Subject: [PATCH] add none option for connection viwe add key type picker --- ShhShell/Keys/KeyType.swift | 2 +- ShhShell/Views/Hosts/ConnectionView.swift | 4 +++- ShhShell/Views/Keys/KeyImporterView.swift | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ShhShell/Keys/KeyType.swift b/ShhShell/Keys/KeyType.swift index 2d23c26..5ac7421 100644 --- a/ShhShell/Keys/KeyType.swift +++ b/ShhShell/Keys/KeyType.swift @@ -7,7 +7,7 @@ import Foundation -enum KeyType: Codable, Equatable, Hashable, CustomStringConvertible { +enum KeyType: Codable, Equatable, Hashable, CustomStringConvertible, CaseIterable { case ed25519 case rsa diff --git a/ShhShell/Views/Hosts/ConnectionView.swift b/ShhShell/Views/Hosts/ConnectionView.swift index 7190d28..62d1bd6 100644 --- a/ShhShell/Views/Hosts/ConnectionView.swift +++ b/ShhShell/Views/Hosts/ConnectionView.swift @@ -80,9 +80,11 @@ struct ConnectionView: View { TextBox(label: "Password", text: $handler.host.password, prompt: "not required if using publickeys", secure: true) Picker("Private key", selection: $handler.host.privateKeyID) { + Text("None") + .tag(nil as UUID?) ForEach(keyManager.keypairs) { keypair in Text(keypair.label) - .tag(keypair.id) + .tag(keypair.id as UUID?) } } diff --git a/ShhShell/Views/Keys/KeyImporterView.swift b/ShhShell/Views/Keys/KeyImporterView.swift index 672309c..9d595df 100644 --- a/ShhShell/Views/Keys/KeyImporterView.swift +++ b/ShhShell/Views/Keys/KeyImporterView.swift @@ -23,12 +23,22 @@ struct KeyImporterView: View { var body: some View { List { TextBox(label: "Name", text: $keyName, prompt: "A name for your key") + + Picker("Key type", selection: $keyType) { + ForEach(KeyType.allCases, id: \.self) { type in + Text(type.description) + .tag(type) + } + } + .pickerStyle(SegmentedPickerStyle()) + HStack { Text("Private Key") Spacer() Text("Required") .foregroundStyle(.red) } + TextEditor(text: $privkeyStr) TextEditor(text: .constant(keypair.openSshPubkey))