DecryptionFailureCallback typedef
Encryption Recovery Hook System
Handles encryption key changes and recovery scenarios.
Features:
- Detect decryption failures
- Clear corrupted encrypted data
- Rotate encryption keys
- Recovery callbacks
Usage:
final cache = PVCache(
env: 'myCache',
hooks: [
...createEncryptionHooks(),
createEncryptionRecoveryHook(
onDecryptionFailure: (key) async {
print('Failed to decrypt: $key');
// Return true to clear the corrupted entry
return true;
},
),
],
defaultMetadata: {},
);
Callback type for handling decryption failures.
Return true to clear the corrupted entry, false to keep it.
Implementation
/// Callback type for handling decryption failures.
///
/// Return `true` to clear the corrupted entry, `false` to keep it.
typedef DecryptionFailureCallback = Future<bool> Function(String key);