diff --git a/ShhShell/Keys/KeyManager.swift b/ShhShell/Keys/KeyManager.swift index cfeac45..2f6b80c 100644 --- a/ShhShell/Keys/KeyManager.swift +++ b/ShhShell/Keys/KeyManager.swift @@ -61,7 +61,7 @@ class KeyManager: ObservableObject { } print(privateKey) - print(SecKeyCopyPublicKey(privateKey)) + print(SecKeyCopyPublicKey(privateKey) ?? "") // do { // try storeKey(privateKey, label: label) // } catch { diff --git a/ShhShell/Keys/KeychainLayer.swift b/ShhShell/Keys/KeychainLayer.swift index 888288e..5522859 100644 --- a/ShhShell/Keys/KeychainLayer.swift +++ b/ShhShell/Keys/KeychainLayer.swift @@ -89,12 +89,14 @@ kSecUseDataProtectionKeychain: true, switch SecItemCopyMatching(query as CFDictionary, &item) { case errSecSuccess: secKey = item as! SecKey case errSecItemNotFound: return nil - case let status: throw KeyStoreError.KeyStoreError("keychain read failed") + case let status: + print(status) + throw KeyStoreError.KeyStoreError("keychain read failed") } // return secKey var error: Unmanaged? - guard let data = SecKeyCopyExternalRepresentation(secKey, &error) as Data? else { + guard (SecKeyCopyExternalRepresentation(secKey, &error) as Data?) != nil else { throw KeyStoreError.KeyStoreError(error.debugDescription) } // let key = try T(x963Representation: data) diff --git a/ShhShell/Views/ConnectionView.swift b/ShhShell/Views/ConnectionView.swift index 5282f46..0cc6836 100644 --- a/ShhShell/Views/ConnectionView.swift +++ b/ShhShell/Views/ConnectionView.swift @@ -110,7 +110,7 @@ struct ConnectionView: View { } defer { fileURL.stopAccessingSecurityScopedResource() } privkey = try? Data(contentsOf: fileURL) - print(privkey) + print(privkey ?? "") print(fileURL) } catch { print(error.localizedDescription)