From ea857a8960243b268fc9f13b7477bb25140f6368 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 23 Jun 2025 09:44:33 +0100 Subject: [PATCH] fix warnings --- ShhShell/Keys/KeyManager.swift | 2 +- ShhShell/Keys/KeychainLayer.swift | 6 ++++-- ShhShell/Views/ConnectionView.swift | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) 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)