Move delete to use a confirmation dialog + various other fixes. (#645)

This commit is contained in:
Max Goedjen
2025-08-27 23:45:56 -07:00
committed by GitHub
parent c5052dd457
commit fb4dec383b
8 changed files with 96 additions and 84 deletions

View File

@@ -4,27 +4,27 @@ import Foundation
public struct AnySecret: Secret, @unchecked Sendable {
public let base: any Secret
private let hashable: AnyHashable
private let _id: () -> AnyHashable
private let _name: () -> String
private let _publicKey: () -> Data
private let _attributes: () -> Attributes
private let _eq: (AnySecret) -> Bool
public init<T>(_ secret: T) where T: Secret {
if let secret = secret as? AnySecret {
base = secret.base
hashable = secret.hashable
_id = secret._id
_name = secret._name
_publicKey = secret._publicKey
_attributes = secret._attributes
_eq = secret._eq
} else {
base = secret
self.hashable = secret
_id = { secret.id as AnyHashable }
_name = { secret.name }
_publicKey = { secret.publicKey }
_attributes = { secret.attributes }
_eq = { secret == $0.base as? T }
}
}
@@ -45,11 +45,11 @@ public struct AnySecret: Secret, @unchecked Sendable {
}
public static func == (lhs: AnySecret, rhs: AnySecret) -> Bool {
lhs.hashable == rhs.hashable
lhs._eq(rhs)
}
public func hash(into hasher: inout Hasher) {
hashable.hash(into: &hasher)
id.hash(into: &hasher)
}
}

View File

@@ -23,6 +23,10 @@ extension SecureEnclave {
self.attributes = attributes
}
public static func ==(lhs: Self, rhs: Self) -> Bool {
lhs.id == rhs.id
}
}
}