Slice 4 of Block 2. The pure rule was already parameterised; this adds the policy, cold-start and UI around it. - commons_core: WotParams (sigQty/stepMax/sigValidity, Duniter defaults) + WebOfTrust.membersWith; npubToHex helper (NIP-19 decode) for adding roots. - WotSettings (keystore): the active parameters, configurable — a young network loosens them and tightens as it grows, as Ğ1 did. Defaults Duniter. - TrustReferents: the bootstrap 'seeds' membership is measured from — a bundled asset (empty until real founders are curated, no invented keys) unioned with referents the user adds by npub/QR. Honest cold-start. - TrustCubit: computes the full membership verdict against referents+params alongside the personal circle, and exposes a TrustTier (networkMember > inYourCircle > vouched > unknown). Certifications issued with the active validity (they expire and renew, Duniter rule). - UI: chat trust badge by tier; a 'Network of trust' screen (manage roots + advanced params) reached from the profile. i18n en/es/pt/ast. Tests: WotParams/membersWith, npubToHex, TrustReferents, WotSettings, and TrustCubit tiers/membership. Resolves the WoT-parameters decision (open-decisions §B). Trust net stays empty/undetermined until seeded — by design; users bootstrap their own roots.
28 lines
898 B
Dart
28 lines
898 B
Dart
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);
|
|
});
|
|
}
|