feat(app): a lost password with the recovery phrase in SimpleLogin's sheet (ADR 0020, 7)

An account that signs in with SimpleLogin opens its keys with its
password. Where that is lost, the unlock step's "Forgot your password?"
opens one step: the recovery phrase, and a new password twice. There is
no address and no code: the SimpleLogin sign-in of a moment ago stands
for them (D20).

- The device opens the keys with the phrase (`keys.beginPhrase`) and
  wraps them under the new password (`AccountCrypto.newKeysPassword`).
  It then signs the phrase's proof bound to that password
  (`signKeysResetProof`), which `keys.resetPassword` takes with the
  sign-in. The keys stay, and every other session ends.
- A phrase that doesn't open the keys is refused on the device, and the
  instance gets no proof to count. Two passwords that differ are
  refused before anything is sent.
- The gateway's `beginPhrase` and `resetPassword` run on the account's
  own session, not yet the device's. The repository's `resetPassword`
  ties them together, and the cubit and sheet have their `forgot` step.
  Three texts are new, in English and German.
- halkyon_base_server exports `isKeysPassword` for the interop test,
  which checks against the register's checks, with real libsodium, what
  the device sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-24 21:25:47 +02:00
commit 9e9f5bf406
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -177,6 +177,42 @@ void main() {
expect(find.text('App of person-9'), findsOneWidget);
});
testWidgets('an account whose password was lost opens its keys with the '
'recovery phrase under a new password, a phrase that is not its own '
'refused', (tester) async {
final material = await dependencies.crypto.newKeys(password);
dependencies.simpleLoginGateway.addAccount(
'person-9',
subject: 'simplelogin-anna',
handle: 'anna',
keys: material.setup,
);
await start(tester);
await tapButton(tester, 'Continue with SimpleLogin');
await tester.tap(find.widgetWithText(TextButton, 'Forgot your password?'));
await tester.pumpAndSettle();
expect(find.text('A new password'), findsOneWidget);
await tester.tap(find.widgetWithText(TextButton, 'Back'));
await tester.pumpAndSettle();
expect(find.text('Your password'), findsOneWidget);
await tester.tap(find.widgetWithText(TextButton, 'Forgot your password?'));
await tester.pumpAndSettle();
const newPassword = 'a new horse battery';
await tester.enterText(field('Recovery phrase'), otherFakePhrase);
await tester.enterText(field('New password'), newPassword);
await tester.enterText(field('New password again'), newPassword);
await tapButton(tester, 'Sign in');
expect(find.text("The recovery phrase isn't right."), findsOneWidget);
await tester.enterText(field('Recovery phrase'), fakePhrase);
await tapButton(tester, 'Sign in');
expect(find.text('App of person-9'), findsOneWidget);
expect(dependencies.keys.kept, {'person-9': material.keys});
});
testWidgets('someone whose SimpleLogin account was lost links theirs '
'again with its handle and recovery phrase', (tester) async {
final material = await dependencies.crypto.newKeys(password);