2023-05-15 08:53:50 -04:00
|
|
|
NIP-32
|
|
|
|
======
|
|
|
|
|
|
|
|
Labeling
|
|
|
|
---------
|
|
|
|
|
2023-11-15 19:42:51 -05:00
|
|
|
`draft` `optional`
|
2023-05-15 08:53:50 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases,
|
|
|
|
including distributed moderation, collection management, license assignment, and content classification.
|
2023-05-15 08:53:50 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
This NIP introduces two new tags:
|
2023-05-15 08:53:50 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
- `L` denotes a label namespace
|
|
|
|
- `l` denotes a label
|
2023-05-17 15:50:29 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
Label Namespace Tag
|
2023-05-15 08:53:50 -04:00
|
|
|
----
|
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
An `L` tag can be any string, but publishers SHOULD ensure they are unambiguous by using a well-defined namespace
|
|
|
|
(such as an ISO standard) or reverse domain name notation.
|
|
|
|
|
2024-03-19 08:59:29 -04:00
|
|
|
`L` tags are RECOMMENDED in order to support searching by namespace rather than by a specific tag. The special `ugc`
|
2023-11-10 11:13:04 -05:00
|
|
|
("user generated content") namespace MAY be used when the label content is provided by an end user.
|
2023-05-15 08:53:50 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
`L` tags starting with `#` indicate that the label target should be associated with the label's value.
|
2023-06-07 19:03:05 -04:00
|
|
|
This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc.
|
2023-05-25 13:22:35 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
Label Tag
|
|
|
|
----
|
2023-06-17 12:07:08 -04:00
|
|
|
|
2024-06-07 12:34:20 -04:00
|
|
|
An `l` tag's value can be any string. If using an `L` tag, `l` tags MUST include a mark matching an `L`
|
|
|
|
tag value in the same event. If no `L` tag is included, a mark SHOULD still be included. If none is
|
|
|
|
included, `ugc` is implied.
|
2023-05-15 08:53:50 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
Label Target
|
|
|
|
----
|
2023-05-16 09:18:01 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
The label event MUST include one or more tags representing the object or objects being
|
|
|
|
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
|
|
|
|
`p` tags.
|
2023-05-15 08:53:50 -04:00
|
|
|
|
2023-05-17 15:50:29 -04:00
|
|
|
Content
|
|
|
|
-------
|
|
|
|
|
2024-03-19 08:59:29 -04:00
|
|
|
Labels should be short, meaningful strings. Longer discussions, such as for an
|
2023-05-24 15:42:26 -04:00
|
|
|
explanation of why something was labeled the way it was, should go in the event's `content` field.
|
2023-05-17 15:50:29 -04:00
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
Self-Reporting
|
|
|
|
-------
|
|
|
|
|
|
|
|
`l` and `L` tags MAY be added to other event kinds to support self-reporting. For events
|
|
|
|
with a kind other than 1985, labels refer to the event itself.
|
|
|
|
|
2023-05-15 08:53:50 -04:00
|
|
|
Example events
|
|
|
|
--------------
|
|
|
|
|
|
|
|
A suggestion that multiple pubkeys be associated with the `permies` topic.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"kind": 1985,
|
|
|
|
"tags": [
|
2023-05-16 09:18:01 -04:00
|
|
|
["L", "#t"],
|
|
|
|
["l", "permies", "#t"],
|
2023-05-17 15:50:29 -04:00
|
|
|
["p", <pubkey1>, <relay_url>],
|
|
|
|
["p", <pubkey2>, <relay_url>]
|
2023-11-18 07:13:12 -05:00
|
|
|
],
|
|
|
|
...
|
2023-05-15 08:53:50 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
A report flagging violence toward a human being as defined by ontology.example.com.
|
2023-05-15 08:53:50 -04:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"kind": 1985,
|
|
|
|
"tags": [
|
2023-06-13 20:30:26 -04:00
|
|
|
["L", "com.example.ontology"],
|
2023-11-10 11:13:04 -05:00
|
|
|
["l", "VI-hum", "com.example.ontology"],
|
|
|
|
["p", <pubkey1>, <relay_url>],
|
|
|
|
["p", <pubkey2>, <relay_url>]
|
2023-11-18 07:13:12 -05:00
|
|
|
],
|
|
|
|
...
|
2023-11-10 11:13:04 -05:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
A moderation suggestion for a chat event.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"kind": 1985,
|
|
|
|
"tags": [
|
|
|
|
["L", "nip28.moderation"],
|
|
|
|
["l", "approve", "nip28.moderation"],
|
|
|
|
["e", <kind40_event_id>, <relay_url>]
|
2023-05-15 08:53:50 -04:00
|
|
|
],
|
2023-11-18 07:13:12 -05:00
|
|
|
...
|
2023-05-15 08:53:50 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-11-10 11:13:04 -05:00
|
|
|
Assignment of a license to an event.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"kind": 1985,
|
|
|
|
"tags": [
|
|
|
|
["L", "license"],
|
|
|
|
["l", "MIT", "license"],
|
|
|
|
["e", <event_id>, <relay_url>]
|
|
|
|
],
|
2023-11-18 07:13:12 -05:00
|
|
|
...
|
2023-11-10 11:13:04 -05:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Publishers can self-label by adding `l` tags to their own non-1985 events. In this case, the kind 1 event's author
|
|
|
|
is labeling their note as being related to Milan, Italy using ISO 3166-2.
|
2023-05-25 13:22:35 -04:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"kind": 1,
|
|
|
|
"tags": [
|
2023-11-10 11:13:04 -05:00
|
|
|
["L", "ISO-3166-2"],
|
|
|
|
["l", "IT-MI", "ISO-3166-2"]
|
2023-05-25 13:22:35 -04:00
|
|
|
],
|
2023-11-10 11:13:04 -05:00
|
|
|
"content": "It's beautiful here in Milan!",
|
2023-11-18 07:13:12 -05:00
|
|
|
...
|
2023-05-25 13:22:35 -04:00
|
|
|
}
|
|
|
|
```
|
2023-06-07 19:03:05 -04:00
|
|
|
|
|
|
|
Other Notes
|
|
|
|
-----------
|
|
|
|
|
|
|
|
When using this NIP to bulk-label many targets at once, events may be deleted and a replacement
|
|
|
|
may be published. We have opted not to use parameterizable/replaceable events for this due to the
|
2023-06-17 12:07:08 -04:00
|
|
|
complexity in coming up with a standard `d` tag. In order to avoid ambiguity when querying,
|
|
|
|
publishers SHOULD limit labeling events to a single namespace.
|
2023-06-13 20:30:26 -04:00
|
|
|
|
|
|
|
Before creating a vocabulary, explore how your use case may have already been designed and
|
|
|
|
imitate that design if possible. Reverse domain name notation is encouraged to avoid
|
|
|
|
namespace clashes, but for the sake of interoperability all namespaces should be
|
|
|
|
considered open for public use, and not proprietary. In other words, if there is a
|
|
|
|
namespace that fits your use case, use it even if it points to someone else's domain name.
|
|
|
|
|
2023-06-14 12:43:03 -04:00
|
|
|
Vocabularies MAY choose to fully qualify all labels within a namespace (for example,
|
|
|
|
`["l", "com.example.vocabulary:my-label"]`. This may be preferred when defining more
|
|
|
|
formal vocabularies that should not be confused with another namespace when querying
|
|
|
|
without an `L` tag. For these vocabularies, all labels SHOULD include the namespace
|
|
|
|
(rather than mixing qualified and unqualified labels).
|
2023-11-10 11:13:04 -05:00
|
|
|
|
|
|
|
A good heuristic for whether a use case fits this NIP is whether labels would ever be unique.
|
|
|
|
For example, many events might be labeled with a particular place, topic, or pubkey, but labels
|
|
|
|
with specific values like "John Doe" or "3.18743" are not labels, they are values, and should
|
|
|
|
be handled in some other way.
|