save method
Writes value through to the store and updates the snapshot. Returns
false when the store is unavailable OR the write fails (locked or
MDM-managed keychain, missing Secret Service provider) — a failing
backend must degrade to session-only, never crash the CLI.
Implementation
Future<bool> save(String name, String value) async {
if (!available) {
_recordSaveFailure('secure store unavailable');
return false;
}
try {
await _store!.write(name, value);
} on Object catch (error) {
_recordSaveFailure(secureKeyDiagnosticLine(error.toString()));
return false;
}
_snapshot[name] = value;
return true;
}