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
| Type | Name | Description |
|---|---|---|
| AUTH_ASSET_TYPE | AUTH_PIN | A value to work with Pin authentication method. The Pin is specific to app created to lock/ unlock the application |
| AUTH_ASSET_TYPE | AUTH_LIVE_ID | A value to work with Live ID authentication method |
| AUTH_ASSET_TYPE | AUTH_DEVICE | A value to work with device authentication (hardware fingerprint, face, password or pin) method |
Constant Summary
| Type | Name | Description |
|---|---|---|
| int | K_KEYGUARD_RESPONSE | Request 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. |
| String | K_LIVEID_DOCUMENT_ID | constant to get and set Live ID data from / to vault |
| String | K_PIN_DOCUMENT_ID | constant to get and set Pin data from / to vault |
Method Summary
| Type | Name | Description |
|---|---|---|
| void | enrollDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener) | Registers device's biometric (fingerprint, face, pin, password, pattern lock) |
| static BIDAuthProvider | getInstance() | Returns an instance of BIDProvider |
| String | getLiveIDb64Image() | Returns registered LiveID base64 image |
| void | initialize() | Initializes and creates an instance of BIDAuthProvider |
| boolean | isAuthAssetEnrolled(AUTH_ASSET_TYPE argEnum) | Checks and indicates if the given type of authentication asset is registered |
| boolean | isSDKUnLocked() | Checks and indicates if the SDK is locked or not |
| void | lockSDK() | Locks the SDK. |
| void | unEnrollDeviceAuth(Activity activity, String title, String description, boolean isPinFallBackRequired, IBiometricResponseListener listener) | Removes the registered device's biometric (fingerprint, face, pin, password, pattern lock) |
| void | unlockSDK() | Unlocks the SDK. |
| void | updateSDKAfterPatterUnlock() | Unlocks the SDK if the application is unlocked using device's pattern lock |
| 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 |
| 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. |
| void | verifyFace(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 |
| boolean | verifyPin(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 | |
|---|---|
| activity | Activity: The application’s activity from which device's biometric is being registered |
| title | String: Title to be displayed on biometric authentication alert |
| description | String: Description to be displayed on biometric authentication alert |
| isPinFallBackRequired | boolean: Indicates if the SDK should fallback for Pin authentication in case biometric authentication is failed |
| listener | IBiometricResponseListener: 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 | |
|---|---|
| argEnum | AUTH_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 | |
|---|---|
| activity | Activity: The application’s activity from which device's biometric is being removed |
| title | String: Title to be displayed on biometric authentication alert |
| description | String: Description to be displayed on biometric authentication alert |
| isPinFallBackRequired | boolean: Indicates if the SDK should fallback for Pin authentication in case biometric authentication is failed |
| listener | IBiometricResponseListener: 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 | |
|---|---|
| activity | Activity: The application’s activity on top of which biometric authentication alert will be displayed |
| title | String: Title to be displayed on biometric authentication alert |
| description | String: Description to be displayed on biometric authentication alert |
| isPinFallBackRequired | boolean: Indicates if the SDK should fallback for Pin authentication in case biometric authentication is failed |
| listener | IBiometricResponseListener: 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 | |
|---|---|
| face | Bitmap: 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. |
| listener | IVerifyFaceWithLivenessCallback: 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 | |
|---|---|
| faceToCompareBitmap | Bitmap: 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. |
| listener | IFaceComparisonListener: 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 | |
|---|---|
| pin | String: Pin to verify against the vault pin |
Interface Summary
| Name | Description |
|---|---|
| IFaceComparisonListener | Callback for event when face comparison is processed |
| IVerifyFaceWithLivenessCallback | Callback 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 | |
|---|---|
| status | boolean: Indicates if the face comparison is successful or not |
| error | ErrorManager.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 | |
|---|---|
| status | boolean: Indicates if the face liveness and comparison is successful or not |
| error | ErrorManager.ErrorResponse: In case of error, an object of ErrorManager.ErrorResponse is returned |