CONTEXT.md: small correction for nip19 identifiers

This commit is contained in:
Alex Gleason 2025-05-14 12:00:02 -05:00
parent 750c165c05
commit d05a78880a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

View File

@ -234,7 +234,7 @@ NIP-19 identifiers include a prefix, the number "1", then a base32-encoded data
### Use in Filters ### Use in Filters
The base Nostr protocol uses hex string identifiers for filtering by event IDs, pubkeys, and signatures. Nostr filters only accept hex strings. The base Nostr protocol uses hex string identifiers when filtering by event IDs and pubkeys. Nostr filters only accept hex strings.
```ts ```ts
// ❌ Wrong: naddr is not decoded // ❌ Wrong: naddr is not decoded
@ -253,9 +253,9 @@ import { nip19 } from 'nostr-tools';
// Decode a NIP-19 identifier // Decode a NIP-19 identifier
const decoded = nip19.decode(value); const decoded = nip19.decode(value);
// Optional: guard certain types // Optional: guard certain types (depending on the use-case)
if (decoded.type !== 'naddr') { if (decoded.type !== 'naddr') {
throw new Error('Invalid stack ID'); throw new Error('Unsupported Nostr identifier');
} }
// Get the addr object // Get the addr object