feat(base)!: a handle at password sign-up (ADR 0020, D26, D28–D30)
Every new account gets a handle, and an account without one gets its first as it sets a password. The handle is private until its person goes public (D5). - `passwordSignIn.signUp` takes a handle. `passwordSignIn.checkHandle` says whether a sign-up could take one, only while that sign-up's mailed code waits (`codeExpired` otherwise), counted per code request (30 an hour) and per network (60) (D29). Members ask the register. - `password.set` takes the first handle of an account without one (D28); `SignInWays.handle` tells the app whether there is one. - Each checks the handle before the code is used, so a refusal leaves the code for another try. An existing account at the address keeps its own handle where it has one, and the typed handle is still checked, so the answer says nothing about the address. - `first_handle.dart` holds what SimpleLogin, the keys and passwords share: `refusalOfNewHandle`, `insertFirstProfile`, `hasHandle`. - halkyon_app: one `HandleField` with its `HandleCheckCubit` (asked 300 ms after typing pauses, only about the handle typed last; the instance's suggestion is free without asking) (D30). The password setup asks for the handle between the phrase check and the code, and a refusal at the code sends back to it. SimpleLogin's sign-up and keys steps use the same field and now check as it is typed. - The module's README and ADR 0020 (D29, D30, the built state) amended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
87671208df
commit
630965d920
1 changed files with 2305 additions and 395 deletions
|
|
@ -107,7 +107,11 @@ void main() {
|
|||
await tester.enterText(field('Handle'), 'anna_m');
|
||||
await tester.pump();
|
||||
expect(find.text('@anna_mueller is free'), findsNothing);
|
||||
expect(find.text('Checking…'), findsOneWidget);
|
||||
await tester.enterText(field('Handle'), 'anna_mueller');
|
||||
await tester.pump();
|
||||
// The suggestion is free without asking (ADR 0020, D30).
|
||||
expect(find.text('@anna_mueller is free'), findsOneWidget);
|
||||
await tapButton(tester, 'Continue');
|
||||
|
||||
await tester.enterText(field('New password'), password);
|
||||
|
|
@ -122,6 +126,34 @@ void main() {
|
|||
expect(find.text('App of person-1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('someone new is told a handle is taken as they type it, and '
|
||||
'goes no further with it', (tester) async {
|
||||
dependencies.simpleLoginGateway.addAccount(
|
||||
'person-9',
|
||||
subject: 'simplelogin-other',
|
||||
handle: 'anna',
|
||||
keys: (await dependencies.crypto.newKeys(password)).setup,
|
||||
);
|
||||
await start(tester);
|
||||
await tapButton(tester, 'Continue with SimpleLogin');
|
||||
await tester.tap(find.widgetWithText(ListTile, 'Create an account'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.enterText(field('Handle'), '@anna');
|
||||
await tester.pump(HandleCheckCubit.pause);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Someone else has this handle.'), findsOneWidget);
|
||||
await tapButton(tester, 'Continue');
|
||||
expect(field('New password'), findsNothing);
|
||||
|
||||
await tester.enterText(field('Handle'), 'anna_k');
|
||||
await tester.pump(HandleCheckCubit.pause);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('@anna_k is free'), findsOneWidget);
|
||||
await tapButton(tester, 'Continue');
|
||||
expect(field('New password'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('an account opens its keys with its password, a wrong one '
|
||||
'refused', (tester) async {
|
||||
final material = await dependencies.crypto.newKeys(password);
|
||||
|
|
|
|||
Loading…
Reference in a new issue