fix warnings

This commit is contained in:
neon443
2025-06-23 09:44:33 +01:00
parent b691224e39
commit ea857a8960
3 changed files with 6 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ class KeyManager: ObservableObject {
} }
print(privateKey) print(privateKey)
print(SecKeyCopyPublicKey(privateKey)) print(SecKeyCopyPublicKey(privateKey) ?? "")
// do { // do {
// try storeKey(privateKey, label: label) // try storeKey(privateKey, label: label)
// } catch { // } catch {

View File

@@ -89,12 +89,14 @@ kSecUseDataProtectionKeychain: true,
switch SecItemCopyMatching(query as CFDictionary, &item) { switch SecItemCopyMatching(query as CFDictionary, &item) {
case errSecSuccess: secKey = item as! SecKey case errSecSuccess: secKey = item as! SecKey
case errSecItemNotFound: return nil 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 // return secKey
var error: Unmanaged<CFError>? var error: Unmanaged<CFError>?
guard let data = SecKeyCopyExternalRepresentation(secKey, &error) as Data? else { guard (SecKeyCopyExternalRepresentation(secKey, &error) as Data?) != nil else {
throw KeyStoreError.KeyStoreError(error.debugDescription) throw KeyStoreError.KeyStoreError(error.debugDescription)
} }
// let key = try T(x963Representation: data) // let key = try T(x963Representation: data)

View File

@@ -110,7 +110,7 @@ struct ConnectionView: View {
} }
defer { fileURL.stopAccessingSecurityScopedResource() } defer { fileURL.stopAccessingSecurityScopedResource() }
privkey = try? Data(contentsOf: fileURL) privkey = try? Data(contentsOf: fileURL)
print(privkey) print(privkey ?? "")
print(fileURL) print(fileURL)
} catch { } catch {
print(error.localizedDescription) print(error.localizedDescription)