tane/apps/app_seeds/lib/services/profile_store.dart
vjrj d7136ec2c2 feat(block2): Ğ1 — publish a Ğ1 address + 'Pay in Ğ1' in chat (levels 1-2)
The optional Ğ1 (free currency) integration, per g1-integration.md.
- Profile: an optional 'Ğ1 address' field, persisted locally and published in
  your NIP-01 kind:0 metadata (separate from the Nostr key).
- commons_core: UserProfile/ProfileTransport carry a 'g1' field (round-trip
  tested).
- Chat: when the peer published a Ğ1 address, a 'Pay in Ğ1' app-bar action opens
  their wallet (url_launcher) so value moves in the wallet, not the app — copies
  the address as a fallback. No payment rails in-app (sharing-model §4.3).

NOTE (vjrj): the wallet deep-link uses the Cesium web wallet as a universal
fallback; swap the URI in chat_screen._payG1 for the Ğ1nkgo/Ğecko scheme you
prefer. Analyzer clean (both packages); profile transport test covers g1.
2026-07-10 13:06:38 +02:00

29 lines
1 KiB
Dart

import '../security/secret_store.dart';
/// Your own display name and short "about", persisted locally (keystore-backed,
/// no plaintext at rest). The network copy is a published NIP-01 kind:0 event;
/// this local copy prefills the editor and works offline.
class ProfileStore {
ProfileStore(this._store);
final SecretStore _store;
static const _nameKey = 'tane.social.profile.name';
static const _aboutKey = 'tane.social.profile.about';
static const _g1Key = 'tane.social.profile.g1';
Future<String> name() async => (await _store.read(_nameKey)) ?? '';
Future<String> about() async => (await _store.read(_aboutKey)) ?? '';
/// Your Ğ1 (Duniter) address, if you chose to share one.
Future<String> g1() async => (await _store.read(_g1Key)) ?? '';
Future<void> save({
required String name,
required String about,
String g1 = '',
}) async {
await _store.write(_nameKey, name.trim());
await _store.write(_aboutKey, about.trim());
await _store.write(_g1Key, g1.trim());
}
}