Files
ShhShell/ShhShell/Views/Keys/KeyManagerView.swift
neon443 80b83644b4 updated keypair data structure to have an name, passphrase and type
added generateKy to generate a key, currently only rsa
update generateRSA to return the Data for pub and priv, and take a custom size
bell animation better, slightly longer in total and easeinout
added new generate button hardcoded to a rsa 4096
added keytype to define key types (duh)
update getKeys to use the new keypair structure
2025-06-30 16:31:01 +01:00

49 lines
1.0 KiB
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 {
ZStack {
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
.ignoresSafeArea(.all)
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("genereate rsa") {
keyManager.generateKey(type: .rsa(4096), SEPKeyTag: "", comment: "jaklsd", passphrase: "")
}
}
.scrollContentBackground(.hidden)
.navigationTitle("Keys")
}
}
}
}
#Preview {
KeyManagerView(
hostsManager: HostsManager(),
keyManager: KeyManager()
)
}