Package apple.localauthentication
Class LAContext
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.localauthentication.LAContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLAContext.Block_evaluateAccessControlOperationLocalizedReasonReplystatic interfaceLAContext.Block_evaluatePolicyLocalizedReasonReply-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLAContext(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static LAContextalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)longbiometryType()Indicates the type of the biometry supported by the device.static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)booleancanEvaluatePolicyError(long policy, org.moe.natj.general.ptr.Ptr<NSError> error)Determines if a particular policy can be evaluated.static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voidevaluateAccessControlOperationLocalizedReasonReply(SecAccessControlRef accessControl, long operation, java.lang.String localizedReason, LAContext.Block_evaluateAccessControlOperationLocalizedReasonReply reply)Evaluates access control object for the specified operation.NSDataevaluatedPolicyDomainState()Contains policy domain state.voidevaluatePolicyLocalizedReasonReply(long policy, java.lang.String localizedReason, LAContext.Block_evaluatePolicyLocalizedReasonReply reply)Evaluates the specified policy.static longhash_static()LAContextinit()static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)booleaninteractionNotAllowed()Allows running authentication in non-interactive mode.voidinvalidate()Invalidates the context.booleanisCredentialSet(long type)Reveals if credential was set with this context.static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)java.lang.StringlocalizedCancelTitle()Cancel button title.java.lang.StringlocalizedFallbackTitle()Fallback button title.java.lang.StringlocalizedReason()Allows setting the default localized authentication reason on context.NSNumbermaxBiometryFailures()Deprecated.static java.lang.Objectnew_objc()static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)booleansetCredentialType(NSData credential, long type)Sets a credential to this context.voidsetInteractionNotAllowed(boolean value)Allows running authentication in non-interactive mode.voidsetLocalizedCancelTitle(java.lang.String value)Cancel button title.voidsetLocalizedFallbackTitle(java.lang.String value)Fallback button title.voidsetLocalizedReason(java.lang.String value)Allows setting the default localized authentication reason on context.voidsetMaxBiometryFailures(NSNumber value)Deprecated.voidsetTouchIDAuthenticationAllowableReuseDuration(double value)Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past.static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()doubletouchIDAuthenticationAllowableReuseDuration()Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past.static longversion_static()-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static LAContext alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
keyPathsForValuesAffectingValueForKey
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
new_objc
public static java.lang.Object new_objc()
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
version_static
public static long version_static()
-
canEvaluatePolicyError
public boolean canEvaluatePolicyError(long policy, org.moe.natj.general.ptr.Ptr<NSError> error)Determines if a particular policy can be evaluated. 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.- Parameters:
policy- Policy for which the preflight check should be run.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.- Returns:
- YES if the policy can be evaluated, NO otherwise.
-
evaluateAccessControlOperationLocalizedReasonReply
public void evaluateAccessControlOperationLocalizedReasonReply(SecAccessControlRef accessControl, long operation, java.lang.String localizedReason, LAContext.Block_evaluateAccessControlOperationLocalizedReasonReply reply)
Evaluates access control object for the specified operation. 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. [@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.- Parameters:
accessControl- Access control object that is typically created by SecAccessControlCreateWithFlags.operation- Type of operation the access control will be used with.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.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.
-
evaluatePolicyLocalizedReasonReply
public void evaluatePolicyLocalizedReasonReply(long policy, java.lang.String localizedReason, LAContext.Block_evaluatePolicyLocalizedReasonReply reply)Evaluates the specified policy. 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. [@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. [@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).- Parameters:
policy- Policy to be evaluated.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.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.- See Also:
Typical error codes returned by this call are:
-
evaluatedPolicyDomainState
public NSData evaluatedPolicyDomainState()
Contains policy domain state. 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.
-
invalidate
public void invalidate()
Invalidates the context. 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.
-
isCredentialSet
public boolean isCredentialSet(long type)
Reveals if credential was set with this context.- Parameters:
type- Type of credential we are asking for.- Returns:
- YES on success, NO otherwise.
-
localizedCancelTitle
public java.lang.String localizedCancelTitle()
Cancel button title. Allows cancel button title customization. A default title "Cancel" is used when this property is left nil or is set to empty string.
-
localizedFallbackTitle
public java.lang.String localizedFallbackTitle()
Fallback button title. 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.
-
maxBiometryFailures
@Deprecated public NSNumber maxBiometryFailures()
Deprecated.This property is deprecated and setting it has no effect.
-
setCredentialType
public boolean setCredentialType(NSData credential, long type)
Sets a credential to this context. Some policies allow to bind application-provided credential with them. This method allows credential to be passed to the right context.- Parameters:
credential- Credential to be used with subsequent calls. Setting this parameter to nil will remove any existing credential of the specified type.type- Type of the provided credential.- Returns:
- YES if the credential was set successfully, NO otherwise.
-
setLocalizedCancelTitle
public void setLocalizedCancelTitle(java.lang.String value)
Cancel button title. Allows cancel button title customization. A default title "Cancel" is used when this property is left nil or is set to empty string.
-
setLocalizedFallbackTitle
public void setLocalizedFallbackTitle(java.lang.String value)
Fallback button title. 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.
-
setMaxBiometryFailures
@Deprecated public void setMaxBiometryFailures(NSNumber value)
Deprecated.This property is deprecated and setting it has no effect.
-
setTouchIDAuthenticationAllowableReuseDuration
public void setTouchIDAuthenticationAllowableReuseDuration(double value)
Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past. 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 Also:
LATouchIDAuthenticationMaximumAllowableReuseDuration
-
touchIDAuthenticationAllowableReuseDuration
public double touchIDAuthenticationAllowableReuseDuration()
Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past. 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 Also:
LATouchIDAuthenticationMaximumAllowableReuseDuration
-
biometryType
public long biometryType()
Indicates the type of the biometry supported by the device. This property is set when canEvaluatePolicy has been called for a biometric policy. The default value is LABiometryTypeNone.
-
interactionNotAllowed
public boolean interactionNotAllowed()
Allows running authentication in non-interactive mode. 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.
-
localizedReason
public java.lang.String localizedReason()
Allows setting the default localized authentication reason on context. 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.
-
setInteractionNotAllowed
public void setInteractionNotAllowed(boolean value)
Allows running authentication in non-interactive mode. 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.
-
setLocalizedReason
public void setLocalizedReason(java.lang.String value)
Allows setting the default localized authentication reason on context. 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.
-
-