Mobile SDK photo enrollment
Enrollment is the process of registering a new user by connecting facial biometrics to a PingOne Recognize account. During this process, a full and unobstructed view of the user’s face is required.
If you have a trusted source (for example, an identity document), PingOne Recognize allows you to register a new user using the facial biometric from the document photo. The assumption is that the document photo satisfies the requirement for a full and unobstructed face image.
To enroll a user from a photo, use PhotoEnrollConfig.
Photo enrollment
Android
// photoBitmap is the bitmap created from the document photo.
val configuration = PhotoEnrollConfig(photo = photoBitmap)
Keyless.enroll(
configuration = configuration,
onCompletion = { result ->
when (result) {
is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "Enroll success - userId ${result.value.keylessId}")
is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Enroll failure - error code ${result.error.code}")
}
}
)
iOS
// photoUIImage is the UIImage created from the document photo.
let configuration = PhotoEnrollConfig(photo: photoUIImage)
Keyless.enroll(
configuration: configuration,
onCompletion: { result in
switch result {
case .success(let enrollmentSuccess):
print("Enrollment finished successfully. UserID: \(enrollmentSuccess.keylessId)")
case .failure(let error):
print("Enrollment finished with error: \(error.message)")
}
}
)
Flutter
import 'package:keyless_flutter_sdk/keyless.dart';
import 'package:keyless_flutter_sdk/models/configurations/enrollment_configuration.dart';
// documentImage from eDocument.
final configuration = PhotoEnrollConfig(documentImage: documentImage);
try {
final result = await Keyless.instance.enroll(configuration);
print("Enrollment finished successfully. UserID: ${result.keylessId}");
} catch (error) {
print("Enrollment finished with error: $error");
}
React Native
const config = new PhotoEnrollConfig({
photoBase64: '<photoBase64>',
});
const result = await Keyless.enroll(config);
result.fold({
onSuccess(data) {
logConsole('Enroll result success ' + JSON.stringify(data, null, 2));
},
onFailure(error) {
logConsole('Enroll result failure ' + JSON.stringify(error, null, 2));
},
});
Photo enrollment configuration
You can configure enrollment with optional parameters in PhotoEnrollConfig().
Android
public data class PhotoEnrollConfig(
public val photo: Bitmap,
public val temporaryState: String? = null,
public val operationInfo: OperationInfo? = null,
public val jwtSigningInfo: JwtSigningInfo? = null
)
iOS
public struct PhotoEnrollConfig {
public let photo: CGImage
public let operationInfo: Keyless.OperationInfo?
public let jwtSigningInfo: JwtSigningInfo?
public let temporaryState: String?
}
Photo enrollment success result
If enroll-from-photo succeeds, the EnrollmentSuccess object contains the fields requested in configuration.
React Native
class EnrollmentSuccess {
public readonly keylessId: string;
public readonly customSecret: string;
public readonly enrollmentFrame: string | null;
public readonly signedJwt: string | null;
public readonly clientState: string | null;
}
If enrollment succeeds, the user is enrolled and can authenticate from that point onward. See authentication.