2023-04-10 12:33:21 +00:00
NIP-705
2023-04-10 12:00:12 +00:00
======
Republish Encrypted Direct Messages
-----------------------------------
`draft` `optional` `author:fiatjaf` `author:motorina0`
2023-04-27 15:45:29 +00:00
This NIP defines a way for a client to indirectly publish events to a relay with the help of its peers.
2023-04-10 12:00:12 +00:00
## Motivation
2023-04-27 15:45:29 +00:00
In order to hide their identity from the "general public" clients can use ephemeral keys or `one-use-only` keys (see [NIP704 ](https://github.com/motorina0/nips/blob/dm-one-use-keys/704.md )) to sign and publish events. However, the relay(s) can still see who is publishing events and who is listening for events with specific public keys (and correlate the two).
2023-04-10 12:07:14 +00:00
2023-04-27 15:45:29 +00:00
This NIP tries to prevent relays from tracking the interaction between the publishers and the subscribers of events.
2023-04-10 12:00:12 +00:00
## Suggestion
2023-04-27 15:45:29 +00:00
A client can ask its peers to `re-publish` messages on its behalf. The simplified version of the interaction is as follows:
- `Alice` wants to communicate with `Bob` . She builds the nostr event but does NOT send it to the relay(s).
- instead `Alice` creates an event for `Carol` where the content is the event for `Bob` . `Alice` publishes this event to the relay(s).
- `Carol` receives the event, unwrapps it, then publishes to the relay(s) the event for `Bob` .
2023-04-10 12:46:33 +00:00
- the relay(s) see the event as coming from `Carol` instead of `Alice`
2023-04-10 12:33:03 +00:00
People can easily run very lightweight republish services for free and provide anonymity for everybody else.
## Implementation
2023-04-10 12:46:33 +00:00
Define a new [NIP-16 ](https://github.com/nostr-protocol/nips/blob/master/16.md ) `republish` event with `kind:20001` (ephemeral) in the form:
2023-04-10 12:33:03 +00:00
```json
{
...
"kind": 20001,
2023-04-10 12:46:33 +00:00
"content": < encrypted JSON of the event ( s ) that is to be republished > ,
2023-04-10 12:33:03 +00:00
"tags": [
["p", < pubkey of the person that is chosen to republish this > ],
2023-04-10 12:46:33 +00:00
["relays", "wss://somerelay.com", "wss://otherrelay.com", "and so on, there could be many of these"]
2023-04-10 12:33:03 +00:00
]
}
```
2023-04-10 12:47:09 +00:00
Whenever the chosen `re-publisher` sees a note like that, they automatically decrypt it using the [NIP-04 ](https://github.com/nostr-protocol/nips/blob/master/04.md ) method and publish it to the chosen relays.
2023-04-10 12:33:03 +00:00
- the chosen relays could (and probably should) be different from the relay used to broadcast the republish event.
2023-04-27 15:45:29 +00:00
- there could be many republish events within the same underlying encrypted event.
2023-04-10 12:33:03 +00:00
- there could be multiple nested levels of republish events.
2023-04-10 12:46:33 +00:00
The JSON content (before encription) of the `kind:20001` event is of this form (other fields might later be added):
```json
{
"events": [< list of nostr events to be re-published > ],
"padding": < string ( optional ) , random data used to obfuscate the real size of re-publised event ( s ) >
}
```