Merge branch 'spike/block2-derisking'

This commit is contained in:
vjrj 2026-07-10 11:56:56 +02:00
commit 88290f5228
12 changed files with 92 additions and 108 deletions

View file

@ -1,12 +1,5 @@
import '../security/secret_store.dart';
/// A suggested community server the user can join with one tap.
class RelayPreset {
const RelayPreset(this.name, this.url);
final String name;
final String url;
}
/// User choices for the (Block 2) social layer: the coarse area to publish/
/// browse offers in, and which community relays to talk to. Backed by the OS
/// keystore (via [SecretStore]) to honour "no plaintext at rest" no
@ -24,17 +17,15 @@ class SocialSettings {
static const _areaKey = 'tane.social.area_geohash';
static const _relaysKey = 'tane.social.relays';
/// Suggested servers shown as one-tap options in the sharing setup.
static const List<RelayPreset> presets = [
RelayPreset('nos.lol', 'wss://nos.lol'),
RelayPreset('Damus', 'wss://relay.damus.io'),
RelayPreset('Primal', 'wss://relay.primal.net'),
/// Community servers used automatically so sharing works from the first
/// launch. The relay pool skips any that are unreachable, so a dead one never
/// breaks the market; the user never has to know these exist.
static const List<String> defaultRelays = [
'wss://nos.lol',
'wss://relay.damus.io',
'wss://relay.primal.net',
];
/// Applied automatically for new users (a subset of [presets]) so sharing
/// works from the first launch, until the user changes it.
static const List<String> defaultRelays = ['wss://nos.lol', 'wss://relay.damus.io'];
/// The user's coarse area as a low-precision geohash (may be empty). Set
/// manually or from device location; the transport coarsens it further.
Future<String> areaGeohash() async => (await _store.read(_areaKey)) ?? '';