From 7ba5e85aaf198a070a691b12f5ea667bb24df579 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 2 Jan 2022 16:20:12 -0800 Subject: [PATCH] . --- .../PublicKeyStandinFileController.swift | 3 +-- Sources/Secretive/Views/SecretDetailView.swift | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename Sources/Packages/Sources/{SecretAgentKit => SecretKit}/PublicKeyStandinFileController.swift (96%) diff --git a/Sources/Packages/Sources/SecretAgentKit/PublicKeyStandinFileController.swift b/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift similarity index 96% rename from Sources/Packages/Sources/SecretAgentKit/PublicKeyStandinFileController.swift rename to Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift index 174d2c8..b35aaf9 100644 --- a/Sources/Packages/Sources/SecretAgentKit/PublicKeyStandinFileController.swift +++ b/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift @@ -1,6 +1,5 @@ import Foundation import OSLog -import SecretKit /// Controller responsible for writing public keys to disk, so that they're easily accessible by scripts. public class PublicKeyFileStoreController { @@ -38,7 +37,7 @@ public class PublicKeyFileStoreController { /// - Parameter secret: The Secret to return the path for. /// - Returns: The path to the Secret's public key. /// - Warning: This method returning a path does not imply that a key has been written to disk already. This method only describes where it will be written to. - func path(for secret: AnySecret) -> String { + public func path(for secret: SecretType) -> String { directory.appending("/").appending("\(secret.name.replacingOccurrences(of: " ", with: "-")).pub") } diff --git a/Sources/Secretive/Views/SecretDetailView.swift b/Sources/Secretive/Views/SecretDetailView.swift index bd26675..5b2c3ea 100644 --- a/Sources/Secretive/Views/SecretDetailView.swift +++ b/Sources/Secretive/Views/SecretDetailView.swift @@ -6,6 +6,7 @@ struct SecretDetailView: View { @State var secret: SecretType private let keyWriter = OpenSSHKeyWriter() + private let publicKeyFileStoreController = PublicKeyFileStoreController() var body: some View { ScrollView { @@ -20,7 +21,7 @@ struct SecretDetailView: View { CopyableView(title: "Public Key Contents", image: Image(systemName: "key"), text: keyString) Spacer() .frame(height: 20) - CopyableView(title: "Public Key Path", image: Image(systemName: "lock.doc"), text: "/Users/max/whatever") + CopyableView(title: "Public Key Path", image: Image(systemName: "lock.doc"), text: publicKeyFileStoreController.path(for: secret)) Spacer() } } @@ -43,7 +44,7 @@ struct SecretDetailView: View { var keyString: String { keyWriter.openSSHString(secret: secret, comment: "\(dashedKeyName)@\(dashedHostName)") } - + } #if DEBUG