Feature: Add NIP-65 (Load User Relays) (#74)

* feat: add NIP-65 utility functions for relay management

- Implemented fetchNip65Relays to retrieve relay permissions for a user.
- Added parseNip65Event to extract relay information from NIP-65 events.
- Created mergeAndStoreRelays to combine NIP-65 relays with existing custom relays and store them in localStorage.

* feat: enhance LoginForm with loading states and improved UI feedback for login actions

---------

Co-authored-by: highperfocused <highperfocused@pm.me>
This commit is contained in:
mroxso
2025-04-18 23:07:48 +02:00
committed by GitHub
parent 8842400f2a
commit ac7de1e1f4
4 changed files with 418 additions and 71 deletions

42
.github/prompts/nostr-nip65.prompt.md vendored Normal file
View File

@@ -0,0 +1,42 @@
NIP-65
======
Relay List Metadata
-------------------
`draft` `optional`
Defines a replaceable event using `kind:10002` to advertise relays where the user generally **writes** to and relays where the user generally **reads** mentions.
The event MUST include a list of `r` tags with relay URLs as value and an optional `read` or `write` marker. If the marker is omitted, the relay is both **read** and **write**.
```jsonc
{
"kind": 10002,
"tags": [
["r", "wss://alicerelay.example.com"],
["r", "wss://brando-relay.com"],
["r", "wss://expensive-relay.example2.com", "write"],
["r", "wss://nostr-relay.example.com", "read"]
],
"content": "",
// other fields...
}
```
When downloading events **from** a user, clients SHOULD use the **write** relays of that user.
When downloading events **about** a user, where the user was tagged (mentioned), clients SHOULD use the user's **read** relays.
When publishing an event, clients SHOULD:
- Send the event to the **write** relays of the author
- Send the event to all **read** relays of each tagged user
### Size
Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays of each category).
### Discoverability
Clients SHOULD spread an author's `kind:10002` event to as many relays as viable, paying attention to relays that, at any moment, serve naturally as well-known public indexers for these relay lists (where most other clients and users are connecting to in order to publish and fetch those).