BIDAuthProvider
public class BIDAuthProvider
This class is responsible for managing different authentication types, i.e., a device's biometric (fingerprint, face, pin, password, pattern lock), pin & 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
| Parameters | ||
|---|---|---|
| void | enrollDeviceAuth(completion: @escaping (Bool, Any?, String?) -> Void) | Registers device's biometric (fingerprint, face, pin, password, pattern lock) |
| 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, 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: verifyPin) | Checks and indicates pin verification result. The given pin is verified with the one stored in vault |
Method Detail
enrollDeviceAuth
Developers will need to add the NSFaceIDUsageDescription key to their application's info.plist file
public func enrollDeviceAuth(completion: @escaping (Bool, Any?, String?) -> Void)
- Registers device's biometric (fingerprint, face, pin, password, pattern lock).
| Parameters | ||
|---|---|---|
| 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.
| Parameters | |
|---|---|
| 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).
| Parameters | ||
|---|---|---|
| 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.
| Parameters | ||
|---|---|---|
| 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, 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.
| Parameters | ||
|---|---|---|
| image | Image | An image of face to be verified |
| keyPair | APIKeyPair | The API key pair |
| tenant | BIDTenant | Tenant details |
| did | String | Application's DID |
| 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.
| Parameters | ||
|---|---|---|
| pin | String | pin to verify against the vault pin. |