mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-23 08:55:52 -05:00
address comments and improve clarifications
This commit is contained in:
parent
c2ed57c05e
commit
f85d60f49e
24
122.md
24
122.md
|
@ -18,14 +18,17 @@ A mechanism to request other clients for missing events will help interested cli
|
||||||
|
|
||||||
#### Specification
|
#### Specification
|
||||||
|
|
||||||
**Direct Request For Events** are ephemeral events with `kind:21122` used to ask for events from specific users. The `content` field is a NIP-44 encrypted list of `e` tags referring to the requested events.
|
**Direct Request For Events** are ephemeral events with `kind:21122` used to ask for events from specific users. The `content` field is a NIP-44 encrypted list of `e` and `a` tags referring to the requested events by ID or addresses, respectively.
|
||||||
|
|
||||||
**Public Request For Events** are ephemeral events with `kind:21122` used to ask for missing events from any user. One or more `e` tags refer to the requested events. The `content` field is unused and left as an empty string.
|
**Public Request For Events** are ephemeral events with `kind:21122` used to ask for missing events from any user. One or more `e` or `a` tags refer to the requested events by ID or address. The `content` field is unused and left as an empty string.
|
||||||
|
|
||||||
##### Example (Direct Request):
|
##### Example (Direct Request):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const events = JSON.stringify([['e','<requested-event-id>'], ['e', '<another-event-id>']])
|
const events = JSON.stringify([
|
||||||
|
['e','<requested-event-id>', '<preferred relay URL>'],
|
||||||
|
['a', '<event-address>', '<preferred relay URL>']
|
||||||
|
]);
|
||||||
const encrypted_content = nip44_encrypt(events, ...);
|
const encrypted_content = nip44_encrypt(events, ...);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -42,8 +45,8 @@ const encrypted_content = nip44_encrypt(events, ...);
|
||||||
{
|
{
|
||||||
"kind": 21122,
|
"kind": 21122,
|
||||||
"tags": [
|
"tags": [
|
||||||
["e", "<missing-event-id>"],
|
["e", "<missing-event-id>", "<optional preferred relay URL>"],
|
||||||
["e", "<another-event-id>"]
|
["a", "<missing-event-address>", "<optional preferred relay URL>"]
|
||||||
],
|
],
|
||||||
"content": "",
|
"content": "",
|
||||||
"sig": "<sig>"
|
"sig": "<sig>"
|
||||||
|
@ -58,13 +61,16 @@ const encrypted_content = nip44_encrypt(events, ...);
|
||||||
|
|
||||||
### Guidelines for Responding Clients
|
### Guidelines for Responding Clients
|
||||||
|
|
||||||
- Clients receiving a `kind:21122` event SHOULD send back the actual requested events to the relay from which it received the request.
|
- Clients SHOULD send back the actual requested events to the relay from which it received the request when relay URL hints are missing or when publishing to the relay hint is not possible.
|
||||||
- Clients SHOULD NOT respond with any ephemeral events they may have in store.
|
- Clients SHOULD NOT respond with any ephemeral events they may have in store.
|
||||||
- Clients SHOULD NOT resend the original Request For Events or issue a new Request For Events for the same event IDs.
|
- Clients SHOULD NOT resend the original Request For Events or issue a new Request For Events for the same event IDs.
|
||||||
- Clients MAY respond to requests from users they follow/trust.
|
- Clients MAY respond to requests from users they follow or that belong to their Web of Trust.
|
||||||
- Clients MAY respond to a fraction of requests (e.g. 10% sample rate) and/or adhere to data caps if they have limited resources (i.e. mobile clients).
|
- Clients MAY respond to a fraction of requests (e.g. 5% sample rate) and/or adhere to data caps if they have limited resources (i.e. mobile clients).
|
||||||
|
- Clients MAY reject requests without sufficient Proof-of-Work. (e.g. [NIP-13](13.md))
|
||||||
|
|
||||||
### Guidelines for Relays
|
### Guidelines for Relays
|
||||||
|
|
||||||
- Relays MAY reject public request for events if at least one of the requested events is already in their store.
|
- Relays SHOULD forward public requests to a fraction of connected clients (e.g. 10% sample rate).
|
||||||
- Relays SHOULD implement rate limits to prevent denial-of-service (DoS) attacks.
|
- Relays SHOULD implement rate limits to prevent denial-of-service (DoS) attacks.
|
||||||
|
- Relays MAY reject public request for events if at least one of the requested events is already in their store.
|
||||||
|
- Relays MAY reject request for events that have insufficient Proof-of-Work.
|
Loading…
Reference in New Issue
Block a user