hasKey method
Checks if an encryption key exists in secure storage.
The keyName
parameter can be used to specify a custom name for the key.
If not provided, a default name will be used.
Returns true
if the key exists, false
otherwise.
Implementation
Future<bool> hasKey({
String? keyName,
}) async {
final effectiveKeyName = keyName ?? _defaultKeyName;
final key = await _secureStorage.read(key: _getKey(effectiveKeyName));
return key != null;
}