Skip to content

Commit

Permalink
Sync with upstream including CONFLICT
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 27, 2024
2 parents 7abafa1 + ee21566 commit b165d86
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 35 deletions.
2 changes: 1 addition & 1 deletion 17.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ When sending a message to anyone, clients must then connect to the relays in the

This example sends the message `Hola, que tal?` from `nsec1w8udu59ydjvedgs3yv5qccshcj8k05fh3l60k9x57asjrqdpa00qkmr89m` to `nsec12ywtkplvyq5t6twdqwwygavp5lm4fhuang89c943nf2z92eez43szvn4dt`.

The two final GiftWraps, one to the receiver and the other to the sender, are:
The two final GiftWraps, one to the receiver and the other to the sender, respectively, are:

```json
{
Expand Down
6 changes: 3 additions & 3 deletions 29.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ When encountering just the `<host>` without the `'<group-id>`, clients MAY infer

Events sent by users to groups (chat messages, text notes, moderation events etc) MUST have an `h` tag with the value set to the group _id_.

`h` tags MAY include the group's name as the second argument. This allows `unmanaged` groups to be assigned human-readable names without relay support.

## Timeline references

In order to not be used out of context, events sent to these groups may contain references to previous events seen from the same relay in the `previous` tag. The choice of which previous events to pick belongs to the clients. The references are to be made using the first 8 characters (4 bytes) of any event in the last 50 events seen by the user in the relay, excluding events by themselves. There can be any number of references (including zero), but it's recommended that clients include at least 3 and that relays enforce this.
Expand Down Expand Up @@ -72,7 +70,7 @@ These are events that can be sent by users to manage their situation in a group,

- *join request* (`kind:9021`)

Any user can send one of these events to the relay in order to be automatically or manually added to the group. If the group is `open` the relay will automatically issue a `kind:9000` in response adding this user. Otherwise group admins may choose to query for these requests and act upon them.
Any user can send a kind `9021` event to the relay in order to request admission to the group. Relays MUST reject the request if the user has not been added to the group. The accompanying error message SHOULD explain whether the rejection is final, if the request is pending review, or if some other special handling is relevant (e.g. if payment is required). If a user is already a member, the event MUST be rejected with `duplicate: ` as the error message prefix.

```json
{
Expand Down Expand Up @@ -242,3 +240,5 @@ A definition for `kind:10009` was included in [NIP-51](51.md) that allows client
### Using `unmanaged` relays

To prevent event leakage, when using `unmanaged` relays, clients should include the [NIP-70](70.md) `-` tag, as just the `previous` tag won't be checked by other `unmanaged` relays.

Groups MAY be named without relay support by adding a `name` to the corresponding tag in a user's `kind 10009` group list.
4 changes: 2 additions & 2 deletions 32.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ considered open for public use, and not proprietary. In other words, if there is
namespace that fits your use case, use it even if it points to someone else's domain name.

Vocabularies MAY choose to fully qualify all labels within a namespace (for example,
`["l", "com.example.vocabulary:my-label"]`. This may be preferred when defining more
`["l", "com.example.vocabulary:my-label"]`). This may be preferred when defining more
formal vocabularies that should not be confused with another namespace when querying
without an `L` tag. For these vocabularies, all labels SHOULD include the namespace
(rather than mixing qualified and unqualified labels).
Expand All @@ -173,4 +173,4 @@ Appendix: Known Ontologies

Below is a non-exhaustive list of ontologies currently in widespread use.

- [social.ontolo.categories](https://ontolo.social/)
- [social ontology categories](https://github.com/CLARIAH/awesome-humanities-ontologies)
50 changes: 50 additions & 0 deletions 37.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
NIP-37
======

Draft Events
------------

`draft` `optional`

This NIP defines kind `31234` as a private wrap for drafts of any other event kind.

The draft event is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content` of the event.

An additional `k` tag identifies the kind of the draft event.

```js
{
"kind": 31234,
"tags": [
["d", "<identifier>"],
["k", "<kind of the draft event>"],
["e", "<anchor event event id>", "<relay-url>"],
["a", "<anchor event address>", "<relay-url>"],
],
"content": nip44Encrypt(JSON.stringify(draft_event)),
// other fields
}
```

A blanked `.content` means this draft has been deleted by a client but relays still have the event.

Tags `e` and `a` identify one or more anchor events, such as parent events on replies.

## Relay List for Private Content

Kind `10013` indicates the user's preferred relays to store private events like Drafts. The event MUST include a list of `relay` URLs in private tags. Private tags are JSON Stringified, NIP-44-encrypted to the signer's keys and placed inside the .content of the event.

```js
{
"kind": 10013,
"tags": [],
"content": nip44Encrypt(JSON.stringify([
["relay", "wss://myrelay.mydomain.com"]
]))
//...other fields
}
```

Relays listed in this event SHOULD be authed and only allow downloads to events signed by the authed user.

Clients SHOULD publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.
14 changes: 7 additions & 7 deletions 44.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Encrypted Payloads (Versioned)

The NIP introduces a new data format for keypair-based encryption. This NIP is versioned
to allow multiple algorithm choices to exist simultaneously. This format may be used for
many things, but MUST be used in the context of a signed event as described in NIP 01.
many things, but MUST be used in the context of a signed event as described in NIP-01.

*Note*: this format DOES NOT define any `kind`s related to a new direct messaging standard,
only the encryption required to define one. It SHOULD NOT be used as a drop-in replacement
for NIP 04 payloads.
for NIP-04 payloads.

## Versions

Expand Down Expand Up @@ -41,7 +41,7 @@ On its own, messages sent using this scheme have a number of important shortcomi
- No post-compromise security: when a key is compromised, it is possible to decrypt all future conversations
- No post-quantum security: a powerful quantum computer would be able to decrypt the messages
- IP address leak: user IP may be seen by relays and all intermediaries between user and relay
- Date leak: `created_at` is public, since it is a part of NIP 01 event
- Date leak: `created_at` is public, since it is a part of NIP-01 event
- Limited message size leak: padding only partially obscures true message length
- No attachments: they are not supported

Expand All @@ -63,7 +63,7 @@ NIP-44 version 2 has the following design characteristics:
- SHA256 is used instead of SHA3 or BLAKE because it is already used in nostr. Also BLAKE's speed advantage
is smaller in non-parallel environments.
- A custom padding scheme is used instead of padmé because it provides better leakage reduction for small messages.
- Base64 encoding is used instead of another compression algorithm because it is widely available, and is already used in nostr.
- Base64 encoding is used instead of another encoding algorithm because it is widely available, and is already used in nostr.

### Encryption

Expand All @@ -86,7 +86,7 @@ NIP-44 version 2 has the following design characteristics:
- Content must be encoded from UTF-8 into byte array
- Validate plaintext length. Minimum is 1 byte, maximum is 65535 bytes
- Padding format is: `[plaintext_length: u16][plaintext][zero_bytes]`
- Padding algorithm is related to powers-of-two, with min padded msg size of 32
- Padding algorithm is related to powers-of-two, with min padded msg size of 32 bytes
- Plaintext length is encoded in big-endian as first 2 bytes of the padded blob
5. Encrypt padded content
- Use ChaCha20, with key and nonce from step 3
Expand Down Expand Up @@ -148,8 +148,8 @@ validation rules, refer to BIP-340.
- `x[i:j]`, where `x` is a byte array and `i, j <= 0` returns a `(j - i)`-byte array with a copy of the
`i`-th byte (inclusive) to the `j`-th byte (exclusive) of `x`.
- Constants `c`:
- `min_plaintext_size` is 1. 1b msg is padded to 32b.
- `max_plaintext_size` is 65535 (64kb - 1). It is padded to 65536.
- `min_plaintext_size` is 1. 1 byte msg is padded to 32 bytes.
- `max_plaintext_size` is 65535 (64kB - 1). It is padded to 65536 bytes.
- Functions
- `base64_encode(string)` and `base64_decode(bytes)` are Base64 ([RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), with padding)
- `concat` refers to byte array concatenation
Expand Down
18 changes: 9 additions & 9 deletions 46.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ nostrconnect://83f3b2ae6aa368e8275397b9c26cf550101d63ebaab900d19dd4a4429f5ad8f5?
{
"kind": 24133,
"pubkey": <local_keypair_pubkey>,
"content": <nip04(<request>)>,
"content": <nip44(<request>)>,
"tags": [["p", <remote-signer-pubkey>]],
}
```

The `content` field is a JSON-RPC-like message that is [NIP-04](04.md) encrypted and has the following structure:
The `content` field is a JSON-RPC-like message that is [NIP-44](44.md) encrypted and has the following structure:

```jsonc
{
Expand Down Expand Up @@ -109,7 +109,7 @@ Each of the following are methods that the _client_ sends to the _remote-signer_

### Requested permissions

The `connect` method may be provided with `optional_requested_permissions` for user convenience. The permissions are a comma-separated list of `method[:params]`, i.e. `nip04_encrypt,sign_event:4` meaning permissions to call `nip04_encrypt` and to call `sign_event` with `kind:4`. Optional parameter for `sign_event` is the kind number, parameters for other methods are to be defined later. Same permission format may be used for `perms` field of `metadata` in `nostrconnect://` string.
The `connect` method may be provided with `optional_requested_permissions` for user convenience. The permissions are a comma-separated list of `method[:params]`, i.e. `nip44_encrypt,sign_event:4` meaning permissions to call `nip44_encrypt` and to call `sign_event` with `kind:4`. Optional parameter for `sign_event` is the kind number, parameters for other methods are to be defined later. Same permission format may be used for `perms` field of `metadata` in `nostrconnect://` string.

## Response Events `kind:24133`

Expand All @@ -118,13 +118,13 @@ The `connect` method may be provided with `optional_requested_permissions` for u
"id": <id>,
"kind": 24133,
"pubkey": <remote-signer-pubkey>,
"content": <nip04(<response>)>,
"content": <nip44(<response>)>,
"tags": [["p", <client-pubkey>]],
"created_at": <unix timestamp in seconds>
}
```

The `content` field is a JSON-RPC-like message that is [NIP-04](04.md) encrypted and has the following structure:
The `content` field is a JSON-RPC-like message that is [NIP-44](44.md) encrypted and has the following structure:

```json
{
Expand All @@ -150,7 +150,7 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](04.md) encrypted
{
"kind": 24133,
"pubkey": "eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86",
"content": nip04({
"content": nip44({
"id": <random_string>,
"method": "sign_event",
"params": [json_stringified(<{
Expand All @@ -170,7 +170,7 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](04.md) encrypted
{
"kind": 24133,
"pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
"content": nip04({
"content": nip44({
"id": <random_string>,
"result": json_stringified(<signed-event>)
}),
Expand Down Expand Up @@ -213,7 +213,7 @@ _remote-signer_ MAY publish it's metadata by using [NIP-05](05.md) and [NIP-89](
},
"nip46": {
"relays": ["wss://relay1","wss://relay2"...],
"nostrconnect_url": "https://remote-signer-domain.com/<nostrconnect>"
"nostrconnect_url": "https://remote-signer-domain.example/<nostrconnect>"
}
}
```
Expand All @@ -224,4 +224,4 @@ The `<remote-signer-app-pubkey>` MAY be used to verify the domain from _remote-s

_remote-signer_ MAY publish a NIP-89 `kind: 31990` event with `k` tag of `24133`, which MAY also include one or more `relay` tags and MAY include `nostrconnect_url` tag. The semantics of `relay` and `nostrconnect_url` tags are the same as in the section above.

_client_ MAY improve UX by discovering _remote-signers_ using their `kind: 31990` events. _client_ MAY then pre-generate `nostrconnect://` strings for the _remote-signers_, and SHOULD in that case verify that `kind: 31990` event's author is mentioned in signer's `nostr.json?name=_` file as `<remote-signer-app-pubkey>`.
_client_ MAY improve UX by discovering _remote-signers_ using their `kind: 31990` events. _client_ MAY then pre-generate `nostrconnect://` strings for the _remote-signers_, and SHOULD in that case verify that `kind: 31990` event's author is mentioned in signer's `nostr.json?name=_` file as `<remote-signer-app-pubkey>`.
8 changes: 4 additions & 4 deletions 51.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ When new items are added to an existing list, clients SHOULD append them to the

## Types of lists

## Standard lists
### Standard lists

Standard lists use normal replaceable events, meaning users may only have a single list of each kind. They have special meaning and clients may rely on them to augment a user's profile or browsing experience.

Expand All @@ -29,14 +29,14 @@ For example, _mute list_ can contain the public keys of spammers and bad actors
| Public chats | 10005 | [NIP-28](28.md) chat channels the user is in | `"e"` (kind:40 channel definitions) |
| Blocked relays | 10006 | relays clients should never connect to | `"relay"` (relay URLs) |
| Search relays | 10007 | relays clients should use when performing search queries | `"relay"` (relay URLs) |
| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group id + relay URL), `"r"` for each relay in use |
| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group id + relay URL + optional group name), `"r"` for each relay in use |
| Interests | 10015 | topics a user may be interested in and pointers | `"t"` (hashtags) and `"a"` (kind:30015 interest set) |
| Emojis | 10030 | user preferred emojis and pointers to emoji sets | `"emoji"` (see [NIP-30](30.md)) and `"a"` (kind:30030 emoji set) |
| DM relays | 10050 | Where to receive [NIP-17](17.md) direct messages | `"relay"` (see [NIP-17](17.md)) |
| Good wiki authors | 10101 | [NIP-54](54.md) user recommended wiki authors | `"p"` (pubkeys) |
| Good wiki relays | 10102 | [NIP-54](54.md) relays deemed to only host useful articles | `"relay"` (relay URLs) |

## Sets
### Sets

Sets are lists with well-defined meaning that can enhance the functionality and the UI of clients that rely on them. Unlike standard lists, users are expected to have more than one set of each kind, therefore each of them must be assigned a different `"d"` identifier.

Expand All @@ -56,7 +56,7 @@ Aside from their main identifier, the `"d"` tag, sets can optionally have a `"ti
| Emoji sets | 30030 | categorized emoji groups | `"emoji"` (see [NIP-30](30.md)) |
| Release artifact sets | 30063 | groups of files of a software release | `"e"` (kind:1063 [file metadata](94.md) events), `"i"` (application identifier, typically reverse domain notation), `"version"` |

## Deprecated standard lists
### Deprecated standard lists

Some clients have used these lists in the past, but they should work on transitioning to the [standard formats](#standard-lists) above.

Expand Down
2 changes: 1 addition & 1 deletion 90.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Any job feedback event MIGHT include results in the `.content` field, as describ
* 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.
* At any point, if there is an `amount` pending to be paid as instructed by the service provider, the user can pay the included `bolt11` or zap the job result event the service provider has sent to the user
* At any point, if there is an `amount` pending to be paid as instructed by the service provider, the user can pay the included `bolt11` or zap the job result event the service provider has sent to the user.

Job feedback (`kind:7000`) and Job Results (`kind:6000-6999`) events MAY include an `amount` tag, this can be interpreted as a suggestion to pay. Service Providers MUST use the `payment-required` feedback event to signal that a payment is required and no further actions will be performed until the payment is sent.

Expand Down
2 changes: 1 addition & 1 deletion 94.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The purpose of this NIP is to allow an organization and classification of shared

## Event format

This NIP specifies the use of the `1063` event type, having in `content` a description of the file content, and a list of tags described below:
This NIP specifies the use of the `1063` event kind, having in `content` a description of the file content, and a list of tags described below:

* `url` the url to download the file
* `m` a string indicating the data type of the file. The [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) format must be used, and they should be lowercase.
Expand Down
Loading

0 comments on commit b165d86

Please sign in to comment.