51 lines
1.7 KiB
Swift
51 lines
1.7 KiB
Swift
import SwiftUI
|
|
import ProxyCore
|
|
|
|
struct CertificateView: View {
|
|
@Environment(AppState.self) private var appState
|
|
|
|
var body: some View {
|
|
List {
|
|
Section {
|
|
HStack {
|
|
Image(systemName: appState.isCertificateTrusted ? "checkmark.shield.fill" : "exclamationmark.shield")
|
|
.font(.largeTitle)
|
|
.foregroundStyle(appState.isCertificateTrusted ? .green : .orange)
|
|
|
|
VStack(alignment: .leading) {
|
|
Text(appState.isCertificateTrusted
|
|
? "Certificate is installed & trusted!"
|
|
: "Certificate not installed")
|
|
.font(.headline)
|
|
Text("Required for HTTPS decryption")
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
.padding(.vertical, 8)
|
|
}
|
|
|
|
Section("Details") {
|
|
LabeledContent("CA Certificate", value: "Proxy CA (\(UIDevice.current.name))")
|
|
LabeledContent("Generated", value: "-")
|
|
LabeledContent("Expires", value: "-")
|
|
}
|
|
|
|
Section {
|
|
Button("Install Certificate") {
|
|
// TODO: Phase 3 - Export and open cert installation
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
|
|
Section {
|
|
Button("Regenerate Certificate", role: .destructive) {
|
|
// TODO: Phase 3 - Generate new CA
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
}
|
|
.navigationTitle("Certificate")
|
|
}
|
|
}
|