mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-12 15:09:07 -05:00
reformat a bunch of json things and small nitpicks.
This commit is contained in:
parent
b0df71824f
commit
5dcfe85306
18
11.md
18
11.md
|
@ -68,7 +68,6 @@ are rejected or fail immediately.
|
|||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"limitation": {
|
||||
"max_message_length": 16384,
|
||||
"max_subscriptions": 20,
|
||||
|
@ -82,7 +81,8 @@ are rejected or fail immediately.
|
|||
"payment_required": true,
|
||||
"created_at_lower_limit": 31536000,
|
||||
"created_at_upper_limit": 3
|
||||
}
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -181,8 +181,8 @@ flexibility is up to the client software.
|
|||
|
||||
```json
|
||||
{
|
||||
"relay_countries": [ "CA", "US" ],
|
||||
...
|
||||
"relay_countries": [ "CA", "US" ]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -203,10 +203,10 @@ To support this goal, relays MAY specify some of the following values.
|
|||
|
||||
```json
|
||||
{
|
||||
"language_tags": ["en", "en-419"],
|
||||
"tags": ["sfw-only", "bitcoin-only", "anime"],
|
||||
"posting_policy": "https://example.com/posting-policy.html",
|
||||
...
|
||||
"language_tags": [ "en", "en-419" ],
|
||||
"tags": [ "sfw-only", "bitcoin-only", "anime" ],
|
||||
"posting_policy": "https://example.com/posting-policy.html"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -239,13 +239,13 @@ Relays that require payments may want to expose their fee schedules.
|
|||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"payments_url": "https://my-relay/payments",
|
||||
"fees": {
|
||||
"admission": [{ "amount": 1000000, "unit": "msats" }],
|
||||
"subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }],
|
||||
"publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }],
|
||||
}
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -255,8 +255,8 @@ A URL pointing to an image to be used as an icon for the relay. Recommended to b
|
|||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
|
6
13.md
6
13.md
|
@ -35,11 +35,7 @@ Example mined note
|
|||
"created_at": 1651794653,
|
||||
"kind": 1,
|
||||
"tags": [
|
||||
[
|
||||
"nonce",
|
||||
"776797",
|
||||
"21"
|
||||
]
|
||||
["nonce", "776797", "21"]
|
||||
],
|
||||
"content": "It's just me mining my own business",
|
||||
"sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977"
|
||||
|
|
8
14.md
8
14.md
|
@ -6,14 +6,16 @@ Subject tag in Text events
|
|||
|
||||
`draft` `optional`
|
||||
|
||||
This NIP defines the use of the "subject" tag in text (kind: 1) events.
|
||||
This NIP defines the use of the "subject" tag in text (kind: 1) events.
|
||||
(implemented in more-speech)
|
||||
|
||||
`["subject": <string>]`
|
||||
```json
|
||||
["subject": <string>]
|
||||
```
|
||||
|
||||
Browsers often display threaded lists of messages. The contents of the subject tag can be used in such lists, instead of the more ad hoc approach of using the first few words of the message. This is very similar to the way email browsers display lists of incoming emails by subject rather than by contents.
|
||||
|
||||
When replying to a message with a subject, clients SHOULD replicate the subject tag. Clients MAY adorn the subject to denote
|
||||
that it is a reply. e.g. by prepending "Re:".
|
||||
that it is a reply. e.g. by prepending "Re:".
|
||||
|
||||
Subjects should generally be shorter than 80 chars. Long subjects will likely be trimmed by clients.
|
||||
|
|
205
15.md
205
15.md
|
@ -1,14 +1,14 @@
|
|||
NIP-15
|
||||
======
|
||||
|
||||
Nostr Marketplace (for resilient marketplaces)
|
||||
-----------------------------------
|
||||
Nostr Marketplace
|
||||
-----------------
|
||||
|
||||
`draft` `optional`
|
||||
`draft` `optional`
|
||||
|
||||
> Based on https://github.com/lnbits/Diagon-Alley
|
||||
Based on https://github.com/lnbits/Diagon-Alley.
|
||||
|
||||
> Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market)
|
||||
Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market).
|
||||
|
||||
## Terms
|
||||
|
||||
|
@ -35,29 +35,30 @@ The `merchant` admin software can be purely clientside, but for `convenience` an
|
|||
A merchant can publish these events:
|
||||
| Kind | | Description |
|
||||
| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
|
||||
| `0 ` | `set_meta` | The merchant description (similar with any `nostr` public key). |
|
||||
| `0` | `set_meta` | The merchant description (similar with any `nostr` public key). |
|
||||
| `30017` | `set_stall` | Create or update a stall. |
|
||||
| `30018` | `set_product` | Create or update a product. |
|
||||
| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
|
||||
| `5 ` | `delete` | Delete a product or a stall. |
|
||||
| `4` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
|
||||
| `5` | `delete` | Delete a product or a stall. |
|
||||
|
||||
### Event `30017`: Create or update a stall.
|
||||
|
||||
**Event Content**:
|
||||
**Event Content**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <String, UUID generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>,
|
||||
"name": <String, stall name>,
|
||||
"description": <String (optional), stall description>,
|
||||
"currency": <String, currency used>,
|
||||
"shipping": [
|
||||
{
|
||||
"id": <String, UUID of the shipping zone, generated by the merchant>,
|
||||
"name": <String (optional), zone name>,
|
||||
"cost": <float, base cost for shipping. The currency is defined at the stall level>,
|
||||
"regions": [<String, regions included in this zone>],
|
||||
}
|
||||
]
|
||||
"id": <string, id generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>,
|
||||
"name": <string, stall name>,
|
||||
"description": <string (optional), stall description>,
|
||||
"currency": <string, currency used>,
|
||||
"shipping": [
|
||||
{
|
||||
"id": <string, id of the shipping zone, generated by the merchant>,
|
||||
"name": <string (optional), zone name>,
|
||||
"cost": <float, base cost for shipping. The currency is defined at the stall level>,
|
||||
"regions": [<string, regions included in this zone>],
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -70,34 +71,39 @@ Fields that are not self-explanatory:
|
|||
- each shipping zone contains the base cost for orders made to that shipping zone, but a specific shipping cost per
|
||||
product can also be specified if the shipping cost for that product is higher than what's specified by the base cost.
|
||||
|
||||
**Event Tags**:
|
||||
**Event Tags**
|
||||
|
||||
```json
|
||||
"tags": [["d", <String, id of stall]]
|
||||
{
|
||||
"tags": [["d", <string, id of stall]],
|
||||
...
|
||||
}
|
||||
```
|
||||
- the `d` tag is required, its value MUST be the same as the stall `id`.
|
||||
|
||||
### Event `30018`: Create or update a product
|
||||
|
||||
**Event Content**:
|
||||
**Event Content**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": <String, UUID generated by the merchant.Sequential IDs (`0`, `1`, `2`...) are discouraged>,
|
||||
"stall_id": <String, UUID of the stall to which this product belong to>,
|
||||
"name": <String, product name>,
|
||||
"description": <String (optional), product description>,
|
||||
"images": <[String], array of image URLs, optional>,
|
||||
"currency": <String, currency used>,
|
||||
"price": <float, cost of product>,
|
||||
"quantity": <int or null, available items>,
|
||||
"specs": [
|
||||
[<String, spec key>, <String, spec value>]
|
||||
],
|
||||
"shipping": [
|
||||
{
|
||||
"id": <String, UUID of the shipping zone. Must match one of the zones defined for the stall>,
|
||||
"cost": <float, extra cost for shipping. The currency is defined at the stall level>,
|
||||
}
|
||||
]
|
||||
"id": <string, id generated by the merchant (sequential ids are discouraged)>,
|
||||
"stall_id": <string, id of the stall to which this product belong to>,
|
||||
"name": <string, product name>,
|
||||
"description": <string (optional), product description>,
|
||||
"images": <[string], array of image URLs, optional>,
|
||||
"currency": <string, currency used>,
|
||||
"price": <float, cost of product>,
|
||||
"quantity": <int or null, available items>,
|
||||
"specs": [
|
||||
[<string, spec key>, <string, spec value>]
|
||||
],
|
||||
"shipping": [
|
||||
{
|
||||
"id": <string, id of the shipping zone (must match one of the zones defined for the stall)>,
|
||||
"cost": <float, extra cost for shipping. The currency is defined at the stall level>,
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -114,16 +120,18 @@ Fields that are not self-explanatory:
|
|||
- the `id` should match the id of the shipping zone, as defined in the `shipping` field of the stall
|
||||
- to calculate the total cost of shipping for an order, the user will choose a shipping option during checkout, and then the client must consider this costs:
|
||||
- the `base cost from the stall` for the chosen shipping option
|
||||
- the result of multiplying the product units by the `shipping costs specified in the product`, if any.
|
||||
- the result of multiplying the product units by the `shipping costs specified in the product`, if any.
|
||||
|
||||
**Event Tags**
|
||||
|
||||
**Event Tags**:
|
||||
```json
|
||||
"tags": [
|
||||
["d", <String, id of product],
|
||||
["t", <String (optional), product category],
|
||||
["t", <String (optional), product category],
|
||||
...
|
||||
]
|
||||
["d", <string, id of product],
|
||||
["t", <string (optional), product category],
|
||||
["t", <string (optional), product category],
|
||||
...
|
||||
],
|
||||
...
|
||||
```
|
||||
|
||||
- the `d` tag is required, its value MUST be the same as the product `id`.
|
||||
|
@ -147,23 +155,23 @@ The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips
|
|||
|
||||
```json
|
||||
{
|
||||
"id": <String, UUID generated by the customer>,
|
||||
"type": 0,
|
||||
"name": <String (optional), ???>,
|
||||
"address": <String (optional), for physical goods an address should be provided>
|
||||
"message": "<String (optional), message for merchant>,
|
||||
"contact": {
|
||||
"nostr": <32-bytes hex of a pubkey>,
|
||||
"phone": <String (optional), if the customer wants to be contacted by phone>,
|
||||
"email": <String (optional), if the customer wants to be contacted by email>,
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"product_id": <String, UUID of the product>,
|
||||
"quantity": <int, how many products the customer is ordering>
|
||||
}
|
||||
],
|
||||
"shipping_id": <String, UUID of the shipping zone>
|
||||
"id": <string, id generated by the customer>,
|
||||
"type": 0,
|
||||
"name": <string (optional), ???>,
|
||||
"address": <string (optional), for physical goods an address should be provided>
|
||||
"message": "<string (optional), message for merchant>,
|
||||
"contact": {
|
||||
"nostr": <32-bytes hex of a pubkey>,
|
||||
"phone": <string (optional), if the customer wants to be contacted by phone>,
|
||||
"email": <string (optional), if the customer wants to be contacted by email>,
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"product_id": <string, id of the product>,
|
||||
"quantity": <int, how many products the customer is ordering>
|
||||
}
|
||||
],
|
||||
"shipping_id": <string, id of the shipping zone>
|
||||
}
|
||||
|
||||
```
|
||||
|
@ -186,23 +194,23 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
|
|||
|
||||
```json
|
||||
{
|
||||
"id": <String, UUID of the order>,
|
||||
"type": 1,
|
||||
"message": <String, message to customer, optional>,
|
||||
"payment_options": [
|
||||
{
|
||||
"type": <String, option type>,
|
||||
"link": <String, url, btc address, ln invoice, etc>
|
||||
},
|
||||
{
|
||||
"type": <String, option type>,
|
||||
"link": <String, url, btc address, ln invoice, etc>
|
||||
},
|
||||
{
|
||||
"type": <String, option type>,
|
||||
"link": <String, url, btc address, ln invoice, etc>
|
||||
}
|
||||
]
|
||||
"id": <string, id of the order>,
|
||||
"type": 1,
|
||||
"message": <string, message to customer, optional>,
|
||||
"payment_options": [
|
||||
{
|
||||
"type": <string, option type>,
|
||||
"link": <string, url, btc address, ln invoice, etc>
|
||||
},
|
||||
{
|
||||
"type": <string, option type>,
|
||||
"link": <string, url, btc address, ln invoice, etc>
|
||||
},
|
||||
{
|
||||
"type": <string, option type>,
|
||||
"link": <string, url, btc address, ln invoice, etc>
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -214,11 +222,11 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
|
|||
|
||||
```json
|
||||
{
|
||||
"id": <String, UUID of the order>,
|
||||
"type": 2,
|
||||
"message": <String, message to customer>,
|
||||
"paid": <Bool, true/false has received payment>,
|
||||
"shipped": <Bool, true/false has been shipped>,
|
||||
"id": <string, id of the order>,
|
||||
"type": 2,
|
||||
"message": <string, message to customer>,
|
||||
"paid": <bool: has received payment>,
|
||||
"shipped": <bool: has been shipped>,
|
||||
}
|
||||
```
|
||||
## Customize Marketplace
|
||||
|
@ -226,19 +234,20 @@ Create a customized user experience using the `naddr` from [NIP-19](https://gith
|
|||
|
||||
### Event `30019`: Create or update marketplace UI/UX
|
||||
|
||||
**Event Content**:
|
||||
**Event Content**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": <String (optional), market name>,
|
||||
"about": <String (optional), market description>,
|
||||
"ui": {
|
||||
"picture": <String (optional), market logo image URL>,
|
||||
"banner": <String (optional), market logo banner URL>,
|
||||
"theme": <String (optional), market theme>,
|
||||
"darkMode": <Bool, true/false>
|
||||
},
|
||||
"merchants": <[String] (optional), array of pubkeys>,
|
||||
...
|
||||
"name": <string (optional), market name>,
|
||||
"about": <string (optional), market description>,
|
||||
"ui": {
|
||||
"picture": <string (optional), market logo image URL>,
|
||||
"banner": <string (optional), market logo banner URL>,
|
||||
"theme": <string (optional), market theme>,
|
||||
"darkMode": <bool, true/false>
|
||||
},
|
||||
"merchants": [array of pubkeys (optional)],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
|
46
28.md
46
28.md
|
@ -27,8 +27,8 @@ In the channel creation `content` field, Client SHOULD include basic channel met
|
|||
|
||||
```json
|
||||
{
|
||||
"content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\"}",
|
||||
...
|
||||
"content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\"}",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -37,7 +37,7 @@ In the channel creation `content` field, Client SHOULD include basic channel met
|
|||
|
||||
Update a channel's public metadata.
|
||||
|
||||
Clients and relays SHOULD handle kind 41 events similar to kind 33 replaceable events, where the information is used to update the metadata, without modifying the event id for the channel. Only the most recent kind 41 is needed to be stored.
|
||||
Clients and relays SHOULD handle kind 41 events similar to kind 33 replaceable events, where the information is used to update the metadata, without modifying the event id for the channel.Only the most recent kind 41 is needed to be stored.
|
||||
|
||||
Clients SHOULD ignore kind 41s from pubkeys other than the kind 40 pubkey.
|
||||
|
||||
|
@ -53,9 +53,9 @@ Clients SHOULD use [NIP-10](10.md) marked "e" tags to recommend a relay.
|
|||
|
||||
```json
|
||||
{
|
||||
"content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\"}",
|
||||
"tags": [["e", <channel_create_event_id>, <relay-url>]],
|
||||
...
|
||||
"content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\"}",
|
||||
"tags": [["e", <channel_create_event_id>, <relay-url>]],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -72,9 +72,9 @@ Root message:
|
|||
|
||||
```json
|
||||
{
|
||||
"content": <string>,
|
||||
"tags": [["e", <kind_40_event_id>, <relay-url>, "root"]],
|
||||
...
|
||||
"content": <string>,
|
||||
"tags": [["e", <kind_40_event_id>, <relay-url>, "root"]],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -82,14 +82,14 @@ Reply to another message:
|
|||
|
||||
```json
|
||||
{
|
||||
"content": <string>,
|
||||
"tags": [
|
||||
["e", <kind_40_event_id>, <relay-url>, "root"],
|
||||
["e", <kind_42_event_id>, <relay-url>, "reply"],
|
||||
["p", <pubkey>, <relay-url>],
|
||||
...
|
||||
],
|
||||
...
|
||||
"content": <string>,
|
||||
"tags": [
|
||||
["e", <kind_40_event_id>, <relay-url>, "root"],
|
||||
["e", <kind_42_event_id>, <relay-url>, "reply"],
|
||||
["p", <pubkey>, <relay-url>],
|
||||
...
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -108,9 +108,9 @@ Clients MAY hide event 42s for other users other than the user who sent the even
|
|||
|
||||
```json
|
||||
{
|
||||
"content": "{\"reason\": \"Dick pic\"}",
|
||||
"tags": [["e", <kind_42_event_id>]],
|
||||
...
|
||||
"content": "{\"reason\": \"Dick pic\"}",
|
||||
"tags": [["e", <kind_42_event_id>]],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -126,9 +126,9 @@ Clients MAY hide event 42s for users other than the user who sent the event 44.
|
|||
|
||||
```json
|
||||
{
|
||||
"content": "{\"reason\": \"Posting dick pics\"}",
|
||||
"tags": [["p", <pubkey>]],
|
||||
...
|
||||
"content": "{\"reason\": \"Posting dick pics\"}",
|
||||
"tags": [["p", <pubkey>]],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
|
9
32.md
9
32.md
|
@ -64,7 +64,8 @@ A suggestion that multiple pubkeys be associated with the `permies` topic.
|
|||
["l", "permies", "#t"],
|
||||
["p", <pubkey1>, <relay_url>],
|
||||
["p", <pubkey2>, <relay_url>]
|
||||
]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -78,7 +79,8 @@ A report flagging violence toward a human being as defined by ontology.example.c
|
|||
["l", "VI-hum", "com.example.ontology"],
|
||||
["p", <pubkey1>, <relay_url>],
|
||||
["p", <pubkey2>, <relay_url>]
|
||||
]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -92,6 +94,7 @@ A moderation suggestion for a chat event.
|
|||
["l", "approve", "nip28.moderation"],
|
||||
["e", <kind40_event_id>, <relay_url>]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -105,6 +108,7 @@ Assignment of a license to an event.
|
|||
["l", "MIT", "license"],
|
||||
["e", <event_id>, <relay_url>]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -119,6 +123,7 @@ is labeling their note as being related to Milan, Italy using ISO 3166-2.
|
|||
["l", "IT-MI", "ISO-3166-2"]
|
||||
],
|
||||
"content": "It's beautiful here in Milan!",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
|
26
36.md
26
36.md
|
@ -24,18 +24,18 @@ options:
|
|||
|
||||
```json
|
||||
{
|
||||
"pubkey": "<pub-key>",
|
||||
"created_at": 1000000000,
|
||||
"kind": 1,
|
||||
"tags": [
|
||||
["t", "hastag"],
|
||||
["L", "content-warning"],
|
||||
["l", "reason", "content-warning"],
|
||||
["L", "social.nos.ontology"],
|
||||
["l", "NS-nud", "social.nos.ontology"],
|
||||
["content-warning", "reason"] /* reason is optional */
|
||||
],
|
||||
"content": "sensitive content with #hastag\n",
|
||||
"id": "<event-id>"
|
||||
"pubkey": "<pub-key>",
|
||||
"created_at": 1000000000,
|
||||
"kind": 1,
|
||||
"tags": [
|
||||
["t", "hastag"],
|
||||
["L", "content-warning"],
|
||||
["l", "reason", "content-warning"],
|
||||
["L", "social.nos.ontology"],
|
||||
["l", "NS-nud", "social.nos.ontology"],
|
||||
["content-warning", "<optional reason>"]
|
||||
],
|
||||
"content": "sensitive content with #hastag\n",
|
||||
"id": "<event-id>"
|
||||
}
|
||||
```
|
||||
|
|
28
39.md
28
39.md
|
@ -15,15 +15,13 @@ Nostr protocol users may have other online identities such as usernames, profile
|
|||
A new optional `i` tag is introduced for `kind 0` metadata event contents in addition to name, about, picture fields as included in [NIP-01](https://github.com/nostr-protocol/nips/blob/master/01.md):
|
||||
```json
|
||||
{
|
||||
"id": <id>,
|
||||
"pubkey": <pubkey>,
|
||||
...
|
||||
"tags": [
|
||||
["i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab"],
|
||||
["i", "twitter:semisol_public", "1619358434134196225"],
|
||||
["i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"]
|
||||
["i", "telegram:1087295469", "nostrdirectory/770"]
|
||||
]
|
||||
"tags": [
|
||||
["i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab"],
|
||||
["i", "twitter:semisol_public", "1619358434134196225"],
|
||||
["i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"]
|
||||
["i", "telegram:1087295469", "nostrdirectory/770"]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -31,9 +29,9 @@ An `i` tag will have two parameters, which are defined as the following:
|
|||
1. `platform:identity`: This is the platform name (for example `github`) and the identity on that platform (for example `semisol`) joined together with `:`.
|
||||
2. `proof`: String or object that points to the proof of owning this identity.
|
||||
|
||||
Clients SHOULD process any `i` tags with more than 2 values for future extensibility.
|
||||
Identity provider names SHOULD only include `a-z`, `0-9` and the characters `._-/` and MUST NOT include `:`.
|
||||
Identity names SHOULD be normalized if possible by replacing uppercase letters with lowercase letters, and if there are multiple aliases for an entity the primary one should be used.
|
||||
Clients SHOULD process any `i` tags with more than 2 values for future extensibility.
|
||||
Identity provider names SHOULD only include `a-z`, `0-9` and the characters `._-/` and MUST NOT include `:`.
|
||||
Identity names SHOULD be normalized if possible by replacing uppercase letters with lowercase letters, and if there are multiple aliases for an entity the primary one should be used.
|
||||
|
||||
## Claim types
|
||||
|
||||
|
@ -41,14 +39,14 @@ Identity names SHOULD be normalized if possible by replacing uppercase letters w
|
|||
|
||||
Identity: A GitHub username.
|
||||
|
||||
Proof: A GitHub Gist ID. This Gist should be created by `<identity>` with a single file that has the text `Verifying that I control the following Nostr public key: <npub encoded public key>`.
|
||||
Proof: A GitHub Gist ID. This Gist should be created by `<identity>` with a single file that has the text `Verifying that I control the following Nostr public key: <npub encoded public key>`.
|
||||
This can be located at `https://gist.github.com/<identity>/<proof>`.
|
||||
|
||||
### `twitter`
|
||||
|
||||
Identity: A Twitter username.
|
||||
|
||||
Proof: A Tweet ID. The tweet should be posted by `<identity>` and have the text `Verifying my account on nostr My Public Key: "<npub encoded public key>"`.
|
||||
Proof: A Tweet ID. The tweet should be posted by `<identity>` and have the text `Verifying my account on nostr My Public Key: "<npub encoded public key>"`.
|
||||
This can be located at `https://twitter.com/<identity>/status/<proof>`.
|
||||
|
||||
### `mastodon`
|
||||
|
@ -62,5 +60,5 @@ This can be located at `https://<identity>/<proof>`.
|
|||
|
||||
Identity: A Telegram user ID.
|
||||
|
||||
Proof: A string in the format `<ref>/<id>` which points to a message published in the public channel or group with name `<ref>` and message ID `<id>`. This message should be sent by user ID `<identity>` and have the text `Verifying that I control the following Nostr public key: "<npub encoded public key>"`.
|
||||
Proof: A string in the format `<ref>/<id>` which points to a message published in the public channel or group with name `<ref>` and message ID `<id>`. This message should be sent by user ID `<identity>` and have the text `Verifying that I control the following Nostr public key: "<npub encoded public key>"`.
|
||||
This can be located at `https://t.me/<proof>`.
|
||||
|
|
24
40.md
24
40.md
|
@ -2,7 +2,7 @@ NIP-40
|
|||
======
|
||||
|
||||
Expiration Timestamp
|
||||
-----------------------------------
|
||||
--------------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
@ -20,14 +20,14 @@ values:
|
|||
|
||||
```json
|
||||
{
|
||||
"pubkey": "<pub-key>",
|
||||
"created_at": 1000000000,
|
||||
"kind": 1,
|
||||
"tags": [
|
||||
["expiration", "1600000000"]
|
||||
],
|
||||
"content": "This message will expire at the specified timestamp and be deleted by relays.\n",
|
||||
"id": "<event-id>"
|
||||
"pubkey": "<pub-key>",
|
||||
"created_at": 1000000000,
|
||||
"kind": 1,
|
||||
"tags": [
|
||||
["expiration", "1600000000"]
|
||||
],
|
||||
"content": "This message will expire at the specified timestamp and be deleted by relays.\n",
|
||||
"id": "<event-id>"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -43,9 +43,9 @@ Clients SHOULD ignore events that have expired.
|
|||
Relay Behavior
|
||||
--------------
|
||||
|
||||
Relays MAY NOT delete expired messages immediately on expiration and MAY persist them indefinitely.
|
||||
Relays SHOULD NOT send expired events to clients, even if they are stored.
|
||||
Relays SHOULD drop any events that are published to them if they are expired.
|
||||
Relays MAY NOT delete expired messages immediately on expiration and MAY persist them indefinitely.
|
||||
Relays SHOULD NOT send expired events to clients, even if they are stored.
|
||||
Relays SHOULD drop any events that are published to them if they are expired.
|
||||
An expiration timestamp does not affect storage of ephemeral events.
|
||||
|
||||
Suggested Use Cases
|
||||
|
|
14
42.md
14
42.md
|
@ -24,13 +24,13 @@ A relay may want to require clients to authenticate to access restricted resourc
|
|||
This NIP defines a new message, `AUTH`, which relays can send when they support authentication and clients can send to relays when they want
|
||||
to authenticate. When sent by relays, the message is of the following form:
|
||||
|
||||
```
|
||||
```json
|
||||
["AUTH", <challenge-string>]
|
||||
```
|
||||
|
||||
And, when sent by clients, of the following form:
|
||||
|
||||
```
|
||||
```json
|
||||
["AUTH", <signed-event-json>]
|
||||
```
|
||||
|
||||
|
@ -41,16 +41,12 @@ Relays MUST exclude `kind: 22242` events from being broadcasted to any client.
|
|||
|
||||
```json
|
||||
{
|
||||
"id": "...",
|
||||
"pubkey": "...",
|
||||
"created_at": 1669695536,
|
||||
"kind": 22242,
|
||||
"tags": [
|
||||
["relay", "wss://relay.example.com/"],
|
||||
["challenge", "challengestringhere"]
|
||||
],
|
||||
"content": "",
|
||||
"sig": "..."
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -67,13 +63,13 @@ is expected to last for the duration of the WebSocket connection.
|
|||
Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For
|
||||
that it can use a `NOTICE` or `OK` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example:
|
||||
|
||||
```
|
||||
```json
|
||||
["NOTICE", "restricted: we can't serve DMs to unauthenticated users, does your client implement NIP-42?"]
|
||||
```
|
||||
|
||||
or it can return an `OK` message noting the reason an event was not written using the same prefix:
|
||||
|
||||
```
|
||||
```json
|
||||
["OK", <event-id>, false, "restricted: we do not accept events from unauthenticated users, please sign up at https://example.com/"]
|
||||
```
|
||||
|
||||
|
|
21
45.md
21
45.md
|
@ -16,29 +16,36 @@ Some queries a client may want to execute against connected relays are prohibiti
|
|||
|
||||
This NIP defines the verb `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result.
|
||||
|
||||
```
|
||||
```json
|
||||
["COUNT", <subscription_id>, <filters JSON>...]
|
||||
```
|
||||
|
||||
Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements.
|
||||
In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`.
|
||||
|
||||
```
|
||||
```json
|
||||
["COUNT", <subscription_id>, {"count": <integer>}]
|
||||
```
|
||||
|
||||
Examples:
|
||||
## Examples:
|
||||
|
||||
```
|
||||
# Followers count
|
||||
### Followers count
|
||||
|
||||
```json
|
||||
["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}]
|
||||
["COUNT", <subscription_id>, {"count": 238}]
|
||||
```
|
||||
|
||||
# Count posts and reactions
|
||||
### Count posts and reactions
|
||||
|
||||
```json
|
||||
["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
|
||||
["COUNT", <subscription_id>, {"count": 5}]
|
||||
```
|
||||
|
||||
# Count posts approximately
|
||||
### Count posts approximately
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, {"kinds": [1]}]
|
||||
["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}]
|
||||
```
|
||||
|
|
30
53.md
30
53.md
|
@ -6,17 +6,17 @@ Live Activities
|
|||
|
||||
`draft` `optional`
|
||||
|
||||
## Abstract
|
||||
|
||||
Service providers want to offer live activities to the Nostr network in such a way that participants can easily logged and queried by clients. This NIP describes a general framework to advertise the involvement of pubkeys in such live activities.
|
||||
|
||||
# Live Event
|
||||
## Concepts
|
||||
|
||||
### Live Event
|
||||
|
||||
A special event with `kind:30311` "Live Event" is defined as a _parameterized replaceable event_ of public `p` tags. Each `p` tag SHOULD have a **displayable** marker name for the current role (e.g. `Host`, `Speaker`, `Participant`) of the user in the event and the relay information MAY be empty. This event will be constantly updated as participants join and leave the activity.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
"kind": 30311,
|
||||
"tags": [
|
||||
|
@ -38,7 +38,7 @@ For example:
|
|||
["relays", "wss://one.com", "wss://two.com", ...]
|
||||
],
|
||||
"content": "",
|
||||
...other fields
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -52,7 +52,7 @@ Live Activity management clients are expected to constantly update `kind:30311`
|
|||
|
||||
The activity MUST be linked to using the [NIP-19](19.md) `naddr` code along with the `a` tag.
|
||||
|
||||
## Proof of Agreement to Participate
|
||||
### Proof of Agreement to Participate
|
||||
|
||||
Event owners can add proof as the 5th term in each `p` tag to clarify the participant's agreement in joining the event. The proof is a signed SHA256 of the complete `a` Tag of the event (`kind:pubkey:dTag`) by each `p`'s private key, encoded in hex.
|
||||
|
||||
|
@ -60,30 +60,28 @@ Clients MAY only display participants if the proof is available or MAY display p
|
|||
|
||||
This feature is important to avoid malicious event owners adding large account holders to the event, without their knowledge, to lure their followers into the malicious owner's trap.
|
||||
|
||||
# Live Chat Message
|
||||
### Live Chat Message
|
||||
|
||||
Event `kind:1311` is live chat's channel message. Clients MUST include the `a` tag of the activity with a `root` marker. Other Kind-1 tags such as `reply` and `mention` can also be used.
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
"id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>",
|
||||
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
|
||||
"created_at": "<Unix timestamp in seconds>",
|
||||
"kind": 1311,
|
||||
"tags": [
|
||||
["a", "30311:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>", "root"],
|
||||
],
|
||||
"content": "Zaps to live streams is beautiful."
|
||||
"content": "Zaps to live streams is beautiful.",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
# Use Cases
|
||||
## Use Cases
|
||||
|
||||
Common use cases include meeting rooms/workshops, watch-together activities, or event spaces, such as [live.snort.social](https://live.snort.social) and [nostrnests.com](https://nostrnests.com).
|
||||
|
||||
# Example
|
||||
## Example
|
||||
|
||||
Live Streaming
|
||||
### Live Streaming
|
||||
|
||||
```json
|
||||
{
|
||||
|
@ -107,7 +105,7 @@ Live Streaming
|
|||
}
|
||||
```
|
||||
|
||||
Live Streaming chat message
|
||||
### Live Streaming chat message
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
14
72.md
14
72.md
|
@ -14,7 +14,6 @@ The goal of this NIP is to create moderator-approved public communities around a
|
|||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"created_at": <Unix timestamp in seconds>,
|
||||
"kind": 34550,
|
||||
"tags": [
|
||||
|
@ -34,7 +33,8 @@ The goal of this NIP is to create moderator-approved public communities around a
|
|||
["relay", "<relay where to send and receive requests>", "requests"],
|
||||
["relay", "<relay where to send and receive approvals>", "approvals"],
|
||||
["relay", "<relay where to post requests to and fetch approvals from>"]
|
||||
]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -44,12 +44,12 @@ Any Nostr event can be submitted to a community by anyone for approval. Clients
|
|||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"kind": 1,
|
||||
"tags": [
|
||||
["a", "34550:<community event author pubkey>:<community-d-identifier>", "<optional-relay-url>"],
|
||||
],
|
||||
"content": "hello world"
|
||||
"content": "hello world",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -61,7 +61,6 @@ The post-approval event MUST include `a` tags of the communities the moderator i
|
|||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
|
||||
"kind": 4550,
|
||||
"tags": [
|
||||
|
@ -70,7 +69,8 @@ The post-approval event MUST include `a` tags of the communities the moderator i
|
|||
["p", "<port-author-pubkey>", "<optional-relay-url>"],
|
||||
["k", "<post-request-kind>"]
|
||||
],
|
||||
"content": "<the full approved event, JSON-encoded>"
|
||||
"content": "<the full approved event, JSON-encoded>",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -86,7 +86,7 @@ Community clients SHOULD display posts that have been approved by at least 1 mod
|
|||
|
||||
The following filter displays the approved posts.
|
||||
|
||||
```js
|
||||
```json
|
||||
[
|
||||
"REQ",
|
||||
"_",
|
||||
|
|
17
75.md
17
75.md
|
@ -1,6 +1,8 @@
|
|||
# NIP-75
|
||||
NIP-75
|
||||
======
|
||||
|
||||
## Zap Goals
|
||||
Zap Goals
|
||||
---------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
@ -27,7 +29,7 @@ Example event:
|
|||
["amount", "210000"],
|
||||
],
|
||||
"content": "Nostrasia travel expenses",
|
||||
...other fields
|
||||
...
|
||||
```
|
||||
|
||||
The following tags are OPTIONAL.
|
||||
|
@ -43,7 +45,8 @@ The following tags are OPTIONAL.
|
|||
["closed_at", "<unix timestamp in seconds>"],
|
||||
],
|
||||
"content": "Nostrasia travel expenses",
|
||||
...other fields
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The goal MAY include an `r` or `a` tag linking to a URL or parameterized replaceable event.
|
||||
|
@ -54,12 +57,14 @@ Parameterized replaceable events can link to a goal by using a `goal` tag specif
|
|||
|
||||
```json
|
||||
{
|
||||
"kind": 3XXXX,
|
||||
...
|
||||
"kind": 3xxxx,
|
||||
"tags": [
|
||||
...
|
||||
["goal", "<event id>", "<Relay URL (optional)>"],
|
||||
],
|
||||
...other fields
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Client behavior
|
||||
|
|
11
84.md
11
84.md
|
@ -27,9 +27,14 @@ useful when highlighting non-nostr content for which the client might be able to
|
|||
last value of the tag.
|
||||
|
||||
```json
|
||||
[ "p", "<pubkey-hex>", "<relay-url>", "author" ],
|
||||
[ "p", "<pubkey-hex>", "<relay-url>", "author" ],
|
||||
[ "p", "<pubkey-hex>", "<relay-url>", "editor" ],
|
||||
{
|
||||
"tags": [
|
||||
["p", "<pubkey-hex>", "<relay-url>", "author"],
|
||||
["p", "<pubkey-hex>", "<relay-url>", "author"],
|
||||
["p", "<pubkey-hex>", "<relay-url>", "editor"]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Context
|
||||
|
|
84
89.md
84
89.md
|
@ -9,10 +9,12 @@ Recommended Application Handlers
|
|||
This NIP describes `kind:31989` and `kind:31990`: a way to discover applications that can handle unknown event-kinds.
|
||||
|
||||
## Rationale
|
||||
|
||||
Nostr's discoverability and transparent event interaction is one of its most interesting/novel mechanics.
|
||||
This NIP provides a simple way for clients to discover applications that handle events of a specific kind to ensure smooth cross-client and cross-kind interactions.
|
||||
|
||||
### Parties involved
|
||||
|
||||
There are three actors to this workflow:
|
||||
|
||||
* application that handles a specific event kind (note that an application doesn't necessarily need to be a distinct entity and it could just be the same pubkey as user A)
|
||||
|
@ -22,18 +24,18 @@ There are three actors to this workflow:
|
|||
* user B, who seeks a recommendation for an app that handles a specific event kind
|
||||
* Queries for `kind:31989` and, based on results, queries for `kind:31990`
|
||||
|
||||
# Events
|
||||
## Events
|
||||
|
||||
## Recommendation event
|
||||
### Recommendation event
|
||||
```json
|
||||
{
|
||||
"kind": 31989,
|
||||
"pubkey": <recommender-user-pubkey>,
|
||||
"tags": [
|
||||
[ "d", <supported-event-kind> ],
|
||||
[ "a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios" ],
|
||||
[ "a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web" ]
|
||||
]
|
||||
"kind": 31989,
|
||||
"pubkey": <recommender-user-pubkey>,
|
||||
"tags": [
|
||||
["d", <supported-event-kind>],
|
||||
["a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios"],
|
||||
["a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -47,34 +49,32 @@ The third value of the tag SHOULD be the platform where this recommendation migh
|
|||
## Handler information
|
||||
```json
|
||||
{
|
||||
"kind": 31990,
|
||||
"pubkey": <pubkey>,
|
||||
"content": "<optional-kind:0-style-metadata>",
|
||||
"tags": [
|
||||
[ "d", <random-id> ],
|
||||
[ "k", <supported-event-kind> ],
|
||||
[ "web", "https://..../a/<bech32>", "nevent" ],
|
||||
[ "web", "https://..../p/<bech32>", "nprofile" ],
|
||||
[ "web", "https://..../e/<bech32>" ],
|
||||
[ "ios", ".../<bech32>" ]
|
||||
]
|
||||
"kind": 31990,
|
||||
"pubkey": "<application-pubkey>",
|
||||
"content": "<optional-kind:0-style-metadata>",
|
||||
"tags": [
|
||||
["d", <random-id>],
|
||||
["k", <supported-event-kind>],
|
||||
["web", "https://..../a/<bech32>", "nevent"],
|
||||
["web", "https://..../p/<bech32>", "nprofile"],
|
||||
["web", "https://..../e/<bech32>"],
|
||||
["ios", ".../<bech32>"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* `content` is an optional `metadata`-like stringified JSON object, as described in NIP-01. This content is useful when the pubkey creating the `kind:31990` is not an application. If `content` is empty, the `kind:0` of the pubkey should be used to display application information (e.g. name, picture, web, LUD16, etc.)
|
||||
|
||||
* `k` tags' value is the event kind that is supported by this `kind:31990`.
|
||||
Using a `k` tag(s) (instead of having the kind onf the NIP-33 `d` tag) provides:
|
||||
* Multiple `k` tags can exist in the same event if the application supports more than one event kind and their handler URLs are the same.
|
||||
* The same pubkey can have multiple events with different apps that handle the same event kind.
|
||||
|
||||
* `bech32` in a URL MUST be replaced by clients with the NIP-19-encoded entity that should be loaded by the application.
|
||||
|
||||
Multiple tags might be registered by the app, following NIP-19 nomenclature as the second value of the array.
|
||||
|
||||
A tag without a second value in the array SHOULD be considered a generic handler for any NIP-19 entity that is not handled by a different tag.
|
||||
|
||||
# Client tag
|
||||
## Client tag
|
||||
When publishing events, clients MAY include a `client` tag in the same format as the recommendation event's `a` tags. This has privacy implications for users, so clients SHOULD allow users to opt-out of using this tag.
|
||||
|
||||
```json
|
||||
|
@ -87,43 +87,45 @@ When publishing events, clients MAY include a `client` tag in the same format as
|
|||
}
|
||||
```
|
||||
|
||||
# User flow
|
||||
## User flow
|
||||
A user A who uses a non-`kind:1`-centric nostr app could choose to announce/recommend a certain kind-handler application.
|
||||
|
||||
When user B sees an unknown event kind, e.g. in a social-media centric nostr client, the client would allow user B to interact with the unknown-kind event (e.g. tapping on it).
|
||||
|
||||
The client MIGHT query for the user's and the user's follows handler.
|
||||
|
||||
# Example
|
||||
## Example
|
||||
|
||||
## User A recommends a `kind:31337`-handler
|
||||
### User A recommends a `kind:31337`-handler
|
||||
User A might be a user of Zapstr, a `kind:31337`-centric client (tracks). Using Zapstr, user A publishes an event recommending Zapstr as a `kind:31337`-handler.
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 31989,
|
||||
"tags": [
|
||||
[ "d", "31337" ],
|
||||
[ "a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web" ]
|
||||
]
|
||||
"kind": 31989,
|
||||
"tags": [
|
||||
["d", "31337"],
|
||||
["a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web"]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## User B interacts with a `kind:31337`-handler
|
||||
User B might see in their timeline an event referring to a `kind:31337` event
|
||||
(e.g. a `kind:1` tagging a `kind:31337`).
|
||||
### User B interacts with a `kind:31337`-handler
|
||||
User B might see in their timeline an event referring to a `kind:31337` event (e.g. a `kind:1` tagging a `kind:31337`).
|
||||
|
||||
User B's client, not knowing how to handle a `kind:31337` might display the event
|
||||
using its `alt` tag (as described in NIP-31). When the user clicks on the event,
|
||||
the application queries for a handler for this `kind`:
|
||||
User B's client, not knowing how to handle a `kind:31337` might display the event using its `alt` tag (as described in NIP-31). When the user clicks on the event, the application queries for a handler for this `kind`:
|
||||
|
||||
`["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']`
|
||||
```json
|
||||
["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']
|
||||
```
|
||||
|
||||
User B, who follows User A, sees that `kind:31989` event and fetches the `a`-tagged event for the app and handler information.
|
||||
|
||||
User B's client sees the application's `kind:31990` which includes the information to redirect the user to the relevant URL with the desired entity replaced in the URL.
|
||||
|
||||
## Alternative query bypassing `kind:31989`
|
||||
Alternatively, users might choose to query directly for `kind:31990` for an event kind. Clients SHOULD be careful doing this and use spam-prevention mechanisms to avoid directing users to malicious handlers.
|
||||
### Alternative query bypassing `kind:31989`
|
||||
Alternatively, users might choose to query directly for `kind:31990` for an event kind. Clients SHOULD be careful doing this and use spam-prevention mechanisms or querying high-quality restricted relays to avoid directing users to malicious handlers.
|
||||
|
||||
`["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']`
|
||||
```json
|
||||
["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']
|
||||
```
|
||||
|
|
147
90.md
147
90.md
|
@ -13,11 +13,11 @@ Money in, data out.
|
|||
## Kinds
|
||||
This NIP reserves the range `5000-7000` for data vending machine use.
|
||||
|
||||
| Kind | Description |
|
||||
| ---- | ----------- |
|
||||
| Kind | Description |
|
||||
| ---- | ----------- |
|
||||
| 5000-5999 | Job request kinds |
|
||||
| 6000-6999 | Job result |
|
||||
| 7000 | Job feedback |
|
||||
| 6000-6999 | Job result |
|
||||
| 7000 | Job feedback |
|
||||
|
||||
Job results always use a kind number that is `1000` higher than the job request kind. (e.g. request: `kind:5001` gets a result: `kind:6001`).
|
||||
|
||||
|
@ -67,34 +67,34 @@ 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
|
||||
## 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. 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
|
||||
[
|
||||
[ "i", "what is the capital of France? ", "text" ],
|
||||
[ "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" ]
|
||||
|
||||
["i", "what is the capital of France? ", "text"],
|
||||
["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"]
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
This param data will be encrypted and added to the `content` field and `p` tag should be present
|
||||
|
||||
```
|
||||
"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...",
|
||||
"tags": [
|
||||
["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"],
|
||||
["encrypted"]
|
||||
]
|
||||
|
||||
This param data will be encrypted and added to the `content` field and `p` tag should be present
|
||||
|
||||
```json
|
||||
{
|
||||
"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...",
|
||||
"tags": [
|
||||
["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"],
|
||||
["encrypted"]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
@ -104,16 +104,17 @@ Service providers publish job results, providing the output of the job result. T
|
|||
|
||||
```json
|
||||
{
|
||||
"pubkey": "<service-provider pubkey>",
|
||||
"content": "<payload>",
|
||||
"kind": 6xxx,
|
||||
"tags": [
|
||||
[ "request", "<job-request>" ],
|
||||
[ "e", "<job-request-id>", "<relay-hint>" ],
|
||||
[ "i", "<input-data>" ],
|
||||
[ "p", "<customer's-pubkey>" ],
|
||||
[ "amount", "requested-payment-amount", "<optional-bolt11>" ]
|
||||
]
|
||||
"pubkey": "<service-provider pubkey>",
|
||||
"content": "<payload>",
|
||||
"kind": 6xxx,
|
||||
"tags": [
|
||||
["request", "<job-request>"],
|
||||
["e", "<job-request-id>", "<relay-hint>"],
|
||||
["i", "<input-data>"],
|
||||
["p", "<customer's-pubkey>"],
|
||||
["amount", "requested-payment-amount", "<optional-bolt11>"]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -123,38 +124,40 @@ 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. 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
|
||||
{
|
||||
"pubkey": "<service-provider pubkey>",
|
||||
"content": "<encrypted payload>",
|
||||
"kind": 6xxx,
|
||||
"tags": [
|
||||
[ "request", "<job-request>" ],
|
||||
[ "e", "<job-request-id>", "<relay-hint>" ],
|
||||
[ "p", "<customer's-pubkey>" ],
|
||||
[ "amount", "requested-payment-amount", "<optional-bolt11>" ],
|
||||
["encrypted"]
|
||||
|
||||
]
|
||||
"pubkey": "<service-provider pubkey>",
|
||||
"content": "<encrypted payload>",
|
||||
"kind": 6xxx,
|
||||
"tags": [
|
||||
["request", "<job-request>"],
|
||||
["e", "<job-request-id>", "<relay-hint>"],
|
||||
["p", "<customer's-pubkey>"],
|
||||
["amount", "requested-payment-amount", "<optional-bolt11>"],
|
||||
["encrypted"]
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Job feedback
|
||||
|
||||
Service providers can give feedback about a job back to the customer.
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 7000,
|
||||
"content": "<empty-or-payload>",
|
||||
"tags": [
|
||||
[ "status", "<status>", "<extra-info>" ],
|
||||
[ "amount", "requested-payment-amount", "<bolt11>" ],
|
||||
[ "e", "<job-request-id>", "<relay-hint>" ],
|
||||
[ "p", "<customer's-pubkey>" ],
|
||||
]
|
||||
"kind": 7000,
|
||||
"content": "<empty-or-payload>",
|
||||
"tags": [
|
||||
["status", "<status>", "<extra-info>"],
|
||||
["amount", "requested-payment-amount", "<bolt11>"],
|
||||
["e", "<job-request-id>", "<relay-hint>"],
|
||||
["p", "<customer's-pubkey>"],
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -166,18 +169,19 @@ Service providers can give feedback about a job back to the customer.
|
|||
|
||||
### Job feedback status
|
||||
|
||||
| status | description |
|
||||
|--------|-------------|
|
||||
| `payment-required` | Service Provider requires payment before continuing. |
|
||||
| `processing` | Service Provider is processing the job. |
|
||||
| `error` | Service Provider was unable to process the job. |
|
||||
| `success` | Service Provider successfully processed the job. |
|
||||
| `partial` | Service Provider partially processed the job. The `.content` might include a sample of the partial results. |
|
||||
| status | description |
|
||||
| -------- | ------------- |
|
||||
| `payment-required` | Service Provider requires payment before continuing. |
|
||||
| `processing` | Service Provider is processing the job. |
|
||||
| `error` | Service Provider was unable to process the job. |
|
||||
| `success` | Service Provider successfully processed the job. |
|
||||
| `partial` | Service Provider partially processed the job. The `.content` might include a sample of the partial results. |
|
||||
|
||||
Any job feedback event MIGHT include results in the `.content` field, as described in the [Job Result](#job-result) section. This is useful for service providers to provide a sample of the results that have been processed so far.
|
||||
|
||||
|
||||
# Protocol Flow
|
||||
|
||||
* Customer publishes a job request (e.g. `kind:5000` speech-to-text).
|
||||
* Service Providers MAY submit `kind:7000` job-feedback events (e.g. `payment-required`, `processing`, `error`, etc.).
|
||||
* Upon completion, the service provider publishes the result of the job with a `kind:6000` job-result event.
|
||||
|
@ -207,18 +211,19 @@ This gives a higher level of flexibility to service providers (which sophisticat
|
|||
# Appendix 2: Service provider discoverability
|
||||
Service Providers MAY use NIP-89 announcements to advertise their support for job kinds:
|
||||
|
||||
```json
|
||||
```js
|
||||
{
|
||||
"kind": 31990,
|
||||
"pubkey": "<pubkey>",
|
||||
"content": "{
|
||||
\"name\": \"Translating DVM\",
|
||||
\"about\": \"I'm a DVM specialized in translating Bitcoin content.\"
|
||||
}",
|
||||
"tags": [
|
||||
[ "k", "5005" ], // e.g. translation
|
||||
[ "t", "bitcoin" ] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains"
|
||||
]
|
||||
"kind": 31990,
|
||||
"pubkey": "<pubkey>",
|
||||
"content": "{
|
||||
\"name\": \"Translating DVM\",
|
||||
\"about\": \"I'm a DVM specialized in translating Bitcoin content.\"
|
||||
}",
|
||||
"tags": [
|
||||
["k", "5005"], // e.g. translation
|
||||
["t", "bitcoin"] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains"
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
|
7
94.md
7
94.md
|
@ -28,9 +28,6 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
|
|||
|
||||
```json
|
||||
{
|
||||
"id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>,
|
||||
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
|
||||
"created_at": <unix timestamp in seconds>,
|
||||
"kind": 1063,
|
||||
"tags": [
|
||||
["url",<string with URI of file>],
|
||||
|
@ -47,8 +44,8 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
|
|||
["summary", <excerpt>],
|
||||
["alt", <description>]
|
||||
],
|
||||
"content": <caption>,
|
||||
"sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field>
|
||||
"content": "<caption>",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
|
28
98.md
28
98.md
|
@ -2,7 +2,7 @@ NIP-98
|
|||
======
|
||||
|
||||
HTTP Auth
|
||||
-------------------------
|
||||
---------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
@ -24,22 +24,16 @@ The following tags MUST be included.
|
|||
Example event:
|
||||
```json
|
||||
{
|
||||
"id": "fe964e758903360f28d8424d092da8494ed207cba823110be3a57dfe4b578734",
|
||||
"pubkey": "63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed",
|
||||
"content": "",
|
||||
"kind": 27235,
|
||||
"created_at": 1682327852,
|
||||
"tags": [
|
||||
[
|
||||
"u",
|
||||
"https://api.snort.social/api/v1/n5sp/list"
|
||||
],
|
||||
[
|
||||
"method",
|
||||
"GET"
|
||||
]
|
||||
],
|
||||
"sig": "5ed9d8ec958bc854f997bdc24ac337d005af372324747efe4a00e24f4c30437ff4dd8308684bed467d9d6be3e5a517bb43b1732cc7d33949a3aaf86705c22184"
|
||||
"id": "fe964e758903360f28d8424d092da8494ed207cba823110be3a57dfe4b578734",
|
||||
"pubkey": "63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed",
|
||||
"content": "",
|
||||
"kind": 27235,
|
||||
"created_at": 1682327852,
|
||||
"tags": [
|
||||
["u", "https://api.snort.social/api/v1/n5sp/list"],
|
||||
["method", "GET"]
|
||||
],
|
||||
"sig": "5ed9d8ec958bc854f997bdc24ac337d005af372324747efe4a00e24f4c30437ff4dd8308684bed467d9d6be3e5a517bb43b1732cc7d33949a3aaf86705c22184"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user