Use JSON for label metadata in NIP-32

This commit is contained in:
Jonathan Staab 2023-05-23 14:47:56 -07:00
parent 5b32def861
commit 2372874b98

11
32.md
View File

@ -21,7 +21,7 @@ Label Target
---- ----
The label event MUST include one or more tags representing the object or objects being The label event MUST include one or more tags representing the object or objects being
labeled: `e`, `p`, `r`, or `t` tags. This allows for labeling of events, people, relays, labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, people, relays,
or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and
`p` tags. `p` tags.
@ -47,9 +47,8 @@ with a kind other than 1985, labels refer to the event itself.
Label Annotations Label Annotations
----- -----
A label tag MAY include a 4th positional element detailing extra information about the label in question. This string A label tag MAY include a 4th positional element detailing extra metadata about the label in question. This string
should be a url-encoded list of key/value pairs, for example `quality=1&confidence=1`. Any key MAY be used, but the should be a json-encoded object. Any key MAY be used, but the following are recommended:
following are recommended:
- `quality` may have a value of 0 to 1. This allows for an absolute, granular scale that can be represented in any way (5 stars, color scale, etc). - `quality` may have a value of 0 to 1. This allows for an absolute, granular scale that can be represented in any way (5 stars, color scale, etc).
- `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating. - `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating.
@ -130,7 +129,7 @@ that's the case.
"kind": 1985, "kind": 1985,
"tags": [ "tags": [
["L", "#t"], ["L", "#t"],
["l", "bitcoin", "#t", "quality=0.7&confidence=0.2"], ["l", "bitcoin", "#t", "{\"quality\": 0.7, \"confidence\": 0.2}"],
["r", <relay_url>] ["r", <relay_url>]
], ],
"content": "I think this relay is mostly just bitcoiners.", "content": "I think this relay is mostly just bitcoiners.",
@ -145,7 +144,7 @@ A plain review of a relay.
"kind": 1985, "kind": 1985,
"tags": [ "tags": [
["L", "review"], ["L", "review"],
["l", "relay", "review", "quality=0.1"], ["l", "relay", "review", "{\"quality\": 0.1}"],
["r", <relay_url>] ["r", <relay_url>]
], ],
"content": "This relay is full of mean people.", "content": "This relay is full of mean people.",