This commit is contained in:
Max Goedjen 2025-09-14 14:03:08 -07:00
parent 25434aa31c
commit cac207f6c9
No known key found for this signature in database
5 changed files with 33 additions and 22 deletions

View File

@ -5754,6 +5754,17 @@
}
}
},
"create_secret_key_type_macOS_update_required_label" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Unavailable on this version of macOS"
}
}
}
},
"create_secret_mldsa_warning" : {
"extractionState" : "manual",
"localizations" : {
@ -17031,9 +17042,6 @@
}
}
}
},
"macOS Tahoe or Later Required" : {
},
"no_secure_storage_description" : {
"extractionState" : "manual",

View File

@ -78,12 +78,16 @@ public struct KeyAvailability: Sendable {
public struct UnavailableKeyType: Sendable {
public let keyType: KeyType
public let reason: LocalizedStringResource
public let reason: Reason
public init(keyType: KeyType, reason: LocalizedStringResource) {
public init(keyType: KeyType, reason: Reason) {
self.keyType = keyType
self.reason = reason
}
public enum Reason: Sendable {
case macOSUpdateRequired
}
}
}

View File

@ -198,7 +198,7 @@ extension SecureEnclave {
.ecdsa256,
] + (isAtLeastMacOS26 ? macOS26Keys : []),
unavailable: (isAtLeastMacOS26 ? [] : macOS26Keys).map {
KeyAvailability.UnavailableKeyType(keyType: $0, reason: "macOS Tahoe or Later Required")
KeyAvailability.UnavailableKeyType(keyType: $0, reason: .macOSUpdateRequired)
}
)
}()

View File

@ -61,19 +61,15 @@ extension Preview {
var name: String { "Modifiable Preview Store" }
let secrets: [Secret]
var supportedKeyTypes: KeyAvailability {
let macOS26Keys: [KeyType] = [.mldsa65, .mldsa87]
let isAtLeastMacOS26 = if #available(macOS 26, *) {
true
} else {
false
}
return KeyAvailability(
available: [
.ecdsa256,
] + (isAtLeastMacOS26 ? macOS26Keys : []),
unavailable: (isAtLeastMacOS26 ? [] : macOS26Keys).map {
KeyAvailability.UnavailableKeyType(keyType: $0, reason: "macOS Tahoe or Later Required")
}
.mldsa65,
.mldsa87
],
unavailable: [
.init(keyType: .ecdsa384, reason: .macOSUpdateRequired)
]
)
}

View File

@ -78,17 +78,20 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
ForEach(store.supportedKeyTypes.available, id: \.self) { option in
Text(String(describing: option))
.tag(option)
.font(.caption)
}
Divider()
ForEach(store.supportedKeyTypes.unavailable, id: \.keyType) { option in
VStack {
Button {
} label: {
Text(String(describing: option.keyType))
.font(.caption)
Text(option.reason)
.font(.caption)
switch option.reason {
case .macOSUpdateRequired:
Text(.createSecretKeyTypeMacOSUpdateRequiredLabel)
}
.disabled(true)
}
}
.selectionDisabled()
}
}
if keyType?.algorithm == .mldsa {