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" : { "create_secret_mldsa_warning" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@ -17031,9 +17042,6 @@
} }
} }
} }
},
"macOS Tahoe or Later Required" : {
}, },
"no_secure_storage_description" : { "no_secure_storage_description" : {
"extractionState" : "manual", "extractionState" : "manual",

View File

@ -78,12 +78,16 @@ public struct KeyAvailability: Sendable {
public struct UnavailableKeyType: Sendable { public struct UnavailableKeyType: Sendable {
public let keyType: KeyType 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.keyType = keyType
self.reason = reason self.reason = reason
} }
public enum Reason: Sendable {
case macOSUpdateRequired
}
} }
} }

View File

@ -198,7 +198,7 @@ extension SecureEnclave {
.ecdsa256, .ecdsa256,
] + (isAtLeastMacOS26 ? macOS26Keys : []), ] + (isAtLeastMacOS26 ? macOS26Keys : []),
unavailable: (isAtLeastMacOS26 ? [] : macOS26Keys).map { 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" } var name: String { "Modifiable Preview Store" }
let secrets: [Secret] let secrets: [Secret]
var supportedKeyTypes: KeyAvailability { var supportedKeyTypes: KeyAvailability {
let macOS26Keys: [KeyType] = [.mldsa65, .mldsa87]
let isAtLeastMacOS26 = if #available(macOS 26, *) {
true
} else {
false
}
return KeyAvailability( return KeyAvailability(
available: [ available: [
.ecdsa256, .ecdsa256,
] + (isAtLeastMacOS26 ? macOS26Keys : []), .mldsa65,
unavailable: (isAtLeastMacOS26 ? [] : macOS26Keys).map { .mldsa87
KeyAvailability.UnavailableKeyType(keyType: $0, reason: "macOS Tahoe or Later Required") ],
} 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 ForEach(store.supportedKeyTypes.available, id: \.self) { option in
Text(String(describing: option)) Text(String(describing: option))
.tag(option) .tag(option)
.font(.caption)
} }
Divider() Divider()
ForEach(store.supportedKeyTypes.unavailable, id: \.keyType) { option in ForEach(store.supportedKeyTypes.unavailable, id: \.keyType) { option in
VStack { VStack {
Text(String(describing: option.keyType)) Button {
.font(.caption) } label: {
Text(option.reason) Text(String(describing: option.keyType))
.font(.caption) switch option.reason {
case .macOSUpdateRequired:
Text(.createSecretKeyTypeMacOSUpdateRequiredLabel)
}
}
} }
.disabled(true) .selectionDisabled()
} }
} }
if keyType?.algorithm == .mldsa { if keyType?.algorithm == .mldsa {