fix(app): on Apple's systems the account's keys stay on this device
flutter_secure_storage's default accessibility on iOS and macOS (unlocked) lets keychain items into encrypted backups, which restore on another device. The account's unlocked keys are now kept first_unlock_this_device (macOS through its data protection keychain, the package's default there), and never synchronised to iCloud Keychain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
5270ce6775
commit
67b26e0ea0
1 changed files with 34 additions and 1 deletions
|
|
@ -4,6 +4,20 @@ import 'dart:developer';
|
|||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:halkyon_app/src/password/model/unlocked_account_keys.dart';
|
||||
|
||||
/// The system's keyring as the account's keys are kept in it. On iOS and
|
||||
/// macOS they open once the device was first unlocked after starting and
|
||||
/// stay on this device alone (`first_unlock_this_device`): the default
|
||||
/// (`unlocked`) lets them into encrypted backups, restored on another
|
||||
/// device; and never into iCloud Keychain (not `synchronizable`).
|
||||
const accountKeyStorage = FlutterSecureStorage(
|
||||
iOptions: IOSOptions(
|
||||
accessibility: KeychainAccessibility.first_unlock_this_device,
|
||||
),
|
||||
mOptions: MacOsOptions(
|
||||
accessibility: KeychainAccessibility.first_unlock_this_device,
|
||||
),
|
||||
);
|
||||
|
||||
/// Where the device keeps the account's private keys once unlocked (ADR
|
||||
/// 0017): in the system's keyring, as sessions are, one person at a time
|
||||
/// per instance, gone once they sign out or another person signs in. Tests
|
||||
|
|
@ -25,7 +39,7 @@ abstract interface class AccountKeyStore() {
|
|||
/// ID, the instance's own prefix (`InstanceStorage.keysOf`).
|
||||
class SecureAccountKeyStore(
|
||||
final String _prefix, {
|
||||
final FlutterSecureStorage _storage = const FlutterSecureStorage(),
|
||||
final FlutterSecureStorage _storage = accountKeyStorage,
|
||||
}) implements AccountKeyStore {
|
||||
String _keyOf(String person) => '$_prefix:$person';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue