mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2025-08-27 04:59:22 +00:00
Add nip19 routing info to CONTEXT.md
This commit is contained in:
parent
830d806933
commit
acbe053c97
17
CONTEXT.md
17
CONTEXT.md
@ -272,6 +272,23 @@ const events = await nostr.query(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Use in URL Paths
|
||||||
|
|
||||||
|
For URL routing, use NIP-19 identifiers as path parameters (e.g., `/:nip19`) to create secure, universal links to Nostr events. Decode the identifier and render the appropriate component based on the type:
|
||||||
|
|
||||||
|
- Regular events: Use `/nevent1...` paths
|
||||||
|
- Replaceable/addressable events: Use `/naddr1...` paths
|
||||||
|
|
||||||
|
Always use `naddr` identifiers for addressable events instead of just the `d` tag value, as `naddr` contains the author pubkey needed to create secure filters. This prevents security issues where malicious actors could publish events with the same `d` tag to override content.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Secure routing with naddr
|
||||||
|
const decoded = nip19.decode(params.nip19);
|
||||||
|
if (decoded.type === 'naddr' && decoded.data.kind === 30024) {
|
||||||
|
// Render ArticlePage component
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Nostr Edit Profile
|
### Nostr Edit Profile
|
||||||
|
|
||||||
To include an Edit Profile form, place the `EditProfileForm` component in the project:
|
To include an Edit Profile form, place the `EditProfileForm` component in the project:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user