isSecurityKeyAvailable static method

Future<bool> isSecurityKeyAvailable()

Check if security key is available for encryption operations. Uses cache to avoid repeated KeyManager calls.

Implementation

static Future<bool> isSecurityKeyAvailable() async {
  // Return cached value if available.
  if (_securityKeyAvailableCache != null) {
    return _securityKeyAvailableCache!;
  }

  try {
    final available = await KeyManager.hasSecurityKey();
    _securityKeyAvailableCache = available;
    return available;
  } catch (_) {
    _securityKeyAvailableCache = false;
    return false;
  }
}