platformSecureKeyStore function

SecureKeyStore platformSecureKeyStore({
  1. SecureKeyRunner? runner,
  2. String? platform,
})

Picks the SecureKeyStore for the host OS. platform and runner are test seams; production callers use the defaults.

Implementation

SecureKeyStore platformSecureKeyStore({
  SecureKeyRunner? runner,
  String? platform,
}) {
  final run = runner ?? _processRunner;
  return switch (platform ?? Platform.operatingSystem) {
    'macos' => _MacosKeychainStore(run),
    'linux' => _LinuxSecretServiceStore(run),
    'windows' => _WindowsCredentialLockerStore(run),
    final other => _UnavailableSecureKeyStore(other),
  };
}