Enroll and Verify with Face SDK Mobile
Enroll and Verify helps you implement biometric authentication in your mobile application. Use Enroll to create a person from a facial image captured during a successful liveness check, and use Verify to confirm that the person completing a liveness check matches an enrolled person.
This guide explains how to configure and start the Enroll and Verify processes.
Enroll
Use Enroll to create a person and associate the facial image captured during a successful liveness check with the person.
To start Liveness with Enroll, use the following examples:
let enrollmentConfiguration = EnrollmentConfiguration { _ in
}
FaceSDK.service.startEnrollment(from: self, animated: true, configuration: enrollmentConfiguration) { livenessResponse, enrollmentResponse in
if livenessResponse.error != nil {
// There was an error
} else if enrollmentResponse != nil {
// Check enrollmentResponse.enrolled value
}
} completion: {
}
RFSEnrollmentConfiguration *enrollmentConfiguation = [RFSEnrollmentConfiguration configurationWithBuilder:^(RFSEnrollmentConfigurationBuilder * _Nonnull builder) {
}];
[[RFSFaceSDK service] startEnrollmentFrom:self animated:YES configuration:enrollmentConfiguation onEnrollment:^(RFSLivenessResponse * _Nonnull livenessResponse, RFSEnrollmentResponse * _Nullable enrollmentResponse) {
if (livenessResponse.error != nil) {
// There was an error
} else if (enrollmentResponse != nil) {
// Check enrollmentResponse.enrolled value
}
} completion:^{
}];
val config = EnrollmentConfiguration
.Builder()
.build()
FaceSDK.Instance().startEnrollment(
this@MainActivity,
config,
{ livenessResponse: LivenessResponse, enrollmentResponse: EnrollmentResponse? ->
if (livenessResponse.exception != null) {
// There was an error
} else if (enrollmentResponse?.isEnrolled == true) {
// Enrollment successful
}
},
null
)
EnrollmentConfiguration config = new EnrollmentConfiguration.Builder()
.build();
FaceSDK.Instance().startEnrollment(
MainActivity.this,
config,
(EnrollmentCallback) (livenessResponse, enrollmentResponse) -> {
if (livenessResponse.getException() != null) {
// There was an error
} else if (enrollmentResponse != null && enrollmentResponse.isEnrolled()){
// Enrollment successful
}
},
null
);
var config = new EnrollmentConfig();
var (livenessResponse, enrollmentResponse) = await FaceSDK.instance.startEnrollment(config);
var [livenessResponse, enrollmentResponse] = await FaceSDK.instance.startEnrollment({});
// iOS
RFSEnrollmentConfiguration config = RFSEnrollmentConfiguration.ConfigurationWithBuilder((RFSEnrollmentConfigurationBuilder builder) => { });
RFSFaceSDK.Service.StartEnrollmentFrom(CurrentPresenter, true, config, (RFSLivenessResponse lr, RFSEnrollmentResponse er) => { }, () => { });
//Android
EnrollmentConfiguration config = (EnrollmentConfiguration)new EnrollmentConfiguration.Builder().Build();
FaceSDK.Instance().StartEnrollment(Platform.AppContext, config, this, this);
If the liveness check succeeds, Face SDK uses the captured facial image to enroll the person.
If search is configured for Enroll, Face SDK first searches for an existing person. If no matching person is found, a new person is created. If a matching person is found, Face SDK returns the search result without creating another person.
Verify
Use Verify to confirm that the person completing a liveness check matches an enrolled person.
Specify the required personId of the person to verify. You can also configure the maximum distance allowed between the captured and enrolled portraits for successful verification.
To start Liveness with Verify, use the following examples:
let verifyConfiguration = VerificationConfiguration {
$0.personId = PERSON_ID
}
FaceSDK.service.startVerification(from: self, animated: true, configuration: verifyConfiguration) { livenessResponse, verificationResponse in
if livenessResponse.error != nil {
// There was an error
} else if verificationResponse != nil {
// Check verificationResponse.verified value
}
} completion: {
}
RFSVerificationConfiguration *verifyConfiguration = [RFSVerificationConfiguration configurationWithBuilder:^(RFSVerificationConfigurationBuilder * _Nonnull builder) {
builder.personId = PERSON_ID;
}];
[[RFSFaceSDK service] startVerificationFrom:self animated:YES configuration:verifyConfiguration onVerification:^(RFSLivenessResponse * _Nonnull livenessResponse, RFSVerificationResponse * _Nullable verificationResponse) {
if (livenessResponse.error != nil) {
// There was an error
} else if (verificationResponse != nil) {
// Check verificationResponse.verified value
}
} completion:^{
}];
val config = VerificationConfiguration
.Builder.withPersonId(PERSON_ID)
.build()
FaceSDK.Instance().startVerification(
this@MainActivity,
config,
{ livenessResponse: LivenessResponse, verificationResponse: VerificationResponse? ->
if (livenessResponse.exception != null) {
// There was an error
} else if (verificationResponse?.isVerified == true) {
// Verification successful
}
},
null
)
VerificationConfiguration config = VerificationConfiguration
.Builder.withPersonId(PERSON_ID)
.build();
FaceSDK.Instance().startVerification(
MainActivity.this,
config,
(VerificationCallback) (livenessResponse, verificationResponse) -> {
if (livenessResponse.getException() != null) {
// There was an error
} else if (verificationResponse != null && verificationResponse.isVerified()) {
// Verification successful
}
},
null
);
var config = VerificationConfig.withPersonId(PERSON_ID);
var (livenessResponse, verificationResponse) = await FaceSDK.instance.startVerification(config);
var config = VerificationConfig.withPersonId(PERSON_ID);
var [livenessResponse, verificationResponse] = await FaceSDK.instance.startVerification(config);
// iOS
RFSVerificationConfiguration config = RFSVerificationConfiguration.ConfigurationWithBuilder((RFSVerificationConfigurationBuilder builder) =>
{
builder.Threshold = 0.9;
builder.PersonId = "";
});
RFSFaceSDK.Service.StartVerificationFrom(CurrentPresenter, true, config, (RFSLivenessResponse lr, RFSVerificationResponse er) => { }, () => { });
//Android
VerificationConfiguration config = (VerificationConfiguration)VerificationConfiguration.Builder.WithPersonId(PERSON_ID).Build();
FaceSDK.Instance().StartVerification(Platform.AppContext, config, this, this);
If the liveness check succeeds, Face SDK compares the captured facial image with the enrolled biometric sample and returns the verification result.