> For the complete documentation index, see [llms.txt](https://docs.1kosmos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1kosmos.com/mobile-sdk/native/android/api-reference/classes/bidauthprovider.md).

# 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 the 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 whether the SDK is locked.

***

#### 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 the device's pattern lock.

***

#### verifyDeviceAuth

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

* Verifies the application using the device's biometric authentication. Provides an option to fall back to PIN authentication in case biometric verification fails.

| 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. Performs a liveness check on the provided face, then compares it 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 purposes.

| 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 the event when verify Face With Liveness is processed.

**Method Summary**

void onVerifyFaceWithLivenessResult(boolean success, ErrorManager.ErrorResponse errorResponse)

* Called when face liveness and comparison are 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 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.1kosmos.com/mobile-sdk/native/android/api-reference/classes/bidauthprovider.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
