| Modifier and Type | Class and Description |
|---|---|
static interface |
LAContext.Block_evaluateAccessControlOperationLocalizedReasonReply |
static interface |
LAContext.Block_evaluatePolicyLocalizedReasonReply |
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
LAContext(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
static LAContext |
alloc() |
static LAContext |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
long |
biometryType()
Indicates the type of the biometry supported by the device.
|
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
boolean |
canEvaluatePolicyError(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.Class |
classForKeyedUnarchiver() |
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
void |
evaluateAccessControlOperationLocalizedReasonReply(SecAccessControlRef accessControl,
long operation,
java.lang.String localizedReason,
LAContext.Block_evaluateAccessControlOperationLocalizedReasonReply reply)
Evaluates access control object for the specified operation.
|
NSData |
evaluatedPolicyDomainState()
Contains policy domain state.
|
void |
evaluatePolicyLocalizedReasonReply(long policy,
java.lang.String localizedReason,
LAContext.Block_evaluatePolicyLocalizedReasonReply reply)
Evaluates the specified policy.
|
static long |
hash_static() |
LAContext |
init() |
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
boolean |
interactionNotAllowed()
Allows running authentication in non-interactive mode.
|
void |
invalidate()
Invalidates the context.
|
boolean |
isCredentialSet(long type)
Reveals if credential was set with this context.
|
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
java.lang.String |
localizedCancelTitle()
Cancel button title.
|
java.lang.String |
localizedFallbackTitle()
Fallback button title.
|
java.lang.String |
localizedReason()
Allows setting the default localized authentication reason on context.
|
NSNumber |
maxBiometryFailures()
Deprecated.
|
static LAContext |
new_objc() |
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
boolean |
setCredentialType(NSData credential,
long type)
Sets a credential to this context.
|
void |
setInteractionNotAllowed(boolean value)
Allows running authentication in non-interactive mode.
|
void |
setLocalizedCancelTitle(java.lang.String value)
Cancel button title.
|
void |
setLocalizedFallbackTitle(java.lang.String value)
Fallback button title.
|
void |
setLocalizedReason(java.lang.String value)
Allows setting the default localized authentication reason on context.
|
void |
setMaxBiometryFailures(NSNumber value)
Deprecated.
|
void |
setTouchIDAuthenticationAllowableReuseDuration(double value)
Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past.
|
static void |
setVersion_static(long aVersion) |
static org.moe.natj.objc.Class |
superclass_static() |
double |
touchIDAuthenticationAllowableReuseDuration()
Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past.
|
static long |
version_static() |
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, willChangeValuesAtIndexesForKeypublic static boolean accessInstanceVariablesDirectly()
public static LAContext alloc()
public static LAContext allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public static long hash_static()
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public static LAContext new_objc()
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public boolean canEvaluatePolicyError(long policy,
org.moe.natj.general.ptr.Ptr<NSError> error)
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.
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.public void evaluateAccessControlOperationLocalizedReasonReply(SecAccessControlRef accessControl, long operation, java.lang.String localizedReason, LAContext.Block_evaluateAccessControlOperationLocalizedReasonReply reply)
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.
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.public void evaluatePolicyLocalizedReasonReply(long policy,
java.lang.String localizedReason,
LAContext.Block_evaluatePolicyLocalizedReasonReply reply)
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).
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.
Typical error codes returned by this call are:
public NSData evaluatedPolicyDomainState()
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.
public void invalidate()
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.
public boolean isCredentialSet(long type)
type - Type of credential we are asking for.public java.lang.String localizedCancelTitle()
Allows cancel button title customization. A default title "Cancel" is used when this property is left nil or is set to empty string.
public java.lang.String localizedFallbackTitle()
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.
@Deprecated public NSNumber maxBiometryFailures()
public boolean setCredentialType(NSData credential, long type)
Some policies allow to bind application-provided credential with them. This method allows credential to be passed to the right context.
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.public void setLocalizedCancelTitle(java.lang.String value)
Allows cancel button title customization. A default title "Cancel" is used when this property is left nil or is set to empty string.
public void setLocalizedFallbackTitle(java.lang.String value)
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.
@Deprecated public void setMaxBiometryFailures(NSNumber value)
public void setTouchIDAuthenticationAllowableReuseDuration(double value)
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.
LATouchIDAuthenticationMaximumAllowableReuseDurationpublic double touchIDAuthenticationAllowableReuseDuration()
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.
LATouchIDAuthenticationMaximumAllowableReuseDurationpublic long biometryType()
This property is set when canEvaluatePolicy has been called for a biometric policy. The default value is LABiometryTypeNone.
public boolean interactionNotAllowed()
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.
public java.lang.String localizedReason()
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.
public void setInteractionNotAllowed(boolean value)
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.
public void setLocalizedReason(java.lang.String value)
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.