@@ -12,6 +12,7 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
1212 case itemNotFound
1313 case interactionNotAllowed
1414 case decodeFailed
15+ case missingEntitlement
1516 case other( status: OSStatus )
1617 case unknown( message: String )
1718
@@ -26,6 +27,7 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
2627 case errSecItemNotFound: self = . itemNotFound
2728 case errSecInteractionNotAllowed: self = . interactionNotAllowed
2829 case errSecDecode: self = . decodeFailed
30+ case errSecMissingEntitlement: self = . missingEntitlement
2931 default : self = . other( status: rawValue)
3032 }
3133 }
@@ -41,6 +43,7 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
4143 case . itemNotFound: return errSecItemNotFound
4244 case . interactionNotAllowed: return errSecInteractionNotAllowed
4345 case . decodeFailed: return errSecDecode
46+ case . missingEntitlement: return errSecMissingEntitlement
4447 case let . other( status) : return status
4548 case . unknown: return errSecSuccess // This is not a Keychain error
4649 }
@@ -91,6 +94,8 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
9194 return " errSecInteractionNotAllowed: Interaction with the Security Server is not allowed. "
9295 case . decodeFailed:
9396 return " errSecDecode: Unable to decode the provided data. "
97+ case . missingEntitlement:
98+ return " errSecMissingEntitlement: A required entitlement is missing. "
9499 case . other:
95100 return " Unspecified Keychain error: \( self . status) . "
96101 case let . unknown( message) :
@@ -136,6 +141,10 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
136141 /// See [errSecDecode](https://developer.apple.com/documentation/security/errsecdecode).
137142 public static let decodeFailed : SimpleKeychainError = . init( code: . decodeFailed)
138143
144+ /// A required entitlement is missing.
145+ /// See [errSecMissingEntitlement](https://developer.apple.com/documentation/security/errsecmissingentitlement).
146+ public static let missingEntitlement : SimpleKeychainError = . init( code: . missingEntitlement)
147+
139148 /// Other Keychain error.
140149 /// The `OSStatus` of the Keychain operation can be accessed via the ``status`` property.
141150 public static let other : SimpleKeychainError = . init( code: . other( status: 0 ) )
0 commit comments