wake-alarm/phone_app/lib/probe/probe_passphrase.dart
Krzysztof kuhy Rudnicki 65df7f6682 Name a bypass's session re-ring for its cause
A bypass during a live morning session restarted the ring natively, and
the session recorded that re-ring as deadline:<leg> (C7, 2026-11-22).
Bypass.record now stamps the cause (dated) when nothing was ringing; the
session takes it on its tick or on the dismiss and records bypass:<cause>.
A bypass during a deadline re-ring stamps nothing: one sound, one re-ring.

Also a debug-only sync backend: a probe build with WAKE_SYNC_EMULATOR
syncs to the PC's RTDB emulator instead of prod and the GitHub mirror,
with scripts/emu_published.py reading it back for _fallback --published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:53:26 +01:00

23 lines
1000 B
Dart

// phone-slot: not-shared-storage (path is per-package: Android/data/<package>/files)
import 'dart:io';
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
/// Moves an adb-written `files/passphrase` into the keystore, then deletes it.
///
/// The emulator syncs to the PC's RTDB emulator (`sync_emulator.dart`), and
/// every push is end-to-end encrypted: with no passphrase in the keystore it
/// throws `SyncLockedException` and nothing is published. The live checks
/// give the AVD a dummy test passphrase this way, never the real one, and
/// the file does not outlive the first launch. Probe-only.
Future<void> plantProbePassphrase() async {
final dir = await getExternalStorageDirectory();
if (dir == null) return;
final file = File(p.join(dir.path, 'passphrase'));
if (!file.existsSync()) return;
await saveE2ePassphrase((await file.readAsString()).trim());
await file.delete();
}