> 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/ios/api-reference/classes/bidauthprovider.md).

# BIDAuthProvider

**public class** BIDAuthProvider

This class manages different authentication types, including device biometrics (fingerprint, face, PIN, password, pattern lock), PIN, and Live ID.

### Enum Values

| **AuthAssetType** |                                                                                                                     |
| ----------------- | ------------------------------------------------------------------------------------------------------------------- |
| **device**        | A value to work with device authentication (hardware fingerprint, face, password or pin) method.                    |
| **liveID**        | A value to work with the Live ID authentication method.                                                             |
| **pin**           | A value to work with Pin authentication method. The Pin is specific to app created to lock/ unlock the application. |

| **BiometricError** |                                        |
| ------------------ | -------------------------------------- |
| **NoID**           | No biometric ID enrolled.              |
| **cancel**         | Biometric enrollment canceled.         |
| **lockout**        | Biometric enrollment locked.           |
| **notAvailable**   | Biometric enrollment is not available. |
| **notEnrolled**    | Biometrics are not enrolled            |
| **password**       | Fallback to password.                  |

***

### Field Summary

| Parameter                  |        |                                       |
| -------------------------- | ------ | ------------------------------------- |
| **static BIDAuthProvider** | shared | Singleton instance of BIDAuthProvider |

***

### Method Summary

| Parameter  |                                                                                                                                                                                                                             |                                                                                                                                                                 |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **void**   | enrollDeviceAuth(allowReEnrollment: Bool = false, completion: @escaping (Bool, Any?, String?) -> Void)                                                                                                                      | Registers device's biometric                                                                                                                                    |
| **String** | getLiveIdImageBase64String() -> **String**?                                                                                                                                                                                 | Returns registered LiveID base64 image                                                                                                                          |
| **void**   | initialize()                                                                                                                                                                                                                | Initializes BIDAuthProvider                                                                                                                                     |
| **Bool**   | isAuthAssetEnrolled(assetType: **AuthAssetType**)                                                                                                                                                                           | Checks and indicates if the given type of authentication asset is registered                                                                                    |
| **Bool**   | isSDKUnLocked()                                                                                                                                                                                                             | Checks and indicates if the SDK is locked or not                                                                                                                |
| **void**   | lockSDK()                                                                                                                                                                                                                   | Locks the SDK                                                                                                                                                   |
| **void**   | unenrollDeviceAuth(completion: **@escaping** (**Bool**, **Any**?, **String**?) -> **Void**)                                                                                                                                 | Removes the registered device's biometric (fingerprint, face, pin, password, pattern lock)                                                                      |
| **void**   | unlockSDK()                                                                                                                                                                                                                 | Unlocks the SDK                                                                                                                                                 |
| **void**   | verifyDeviceAuth(completion: **@escaping** (**Bool**, **BiometricError**?, **String**?) -> **Void**)                                                                                                                        | Verifies the application using device's biometric authentication. Provides an option to fallback to Pin authentication in case biometric verification is failed |
| **void**   | verifyFace(image: UIImage, keyPair: APIKeyPair, tenant: BIDTenant, did: String, mobileSessionId: String? = nil, mobileDocumentId: String? = nil, completion: @escaping (\_ status: Bool, \_ error: ErrorResponse?) -> Void) | Compares the given face with the one stored in vault and returns the result. This method is generally used for document enrollment purpose.                     |
| **Bool**   | verifyPin(pin: **String**)                                                                                                                                                                                                  | Checks and indicates pin verification result. The given pin is verified with the one stored in vault                                                            |

***

### Method Details

#### enrollDeviceAuth

:::tip You must add the `NSFaceIDUsageDescription` key to your application's `info.plist` file. :::

public func enrollDeviceAuth(allowReEnrollment: Bool = false, completion: @escaping (Bool, Any?, String?) -> Void)

* Registers device's biometric (fingerprint, face, pin, password, pattern lock).

| Parameter         |                                                             |                                                                                      |
| ----------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| allowReEnrollment | Bool: Re-enroll Biomatric when device Biomatric changed     |                                                                                      |
| completion        | **@escaping** (**Bool**, **Any**?, **String**?) -> **Void** | The block to execute after the device authentication enrollment response is received |

***

#### getLiveIdImageBase64String

**public func** getLiveIdImageBase64String() -> String?

* Returns registered LiveID base64 image

***

#### initialize

**public func** initialize()

* Initializes BIDAuthProvider.

***

#### isAuthAssetEnrolled

**public func** isAuthAssetEnrolled(assetType: **AuthAssetType**) -> **Bool**

* Checks and indicates if the given type of authentication asset is registered.

| Parameter |                   |
| --------- | ----------------- |
| assetType | **AuthAssetType** |

***

#### isSDKUnLocked

**public func** isSDKUnLocked() -> **Bool**

* Checks and indicates if the SDK is locked or not.

***

#### lockSDK

**public func** lockSDK()

* Locks the SDK.

***

#### unEnrollDeviceAuth

**public func** unenrollDeviceAuth(completion: **@escaping** (**Bool**, **Any**?, **String**?) -> **Void**)

* Removes the registered device's biometric (fingerprint, face, pin, password, pattern lock).

| Parameter  |                                                             |                                                                                        |
| ---------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| completion | **@escaping** (**Bool**, **Any**?, **String**?) -> **Void** | The block to execute after the device authentication unenrollment response is received |

***

#### unlockSDK

**public func** unlockSDK()

* Unlocks the SDK.

***

#### verifyDeviceAuth

**public func** verifyDeviceAuth(completion: **@escaping** (**Bool**, **BiometricError**?, **String**?) -> **Void**)

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

| Parameter  |                                                             |                                                                                        |
| ---------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| completion | **@escaping** (**Bool**, **Any**?, **String**?) -> **Void** | The block to execute after the device authentication verification response is received |

***

#### verifyFace

**public func** verifyFace(image: **UIImage**, keyPair: **APIKeyPair**, tenant: **BIDTenant**, did: **String**, mobileSessionId: String? = nil, mobileDocumentId: String? = nil, completion: **@escaping** (\_ status: **Bool**, \_ error: **ErrorResponse**?) -> **Void**)

* Compares the given face with the one stored in the vault and returns the result. This method is generally used for document enrollment purposes.

| Parameter        |                                                                                                       |                                                                       |
| ---------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| image            | **Image**                                                                                             | An image of face to be verified                                       |
| keyPair          | **APIKeyPair**                                                                                        | The API key pair                                                      |
| tenant           | **BIDTenant**                                                                                         | Tenant details                                                        |
| did              | **String**                                                                                            | Application's DID                                                     |
| mobileSessionId  | **String**: (Optional) Unique Session ID that can be used for event tracking or validation purposes.  |                                                                       |
| mobileDocumentId | **String**: (Optional) Unique Document ID that can be used for event tracking or validation purposes. |                                                                       |
| completion       | **@escaping** (\_ status: **Bool**, \_ error: **ErrorResponse**?) -> **Void**                         | The block to execute after the face verification response is received |

***

#### verifyPin

**public func** verifyPin(pin: String) -> Bool

* Checks and indicates pin verification result. The given pin is verified with the one stored in the vault.

| Parameter | Type       | Description                          |
| --------- | ---------- | ------------------------------------ |
| pin       | **String** | pin to verify against the vault pin. |


---

# 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/ios/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.
