Device Activation Removal
You can remove activation using several ways - the choice depends on the desired behavior.
Simple Device-Only Removal
You can clear activation data anytime from the Keychain. The benefit of this method is that it does not require help from the server, and the user does not have to be logged in. The issue with this removal method is simple: The activation still remains active on the server side. This, however, does not have to be an issue in your case.
To remove only data related to PowerAuth, use:
await powerAuth.removeActivationLocal();
Removal via Signed Request
PowerAuth Standard RESTful API has a dedicated endpoint for activation removal. This endpoint uses authentication code verification to look up the activation to be removed. The benefit of this method is that it is already present in both PowerAuth Flutter SDK and PowerAuth Standard RESTful API - nothing has to be programmed. Also, the user does not have to be logged in to use it. By default, authenticate using 2FA with either a password or biometrics.
Use the following code for an activation removal using a signed request:
// 2FA signature, uses device-related key and user PIN code
final auth = PowerAuthAuthentication.password(await PowerAuthPassword.fromString("1234"));
try {
await powerAuth.removeActivationWithAuthentication(auth);
// activation removed
} catch (e) {
// failed to remove
}
Depending on server support and configuration, it is possible to remove the activation with 1FA authentication, for example by using PowerAuthAuthentication.possession().