Files
zapstore/lib/constants/app_constants.dart
T
alltheseasandClaude Opus 4.6 1675cb8a24 fix: include relay hint in naddr for app events
All encodeShareableIdentifier calls passed empty relay lists,
causing other Nostr clients to fail resolving NIP-82 app events
since they don't know to query relay.zapstore.dev.

Adds kDefaultRelay constant with invariant comment and uses it
for app naddr encoding (app_card, app_detail_screen). Stack naddr
calls (user_screen, app_stack_container) keep empty relay lists
since stacks live on social relays, not the app catalog relay.

Closes #343

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:55:49 -05:00

54 lines
1.8 KiB
Dart

/// Application identifier for Zapstore itself
const kZapstoreAppIdentifier = 'dev.zapstore.app';
/// Zapstore's public key for relay-signed apps
const kZapstorePubkey =
'78ce6faa72264387284e647ba6938995735ec8c7d5c5a65737e55130f026307d';
/// Franzap's public key for curation sets
const kFranzapPubkey =
'726a1e261cc6474674e8285e3951b3bb139be9a773d1acf49dc868db861a1c11';
/// Identifier for storing user saved apps
const kAppBookmarksIdentifier = 'zapstore-bookmarks';
/// Event filter for app stacks - excludes saved apps and stacks with zero App references
bool appStackEventFilter(Map<String, dynamic> event) {
final tags = event['tags'] as List<dynamic>?;
if (tags == null) return false;
// Check for saved apps identifier in 'd' tag
for (final tag in tags) {
if (tag is List && tag.isNotEmpty && tag[0] == 'd') {
if (tag.length > 1 && tag[1] == kAppBookmarksIdentifier) {
return false;
}
}
}
// Check for at least one 'a' tag starting with '32267:' (App kind)
for (final tag in tags) {
if (tag is List && tag.isNotEmpty && tag[0] == 'a') {
if (tag.length > 1 && tag[1] is String && tag[1].startsWith('32267:')) {
return true;
}
}
}
// No valid App references found
return false;
}
/// Authoritative relay for NIP-82 software application events (kind 32267).
/// Used as the relay hint in naddr encoding so other clients can resolve app events.
/// Invariant: all Zapstore-published app events are available on this relay.
/// Stack events (social relays) should NOT use this hint.
const kDefaultRelay = 'wss://relay.zapstore.dev';
/// Amber signer package ID
const kAmberPackageId = 'com.greenart7c3.nostrsigner';
/// Amber signer naddr
const kAmberNaddr =
'naddr1qqdkxmmd9enhyet9deshyaphvvejumn0wd68yumfvahx2uszyp6hjpmdntls5n8aa7n7ypzlyjrv0ewch33ml3452wtjx0smhl93jqcyqqq8uzcgpp6ky';