From 1a2b21b67eeae2eba8c03215826a32d4a03ae172 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Tue, 9 Jan 2024 13:39:58 -0800 Subject: [PATCH] Remove p tag, clarify that NIP 59 does not define a messaging protocol on its own --- 59.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/59.md b/59.md index cd841cff..c990236c 100644 --- a/59.md +++ b/59.md @@ -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": "", "kind": 1059, "created_at": 1686840217, - "tags": [["p", ""]], + "tags": [["p", ""]], "sig": "" } ``` @@ -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)