diff --git a/Sources/Packages/Resources/Localizable.xcstrings b/Sources/Packages/Resources/Localizable.xcstrings index 85b8a3f..d869fdd 100644 --- a/Sources/Packages/Resources/Localizable.xcstrings +++ b/Sources/Packages/Resources/Localizable.xcstrings @@ -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", diff --git a/Sources/Packages/Sources/SecretKit/Types/SecretStore.swift b/Sources/Packages/Sources/SecretKit/Types/SecretStore.swift index 05d9228..42b4db9 100644 --- a/Sources/Packages/Sources/SecretKit/Types/SecretStore.swift +++ b/Sources/Packages/Sources/SecretKit/Types/SecretStore.swift @@ -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 + } } } diff --git a/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift b/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift index be11a25..7f2fc55 100644 --- a/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift +++ b/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift @@ -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) } ) }() diff --git a/Sources/Secretive/Preview Content/PreviewStore.swift b/Sources/Secretive/Preview Content/PreviewStore.swift index 56fe9ec..63e7507 100644 --- a/Sources/Secretive/Preview Content/PreviewStore.swift +++ b/Sources/Secretive/Preview Content/PreviewStore.swift @@ -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) + ] ) } diff --git a/Sources/Secretive/Views/Secrets/CreateSecretView.swift b/Sources/Secretive/Views/Secrets/CreateSecretView.swift index d976742..5b305a2 100644 --- a/Sources/Secretive/Views/Secrets/CreateSecretView.swift +++ b/Sources/Secretive/Views/Secrets/CreateSecretView.swift @@ -78,17 +78,20 @@ struct CreateSecretView: 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 { - Text(String(describing: option.keyType)) - .font(.caption) - Text(option.reason) - .font(.caption) + Button { + } label: { + Text(String(describing: option.keyType)) + switch option.reason { + case .macOSUpdateRequired: + Text(.createSecretKeyTypeMacOSUpdateRequiredLabel) + } + } } - .disabled(true) + .selectionDisabled() } } if keyType?.algorithm == .mldsa {