feat(block2): 'in your circle' trust — friend-of-a-friend, not a raw count

A network-wide 'N people vouch' count invites spam and means little. Now the
trust banner computes whether the peer is within YOUR circle — you vouch for
them, or someone you vouch for does (friend-of-a-friend) — via the pure
WebOfTrust rule (seeds={you}, threshold 1, distance 2). When known, the banner
turns green with 'In your circle' (else it falls back to the count).

The full member policy (threshold/distance/bootstrap) stays open (network-trust
§2); this is a deliberately loose 'people near you' heuristic.

Analyzer clean; trust cubit test adds a friend-of-a-friend vs stranger case
(run flutter test locally to confirm — the widget suite is too slow to run here).
This commit is contained in:
vjrj 2026-07-10 12:10:06 +02:00
parent eed7c70037
commit 163d659119
10 changed files with 96 additions and 16 deletions

View file

@ -173,20 +173,31 @@ class _TrustBanner extends StatelessWidget {
builder: (context, state) {
final cubit = context.read<TrustCubit>();
if (!cubit.isOnline || state.loading) return const SizedBox.shrink();
final known = state.knownToYou;
return Container(
width: double.infinity,
color: seedPrimaryContainer.withValues(alpha: 0.5),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
const Icon(Icons.verified_user_outlined, size: 18, color: seedGreen),
Icon(
known ? Icons.verified : Icons.verified_user_outlined,
size: 18,
color: seedGreen,
),
const SizedBox(width: 8),
Expanded(
child: Text(
state.certifierCount == 0
? t.trust.none
: t.trust.count(n: state.certifierCount),
style: const TextStyle(color: seedOnSurface, fontSize: 13),
known
? t.trust.circle
: state.certifierCount == 0
? t.trust.none
: t.trust.count(n: state.certifierCount),
style: TextStyle(
color: known ? seedGreen : seedOnSurface,
fontSize: 13,
fontWeight: known ? FontWeight.w600 : FontWeight.w400,
),
),
),
TextButton(