@@ -12,6 +12,7 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
12
12
case itemNotFound
13
13
case interactionNotAllowed
14
14
case decodeFailed
15
+ case missingEntitlement
15
16
case other( status: OSStatus )
16
17
case unknown( message: String )
17
18
@@ -26,6 +27,7 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
26
27
case errSecItemNotFound: self = . itemNotFound
27
28
case errSecInteractionNotAllowed: self = . interactionNotAllowed
28
29
case errSecDecode: self = . decodeFailed
30
+ case errSecMissingEntitlement: self = . missingEntitlement
29
31
default : self = . other( status: rawValue)
30
32
}
31
33
}
@@ -41,6 +43,7 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
41
43
case . itemNotFound: return errSecItemNotFound
42
44
case . interactionNotAllowed: return errSecInteractionNotAllowed
43
45
case . decodeFailed: return errSecDecode
46
+ case . missingEntitlement: return errSecMissingEntitlement
44
47
case let . other( status) : return status
45
48
case . unknown: return errSecSuccess // This is not a Keychain error
46
49
}
@@ -91,6 +94,8 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
91
94
return " errSecInteractionNotAllowed: Interaction with the Security Server is not allowed. "
92
95
case . decodeFailed:
93
96
return " errSecDecode: Unable to decode the provided data. "
97
+ case . missingEntitlement:
98
+ return " errSecMissingEntitlement: A required entitlement is missing. "
94
99
case . other:
95
100
return " Unspecified Keychain error: \( self . status) . "
96
101
case let . unknown( message) :
@@ -136,6 +141,10 @@ public struct SimpleKeychainError: LocalizedError, CustomDebugStringConvertible
136
141
/// See [errSecDecode](https://developer.apple.com/documentation/security/errsecdecode).
137
142
public static let decodeFailed : SimpleKeychainError = . init( code: . decodeFailed)
138
143
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
+
139
148
/// Other Keychain error.
140
149
/// The `OSStatus` of the Keychain operation can be accessed via the ``status`` property.
141
150
public static let other : SimpleKeychainError = . init( code: . other( status: 0 ) )
0 commit comments