feat(app,learn): shared spaces' members on the device

Step 4 (e) of ADR 0044, its first part, for every app's screens.

- halkyon_app: `SharedSpaceGateway` on the module's `sharedSpace`
  endpoint (the spaces, their members and roles, inviting, handing on,
  leaving), refusals as `SpaceRefused`; `SharedKeys.trustIn` gives
  each member's safety code and whether it was compared or their keys
  changed, `markCompared`, and `trustNewKeys`, which pins the keys
  whose code was compared and never those the instance hands next.
  `FakeSharedSpaceServer` keeps the module's rules for tests, in step
  with `FakeSharedKeysServer`, which now knows members' handles.
- Learn's sharing makes its space through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-11 14:39:12 +01:00
commit 02bb24428c
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1,5 +1,7 @@
import 'dart:developer';
import 'package:halkyon_app/halkyon_app.dart' show SharedSpaceGateway;
import 'package:halkyon_learn_flutter/src/core/privacy/data/privacy.dart';
import 'package:halkyon_learn_flutter/src/core/work/work_progress.dart';
import 'package:halkyon_learn_flutter/src/feature/archive/data/archive_exporter.dart';
@ -8,7 +10,6 @@ import 'package:halkyon_learn_flutter/src/feature/archive/model/import_archive.d
import 'package:halkyon_learn_flutter/src/feature/export/data/studyset_markdown.dart'
show ExportFile;
import 'package:halkyon_learn_flutter/src/feature/publish/data/publish_gateway.dart';
import 'package:halkyon_learn_flutter/src/feature/sharing/data/shared_space_gateway.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_deletions.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_repository.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_tree.dart';
@ -90,6 +91,9 @@ class StudysetSharing(
final ArchiveImporter _importer,
final StudysetDeletions _deletions,
) {
/// What a Learn space holds, in the module's words for it.
static const spaceKind = 'studyset';
static final _stages = WorkStages(
SharingStage.values,
weights: const {SharingStage.reading: 2, SharingStage.content: 2},
@ -116,7 +120,7 @@ class StudysetSharing(
}
abort?.check();
final space = await _spaces.create();
final space = await _spaces.create(spaceKind);
try {
await _setup.ready(space);
onProgress?.call(_stages.at(SharingStage.space, done: 1, total: 1));