AnylineFaceAuthentication
AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, best suited for authenticating users over the internet.
Suitable IDs include passports, national IDs, as well as some supported driving licenses (TODO: show a full list of supported identity documents).
NOTE: An internet connection is required in order to use face authentication. (TODO: explain how data sent is captured and used).
How to use
This section shows how to set up and use AnylineFaceAuthentication for your iOS app.
You will need the following keys: Anyline License Key, and Anyline Facescan Encryption Key (TODO: find the directions for obtaining the keys).
First, build the AnylineFaceAuthentication and FaceTecSDK frameworks.
make all
The frameworks can be found in: ... TODO: give the locations of the xcframework files.
Add both .xcframework
files, as well as Anyline.xcframework
(TODO: link to the directions) to your iOS project.
(TODO: make a Cocoapod of AnylineFaceAuthentication.)
On the view controller where you would want the face authentication flow to take place, make the following imports:
#import
#import
Then on viewDidLoad
, initialize AnylineFaceAuthenticationSDK using the Anyline license key and encryption key. If the completion block returns successfully, obtain an instance of FaceAuthenticationViewController
using AnylineFaceAuthenticationSDK createViewControllerWithDelegate:
, and add it as a child to this view controller:
[[AnylineFaceAuthenticationSDK sdk] setupProdModeWithAnylineLicenseKey:kAnylineLicenseKey
encryptionKey:kFaceScanEncryptionKey
faceTecLicenseString:nil
endpointUrl:nil
completion:^(BOOL success, NSError * _Nullable error) {
if (error) {
/* ... */
return;
}
UIViewController *faceAuthVC = [[AnylineFaceAuthenticationSDK sdk]
createViewControllerWithDelegate:self];
[self addChildViewController:faceAuthVC];
[self.view addSubview:faceAuthVC.view];
[faceAuthVC didMoveToParentViewController:self];
}];
Then, implement FaceAuthenticationDelegate
for the view controller:
- (void)faceAuthenticationController:(FaceAuthenticationViewController *)faceAuthenticationViewController
completedWithError:(NSError *)error {
// handle error
}
- (void)faceAuthenticationController:(FaceAuthenticationViewController * _Nonnull)faceAuthenticationController
completedWithLivenessResult:(id
_Nonnull)completedWithLivenessResult
scanResult:(ALIDResult
* _Nonnull)scanResult
matchLevel:(enum MatchLevel)matchLevel {
NSString *matchString = [[self class] matchStringForLevel:matchLevel];
ALUniversalIDIdentification *identification = (ALUniversalIDIdentification *)scanResult.result;
// ...
}
From -[faceAuthenticationController:completedWithLivenessResult:scanResult:matchLevel:]
, identification
returns the scanned information from the identification document presented during the authentication process, and matchLevel
gives you an accuracy level for the face scan using the photo from the identification document as reference.
The match levels can be read as follows:
- Match Level1 - 99% match
- Match Level2 - 99.6% match
- Match Level3 - 99.8% match
- Match Level4 - 99.9% match
- Match Level5 - 99.99% match
- Match Level6 - 99.999% match
- Match Level7 - 99.9998% match
- Match Failed - No match detected
(Also check the demo app for usage examples.)