deleteStoredIdentity static method

Future<void> deleteStoredIdentity()

Atomically erase the local install_id and hardware attestation key state kept by the native SDK on this device.

Strictly for user-initiated GDPR / privacy erasure and account deletion. Wipes both the local install_id record and local hardware attestation key state (Application Support/io.fingerly.sdk/ container files and App Attest key state on iOS; the install_id record and persistent AndroidKeyStore v3 ECDSA signing key on Android). On iOS a future re-consented session starts unlinked from any prior visitorId. On Android, also have your backend call the management API's "Erase a visitor": until then, on a phone that passes hardware attestation, the ANDROID_ID digest can still lead the next report back to the old visitorId.

Do not call this method during routine sign-out, user switching, or session rotation: unnecessary resets force hardware key re-attestation and repeated install_id rotation (>= 3 distinct IDs on a hardware key within 24 hours triggers tampering churn detection).

Needs no load and no consent, sends nothing over the network, and completes once neither the install_id record nor local attestation key state remains (including when nothing was stored). To stop identifying after erasure as well, set consent to ConsentState.denied first so a call already in flight cannot write a fresh record.

Throws a FingerlyException when the delete fails, or when the native SDK in the app predates this call.

Implementation

static Future<void> deleteStoredIdentity() async {
  try {
    await _invokeVoid('deleteStoredIdentity');
  } on FingerlyException catch (error) {
    // The channel cannot tell a plugin that is not registered from one
    // whose native SDK predates this method, and the second is the likelier
    // cause here, so the message names both.
    if (error.message == _missingPlugin) {
      throw const FingerlyException(
        'deleteStoredIdentity is not available in the native Fingerly SDK '
        'on this platform, or the plugin is not registered',
      );
    }
    rethrow;
  }
}