refactor(trust): ego-centric trust replaces the global Duniter membership

The global membership rule (curated bootstrap referents + sigQty/stepMax
parameters) solved sybil-proof identity for a UBI — a problem this app
doesn't have — and its screen leaked graph jargon (npub roots, parameter
steppers). Trust is now computed from the user's own position only:
you vouch / vouched by people you know (distance <=2) / vouched by N.

- TrustCubit: drop networkMember tier, referents and params; keep the
  circle rule and the 365-day vouch expiry (renewable, self-pruning).
- Delete TrustReferents, WotSettings, TrustNetworkScreen and the bundled
  referents asset; unwire injector/bootstrap/app/chat.
- New 'Your people' screen (/your-people, from the profile): who you
  vouch for (revocable) and who vouches for you, names via ProfileCache.
- i18n: wot.* removed, yourPeople.* added (en/es/pt/ast); trust.member
  removed. Kind 30777 events on relays stay fully compatible — only the
  interpretation changes.
This commit is contained in:
vjrj 2026-07-11 13:03:20 +02:00
parent 4af90876f4
commit dc7b2eee27
25 changed files with 595 additions and 863 deletions

View file

@ -1,45 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/services/trust_referents.dart';
import '../support/test_support.dart';
void main() {
const npub =
'npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6';
const hex =
'3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d';
// No bundled asset in the unit test bundle _bundled() degrades to empty, so
// these exercise the user-added set (the cold-start bootstrap path).
late TrustReferents referents;
setUp(() => referents = TrustReferents(InMemorySecretStore()));
test('starts empty', () async {
expect(await referents.all(), isEmpty);
expect(await referents.userAdded(), isEmpty);
});
test('adds a referent from an npub, storing hex', () async {
final stored = await referents.add(npub);
expect(stored, hex);
expect(await referents.userAdded(), {hex});
expect(await referents.all(), contains(hex));
});
test('accepts a hex key directly and is idempotent', () async {
await referents.add(hex);
await referents.add(npub); // same identity, npub form
expect(await referents.userAdded(), {hex});
});
test('rejects an invalid identity code', () async {
expect(() => referents.add('not-a-key'), throwsFormatException);
expect(await referents.userAdded(), isEmpty);
});
test('removes a referent', () async {
await referents.add(hex);
await referents.remove(hex);
expect(await referents.userAdded(), isEmpty);
});
}

View file

@ -1,28 +0,0 @@
import 'package:commons_core/commons_core.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/services/wot_settings.dart';
import '../support/test_support.dart';
void main() {
late WotSettings settings;
setUp(() => settings = WotSettings(InMemorySecretStore()));
test('defaults to the Duniter parameters', () async {
expect(await settings.params(), WotParams.duniter);
});
test('persists saved parameters', () async {
const custom = WotParams(
sigQty: 3, stepMax: 4, sigValidity: Duration(days: 180));
await settings.save(custom);
expect(await settings.params(), custom);
});
test('reset restores the Duniter defaults', () async {
await settings.save(const WotParams(
sigQty: 1, stepMax: 1, sigValidity: Duration(days: 30)));
await settings.reset();
expect(await settings.params(), WotParams.duniter);
});
}