Remove p tag, clarify that NIP 59 does not define a messaging protocol on its own

This commit is contained in:
Jon Staab 2024-01-09 13:39:58 -08:00
parent d7293a3924
commit 1a2b21b67e

16
59.md
View File

@ -9,6 +9,8 @@ Gift Wrap
This NIP defines a protocol for encapsulating any nostr event. This makes it possible to obscure most metadata
for a given event, perform collaborative signing, and more.
This NIP *does not* define any messaging protocol. Applications of this NIP should be defined separately.
This NIP relies on [NIP-44](./44.md)'s versioned encryption algorithms.
# Overview
@ -55,11 +57,8 @@ Tags MUST must always be empty in a `kind:13`. The inner event MUST always be un
## 3. Gift Wrap Event Kind
A `gift wrap` event is a `kind:1059` event that wraps any other event. `tags` MUST include a single `p` tag
containing the recipient's public key.
The goal is to hide the sender's information, the metadata, and the content of the original event from the public.
The only public information is the receiver's public key.
A `gift wrap` event is a `kind:1059` event that wraps any other event. `tags` SHOULD include any information
needed to route the event to its intended recipient, including the recipient's `p` tag or NIP-13 proof of work.
```js
{
@ -68,7 +67,7 @@ The only public information is the receiver's public key.
"content": "<encrypted kind 13>",
"kind": 1059,
"created_at": 1686840217,
"tags": [["p", "<Receiver>"]],
"tags": [["p", "<recipient pubkey>"]],
"sig": "<random, one-time-use pubkey signature>"
}
```
@ -106,6 +105,9 @@ Let's send a wrapped `kind 1` message between two parties asking "Are you going
- Recipient private key: `e108399bd8424357a710b606ae0c13166d853d327e47a6e5e038197346bdbf45`
- Ephemeral wrapper key: `4f02eac59266002db5801adc5270700ca69d5b8f761d8732fab2fbf233c90cbd`
Note that this messaging protocol should not be used in practice, this is just an example. Refer to other
NIPs for concrete messaging protocols that depend on gift wraps.
## 1. Create an event
Create a `kind 1` event with the message, the receivers, and any other tags you want, signed by the author.
@ -243,7 +245,7 @@ const rumor = createRumor(
const seal = createSeal(rumor, senderPrivateKey, recipientPublicKey)
const wrap = createWrap(seal, recipientPublicKey)
// Receiver unwraps with his/her private key.
// Recipient unwraps with his/her private key.
const unwrappedSeal = nip44Decrypt(wrap, recipientPrivateKey)
const unsealedRumor = nip44Decrypt(unwrappedSeal, recipientPrivateKey)