Skip to main content

BIDAuthProvider

public class BIDAuthProvider extends Object

↳ package com.onekosmos.blockid.sdk.authentication


This class is responsible for managing different authentication types, such as device biometrics (fingerprint, face, pin, password, pattern lock), PIN & Live ID.

Enum Values​

TypeNameDescription
AUTH_ASSET_TYPEAUTH_PINA value to work with Pin authentication method. The Pin is specific to app created to lock/ unlock the application
AUTH_ASSET_TYPEAUTH_LIVE_IDA value to work with Live ID authentication method
AUTH_ASSET_TYPEAUTH_DEVICEA value to work with device authentication (hardware fingerprint, face, password or pin) method

Constant Summary​

TypeNameDescription
intK_KEYGUARD_RESPONSERequest code used to identify the result returned from the Keyguard (device lock screen) authentication flow. It is passed to startActivityForResult() and later used in onActivityResult() to verify that the response corresponds to the Keyguard authentication request.
StringK_LIVEID_DOCUMENT_IDconstant to get and set Live ID data from / to vault
StringK_PIN_DOCUMENT_IDconstant to get and set Pin data from / to vault

Method Summary​

TypeNameDescription
voidenrollDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener)Registers device's biometric (fingerprint, face, pin, password, pattern lock)
static BIDAuthProvidergetInstance()Returns an instance of BIDProvider
StringgetLiveIDb64Image()Returns registered LiveID base64 image
voidinitialize()Initializes and creates an instance of BIDAuthProvider
booleanisAuthAssetEnrolled(AUTH_ASSET_TYPE argEnum)Checks and indicates if the given type of authentication asset is registered
booleanisSDKUnLocked()Checks and indicates if the SDK is locked or not
voidlockSDK()Locks the SDK.
voidunEnrollDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener)Removes the registered device's biometric (fingerprint, face, pin, password, pattern lock)
voidunlockSDK()Unlocks the SDK.
voidupdateSDKAfterPatterUnlock()Unlocks the SDK if the application is unlocked using device's pattern lock
voidverifyDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener)Verifies the application using device's biometric authentication. Provides an option to fallback to Pin authentication in case biometric verification is failed
voidverifyFaceWithLiveness(Bitmap face, @Nullable String mobileSessionID, @Nullable String mobileDocumentID, IVerifyFaceWithLivenessCallback listener)Verifies the face against the enrolled LiveID. A liveness check is performed on the provided face, followed by a comparison with the enrolled LiveID.
voidverifyFace(Bitmap faceToCompareBitmap, IFaceComparisonListener listener)Compares the given face with the one stored in vault and returns the result. This method is generally used for document enrollment purpose
booleanverifyPin(String pin)Checks and indicates pin verification result. The given pin is verified with the one stored in vault

Method Detail​

enrollDeviceAuth​

public void enrollDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener)

  • Registers device's biometric (fingerprint, face, pin, password, pattern lock).
Parameters
activityActivity: The application’s activity from which device's biometric is being registered
titleString: Title to be displayed on biometric authentication alert
descriptionString: Description to be displayed on biometric authentication alert
isPinFallBackRequiredboolean: Indicates if the SDK should fallback for Pin authentication in case biometric authentication is failed
listenerIBiometricResponseListener: The block to execute after the response is received

getInstance​

public static synchronized BIDAuthProvider getInstance()

  • Returns an instance of BIDProvider.

getLiveIDb64Image​

public String getLiveIDb64Image()

  • Returns registered LiveID base64 image.

initialize​

public void initialize()

  • Initializes and creates an instance of BIDAuthProvider.

isAuthAssetEnrolled​

public boolean isAuthAssetEnrolled(AUTH_ASSET_TYPE argEnum)

  • Checks and indicates if the given type of authentication asset is registered.
Parameters
argEnumAUTH_ASSET_TYPE: Authentication asset type

isSDKUnLocked​

public boolean isSDKUnLocked()

  • Checks and indicates whether the SDK is locked or not.

lockSDK​

public void lockSDK()

  • Locks the SDK.

unEnrollDeviceAuth​

public void unEnrollDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener)

  • Removes the registered device's biometric (fingerprint, face, pin, password, pattern lock).
Parameter
activityActivity: The application’s activity from which device's biometric is being removed
titleString: Title to be displayed on biometric authentication alert
descriptionString: Description to be displayed on biometric authentication alert
isPinFallBackRequiredboolean: Indicates if the SDK should fallback for Pin authentication in case biometric authentication is failed
listenerIBiometricResponseListener: The block to execute after the response is received

unlockSDK​

public void unlockSDK()

  • Unlocks the SDK.

updateSDKAfterPatterUnlock​

public void updateSDKAfterPatterUnlock()

  • Unlocks the SDK if the application is unlocked using device's pattern lock.

verifyDeviceAuth​

public void verifyDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener)

  • Verifies the application using device's biometric authentication. Provides an option to fallback to Pin authentication in case biometric verification is failed.
Parameter
activityActivity: The application’s activity on top of which biometric authentication alert will be displayed
titleString: Title to be displayed on biometric authentication alert
descriptionString: Description to be displayed on biometric authentication alert
isPinFallBackRequiredboolean: Indicates if the SDK should fallback for Pin authentication in case biometric authentication is failed
listenerIBiometricResponseListener: The block to execute after the response is received

verifyFaceWithLiveness​

public void verifyFaceWithLiveness(Bitmap face, @Nullable String mobileSessionID, @Nullable String mobileDocumentID, IVerifyFaceWithLivenessCallback listener)

  • Verifies the face against the enrolled LiveID. A liveness check is performed on the provided face, followed by a comparison with the enrolled LiveID.
Parameter
faceBitmap: Bitmap to compare with enrolled Live ID.
mobileSessionID@Nullable String: Unique Session ID that can be used for event tracking or validation purposes.
mobileDocumentID@Nullable String: Unique Document ID that can be used for event tracking or validation purposes.
listenerIVerifyFaceWithLivenessCallback: The block to execute after the response is received.

verifyFace​

public void verifyFace(Bitmap faceToCompareBitmap, @Nullable String mobileSessionID, @Nullable String mobileDocumentID, IFaceComparisonListener listener)

  • Compares the given face with the one stored in vault and returns the result. This method is generally used for document enrollment purpose.
Parameter
faceToCompareBitmapBitmap: Bitmap representation of face for comparison
mobileSessionID@Nullable String: Unique Session ID that can be used for event tracking or validation purposes.
mobileDocumentID@Nullable String: Unique Document ID that can be used for event tracking or validation purposes.
listenerIFaceComparisonListener: The block to execute after the response is received

verifyPin​

public boolean verifyPin(String pin)

  • Checks and indicates pin verification result. The given pin is verified with the one stored in vault.
Parameter
pinString: Pin to verify against the vault pin

Interface Summary​

NameDescription
IFaceComparisonListenerCallback for event when face comparison is processed
IVerifyFaceWithLivenessCallbackCallback for event when verify Face With Liveness is processed.

IFaceComparisonListener​

public static interface BIDAuthProvider.IFaceComparisonListener

  • Callback for event when face comparison is processed.

Method Summary​

void onFaceCompareResult(boolean success, ErrorManager.ErrorResponse errorResponse)

  • Called when face comparison is processed.
Parameters
statusboolean: Indicates if the face comparison is successful or not
errorErrorManager.ErrorResponse: In case of error, an object of ErrorManager.ErrorResponse is returned

IVerifyFaceWithLivenessCallback​

public static interface BIDAuthProvider.IVerifyFaceWithLivenessCallback

  • Callback for event when verify Face With Liveness is processed.

Method Summary​

void onVerifyFaceWithLivenessResult(boolean success, ErrorManager.ErrorResponse errorResponse)

  • Called when face liveness and comparison is processed.
Parameters
statusboolean: Indicates if the face liveness and comparison is successful or not
errorErrorManager.ErrorResponse: In case of error, an object of ErrorManager.ErrorResponse is returned