From 142cb8d655d411628517b44a1cbafdc8c1fbcc68 Mon Sep 17 00:00:00 2001 From: starbuilder <101296187+starbackr-dev@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:44:07 -0400 Subject: [PATCH 01/13] Update 90.md Added optional Encryption to params and payload if the user require the input and output to be a secret. --- 90.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/90.md b/90.md index 4c0eff6..7de34fc 100644 --- a/90.md +++ b/90.md @@ -67,6 +67,37 @@ All tags are optional. * `relays`: List of relays where Service Providers SHOULD publish responses to * `p`: Service Providers the customer is interested in. Other SPs MIGHT still choose to process the job +## Encrypted Params + +If the user wants to keep the input parameters a secret, they can encrypt the `i` and `param` tags with the service provider's 'p' tag and add it to the content field. The user also indicates whether the output should be encrypted or not as one of the parameters. + +```json +[ + [ "i", "what is the capital of France? ", "prompt" ], + [ "param", "model", "LLaMA-2" ], + [ "param", "max_tokens", "512" ], + [ "param", "temperature", "0.5" ], + [ "param", "top-k", "50" ], + [ "param", "top-p", "0.7" ], + [ "param", "frequency_penalty", "1" ], + [ "param", "output", "encrypted"] +] + +``` + +This param data will be encrypted and added to the `content` field and `p` tag should be present + +``` +"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", + "tags": [ + [`p`, `04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f`] + + ] + + +``` + + ## Job result (`kind:6000-6999`) Service providers publish job results, providing the output of the job result. They should tag the original job request event id as well as the customer's pubkey. @@ -110,6 +141,8 @@ Service providers can give feedback about a job back to the customer. * `amount` tag: as defined in the [Job Result](#job-result) section. * `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Appendix 1](#appendix-1-job-feedback-status) defines status. Extra human-readable information can be added as an extra argument. +* NOTE: If the input params requires input to be encryped, then `content` field will have encrypted payload with `p` tag as key. + ### Job feedback status | status | description | @@ -168,4 +201,4 @@ Service Providers MAY use NIP-89 announcements to advertise their support for jo } ``` -Customers can use NIP-89 to see what service providers their follows use. \ No newline at end of file +Customers can use NIP-89 to see what service providers their follows use. From 9f4a4cf9d2f0a626fc2a341cff6d7f66d73c12e4 Mon Sep 17 00:00:00 2001 From: starbuilder <101296187+starbackr-dev@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:59:13 -0400 Subject: [PATCH 02/13] Update 90.md changed `prompt` to 'text` --- 90.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/90.md b/90.md index 7de34fc..a55d491 100644 --- a/90.md +++ b/90.md @@ -73,7 +73,7 @@ If the user wants to keep the input parameters a secret, they can encrypt the `i ```json [ - [ "i", "what is the capital of France? ", "prompt" ], + [ "i", "what is the capital of France? ", "text" ], [ "param", "model", "LLaMA-2" ], [ "param", "max_tokens", "512" ], [ "param", "temperature", "0.5" ], From c2020929fbbcd667caa8ac67b706844512d19d7c Mon Sep 17 00:00:00 2001 From: starbuilder <101296187+starbackr-dev@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:56:24 -0500 Subject: [PATCH 03/13] Update 90.md updated based on Pablo's feedback. --- 90.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/90.md b/90.md index a55d491..0ac4b98 100644 --- a/90.md +++ b/90.md @@ -79,8 +79,8 @@ If the user wants to keep the input parameters a secret, they can encrypt the `i [ "param", "temperature", "0.5" ], [ "param", "top-k", "50" ], [ "param", "top-p", "0.7" ], - [ "param", "frequency_penalty", "1" ], - [ "param", "output", "encrypted"] + [ "param", "frequency_penalty", "1" ] + ] ``` @@ -90,8 +90,8 @@ This param data will be encrypted and added to the `content` field and `p` tag s ``` "content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", "tags": [ - [`p`, `04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f`] - + [`p`, `04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f`], + [ `param`, `encrypted`, true] ] @@ -121,6 +121,10 @@ Service providers publish job results, providing the output of the job result. T * `amount`: millisats that the Service Provider is requesting to be paid. An optional third value can be a bolt11 invoice. * `i`: The original input(s) specified in the request. +## Encrypted Output + +If the request has encrypted params, then output should be encrypted and placed in `content` field with `p` tag. If the output is encrypted, then avoid including `i` tag with input-data as clear text. + ## Job feedback Service providers can give feedback about a job back to the customer. From 56dbb7722c3d1a2c759277391960f41ba6948dcd Mon Sep 17 00:00:00 2001 From: starbuilder <101296187+starbackr-dev@users.noreply.github.com> Date: Mon, 6 Nov 2023 16:31:37 -0500 Subject: [PATCH 04/13] Update 90.md changed and added [`encrypted`] to both 5xxx and 6xxx events --- 90.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/90.md b/90.md index 0ac4b98..24da99c 100644 --- a/90.md +++ b/90.md @@ -91,7 +91,7 @@ This param data will be encrypted and added to the `content` field and `p` tag s "content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", "tags": [ [`p`, `04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f`], - [ `param`, `encrypted`, true] + [`encrypted`] ] @@ -124,6 +124,23 @@ Service providers publish job results, providing the output of the job result. T ## Encrypted Output If the request has encrypted params, then output should be encrypted and placed in `content` field with `p` tag. If the output is encrypted, then avoid including `i` tag with input-data as clear text. +Add a tag encrypted to mark the output content as `encrypted` +```json +{ + "pubkey": "", + "content": "", + "kind": 6xxx, + "tags": [ + [ "request", "" ], + [ "e", "", "" ], + [ "p", "" ], + [ "amount", "requested-payment-amount", "" ], + [`encrypted`] + + ] +} +``` + ## Job feedback Service providers can give feedback about a job back to the customer. From 7e3b7cd90c6e5c4ccba94b58231312aaac421551 Mon Sep 17 00:00:00 2001 From: starbuilder <101296187+starbackr-dev@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:22:50 -0500 Subject: [PATCH 05/13] Update 90.md updated based on comments --- 90.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/90.md b/90.md index 24da99c..8394c38 100644 --- a/90.md +++ b/90.md @@ -69,7 +69,7 @@ All tags are optional. ## Encrypted Params -If the user wants to keep the input parameters a secret, they can encrypt the `i` and `param` tags with the service provider's 'p' tag and add it to the content field. The user also indicates whether the output should be encrypted or not as one of the parameters. +If the user wants to keep the input parameters a secret, they can encrypt the `i` and `param` tags with the service provider's 'p' tag and add it to the content field. Add a tag `encrypted` as tags. Encryption for private tags will use [NIP-04 - Encrypted Direct Message encryption](https://github.com/nostr-protocol/nips/blob/master/04.md), using the user's private and service provider's public key for the shared secret ```json [ @@ -90,8 +90,8 @@ This param data will be encrypted and added to the `content` field and `p` tag s ``` "content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", "tags": [ - [`p`, `04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f`], - [`encrypted`] + ["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"], + ["encrypted"] ] @@ -123,7 +123,7 @@ Service providers publish job results, providing the output of the job result. T ## Encrypted Output -If the request has encrypted params, then output should be encrypted and placed in `content` field with `p` tag. If the output is encrypted, then avoid including `i` tag with input-data as clear text. +If the request has encrypted params, then output should be encrypted and placed in `content` field. If the output is encrypted, then avoid including `i` tag with input-data as clear text. Add a tag encrypted to mark the output content as `encrypted` ```json { @@ -135,7 +135,7 @@ Add a tag encrypted to mark the output content as `encrypted` [ "e", "", "" ], [ "p", "" ], [ "amount", "requested-payment-amount", "" ], - [`encrypted`] + ["encrypted"] ] } From 2392dfc9a8b10873cf81c9366291e5971cb9d28c Mon Sep 17 00:00:00 2001 From: Akiomi Kamakura Date: Fri, 10 Nov 2023 05:45:29 +0900 Subject: [PATCH 06/13] Fix typo in 65.md --- 65.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/65.md b/65.md index 939b263..cdfe9bf 100644 --- a/65.md +++ b/65.md @@ -53,7 +53,7 @@ This NIP allows Clients to connect directly with the most up-to-date relay set f 1. Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays). -2. Clients SHOULD spread an author's `kind:10002` events to as many relays as viable. +2. Clients SHOULD spread an author's `kind:10002` event to as many relays as viable. 3. `kind:10002` events should primarily be used to advertise the user's preferred relays to others. A user's own client may use other heuristics for selecting relays for fetching data. From 05cad663f8f4eb022620e2e27f0761733f05ce14 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 10 Nov 2023 07:00:40 -0300 Subject: [PATCH 07/13] improve nip-24. closes https://github.com/nostr-protocol/nips/pull/828 --- 24.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/24.md b/24.md index dee9daa..b88d990 100644 --- a/24.md +++ b/24.md @@ -13,7 +13,7 @@ kind 0 These are extra fields not specified in NIP-01 that may be present in the stringified JSON of metadata events: - - `display_name`: a bigger name with richer characters than `name`. Implementations should fallback to `name` when this is not available. + - `display_name`: an alternative, bigger name with richer characters than `name`. `name` should always be set regardless of the presence of `display_name` in the metadata. - `website`: a web URL related in any way to the event author. - `banner`: an URL to a wide (~1024x768) picture to be optionally displayed in the background of a profile screen. From c945d8bd9d14f928b52ba20e0441f311b046f0f6 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 9 Nov 2023 13:05:31 -0800 Subject: [PATCH 08/13] Remove label annotations from NIP 32 --- 32.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/32.md b/32.md index ddd364a..c5c6272 100644 --- a/32.md +++ b/32.md @@ -6,7 +6,7 @@ Labeling `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` -A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases, from distributed moderation and content recommendations to reviews and ratings. +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. Label Target ---- @@ -41,16 +41,6 @@ MAY be used when the label content is provided by an end user. `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. -Label Annotations ------ - -A label tag MAY include a 4th positional element detailing extra metadata about the label in question. This string -should be a json-encoded object. Any key MAY be used, but the 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). -- `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating. -- `context` may be an array of urls (including NIP-21 urls) indicating other context that should be considered when interpreting labels. - Content ------- @@ -83,8 +73,9 @@ A review of a relay. "kind": 1985, "tags": [ ["L", "com.example.ontology"], - ["l", "relay/review", "com.example.ontology", "{\"quality\": 0.1}"], - ["r", ] + ["l", "relay/review", "com.example.ontology"], + ["r", ], + ["rating", "0.1"] ], "content": "This relay is full of mean people.", ... From 2e652f03d5d645b77f233d16cd3f2c29e1d1a1ec Mon Sep 17 00:00:00 2001 From: Asai Toshiya Date: Fri, 10 Nov 2023 23:59:00 +0900 Subject: [PATCH 09/13] Update TOC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f818b04..a42aa20 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos - [List](#list) - [Event Kinds](#event-kinds) - - [Event Kind Ranges](#event-kind-ranges) - [Message Types](#message-types) - [Client to Relay](#client-to-relay) - [Relay to Client](#relay-to-client) - [Standardized Tags](#standardized-tags) - [Criteria for acceptance of NIPs](#criteria-for-acceptance-of-nips) +- [Mailing Lists](#mailing-lists) - [License](#license) --- From e7777c30315969b3097d4b7940a92e49519b1556 Mon Sep 17 00:00:00 2001 From: Asai Toshiya Date: Sat, 11 Nov 2023 00:50:47 +0900 Subject: [PATCH 10/13] Add DVM kinds to list --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a42aa20..9d3ee62 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos | `1984` | Reporting | [56](56.md) | | `1985` | Label | [32](32.md) | | `4550` | Community Post Approval | [72](72.md) | +| `5000`-`5999` | Job Request | [90](90.md) | +| `6000`-`6999` | Job Result | [90](90.md) | | `7000` | Job Feedback | [90](90.md) | | `9041` | Zap Goal | [75](75.md) | | `9734` | Zap Request | [57](57.md) | From b303240a2b9a168069d94b4fefb3f156316215cd Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 10 Nov 2023 13:11:11 -0300 Subject: [PATCH 11/13] format kinds table. --- README.md | 118 +++++++++++++++++++++++++++--------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 9d3ee62..3f7cb41 100644 --- a/README.md +++ b/README.md @@ -75,65 +75,65 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos ## Event Kinds -| kind | description | NIP | -| ------- | -------------------------- | ----------- | -| `0` | Metadata | [1](01.md) | -| `1` | Short Text Note | [1](01.md) | -| `2` | Recommend Relay | | -| `3` | Contacts | [2](02.md) | -| `4` | Encrypted Direct Messages | [4](04.md) | -| `5` | Event Deletion | [9](09.md) | -| `6` | Repost | [18](18.md) | -| `7` | Reaction | [25](25.md) | -| `8` | Badge Award | [58](58.md) | -| `16` | Generic Repost | [18](18.md) | -| `40` | Channel Creation | [28](28.md) | -| `41` | Channel Metadata | [28](28.md) | -| `42` | Channel Message | [28](28.md) | -| `43` | Channel Hide Message | [28](28.md) | -| `44` | Channel Mute User | [28](28.md) | -| `1063` | File Metadata | [94](94.md) | -| `1311` | Live Chat Message | [53](53.md) | -| `1040` | OpenTimestamps | [03](03.md) | -| `1984` | Reporting | [56](56.md) | -| `1985` | Label | [32](32.md) | -| `4550` | Community Post Approval | [72](72.md) | -| `5000`-`5999` | Job Request | [90](90.md) | -| `6000`-`6999` | Job Result | [90](90.md) | -| `7000` | Job Feedback | [90](90.md) | -| `9041` | Zap Goal | [75](75.md) | -| `9734` | Zap Request | [57](57.md) | -| `9735` | Zap | [57](57.md) | -| `9802` | Highlights | [84](84.md) | -| `10000` | Mute List | [51](51.md) | -| `10001` | Pin List | [51](51.md) | -| `10002` | Relay List Metadata | [65](65.md) | -| `13194` | Wallet Info | [47](47.md) | -| `22242` | Client Authentication | [42](42.md) | -| `23194` | Wallet Request | [47](47.md) | -| `23195` | Wallet Response | [47](47.md) | -| `24133` | Nostr Connect | [46](46.md) | -| `27235` | HTTP Auth | [98](98.md) | -| `30000` | Categorized People List | [51](51.md) | -| `30001` | Categorized Bookmark List | [51](51.md) | -| `30008` | Profile Badges | [58](58.md) | -| `30009` | Badge Definition | [58](58.md) | -| `30017` | Create or update a stall | [15](15.md) | -| `30018` | Create or update a product | [15](15.md) | -| `30023` | Long-form Content | [23](23.md) | -| `30024` | Draft Long-form Content | [23](23.md) | -| `30078` | Application-specific Data | [78](78.md) | -| `30311` | Live Event | [53](53.md) | -| `30315` | User Statuses | [38](38.md) | -| `30402` | Classified Listing | [99](99.md) | -| `30403` | Draft Classified Listing | [99](99.md) | -| `31922` | Date-Based Calendar Event | [52](52.md) | -| `31923` | Time-Based Calendar Event | [52](52.md) | -| `31924` | Calendar | [52](52.md) | -| `31925` | Calendar Event RSVP | [52](52.md) | -| `31989` | Handler recommendation | [89](89.md) | -| `31990` | Handler information | [89](89.md) | -| `34550` | Community Definition | [72](72.md) | +| kind | description | NIP | +| ------------- | -------------------------- | ----------- | +| `0` | Metadata | [1](01.md) | +| `1` | Short Text Note | [1](01.md) | +| `2` | Recommend Relay | | +| `3` | Contacts | [2](02.md) | +| `4` | Encrypted Direct Messages | [4](04.md) | +| `5` | Event Deletion | [9](09.md) | +| `6` | Repost | [18](18.md) | +| `7` | Reaction | [25](25.md) | +| `8` | Badge Award | [58](58.md) | +| `16` | Generic Repost | [18](18.md) | +| `40` | Channel Creation | [28](28.md) | +| `41` | Channel Metadata | [28](28.md) | +| `42` | Channel Message | [28](28.md) | +| `43` | Channel Hide Message | [28](28.md) | +| `44` | Channel Mute User | [28](28.md) | +| `1063` | File Metadata | [94](94.md) | +| `1311` | Live Chat Message | [53](53.md) | +| `1040` | OpenTimestamps | [03](03.md) | +| `1984` | Reporting | [56](56.md) | +| `1985` | Label | [32](32.md) | +| `4550` | Community Post Approval | [72](72.md) | +| `5000`-`5999` | Job Request | [90](90.md) | +| `6000`-`6999` | Job Result | [90](90.md) | +| `7000` | Job Feedback | [90](90.md) | +| `9041` | Zap Goal | [75](75.md) | +| `9734` | Zap Request | [57](57.md) | +| `9735` | Zap | [57](57.md) | +| `9802` | Highlights | [84](84.md) | +| `10000` | Mute List | [51](51.md) | +| `10001` | Pin List | [51](51.md) | +| `10002` | Relay List Metadata | [65](65.md) | +| `13194` | Wallet Info | [47](47.md) | +| `22242` | Client Authentication | [42](42.md) | +| `23194` | Wallet Request | [47](47.md) | +| `23195` | Wallet Response | [47](47.md) | +| `24133` | Nostr Connect | [46](46.md) | +| `27235` | HTTP Auth | [98](98.md) | +| `30000` | Categorized People List | [51](51.md) | +| `30001` | Categorized Bookmark List | [51](51.md) | +| `30008` | Profile Badges | [58](58.md) | +| `30009` | Badge Definition | [58](58.md) | +| `30017` | Create or update a stall | [15](15.md) | +| `30018` | Create or update a product | [15](15.md) | +| `30023` | Long-form Content | [23](23.md) | +| `30024` | Draft Long-form Content | [23](23.md) | +| `30078` | Application-specific Data | [78](78.md) | +| `30311` | Live Event | [53](53.md) | +| `30315` | User Statuses | [38](38.md) | +| `30402` | Classified Listing | [99](99.md) | +| `30403` | Draft Classified Listing | [99](99.md) | +| `31922` | Date-Based Calendar Event | [52](52.md) | +| `31923` | Time-Based Calendar Event | [52](52.md) | +| `31924` | Calendar | [52](52.md) | +| `31925` | Calendar Event RSVP | [52](52.md) | +| `31989` | Handler recommendation | [89](89.md) | +| `31990` | Handler information | [89](89.md) | +| `34550` | Community Definition | [72](72.md) | ## Message types From cbdca1e9643711c62e06a19d9c2d889699a7978d Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 10 Nov 2023 13:16:35 -0300 Subject: [PATCH 12/13] nip-84: remove all the "range" stuff, we can add later if the need arises. --- 84.md | 61 ----------------------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/84.md b/84.md index 89bf88b..4caab62 100644 --- a/84.md +++ b/84.md @@ -35,64 +35,3 @@ last value of the tag. ### Context Clients MAY include a `context` tag, useful when the highlight is a subset of a paragraph and displaying the surrounding content might be beneficial to give context to the higlight. - -### Ranges -Clients MAY include `range` tags with the start/end indexes of where the highlight begins and finishes within -the referenced article/tagged-event. - -``` -[ "range", , ] -``` - -Additionally a range with `context` as the third value of the tag MAY be added to indicate the begin/finish indexes -of the highlight within the included `context` tag. - -``` -[ "range", , , "context" ] -``` - -#### Text-based nostr events' highlights - -Highlights of Nostr events SHOULD use the range index of the content as-is -(e.g. NIP-23 articles include the markdown instead of computing the index from the rendered markdown). - -``` -[ "range", 3000, 3042 ] # highlight begins at index position 3000 of the tagged event's `.content` -[ "range", 42, 84, "context" ] # highlight begins at index position 42 of the `context` tag's value -``` - -#### Non-text-based nostr events' highlights - -A `kind:9802` event that tags a NIP-94 event which includes a video or audio file can use ranges to -indicate the start/end time position in seconds. - -#### Ranges in URL highlights - -When creating a highlight from a URL the range should be expressed over -the extracted plain text of the formatted content (e.g. rendered HTML instead of including the HTML markup); -this helps make finding the correct indexes easier on websites with markup variations on each render. - -e.g. `hello, world` - -Tagging `hello, world` would result in using a range tag like `["range", 0, 12 ]`. - -Text extraction (i.e. translation from non-plain text medium like HTML or PDF) is highly subjective and the value -of the range should be carefully interpreted by the different clients that support this. - -```json -{ - "created_at": 1682707885, - "content": "while allowing creators to simply keep doing what they’re doing. Creators don’t need to be blatant shills for brands", - "tags": [ - [ "r", "https://footstr.com/zapvertise/" ], - [ "p", "c48e29f04b482cc01ca1f9ef8c86ef8318c059e0e9353235162f080f26e14c11", "wss://relay.url", "author" ], - [ "context", "The Nostr zapvertising model creates a truly free market for advertisers, while allowing creators to simply keep doing what they’re doing. Creators don’t need to be blatant shills for brands, they just have to create high quality content people find valuable, and companies will naturally want to zapvertise on their posts." ] - [ "range", 3916, 4032 ], - [ "range", 74, 190, "context" ], - ], - "kind": 9802, - "pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", - "id": "59e5887a3cdf32d5f11edf9b8cd098c620d278514b2edde3e6d1ba8a541d262c", - "sig": "f2d15b8bc2csf6d198350f8df0a31dcf66d7c32ec9c54e6b3f102d579370b7de9d164d70350a5b32a2911db3b124e972bafa9a1bc8fd60c1e338903d2f6306b0" -} -``` From b6c7a255102a65c4978b465a85f124e910e82a2d Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 10 Nov 2023 08:13:04 -0800 Subject: [PATCH 13/13] Clarify NIP 32 --- 32.md | 113 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 41 deletions(-) diff --git a/32.md b/32.md index c5c6272..f8dc002 100644 --- a/32.md +++ b/32.md @@ -6,7 +6,30 @@ Labeling `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` -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. +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. + +This NIP introduces two new tags: + +- `L` denotes a label namespace +- `l` denotes a label + +Label Namespace Tag +---- + +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. + +`L` tags are REQUIRED in order to support searching by namespace rather than by a specific tag. The special `ugc` +("user generated content") namespace MAY be used when the label content is provided by an end user. + +`L` tags starting with `#` indicate that the label target should be associated with the label's value. +This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. + +Label Tag +---- + +An `l` tag's value can be any string. `l` tags MUST include a `mark` matching an `L` tag value in the same event. Label Target ---- @@ -16,37 +39,18 @@ labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, pe or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and `p` tags. -Label Tag ----- - -This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. -A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature -external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD -ensure they are unambiguous by using a well-defined namespace (such as an ISO standard) or reverse domain name notation. - -Namespaces starting with `#` indicate that the label target should be associated with the label's value. -This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. - -Some examples: - -- `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. -- `["l", "", "#p"]` - the publisher thinks the given entity is related to `` -- `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. -- `["l", "VI-hum", "com.example.ontology"]` - Violence toward a human being as defined by ontology.example.com. - -`L` tags containing the label namespaces MUST be included in order to support searching by -namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace -MAY be used when the label content is provided by an end user. - -`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. - Content ------- Labels should be short, meaningful strings. Longer discussions, such as for a review, or an explanation of why something was labeled the way it was, should go in the event's `content` field. +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. + Example events -------------- @@ -60,39 +64,61 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. ["l", "permies", "#t"], ["p", , ], ["p", , ] - ], - "content": "", - ... + ] } ``` -A review of a relay. +A report flagging violence toward a human being as defined by ontology.example.com. ```json { "kind": 1985, "tags": [ ["L", "com.example.ontology"], - ["l", "relay/review", "com.example.ontology"], - ["r", ], - ["rating", "0.1"] - ], - "content": "This relay is full of mean people.", - ... + ["l", "VI-hum", "com.example.ontology"], + ["p", , ], + ["p", , ] + ] } ``` -Publishers can self-label by adding `l` tags to their own non-1985 events. +A moderation suggestion for a chat event. + +```json +{ + "kind": 1985, + "tags": [ + ["L", "nip28.moderation"], + ["l", "approve", "nip28.moderation"], + ["e", , ] + ], +} +``` + +Assignment of a license to an event. + +```json +{ + "kind": 1985, + "tags": [ + ["L", "license"], + ["l", "MIT", "license"], + ["e", , ] + ], +} +``` + +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. ```json { "kind": 1, "tags": [ - ["L", "com.example.ontology"], - ["l", "IL-frd", "com.example.ontology"] + ["L", "ISO-3166-2"], + ["l", "IT-MI", "ISO-3166-2"] ], - "content": "Send me 100 sats and I'll send you 200 back", - ... + "content": "It's beautiful here in Milan!", } ``` @@ -115,3 +141,8 @@ Vocabularies MAY choose to fully qualify all labels within a namespace (for exam 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). + +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.