Initial version

This commit is contained in:
2026-09-21 18:03:21 -04:00
commit e8e7dc4a81
83 changed files with 7177 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
/// Remembers scooter PINs in platform secure storage (Android Keystore backed
/// storage, iOS Keychain), keyed by the BLE peripheral id.
///
/// The peripheral id is not a permanent scooter identity (see ScooterDevice).
/// Once the Apollo UID is read over AT+UID? this should key by that instead.
class PinStore {
PinStore([FlutterSecureStorage? storage])
: _storage = storage ?? const FlutterSecureStorage();
final FlutterSecureStorage _storage;
String _key(String deviceId) => 'pin:$deviceId';
Future<String?> read(String deviceId) async {
try {
return await _storage.read(key: _key(deviceId));
} catch (_) {
return null;
}
}
Future<void> save(String deviceId, String pin) =>
_storage.write(key: _key(deviceId), value: pin);
Future<void> forget(String deviceId) => _storage.delete(key: _key(deviceId));
}