Files
ShhShell/ShhShell/Views/Keys/KeyManagerView.swift
neon443 4affc532d9 fix adding new hosts, it will navigate u to a new connection view with a host.blank, and add the host if it doesnt exist
added addhostifneeded
extracted hostskeys stuff to hostkeysview
added nav titles to everything
removed tabs, now just a list
renamed savedHosts -> hosts
2025-06-28 15:37:50 +01:00

51 lines
927 B
Swift

//
// KeyManagerView.swift
// ShhShell
//
// Created by neon443 on 20/06/2025.
//
import SwiftUI
struct KeyManagerView: View {
@ObservedObject var hostsManager: HostsManager
@ObservedObject var keyManager: KeyManager
var body: some View {
NavigationStack {
List {
Section {
ForEach(hostsManager.getKeys()) { keypair in
NavigationLink {
KeyDetailView(hostsManager: hostsManager, keypair: keypair)
} label: {
if let publicKey = keypair.publicKey {
Text(String(data: publicKey, encoding: .utf8) ?? "nil")
}
}
}
}
Button("ed25519") {
keyManager.generateEd25519()
}
Button("rsa") {
do {
try keyManager.generateRSA()
} catch {
print(error.localizedDescription)
}
}
}
.navigationTitle("Keys")
}
}
}
#Preview {
KeyManagerView(
hostsManager: HostsManager(),
keyManager: KeyManager()
)
}