Drawer 'Profile' is now live. - commons_core: ProfileTransport + UserProfile + NostrProfileTransport (kind:0 publish/fetch), exposed as SocialSession.profile. Round-trip tested against the in-process relay (fast dart test). - app: ProfileStore (local name/about, keystore) + ProfileScreen — shows your shareable npub with copy, edits display name + 'about', saves locally and (when online) publishes kind:0 so peers can recognise you instead of a raw key. - Drawer 'Profile' -> /profile (gated like Market/Chat). - i18n en/es/pt. ProfileStore + profile transport covered by plain/dart tests. Analyzer clean (both packages).
20 lines
771 B
Dart
20 lines
771 B
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';
|
|
|
|
Future<String> name() async => (await _store.read(_nameKey)) ?? '';
|
|
Future<String> about() async => (await _store.read(_aboutKey)) ?? '';
|
|
|
|
Future<void> save({required String name, required String about}) async {
|
|
await _store.write(_nameKey, name.trim());
|
|
await _store.write(_aboutKey, about.trim());
|
|
}
|
|
}
|