-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocalAuthentication.framework.h
More file actions
524 lines (460 loc) · 29.3 KB
/
LocalAuthentication.framework.h
File metadata and controls
524 lines (460 loc) · 29.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
// ========== LocalAuthentication.framework/Headers/LABase.h
//
// LABase.h
// LocalAuthentication
//
// Copyright © 2018 Apple. All rights reserved.
//
#ifndef LA_EXPORT
#define LA_EXPORT __attribute__((visibility("default")))
#endif
#ifndef LA_EXTERN
#ifdef __cplusplus
#define LA_EXTERN extern "C" __attribute__((visibility("default")))
#else
#define LA_EXTERN extern __attribute__((visibility("default")))
#endif
#endif
// ========== LocalAuthentication.framework/Headers/LAContext.h
//
// LAContext.h
// LocalAuthentication
//
// Copyright (c) 2014 Apple. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <LocalAuthentication/LAPublicDefines.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, LAPolicy)
{
/// Device owner is going to be authenticated using a biometric method (Touch ID or Face ID).
///
/// @discussion Biometric authentication is required. If the biometry is not available, not enrolled,
/// or locked out, then the evaluation of this policy will fail with LAErrorBiometryNotAvailable,
/// LAErrorBiometryNotEnrolled or LAErrorBiometryLockout. Biometry can't be used without a passcode,
/// i.e. when biometry is available, enrolled and not locked out but passcode is not set, then
/// the evaluation will fail with LAErrorPasscodeNotSet.
///
/// Touch ID authentication dialog contains a cancel button with default title "Cancel"
/// which can be customized using localizedCancelTitle property, and a fallback button with
/// default title "Enter Password" which can be customized using localizedFallbackTitle
/// property. Fallback button is initially hidden and shows up after first unsuccessful
/// Touch ID attempt. Tapping either button causes evaluatePolicy call to fail, returning
/// a distinct error code: LAErrorUserCancel or LAErrorUserFallback.
///
/// Face ID authentication begins with animating HUD. If it succeeds at first attempt,
/// the HUD will disappear and no other UI is shown. If the first attempt fails, then
/// LocalAuthentication will show a dialog with two buttons: "Cancel" and "Try Face ID Again".
/// After second failure, the buttons are "Cancel" and "Enter Password" with the same
/// semantics as in the case of Touch ID.
///
/// Biometric authentication will get locked after 5 unsuccessful attempts. After that,
/// users have to unlock it by entering passcode. The passcode can be entered either at
/// Lock Screen or even in app by the means of LAPolicyDeviceOwnerAuthentication.
/// The Lock Screen unlock is preferred user experience because we generaly don't want users to
/// enter their passcode at app's request.
LAPolicyDeviceOwnerAuthenticationWithBiometrics API_AVAILABLE(ios(8.0), macos(10.12.2), watchos(3.0), tvos(10.0)) = kLAPolicyDeviceOwnerAuthenticationWithBiometrics,
/// Device owner is going to be authenticated by biometry or device passcode.
///
/// @discussion Biometric or passcode authentication is required. If the biometry is available, enrolled and
/// not locked out, users are asked for it first. Otherwise they are asked to enter device
/// passcode. If passcode is not enabled, policy evaluation will fail with LAErrorPasscodeNotSet.
///
/// Biometric authentication dialog behaves similarly as the one used by
/// LAPolicyDeviceOwnerAuthenticationWithBiometrics. However, instead of "Enter Password"
/// button there is "Enter Passcode" button which, when tapped, switches the authentication
/// method and allows users to enter device passcode.
///
/// Passcode authentication will get locked after 6 unsuccessful attempts with progressively
/// increased backoff delay.
LAPolicyDeviceOwnerAuthentication API_AVAILABLE(ios(9.0), macos(10.11), watchos(3.0), tvos(10.0)) = kLAPolicyDeviceOwnerAuthentication,
/// Device owner is going to be authenticated by Watch.
///
/// @discussion Watch authentication is required. If no nearby paired watch device can be found,
/// LAErrorWatchNotAvailable is returned.
///
/// Watch authentication dialog looks and behaves similarly to the biometric variant. Users can
/// confirm authentication by double-clicking the side button on their watch.
LAPolicyDeviceOwnerAuthenticationWithWatch API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios, watchos, tvos) = kLAPolicyDeviceOwnerAuthenticationWithWatch,
/// Device owner is going to be authenticated by biometry or Watch.
///
/// @discussion Watch or biometric authentication is required. If no nearby paired watch device can be found,
/// it behaves as LAPolicyDeviceOwnerAuthenticationWithBiometrics. Similarly, if biometry is
/// unavailable it behaves as LAPolicyDeviceOwnerAuthenticationWithWatch.
///
/// Watch authentication dialog looks and behaves similarly to biometric variant. When both
/// machanisms are available, user is asked to use biometry and watch authentication will run in
/// parallel.
LAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios, watchos, tvos) = kLAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch
} API_AVAILABLE(ios(8.0), macos(10.10), watchos(3.0), tvos(10.0));
/// The maximum value for LAContext touchIDAuthenticationAllowableReuseDuration property.
extern const NSTimeInterval LATouchIDAuthenticationMaximumAllowableReuseDuration API_AVAILABLE(macos(10.12), ios(9.0)) API_UNAVAILABLE(watchos, tvos);
/// Class that represents an authentication context.
///
/// @discussion This context can be used for evaluating policies.
///
/// @see LAPolicy
API_AVAILABLE(macos(10.10), ios(8.0), watchos(3.0), tvos(10.0))
@interface LAContext : NSObject
/// Determines if a particular policy can be evaluated.
///
/// @discussion Policies can have certain requirements which, when not satisfied, would always cause
/// the policy evaluation to fail - e.g. a passcode set, a fingerprint
/// enrolled with Touch ID or a face set up with Face ID. This method allows easy checking
/// for such conditions.
///
/// Applications should consume the returned value immediately and avoid relying on it
/// for an extensive period of time. At least, it is guaranteed to stay valid until the
/// application enters background.
///
/// @warning Do not call this method in the reply block of evaluatePolicy:reply: because it could
/// lead to a deadlock.
///
/// @param policy Policy for which the preflight check should be run.
///
/// @param error Optional output parameter which is set to nil if the policy can be evaluated, or it
/// contains error information if policy evaluation is not possible.
///
/// @return YES if the policy can be evaluated, NO otherwise.
- (BOOL)canEvaluatePolicy:(LAPolicy)policy error:(NSError * __autoreleasing *)error __attribute__((swift_error(none)))
API_AVAILABLE(macos(10.10), ios(8.0), watchos(3.0), tvos(10.0));
/// Evaluates the specified policy.
///
/// @discussion Policy evaluation may involve prompting user for various kinds of interaction
/// or authentication. Actual behavior is dependent on evaluated policy, device type,
/// and can be affected by installed configuration profiles.
///
/// Be sure to keep a strong reference to the context while the evaluation is in progress.
/// Otherwise, an evaluation would be canceled when the context is being deallocated.
///
/// The method does not block. Instead, the caller must provide a reply block to be
/// called asynchronously when evaluation finishes. The block is executed on a private
/// queue internal to the framework in an unspecified threading context. Other than that,
/// no guarantee is made about which queue, thread, or run-loop the block is executed on.
///
/// Implications of successful policy evaluation are policy specific. In general, this
/// operation is not idempotent. Policy evaluation may fail for various reasons, including
/// user cancel, system cancel and others, see LAError codes.
///
/// @param policy Policy to be evaluated.
///
/// @param reply Reply block that is executed when policy evaluation finishes.
/// success Reply parameter that is YES if the policy has been evaluated successfully or
/// NO if the evaluation failed.
/// error Reply parameter that is nil if the policy has been evaluated successfully, or it
/// contains error information about the evaluation failure.
///
/// @param localizedReason Application reason for authentication. This string must be provided in correct
/// localization and should be short and clear. It will be eventually displayed in
/// the authentication dialog subtitle for Touch ID or passcode. The name of the
/// calling application will be displayed in title, so it should not be duplicated here.
///
/// This parameter is mostly ignored by Face ID authentication. Face ID will show
/// generic instructions unless a customized fallback title is provided in
/// localizedFallbackTitle property. For that case, it will show the authentication
/// reason so that the instructions can be made consistent with the custom button
/// title. Therefore, you should make sure that users are already aware of the need
/// and reason for Face ID authentication before they have triggered the policy evaluation.
///
/// @warning localizedReason parameter is mandatory and the call will throw NSInvalidArgumentException if
/// nil or empty string is specified.
///
/// @warning Applications should also supply NSFaceIDUsageDescription key in the Info.plist. This key identifies
/// a string value that contains a message to be displayed to users when the app is trying to use
/// Face ID for the first time. Users can choose to allow or deny the use of Face ID by the app before
/// the first use or later in Face ID privacy settings. When the use of Face ID is denied, evaluations
/// will fail with LAErrorBiometryNotAvailable.
///
/// @see LAError
///
/// Typical error codes returned by this call are:
/// @li LAErrorUserFallback if user tapped the fallback button
/// @li LAErrorUserCancel if user has tapped the Cancel button
/// @li LAErrorSystemCancel if some system event interrupted the evaluation (e.g. Home button pressed).
- (void)evaluatePolicy:(LAPolicy)policy
localizedReason:(NSString *)localizedReason
reply:(void(^)(BOOL success, NSError * __nullable error))reply
API_AVAILABLE(macos(10.10), ios(8.0), watchos(3.0), tvos(10.0));
/// Invalidates the context.
///
/// @discussion The context is invalidated automatically when it is (auto)released. This method
/// allows invalidating it manually while it is still in scope.
///
/// Invalidation terminates any existing policy evaluation and the respective call will
/// fail with LAErrorAppCancel. After the context has been invalidated, it can not be
/// used for policy evaluation and an attempt to do so will fail with LAErrorInvalidContext.
///
/// Invalidating a context that has been already invalidated has no effect.
- (void)invalidate API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(10.0));
typedef NS_ENUM(NSInteger, LACredentialType)
{
/// Password provided by application
///
/// @discussion If not set, LocalAuthentication will ask for the password when necessary. It will use
/// its own user interface depending on the evaluated policy or ACL.
/// Applications can provide the password using the setCredential method. In such case,
/// LocalAuthentication will not show password entry user interface.
/// When entered from the LocalAuthentication user interface, the password is stored as
/// UTF-8 encoded string.
LACredentialTypeApplicationPassword = kLACredentialTypeApplicationPassword,
} API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(10.0));
/// Sets a credential to this context.
///
/// @discussion Some policies allow to bind application-provided credential with them.
/// This method allows credential to be passed to the right context.
///
/// @param credential Credential to be used with subsequent calls. Setting this parameter to nil will remove
/// any existing credential of the specified type.
///
/// @param type Type of the provided credential.
///
/// @return YES if the credential was set successfully, NO otherwise.
///
- (BOOL)setCredential:(nullable NSData *)credential
type:(LACredentialType)type API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(10.0));
/// Reveals if credential was set with this context.
///
/// @param type Type of credential we are asking for.
///
/// @return YES on success, NO otherwise.
///
- (BOOL)isCredentialSet:(LACredentialType)type API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(10.0));
typedef NS_ENUM(NSInteger, LAAccessControlOperation)
{
/// Access control will be used for item creation.
LAAccessControlOperationCreateItem,
/// Access control will be used for accessing existing item.
LAAccessControlOperationUseItem,
/// Access control will be used for key creation.
LAAccessControlOperationCreateKey,
/// Access control will be used for sign operation with existing key.
LAAccessControlOperationUseKeySign,
/// Access control will be used for data decryption using existing key.
LAAccessControlOperationUseKeyDecrypt API_AVAILABLE(macos(10.12), ios(10.0)),
/// Access control will be used for key exchange.
LAAccessControlOperationUseKeyKeyExchange API_AVAILABLE(macos(10.12), ios(10.0)),
} API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(10.0));
/// Evaluates access control object for the specified operation.
///
/// @discussion Access control evaluation may involve prompting user for various kinds of interaction
/// or authentication. Actual behavior is dependent on evaluated access control, device type,
/// and can be affected by installed configuration profiles.
///
/// Be sure to keep a strong reference to the context while the evaluation is in progress.
/// Otherwise, an evaluation would be canceled when the context is being deallocated.
///
/// The method does not block. Instead, the caller must provide a reply block to be
/// called asynchronously when evaluation finishes. The block is executed on a private
/// queue internal to the framework in an unspecified threading context. Other than that,
/// no guarantee is made about which queue, thread, or run-loop the block is executed on.
///
/// After successful access control evaluation, the LAContext can be used with keychain operations,
/// so that they do not require user to authenticate.
///
/// Access control evaluation may fail for various reasons, including user cancel, system cancel
/// and others, see LAError codes.
///
/// @param accessControl Access control object that is typically created by SecAccessControlCreateWithFlags.
///
/// @param operation Type of operation the access control will be used with.
///
/// @param localizedReason Application reason for authentication. This string must be provided in correct
/// localization and should be short and clear. It will be eventually displayed in
/// the authentication dialog subtitle for Touch ID or passcode. The name of the
/// calling application will be displayed in title, so it should not be duplicated here.
///
/// This parameter is mostly ignored by Face ID authentication. Face ID will show
/// generic instructions unless a customized fallback title is provided in
/// localizedFallbackTitle property. For that case, it will show the authentication
/// reason so that the instructions can be made consistent with the custom button
/// title. Therefore, you should make sure that users are already aware of the need
/// and reason for Face ID authentication before they have triggered the policy evaluation.
///
/// @param reply Reply block that is executed when access control evaluation finishes.
/// success Reply parameter that is YES if the access control has been evaluated successfully or
/// NO if the evaluation failed.
/// error Reply parameter that is nil if the access control has been evaluated successfully, or
/// it contains error information about the evaluation failure.
///
/// @warning localizedReason parameter is mandatory and the call will throw NSInvalidArgumentException if
/// nil or empty string is specified.
///
/// @warning Applications should also supply NSFaceIDUsageDescription key in the Info.plist. This key identifies
/// a string value that contains a message to be displayed to users when the app is trying to use
/// Face ID for the first time. Users can choose to allow or deny the use of Face ID by the app before
/// the first use or later in Face ID privacy settings. When the use of Face ID is denied, evaluations
/// will fail with LAErrorBiometryNotAvailable.
- (void)evaluateAccessControl:(SecAccessControlRef)accessControl
operation:(LAAccessControlOperation)operation
localizedReason:(NSString *)localizedReason
reply:(void(^)(BOOL success, NSError * __nullable error))reply
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0)) API_UNAVAILABLE(tvos);
/// Fallback button title.
/// @discussion Allows fallback button title customization. If set to empty string, the button will be hidden.
/// A default title "Enter Password" is used when this property is left nil.
@property (nonatomic, nullable, copy) NSString *localizedFallbackTitle API_AVAILABLE(macos(10.10), ios(8.0), watchos(3.0), tvos(10.0));
/// This property is deprecated and setting it has no effect.
@property (nonatomic, nullable) NSNumber *maxBiometryFailures NS_DEPRECATED_IOS(8_3, 9_0) __WATCHOS_UNAVAILABLE __TVOS_UNAVAILABLE;
/// Cancel button title.
/// @discussion Allows cancel button title customization. A default title "Cancel" is used when
/// this property is left nil or is set to empty string.
@property (nonatomic, nullable, copy) NSString *localizedCancelTitle API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0));
/// Contains policy domain state.
///
/// @discussion This property is set only when evaluatePolicy is called and succesful Touch ID or Face ID authentication
/// was performed, or when canEvaluatePolicy succeeds for a biometric policy.
/// It stays nil for all other cases.
/// If biometric database was modified (fingers or faces were removed or added), evaluatedPolicyDomainState
/// data will change. Nature of such database changes cannot be determined
/// but comparing data of evaluatedPolicyDomainState after different evaluatePolicy
/// will reveal the fact database was changed between calls.
///
/// @warning Please note that the value returned by this property can change exceptionally between major OS versions even if
/// the state of biometry has not changed.
@property (nonatomic, nullable, readonly) NSData *evaluatedPolicyDomainState API_AVAILABLE(macos(10.11), ios(9.0)) API_UNAVAILABLE(watchos, tvos);
/// Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past.
///
/// @discussion This property can be set with a time interval in seconds. If the device was successfully unlocked by
/// biometry within this time interval, then biometric authentication on this context will succeed
/// automatically and the reply block will be called without prompting user for Touch ID or Face ID.
///
/// The default value is 0, meaning that no previous biometric unlock can be reused.
///
/// This property is meant only for reusing biometric matches from the device lock screen.
/// It does not allow reusing previous biometric matches in application or between applications.
///
/// The maximum supported interval is 5 minutes and setting the value beyond 5 minutes does not increase
/// the accepted interval.
///
/// @see LATouchIDAuthenticationMaximumAllowableReuseDuration
@property (nonatomic) NSTimeInterval touchIDAuthenticationAllowableReuseDuration API_AVAILABLE(macos(10.12), ios(9.0)) API_UNAVAILABLE(watchos, tvos);
/// Allows setting the default localized authentication reason on context.
///
/// @discussion A localized string from this property is displayed in the authentication UI if the caller didn't specify
/// its own authentication reason (e.g. a keychain operation with kSecUseAuthenticationContext). This property
/// is ignored if the authentication reason was provided by caller.
@property (nonatomic, copy) NSString *localizedReason API_AVAILABLE(macos(10.13), ios(11.0)) API_UNAVAILABLE(watchos, tvos);
/// Allows running authentication in non-interactive mode.
///
/// @discussion If the context is used in a keychain query by the means of kSecUseAuthenticationContext,
/// then setting this property to YES has the same effect as passing kSecUseNoAuthenticationUI
/// in the query, i.e. the keychain call will eventually fail with errSecInteractionNotAllowed
/// instead of displaying the authentication UI.
///
/// If this property is used with a LocalAuthentication evaluation, it will eventually fail with
/// LAErrorNotInteractive instead of displaying the authentication UI.
@property (nonatomic) BOOL interactionNotAllowed API_AVAILABLE(macos(10.13), ios(11.0)) API_UNAVAILABLE(watchos, tvos);
typedef NS_ENUM(NSInteger, LABiometryType)
{
/// The device does not support biometry.
LABiometryTypeNone API_AVAILABLE(macos(10.13.2), ios(11.2)),
LABiometryNone API_DEPRECATED_WITH_REPLACEMENT("LABiometryTypeNone", macos(10.13, 10.13.2), ios(11.0, 11.2)) = LABiometryTypeNone,
/// The device supports Touch ID.
LABiometryTypeTouchID,
/// The device supports Face ID.
LABiometryTypeFaceID API_AVAILABLE(macos(10.15)),
} API_AVAILABLE(macos(10.13.2), ios(11.0)) API_UNAVAILABLE(watchos, tvos);
/// Indicates the type of the biometry supported by the device.
///
/// @discussion This property is set when canEvaluatePolicy has been called for a biometric policy.
/// The default value is LABiometryTypeNone.
@property (nonatomic, readonly) LABiometryType biometryType API_AVAILABLE(macos(10.13.2), ios(11.0)) API_UNAVAILABLE(watchos, tvos);
@end
NS_ASSUME_NONNULL_END
// ========== LocalAuthentication.framework/Headers/LAPublicDefines.h
//
// LAPublicDefines.h
// LocalAuthentication
//
// Copyright (c) 2014 Apple. All rights reserved.
//
#ifndef LocalAuthentication_LAPublicDefines_h
#define LocalAuthentication_LAPublicDefines_h
// Policies
#define kLAPolicyDeviceOwnerAuthenticationWithBiometrics 1
#define kLAPolicyDeviceOwnerAuthentication 2
#define kLAPolicyDeviceOwnerAuthenticationWithWatch 3
#define kLAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch 4
// Credential types
#define kLACredentialTypeApplicationPassword 0
// Error codes
#define kLAErrorAuthenticationFailed -1
#define kLAErrorUserCancel -2
#define kLAErrorUserFallback -3
#define kLAErrorSystemCancel -4
#define kLAErrorPasscodeNotSet -5
#define kLAErrorTouchIDNotAvailable -6
#define kLAErrorTouchIDNotEnrolled -7
#define kLAErrorTouchIDLockout -8
#define kLAErrorAppCancel -9
#define kLAErrorInvalidContext -10
#define kLAErrorWatchNotAvailable -11
#define kLAErrorNotInteractive -1004
#define kLAErrorBiometryNotAvailable kLAErrorTouchIDNotAvailable
#define kLAErrorBiometryNotEnrolled kLAErrorTouchIDNotEnrolled
#define kLAErrorBiometryLockout kLAErrorTouchIDLockout
// Error domain
#define kLAErrorDomain "com.apple.LocalAuthentication"
#endif
// ========== LocalAuthentication.framework/Headers/LocalAuthentication.h
//
// LocalAuthentication.h
// LocalAuthentication
//
// Copyright (c) 2014 Apple. All rights reserved.
//
#import <LocalAuthentication/LABase.h>
#import <LocalAuthentication/LAContext.h>
#import <LocalAuthentication/LAError.h>
// ========== LocalAuthentication.framework/Headers/LAError.h
//
// LAError.h
// LocalAuthentication
//
// Copyright (c) 2013 Apple. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <LocalAuthentication/LAPublicDefines.h>
typedef NS_ENUM(NSInteger, LAError)
{
/// Authentication was not successful, because user failed to provide valid credentials.
LAErrorAuthenticationFailed = kLAErrorAuthenticationFailed,
/// Authentication was canceled by user (e.g. tapped Cancel button).
LAErrorUserCancel = kLAErrorUserCancel,
/// Authentication was canceled, because the user tapped the fallback button (Enter Password).
LAErrorUserFallback = kLAErrorUserFallback,
/// Authentication was canceled by system (e.g. another application went to foreground).
LAErrorSystemCancel = kLAErrorSystemCancel,
/// Authentication could not start, because passcode is not set on the device.
LAErrorPasscodeNotSet = kLAErrorPasscodeNotSet,
/// Authentication could not start, because Touch ID is not available on the device.
LAErrorTouchIDNotAvailable NS_ENUM_DEPRECATED(10_10, 10_13, 8_0, 11_0, "use LAErrorBiometryNotAvailable") = kLAErrorTouchIDNotAvailable,
/// Authentication could not start, because Touch ID has no enrolled fingers.
LAErrorTouchIDNotEnrolled NS_ENUM_DEPRECATED(10_10, 10_13, 8_0, 11_0, "use LAErrorBiometryNotEnrolled") = kLAErrorTouchIDNotEnrolled,
/// Authentication was not successful, because there were too many failed Touch ID attempts and
/// Touch ID is now locked. Passcode is required to unlock Touch ID, e.g. evaluating
/// LAPolicyDeviceOwnerAuthenticationWithBiometrics will ask for passcode as a prerequisite.
LAErrorTouchIDLockout NS_ENUM_DEPRECATED(10_11, 10_13, 9_0, 11_0, "use LAErrorBiometryLockout")
__WATCHOS_DEPRECATED(3.0, 4.0, "use LAErrorBiometryLockout") __TVOS_DEPRECATED(10.0, 11.0, "use LAErrorBiometryLockout") = kLAErrorTouchIDLockout,
/// Authentication was canceled by application (e.g. invalidate was called while
/// authentication was in progress).
LAErrorAppCancel API_AVAILABLE(macos(10.11), ios(9.0)) = kLAErrorAppCancel,
/// LAContext passed to this call has been previously invalidated.
LAErrorInvalidContext API_AVAILABLE(macos(10.11), ios(9.0)) = kLAErrorInvalidContext,
/// Authentication could not start, because biometry is not available on the device.
LAErrorBiometryNotAvailable API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = kLAErrorBiometryNotAvailable,
/// Authentication could not start, because biometry has no enrolled identities.
LAErrorBiometryNotEnrolled API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = kLAErrorBiometryNotEnrolled,
/// Authentication was not successful, because there were too many failed biometry attempts and
/// biometry is now locked. Passcode is required to unlock biometry, e.g. evaluating
/// LAPolicyDeviceOwnerAuthenticationWithBiometrics will ask for passcode as a prerequisite.
LAErrorBiometryLockout API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = kLAErrorBiometryLockout,
/// Authentication failed, because it would require showing UI which has been forbidden
/// by using interactionNotAllowed property.
LAErrorNotInteractive API_AVAILABLE(macos(10.10), ios(8.0), watchos(3.0), tvos(10.0)) = kLAErrorNotInteractive,
/// Authentication could not start, because there was no paired watch device nearby.
LAErrorWatchNotAvailable API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios, watchos, tvos) = kLAErrorWatchNotAvailable,
} API_AVAILABLE(macos(10.10), ios(8.0), watchos(3.0), tvos(10.0));
/// LocalAuthentication error domain.
extern NSString *const __nonnull LAErrorDomain
API_AVAILABLE(macos(10.11), ios(8.3), watchos(3.0), tvos(10.0));