De-enrollment
Example for how to de-enroll an existing user.
The de-enrollment verifies the validity of the face features captured by the selected camera device and deletes the user entity from the Keyless Network.
To de-enroll a user we must first perform the enrollment (see Enrollment).

Synchronous de-enrollment

We will perform de-enrollment using a simple blocking call.
1
/// USER SESSION HAS BEEN INITIALIZED
2
/// USER HAS BEEN ENROLLED
3
​
4
// This is an enrollment output, load it here before de-enrollment
5
std::vector<unsigned char> user_key = loadUserKey();
6
​
7
try
8
{
9
// Perform de-enrollment using previously selected and configured camera device
10
session->deEnroll(*device_selector, *user_key, nullptr);
11
12
/// USER SUCCESFULLY DE-ENROLLED
13
14
// Optionally we can check succesful de-enrollment
15
if (!session->isEnrolled()) {
16
/// USER SUCCESFULLY DE-ENROLLED
17
}
18
}
19
catch (const keyless::IException& e)
20
{
21
std::cerr << e.message() << std::endl;
22
}
23
​
Copied!

Asynchronous de-enrollment

To perform the de-enrollment we call the deEnrollAsync()method with our implementation of IDeEnrollmentCallbacks interface which will report the execution end.
1
class KeylessDeEnrollmentCallbacks : public keyless::IDeEnrollmentCallbacks
2
{
3
private:
4
void KEYLESS_SDK_CALL onFailure(const keyless::IException& exception) noexcept override
5
{
6
// De-enrollment has ended with failure here, save details from `exception`
7
}
8
9
void KEYLESS_SDK_CALL onSuccess() noexcept override
10
{
11
// De-enrollmenthas ended with success here
12
}
13
14
keyless::IStatusCallbacks* KEYLESS_SDK_CALL getStatusCallbacks() noexcept override
15
{
16
return nullptr; // see "Status Updates" below
17
}
18
};
Copied!
We will also retrieve the IControl interface allowing us to stop the running execution.
1
/// USER SESSION HAS BEEN INITIALIZED
2
/// USER HAS BEEN ENROLLED
3
​
4
try
5
{
6
// declare our asynchronous callbacks
7
KeylessDeEnrollmentCallbacks callbacks;
8
9
// Perform enrollment
10
keyless::IControl& control = session->deEnrollAsync(callbacks);
11
12
/// DE-ENROLLMENT IN PROGRESS, WAIT FOR RESULT VIA CALLBACKS
13
14
// we can optionally interrupt the running execution with this call
15
control.stop();
16
}
17
catch (const keyless::IException& e)
18
{
19
std::cerr << e.message() << std::endl;
20
}
Copied!

Status updates

We may provide both deEnroll() and deEnrollAsync() methods with our implementation of IStatusCallbacks interface which will report enrollment progress.
1
class KeylessWndStatusCallbacks : public keyless::IStatusCallbacks
2
{
3
private:
4
void KEYLESS_SDK_CALL onFrameCapture(const keyless::IFrame& frame) noexcept override
5
{
6
// New frame capture from the camera, save it to be displayed to user
7
}
8
void KEYLESS_SDK_CALL onSessionStatus(keyless::SessionStatus status, const keyless::IException& e) noexcept override
9
{
10
// Overall execution status has changed
11
}
12
void KEYLESS_SDK_CALL onLivenessStatus(keyless::LivenessStatus status) noexcept override
13
{
14
// Liveness detection status has changed
15
}
16
void KEYLESS_SDK_CALL onRecognitionStatus(keyless::FaceRecognitionStatus status) noexcept override
17
{
18
// Face recognition status has changed
19
}
20
}
Copied!
Last modified 4mo ago