From 02e6757c61944452b764db2fe0b88f5f29141e37 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 26 May 2024 12:10:42 -0500 Subject: [PATCH] NIP-51: add "encrypted" tag --- 51.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/51.md b/51.md index fb40b26e..79161b00 100644 --- a/51.md +++ b/51.md @@ -8,7 +8,7 @@ Lists This NIP defines lists of things that users can create. Lists can contain references to anything, and these references can be **public** or **private**. -Public items in a list are specified in the event `tags` array, while private items are specified in a JSON array that mimics the structure of the event `tags` array, but stringified and encrypted using the same scheme from [NIP-04](04.md) (the shared key is computed using the author's public and private key) and stored in the `.content`. +Public items in a list are specified in the event `tags` array, while private items are specified in a JSON array that mimics the structure of the event `tags` array, but stringified and encrypted (see the "Encryption" section below) and stored in the `.content`. When new items are added to an existing list, clients SHOULD append them to the end of the list, so they are stored in chronological order. @@ -131,7 +131,18 @@ Some clients have used these lists in the past, but they should work on transiti } ``` -## Encryption process pseudocode +## Encryption + +If the event content is non-empty, the list content is an encrypted JSON tag array. The data is encrypted using the author's public and private keys. + +An optional `["encrypted", ]` tag may be included, where encryption is one of: + +- `nip04` - NIP-04 encryption +- `nip44` - NIP-44 encryption + +If the tag is not included, the encryption method is assumed to be NIP-04 for backwards-compatibility. + +### Pseudocode ```scala val private_items = [