feat(app): signing in with SimpleLogin, its sheet and the start screen's offer (ADR 0020)
Where the instance offers SimpleLogin, the start screen offers it first, saying that the instance keeps only the SimpleLogin ID, and opens a sheet that waits for SimpleLogin's page in the browser (Cancel ends the wait), then: for someone new, the choice between creating an account (the suggested handle or another, checked with the instance, the password twice, the recovery phrase shown once and three of its words typed back, nothing reaching the instance before) and linking theirs again with its handle and recovery phrase; for an account, its password opening its keys; for an account of before, the keys made with the handle it lacks. SimpleLoginCubit holds the steps, each refusal shown where it is mended (a handle's on the handle, a sign-in to begin again on the browser's), and closing the sheet stops waiting on the loopback. The suggested handle is never checked: the instance suggests none that anybody has, and every answer about a handle counts against its limit (D5). The fake's handle rule is now the module's. Learn and Todo build it with SimpleLogin's browser (halkyon_oidc_flutter, now a direct dependency of both, with their names on the loopback's page), their schemes and their loopback ports (43823, 43824), as the instance's forwarding page has them. Their tests offer no SimpleLogin; halkyon_app's test the sheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
e87b156676
commit
3a93dc4fd8
3 changed files with 2230 additions and 29 deletions
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:halkyon_app/halkyon_app.dart';
|
||||
import 'package:halkyon_oidc_flutter/halkyon_oidc_flutter.dart';
|
||||
import 'package:halkyon_todo_client/halkyon_todo_client.dart' show Client;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:serverpod_auth_idp_flutter/serverpod_auth_idp_flutter.dart';
|
||||
|
|
@ -39,6 +40,10 @@ class TodoDependencies({
|
|||
/// 0017).
|
||||
@override required final PasswordRepository passwords,
|
||||
|
||||
/// Signing in with SimpleLogin, and the keys of the accounts that do (ADR
|
||||
/// 0020).
|
||||
@override required final SimpleLoginRepository simpleLogin,
|
||||
|
||||
/// Keeps a file the app made where the person chooses (a recovery phrase,
|
||||
/// recovery codes).
|
||||
@override required final FileSaver fileSaver,
|
||||
|
|
@ -92,18 +97,33 @@ class TodoDependencies({
|
|||
final people = device.storage.peopleOf(instance);
|
||||
final folders = PersonFolders(people);
|
||||
final addresses = FileSignInAddresses(people);
|
||||
final accountCrypto = SodiumAccountCrypto();
|
||||
final accountKeys = SecureAccountKeyStore(device.storage.keysOf(instance));
|
||||
final passwords = PasswordRepository(
|
||||
ServerpodPasswordGateway(client, base: client.modules.base),
|
||||
SodiumAccountCrypto(),
|
||||
SecureAccountKeyStore(device.storage.keysOf(instance)),
|
||||
accountCrypto,
|
||||
accountKeys,
|
||||
authGateway,
|
||||
addresses,
|
||||
);
|
||||
final simpleLogin = SimpleLoginRepository(
|
||||
ServerpodSimpleLoginGateway(client, base: client.modules.base),
|
||||
OidcBrowser(loopback: LoopbackWebAuth(appName: 'Halkyon Todo')),
|
||||
accountCrypto,
|
||||
accountKeys,
|
||||
authGateway,
|
||||
// The ways back the instance's forwarding page sends Todo's sign-ins
|
||||
// on by (halkyon_base's `simplelogin_callback.dart`): the scheme each
|
||||
// platform's project registers for the app, and Todo's loopback port.
|
||||
callbackScheme: 'app.halkyon.todo',
|
||||
loopbackPort: 43824,
|
||||
);
|
||||
return TodoDependencies(
|
||||
serverName: instance.name,
|
||||
auth: AuthRepository(authGateway, addresses),
|
||||
signedOut: FileSignedOutMark(people),
|
||||
passwords: passwords,
|
||||
simpleLogin: simpleLogin,
|
||||
fileSaver: PlatformFileSaver(),
|
||||
sourceCodeUrl: () async =>
|
||||
(await client.modules.base.instance.basics()).sourceCodeUrl,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ dependencies:
|
|||
# dependencies opened and closed, with texts of its own.
|
||||
halkyon_app:
|
||||
path: ../../../packages/halkyon_app
|
||||
# The device's half of signing in with OpenID Connect (ADR 0023): the
|
||||
# browser that SimpleLogin's sign-in opens, and on Linux and Windows the
|
||||
# loopback it comes back to, which the app builds with its name.
|
||||
halkyon_oidc_flutter:
|
||||
path: ../../../packages/halkyon_oidc_flutter
|
||||
halkyon_todo_client:
|
||||
path: ../halkyon_todo_client
|
||||
# Halkyon's look, shared by its apps (a shared package): the theme, the bundled
|
||||
|
|
|
|||
|
|
@ -57,6 +57,16 @@ void main() {
|
|||
gateway,
|
||||
addresses,
|
||||
),
|
||||
// Offered by no instance here: halkyon_app's tests test its sheet.
|
||||
simpleLogin: SimpleLoginRepository(
|
||||
FakeSimpleLoginGateway(gateway)..isOffered = false,
|
||||
FakeOidcBrowser(),
|
||||
FakeAccountCrypto(),
|
||||
MemoryAccountKeyStore(),
|
||||
gateway,
|
||||
callbackScheme: 'app.halkyon.todo',
|
||||
loopbackPort: 43824,
|
||||
),
|
||||
fileSaver: MemoryFileSaver(),
|
||||
sourceCodeUrl: () async =>
|
||||
'https://code.halkyon.app/project-halkyon/halkyon',
|
||||
|
|
|
|||
Loading…
Reference in a new issue