Compare commits
10 Commits
8d22b49ee3
...
8e957d4679
Author | SHA1 | Date |
---|---|---|
|
8e957d4679 | |
|
7dec812f99 | |
|
739f3c5263 | |
|
8830525250 | |
|
ca3863a539 | |
|
9e4399cb2f | |
|
bdfce66e3d | |
|
f1fd0236a3 | |
|
5adcdda2e6 | |
|
40ec29f826 |
2
21.md
2
21.md
|
@ -21,7 +21,7 @@ The identifiers that come after are expected to be the same as those defined in
|
|||
|
||||
### Linking HTML pages to Nostr entities
|
||||
|
||||
`<link>` tags with `rel="alternate"` can be used to associate webpages to Nostr events, in cases where the same content is served via the two mediums (for example, a web server that exposes Markdown articles both as HTML pages and as `kind:30023' events served under itself as a relay or through some other relay). For example:
|
||||
`<link>` tags with `rel="alternate"` can be used to associate webpages to Nostr events, in cases where the same content is served via the two mediums (for example, a web server that exposes Markdown articles both as HTML pages and as `kind:30023` events served under itself as a relay or through some other relay). For example:
|
||||
|
||||
```
|
||||
<head>
|
||||
|
|
8
22.md
8
22.md
|
@ -143,13 +143,13 @@ A comment on a website's url looks like this:
|
|||
"tags": [
|
||||
// referencing the root url
|
||||
["I", "https://abc.com/articles/1"],
|
||||
// the root "kind": for an url, the kind is its domain
|
||||
["K", "https://abc.com"],
|
||||
// the root "kind": for an url
|
||||
["K", "web"],
|
||||
|
||||
// the parent reference (same as root for top-level comments)
|
||||
["i", "https://abc.com/articles/1"],
|
||||
// the parent "kind": for an url, the kind is its domain
|
||||
["k", "https://abc.com"]
|
||||
// the parent "kind": for an url
|
||||
["k", "web"]
|
||||
]
|
||||
// other fields
|
||||
}
|
||||
|
|
13
24.md
13
24.md
|
@ -8,8 +8,7 @@ Extra metadata fields and tags
|
|||
|
||||
This NIP keeps track of extra optional fields that can added to events which are not defined anywhere else but have become _de facto_ standards and other minor implementation possibilities that do not deserve their own NIP and do not have a place in other NIPs.
|
||||
|
||||
kind 0
|
||||
======
|
||||
### kind 0
|
||||
|
||||
These are extra fields not specified in NIP-01 that may be present in the stringified JSON of metadata events:
|
||||
|
||||
|
@ -19,24 +18,22 @@ These are extra fields not specified in NIP-01 that may be present in the string
|
|||
- `bot`: a boolean to clarify that the content is entirely or partially the result of automation, such as with chatbots or newsfeeds.
|
||||
- `birthday`: an object representing the author's birth date. The format is { "year": number, "month": number, "day": number }. Each field MAY be omitted.
|
||||
|
||||
### Deprecated fields
|
||||
#### Deprecated fields
|
||||
|
||||
These are fields that should be ignored or removed when found in the wild:
|
||||
|
||||
- `displayName`: use `display_name` instead.
|
||||
- `username`: use `name` instead.
|
||||
|
||||
kind 3
|
||||
======
|
||||
### kind 3
|
||||
|
||||
These are extra fields not specified in NIP-02 that may be present in the stringified JSON of follow events:
|
||||
|
||||
### Deprecated fields
|
||||
#### Deprecated fields
|
||||
|
||||
- `{<relay-url>: {"read": <true|false>, "write": <true|false>}, ...}`: an object of relays used by a user to read/write. [NIP-65](65.md) should be used instead.
|
||||
|
||||
tags
|
||||
====
|
||||
### tags
|
||||
|
||||
These tags may be present in multiple event kinds. Whenever a different meaning is not specified by some more specific NIP, they have the following meanings:
|
||||
|
||||
|
|
69
C0.md
69
C0.md
|
@ -1,69 +0,0 @@
|
|||
NIP-C0
|
||||
======
|
||||
|
||||
Code Snippets
|
||||
-------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
## Abstract
|
||||
|
||||
This NIP defines a new event kind for sharing and storing code snippets. Unlike regular text notes (`kind:1`), code snippets have specialized metadata like language, extension, and other code-specific attributes that enhance discoverability, syntax highlighting, and improved user experience.
|
||||
|
||||
## Event Kind
|
||||
|
||||
This NIP defines `kind:1337` as a code snippet event.
|
||||
|
||||
The `.content` field contains the actual code snippet text.
|
||||
|
||||
## Optional Tags
|
||||
|
||||
- `l` - Programming language name (lowercase). Examples: "javascript", "python", "rust"
|
||||
- `name` - Name of the code snippet, commonly a filename. Examples: "hello-world.js", "quick-sort.py"
|
||||
- `extension` - File extension (without the dot). Examples: "js", "py", "rs"
|
||||
- `description` - Brief description of what the code does
|
||||
- `runtime` - Runtime or environment specification (e.g., "node v18.15.0", "python 3.11")
|
||||
- `license` - License under which the code is shared (e.g., "MIT", "GPL-3.0", "Apache-2.0")
|
||||
- `dep` - Dependency required for the code to run (can be repeated)
|
||||
- `repo` - Reference to a repository where this code originates
|
||||
|
||||
## Format
|
||||
|
||||
```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": 1337,
|
||||
"content": "function helloWorld() {\n console.log('Hello, Nostr!');\n}\n\nhelloWorld();",
|
||||
"tags": [
|
||||
["l", "javascript"],
|
||||
["extension", "js"],
|
||||
["name", "hello-world.js"],
|
||||
["description", "A basic JavaScript function that prints 'Hello, Nostr!' to the console"],
|
||||
["runtime", "node v18.15.0"],
|
||||
["license", "MIT"],
|
||||
["repo", "https://github.com/nostr-protocol/nostr"]
|
||||
],
|
||||
"sig": "<64-bytes signature of the id>"
|
||||
}
|
||||
```
|
||||
|
||||
## Client Behavior
|
||||
|
||||
Clients that support this NIP SHOULD:
|
||||
|
||||
1. Display code snippets with proper syntax highlighting based on the language.
|
||||
2. Allow copying the full code snippet with a single action.
|
||||
3. Render the code with appropriate formatting, preserving whitespace and indentation.
|
||||
4. Display the language and extension prominently.
|
||||
5. Provide "run" functionality for supported languages when possible.
|
||||
6. Display the description (if available) as part of the snippet presentation.
|
||||
|
||||
Clients MAY provide additional functionality such as:
|
||||
|
||||
1. Code editing capabilities
|
||||
2. Forking/modifying snippets
|
||||
3. Creating executable environments based on the runtime/dependencies
|
||||
4. Downloading the snippet as a file using the provided extension
|
||||
5. Sharing the snippet with attribution
|
|
@ -0,0 +1,171 @@
|
|||
# NIP-CC: Communi-keys
|
||||
|
||||
This NIP defines a standard for creating, managing and publishing to communities by leveraging existing key pairs and relays.
|
||||
|
||||
This approach uniquely allows:
|
||||
|
||||
* any existing npub to become a community (identity + manager).
|
||||
* any existing publication to be targeted at any community.
|
||||
* communities to have their own selected content types.
|
||||
|
||||
## Motivation
|
||||
|
||||
Current community management solutions on Nostr often require complex relay-specific implementations, lack proper decentralization and don't allow publications to be targeted at more than one community.
|
||||
|
||||
This proposal aims to simplify community management by utilizing existing Nostr primitives (key pairs and relays) while adding minimal new event kinds.
|
||||
|
||||
## Specification
|
||||
|
||||
### Community Creation Event
|
||||
|
||||
A community is created when a key pair publishes a `kind:10222` event. The pubkey of this key pair becomes the unique identifier for that community. One key pair can only represent one community.
|
||||
|
||||
The community's name, picture, and description are derived from the pubkey's `kind:0` metadata event.
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 10222,
|
||||
// The name, picture and description of the community are derived from the pubkey's kind 0
|
||||
"pubkey": <community-pubkey>,
|
||||
"tags": [
|
||||
// at least one relay for the community
|
||||
["r", <relay-url>],
|
||||
|
||||
// one or more blossom servers
|
||||
["blossom", <blossom-url>],
|
||||
|
||||
// one or more ecash mints
|
||||
["mint", <mint-url>, "cashu"],
|
||||
|
||||
// one or more content sections: ["content", <name>]
|
||||
["content", "Chat"],
|
||||
["k", "9"],
|
||||
|
||||
["content", "Post"],
|
||||
["k", "1"],
|
||||
["k", "11"],
|
||||
["fee", "10", "sat"],
|
||||
["exclusive", "true"], // true if this event kind can ONLY be targeted to this community, not others
|
||||
|
||||
["content", "Article"],
|
||||
["k", "30023"],
|
||||
["k", "30040"],
|
||||
["role", "admin", "team"] // only admins and team can post Articles
|
||||
|
||||
// Optional terms of service, points to another event
|
||||
["tos", <event-id-or-address>, <relay-url>],
|
||||
|
||||
// Optional location
|
||||
["location", "<location>"],
|
||||
["g", "<geo-hash>"],
|
||||
|
||||
// Optional description
|
||||
["description", "A description text that overwrites the profile's description, if needed"],
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Tag definitions
|
||||
|
||||
| Tag | Description |
|
||||
|-----|-------------|
|
||||
| r | URLs of relays where community content should be published. First one is considered main relay. |
|
||||
| blossom | URLs of blossom servers for additional community features (optional). |
|
||||
| mint | URL of community mint for token/payment features (optional). |
|
||||
| content | Name of Content Type section that the Communikey works with |
|
||||
| k | Event kind, within a content type section. |
|
||||
| retention | Retention policy in format [kind, value, type] where type is either "time" (seconds) or "count" (number of events). |
|
||||
| fee | Admission fee in format [kind, amount, unit] where unit is typically "msats". |
|
||||
| exclusive | boolean that specifies if this content type can be targeted to other communities too. |
|
||||
| role | Publishing permission in format [kind, role1, role2, ...] where roles are plain text labels like "admin", "team", "CEO", etc. |
|
||||
| tos | URL to the community's posting policy. |
|
||||
| location | Location of the community. |
|
||||
| g | Geo hash of the community. |
|
||||
| description | Description of the community. |
|
||||
|
||||
The pubkey of the key pair that creates this event serves as the unique identifier for the community. This means:
|
||||
|
||||
1. Each key pair can only represent one community
|
||||
2. Communities can be easily discovered by querying for the most recent `kind:10222` event for a given pubkey
|
||||
3. Community managers can update their settings by publishing a new `kind:10222` event
|
||||
|
||||
### Community Identifier Format
|
||||
|
||||
Communities can be referenced using an "ncommunity" format:
|
||||
|
||||
```
|
||||
ncommunity://<pubkey>?relay=<url-encoded-relay-1>&relay=<url-encoded-relay-2>
|
||||
```
|
||||
|
||||
This format follows the same principles as nprofile, but specifically for community identification. While the ncommunity format is recommended for complete relay information, the standard pubkey format can also be used when relay discovery is not needed.
|
||||
|
||||
### Targeted Publication Event
|
||||
|
||||
To target an existing publication at specific communities, users create a `kind:30222` event:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 30222,
|
||||
"content": "",
|
||||
"tags": [
|
||||
["d", "<random-id>"], // or maybe equate to "e" tag, but then we run into trouble for the "a" tags
|
||||
["e" , "<event-id-of-original-publication>"], // Or ["a" , "<event-id-of-original-publication>"]
|
||||
["k", "<kind-of-original-publication>"],
|
||||
["p", "<community-pubkey>"],
|
||||
["r", "<main-relay-url>"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The targeted publication event can reference the original publication in two ways:
|
||||
1. Using an `e` tag with the event ID, relay hint, and pubkey hint
|
||||
2. Using an `a` tag with the event address and relay hint
|
||||
|
||||
The `k` tag specifies the kind of the original publication, and the `p` tags list the communities that this publication is targeting.
|
||||
|
||||
**IMPORTANT**: For publishing new events clients SHOULD create a targeted Publication event first (that only has an id) and reference it with an h-tag in the main event.
|
||||
|
||||
### Community-Exclusive Publications
|
||||
|
||||
Some content types should be exclusive by default: Chat, Labels, Forum, ...
|
||||
|
||||
For these we don't need a Targeted Publication event and can just use an h-tag instead.
|
||||
|
||||
For chat messages within a community, users should use `kind:9` events with a community tag:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 9,
|
||||
"content": "<message>",
|
||||
"tags": [
|
||||
["h", "<community-pubkey>"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The same pattern applies to Labels, Forum posts, ...
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
1. Clients SHOULD verify that targeted publications (`kind:32222`) are present on the community's main relays. The main relay specified in the community creation event SHOULD be considered authoritative for community-related events. Clients MAY, however, fall back on a backup relay (as the authority) when the main relay is offline.
|
||||
2. Clients MAY cache community metadata events to reduce relay queries.
|
||||
3. Relay operators MAY implement/automate additional filtering or moderation based on community specifications.
|
||||
|
||||
## Benefits
|
||||
|
||||
1. Any existing npub can become a community
|
||||
2. Communities are not permanently tied to specific relays
|
||||
3. Simplified relay operator implementation compared to other community proposals
|
||||
4. Supports relay-per-community model while remaining flexible
|
||||
5. Enables cross-community interaction through targeted publications
|
||||
6. The ability to target publications to more than one community and the access to any desired content type eliminates the need for #channels or rooms
|
||||
7. Flexible referencing allows for both simple and complete community identification
|
||||
|
||||
## Security Considerations
|
||||
|
||||
1. Clients MUST verify event signatures from community managers
|
||||
2. Relays SHOULD implement rate limiting for community-related events
|
||||
3. Clients SHOULD respect the relay hierarchy specified in community creation events
|
||||
4. When using simple pubkey references, clients should be aware of potential relay discovery challenges
|
||||
|
||||
|
Loading…
Reference in New Issue