NIP-51: add "encrypted" tag

This commit is contained in:
Alex Gleason 2024-05-26 12:10:42 -05:00
parent d3b47d1982
commit 02e6757c61
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

15
51.md
View File

@ -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", <encryption>]` 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 = [