mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-09 08:38:50 +00:00
Compare commits
37 Commits
cashu-wall
...
editable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b6956ddad | ||
|
|
8e2523e331 | ||
|
|
f1e8d2c4f7 | ||
|
|
3cebb2afe0 | ||
|
|
f21aa981d4 | ||
|
|
dde8c81a87 | ||
|
|
ba46b23d95 | ||
|
|
e3afd7ac5b | ||
|
|
bef7fc1cf4 | ||
|
|
d4d040ee71 | ||
|
|
e3cf02840d | ||
|
|
07de7ea7e5 | ||
|
|
743e925ca5 | ||
|
|
1cda2dcc59 | ||
|
|
1e2f19863c | ||
|
|
30f39d35d1 | ||
|
|
e381b577c9 | ||
|
|
79cc2ef215 | ||
|
|
22c11cb243 | ||
|
|
38af1efe77 | ||
|
|
23ef4aa05b | ||
|
|
10c112defe | ||
|
|
4769b1658a | ||
|
|
db13d12eb6 | ||
|
|
7bb8997be5 | ||
|
|
7df7deebf5 | ||
|
|
2053aee0c2 | ||
|
|
f5a6fb258f | ||
|
|
78b6615c21 | ||
|
|
02e934acb7 | ||
|
|
7f67ce53fb | ||
|
|
344b0b9a72 | ||
|
|
e830a73cbd | ||
|
|
ce2234e0ba | ||
|
|
765daceaa1 | ||
|
|
e61651ac06 | ||
|
|
53afaaece6 |
2
01.md
2
01.md
@@ -81,7 +81,7 @@ This NIP defines 3 standard tags that can be used across all event kinds with th
|
|||||||
- for an addressable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>, <recommended relay URL, optional>]`
|
- for an addressable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>, <recommended relay URL, optional>]`
|
||||||
- for a normal replaceable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:, <recommended relay URL, optional>]`
|
- for a normal replaceable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:, <recommended relay URL, optional>]`
|
||||||
|
|
||||||
As a convention, all single-letter (only english alphabet letters: a-z, A-Z) key tags are expected to be indexed by relays, such that it is possible, for example, to query or subscribe to events that reference the event `"5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"` by using the `{"#e": ["5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"]}` filter.
|
As a convention, all single-letter (only english alphabet letters: a-z, A-Z) key tags are expected to be indexed by relays, such that it is possible, for example, to query or subscribe to events that reference the event `"5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"` by using the `{"#e": ["5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"]}` filter. Only the first value in any given tag is indexed.
|
||||||
|
|
||||||
### Kinds
|
### Kinds
|
||||||
|
|
||||||
|
|||||||
8
18.md
8
18.md
@@ -25,6 +25,14 @@ quote reposted. The `q` tag ensures quote reposts are not pulled and included
|
|||||||
as replies in threads. It also allows you to easily pull and count all of the
|
as replies in threads. It also allows you to easily pull and count all of the
|
||||||
quotes for a post.
|
quotes for a post.
|
||||||
|
|
||||||
|
`q` tags should follow the same conventions as NIP 10 `e` tags, with the exception
|
||||||
|
of the `mark` argument.
|
||||||
|
|
||||||
|
`["q", <event-id>, <relay-url>, <pubkey>]`
|
||||||
|
|
||||||
|
Quote reposts MUST include the [NIP-21](21.md) `nevent`, `note`, or `naddr` of the
|
||||||
|
event in the content.
|
||||||
|
|
||||||
## Generic Reposts
|
## Generic Reposts
|
||||||
|
|
||||||
Since `kind 6` reposts are reserved for `kind 1` contents, we use `kind 16`
|
Since `kind 6` reposts are reserved for `kind 1` contents, we use `kind 16`
|
||||||
|
|||||||
2
23.md
2
23.md
@@ -20,7 +20,7 @@ The `.content` of these events should be a string text in Markdown syntax. To ma
|
|||||||
|
|
||||||
### Metadata
|
### Metadata
|
||||||
|
|
||||||
For the date of the last update the `.created_at` field should be used, for "tags"/"hashtags" (i.e. topics about which the event might be of relevance) the `t` tag should be used, as per NIP-12.
|
For the date of the last update the `.created_at` field should be used, for "tags"/"hashtags" (i.e. topics about which the event might be of relevance) the `t` tag should be used.
|
||||||
|
|
||||||
Other metadata fields can be added as tags to the event as necessary. Here we standardize 4 that may be useful, although they remain strictly optional:
|
Other metadata fields can be added as tags to the event as necessary. Here we standardize 4 that may be useful, although they remain strictly optional:
|
||||||
|
|
||||||
|
|||||||
148
29.md
148
29.md
@@ -22,6 +22,12 @@ Relays are supposed to generate the events that describe group metadata and grou
|
|||||||
|
|
||||||
A group may be identified by a string in the format `<host>'<group-id>`. For example, a group with _id_ `abcdef` hosted at the relay `wss://groups.nostr.com` would be identified by the string `groups.nostr.com'abcdef`.
|
A group may be identified by a string in the format `<host>'<group-id>`. For example, a group with _id_ `abcdef` hosted at the relay `wss://groups.nostr.com` would be identified by the string `groups.nostr.com'abcdef`.
|
||||||
|
|
||||||
|
Group identifiers must be strings restricted to the characters `a-z0-9-_`.
|
||||||
|
|
||||||
|
When encountering just the `<host>` without the `'<group-id>`, clients can choose to connect to the group with id `_`, which is a special top-level group dedicated to relay-local discussions.
|
||||||
|
|
||||||
|
Group identifiers in most cases should be random or pseudo-random, as that mitigates message replay confusiong and ensures they can be migrated or forked to other relays easily without risking conflicting with other groups using the same id in these new relays. This isn't a hard rule, as, for example, in `unmanaged` and/or ephemeral relays groups might not want to migrate ever, so they might not care about this. Notably, the `_` relay-local group isn't expected to be migrated ever.
|
||||||
|
|
||||||
## The `h` tag
|
## The `h` tag
|
||||||
|
|
||||||
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_.
|
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_.
|
||||||
@@ -36,8 +42,30 @@ This is a hack to prevent messages from being broadcasted to external relays tha
|
|||||||
|
|
||||||
Relays should prevent late publication (messages published now with a timestamp from days or even hours ago) unless they are open to receive a group forked or moved from another relay.
|
Relays should prevent late publication (messages published now with a timestamp from days or even hours ago) unless they are open to receive a group forked or moved from another relay.
|
||||||
|
|
||||||
|
## Group management
|
||||||
|
|
||||||
|
Groups can have any number of users with elevated access. These users are identified by role labels which are arbitrarily defined by the relays (see also the description of `kind:39003`). What each role is capable of not defined in this NIP either, it's a relay policy that can vary. Roles can be assigned by other users (as long as they have the capability to add roles) by publishing a `kind:9000` event with that user's pubkey in a `p` tag and the roles afterwards (even if the user is already a group member a `kind:9000` can be issued and the user roles must just be updated).
|
||||||
|
|
||||||
|
The roles supported by the group as to having some special privilege assigned to them should be accessible on the event `kind:39003`, but the relay may also accept other role names, arbitrarily defined by clients, and just not do anything with them.
|
||||||
|
|
||||||
|
Users with any roles that have any privilege can be considered _admins_ in a broad sense and be returned in the `kind:39001` event for a group.
|
||||||
|
|
||||||
|
## Unmanaged groups
|
||||||
|
|
||||||
|
Unmanaged groups are impromptu groups that can be used in any public relay unaware of NIP-29 specifics. They piggyback on relays' natural white/blacklists (or lack of) but aside from that are not actively managed and won't have any admins, group state or metadata events.
|
||||||
|
|
||||||
|
In `unmanaged` groups, everybody is considered to be a member.
|
||||||
|
|
||||||
|
Unmanaged groups can transition to managed groups, in that case the relay master key just has to publish moderation events setting the state of all groups and start enforcing the rules they choose to.
|
||||||
|
|
||||||
## Event definitions
|
## Event definitions
|
||||||
|
|
||||||
|
These are the events expected to be found in NIP-29 groups.
|
||||||
|
|
||||||
|
### Normal user-created events
|
||||||
|
|
||||||
|
These events generally can be sent by all members of a group and they require the `h` tag to be present so they're attached to a specific group.
|
||||||
|
|
||||||
- *text root note* (`kind:11`)
|
- *text root note* (`kind:11`)
|
||||||
|
|
||||||
This is the basic unit of a "microblog" root text note sent to a group.
|
This is the basic unit of a "microblog" root text note sent to a group.
|
||||||
@@ -79,6 +107,14 @@ Similar to `kind:12`, this is the basic unit of a chat message sent to a group.
|
|||||||
|
|
||||||
`kind:10` SHOULD use NIP-10 markers, just like `kind:12`.
|
`kind:10` SHOULD use NIP-10 markers, just like `kind:12`.
|
||||||
|
|
||||||
|
- other events:
|
||||||
|
|
||||||
|
Groups may also accept other events, like long-form articles, calendar, livestream, market announcements and so on. These should be as defined in their respective NIPs, with the addition of the `h` tag.
|
||||||
|
|
||||||
|
### User-related group management events
|
||||||
|
|
||||||
|
These are events that can be sent by users to manage their situation in a group, they also require the `h` tag.
|
||||||
|
|
||||||
- *join request* (`kind:9021`)
|
- *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 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.
|
||||||
@@ -88,11 +124,14 @@ Any user can send one of these events to the relay in order to be automatically
|
|||||||
"kind": 9021,
|
"kind": 9021,
|
||||||
"content": "optional reason",
|
"content": "optional reason",
|
||||||
"tags": [
|
"tags": [
|
||||||
["h", "<group-id>"]
|
["h", "<group-id>"],
|
||||||
|
["code", "<optional-invite-code>"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The optional `code` tag may be used by the relay to preauthorize acceptances in `closed` groups, together with the `kind:9009` `create-invite` moderation event.
|
||||||
|
|
||||||
- *leave request* (`kind:9022`)
|
- *leave request* (`kind:9022`)
|
||||||
|
|
||||||
Any user can send one of these events to the relay in order to be automatically removed from the group. The relay will automatically issue a `kind:9001` in response removing this user.
|
Any user can send one of these events to the relay in order to be automatically removed from the group. The relay will automatically issue a `kind:9001` in response removing this user.
|
||||||
@@ -107,9 +146,13 @@ Any user can send one of these events to the relay in order to be automatically
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Group state -- or moderation
|
||||||
|
|
||||||
|
These are events expected to be sent by the relay master key or by group admins -- and relays should reject them if they don't come from an authorized admin. They also require the `h` tag.
|
||||||
|
|
||||||
- *moderation events* (`kinds:9000-9020`) (optional)
|
- *moderation events* (`kinds:9000-9020`) (optional)
|
||||||
|
|
||||||
Clients can send these events to a relay in order to accomplish a moderation action. Relays must check if the pubkey sending the event is capable of performing the given action. The relay may discard the event after taking action or keep it as a moderation log.
|
Clients can send these events to a relay in order to accomplish a moderation action. Relays must check if the pubkey sending the event is capable of performing the given action based on its role and the relay's internal policy (see also the description of `kind:39003`).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -124,17 +167,20 @@ Clients can send these events to a relay in order to accomplish a moderation act
|
|||||||
|
|
||||||
Each moderation action uses a different kind and requires different arguments, which are given as tags. These are defined in the following table:
|
Each moderation action uses a different kind and requires different arguments, which are given as tags. These are defined in the following table:
|
||||||
|
|
||||||
| kind | name | tags |
|
| kind | name | tags |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| 9000 | `add-user` | `p` (pubkey hex) |
|
| 9000 | `add-user` | `p` with pubkey hex and optional roles |
|
||||||
| 9001 | `remove-user` | `p` (pubkey hex) |
|
| 9001 | `remove-user` | `p` with pubkey hex |
|
||||||
| 9002 | `edit-metadata` | `name`, `about`, `picture` (string) |
|
| 9002 | `edit-metadata` | fields from `kind:39000` to be modified |
|
||||||
| 9003 | `add-permission` | `p` (pubkey), `permission` (name) |
|
| 9005 | `delete-event` | |
|
||||||
| 9004 | `remove-permission` | `p` (pubkey), `permission` (name) |
|
| 9007 | `create-group` | |
|
||||||
| 9005 | `delete-event` | `e` (id hex) |
|
| 9008 | `delete-group` | |
|
||||||
| 9006 | `edit-group-status` | `public` or `private`, `open` or `closed` |
|
|
||||||
| 9007 | `create-group` | |
|
It's expected that the group state (of who is an allowed member or not, who is an admin and with which permission or not, what are the group name and picture etc) can be fully reconstructed from the canonical sequence of these events.
|
||||||
| 9008 | `delete-group` | |
|
|
||||||
|
### Group metadata events
|
||||||
|
|
||||||
|
These events contain the group id in a `d` tag instead of the `h` tag. They MUST be created by the relay master key only and a single instance of each (or none) should exist at all times for each group. They are merely informative but should reflect the latest group state (as it was changed by moderation events over time).
|
||||||
|
|
||||||
- *group metadata* (`kind:39000`) (optional)
|
- *group metadata* (`kind:39000`) (optional)
|
||||||
|
|
||||||
@@ -142,6 +188,8 @@ This event defines the metadata for the group -- basically how clients should di
|
|||||||
|
|
||||||
If the group is forked and hosted in multiple relays, there will be multiple versions of this event in each different relay and so on.
|
If the group is forked and hosted in multiple relays, there will be multiple versions of this event in each different relay and so on.
|
||||||
|
|
||||||
|
When this event is not found, clients may still connect to the group, but treat it as having a different status, `unmanaged`,
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
"kind": 39000,
|
"kind": 39000,
|
||||||
@@ -162,41 +210,29 @@ If the group is forked and hosted in multiple relays, there will be multiple ver
|
|||||||
|
|
||||||
- *group admins* (`kind:39001`) (optional)
|
- *group admins* (`kind:39001`) (optional)
|
||||||
|
|
||||||
Similar to the group metadata, this event is supposed to be generated by relays that host the group.
|
Each admin is listed along with one or more roles. These roles SHOULD have a correspondence with the roles supported by the relay, as advertised by the `kind:39003` event.
|
||||||
|
|
||||||
Each admin gets a label that is only used for display purposes, and a list of permissions it has are listed afterwards. These permissions can inform client building UI, but ultimately are evaluated by the relay in order to become effective.
|
```jsonc
|
||||||
|
|
||||||
The list of capabilities, as defined by this NIP, for now, is the following:
|
|
||||||
|
|
||||||
- `add-user`
|
|
||||||
- `edit-metadata`
|
|
||||||
- `delete-event`
|
|
||||||
- `remove-user`
|
|
||||||
- `add-permission`
|
|
||||||
- `remove-permission`
|
|
||||||
- `edit-group-status`
|
|
||||||
- `delete-group`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
{
|
||||||
"kind": 39001,
|
"kind": 39001,
|
||||||
"content": "list of admins for the pizza lovers group",
|
"content": "list of admins for the pizza lovers group",
|
||||||
"tags": [
|
"tags": [
|
||||||
["d", "<group-id>"],
|
["d", "<group-id>"],
|
||||||
["p", "<pubkey1-as-hex>", "ceo", "add-user", "edit-metadata", "delete-event", "remove-user"],
|
["p", "<pubkey1-as-hex>", "ceo"],
|
||||||
["p", "<pubkey2-as-hex>", "secretary", "add-user", "delete-event"]
|
["p", "<pubkey2-as-hex>", "secretary", "gardener"],
|
||||||
]
|
// other pubkeys...
|
||||||
|
],
|
||||||
// other fields...
|
// other fields...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- *group members* (`kind:39002`) (optional)
|
- *group members* (`kind:39002`) (optional)
|
||||||
|
|
||||||
Similar to *group admins*, this event is supposed to be generated by relays that host the group.
|
It's a list of pubkeys that are members of the group. Relays might choose to not to publish this information, to restrict what pubkeys can fetch it or to only display a subset of the members in it.
|
||||||
|
|
||||||
It's a NIP-51-like list of pubkeys that are members of the group. Relays might choose to not to publish this information or to restrict what pubkeys can fetch it.
|
Clients should not assume this will always be present or that it will contain a full list of members.
|
||||||
|
|
||||||
```json
|
```jsonc
|
||||||
{
|
{
|
||||||
"kind": 39002,
|
"kind": 39002,
|
||||||
"content": "list of members for the pizza lovers group",
|
"content": "list of members for the pizza lovers group",
|
||||||
@@ -205,10 +241,48 @@ It's a NIP-51-like list of pubkeys that are members of the group. Relays might c
|
|||||||
["p", "<admin1>"],
|
["p", "<admin1>"],
|
||||||
["p", "<member-pubkey1>"],
|
["p", "<member-pubkey1>"],
|
||||||
["p", "<member-pubkey2>"],
|
["p", "<member-pubkey2>"],
|
||||||
]
|
// other pubkeys...
|
||||||
|
],
|
||||||
|
// other fields...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Storing the list of groups a user belongs to
|
- *group roles* (`kind:39003`) (optional)
|
||||||
|
|
||||||
A definition for kind `10009` was included in [NIP-51](51.md) that allows clients to store the list of groups a user wants to remember being in.
|
This is an event that MAY be published by the relay informing users and clients about what are the roles supported by this relay according to its internal logic.
|
||||||
|
|
||||||
|
For example, a relay may choose to support the roles `"admin"` and `"moderator"`, in which the `"admin"` will be allowed to edit the group metadata, delete messages and remove users from the group, while the `"moderator"` can only delete messages (or the relay may choose to call these roles `"ceo"` and `"secretary"` instead, the exact role name is not relevant).
|
||||||
|
|
||||||
|
The process through which the relay decides what roles to support and how to handle moderation events internally based on them is specific to each relay and not specified here.
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
"kind": 39003,
|
||||||
|
"content": "list of roles supported by this group",
|
||||||
|
"tags": [
|
||||||
|
["d", "<group-id>"],
|
||||||
|
["role", "<role-name>", "<optional-description>"],
|
||||||
|
["role", "<role-name>", "<optional-description>"],
|
||||||
|
// other roles...
|
||||||
|
],
|
||||||
|
// other fields...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation quirks
|
||||||
|
|
||||||
|
### Checking your own membership in a group
|
||||||
|
|
||||||
|
The latest of either `kind:9000` or `kind:9001` events present in a group should tell a user that they are currently members of the group or if they were removed. In case none of these exist the user is assumed to not be a member of the group -- unless the group is `unmanaged`, in which case the user is assumed to be a member.
|
||||||
|
|
||||||
|
### Adding yourself to a group
|
||||||
|
|
||||||
|
When a group is `open`, anyone can send a `kind:9021` event to it in order to be added, then expect a `kind:9000` event to be emitted confirming that the user was added. The same happens with `closed` groups, except in that case a user may only send a `kind:9021` if it has an invite code.
|
||||||
|
|
||||||
|
### Storing your list of groups
|
||||||
|
|
||||||
|
A definition for `kind:10009` was included in [NIP-51](51.md) that allows clients to store the list of groups a user wants to remember being in.
|
||||||
|
|
||||||
|
### Using `unmanaged` relays
|
||||||
|
|
||||||
|
To prevent event leakage, replay and confusion, 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.
|
||||||
|
|||||||
59
37.md
Normal file
59
37.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
NIP-37
|
||||||
|
======
|
||||||
|
|
||||||
|
Editable Short Notes
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
`draft` `optional`
|
||||||
|
|
||||||
|
This NIP describes a flow for editing `kind:1` notes that is mostly backwards-compatible (as long as clients support [NIP-09](./09.md) properly).
|
||||||
|
|
||||||
|
The flow for editing a `kind:1` note consists of creating a new `kind:1` note to be published in its place, then issuing a `kind:5` delete request for the first, in both cases attaching special tags that denote the nature of the operation to clients that want to support a more rich edit flow.
|
||||||
|
|
||||||
|
## Example flow
|
||||||
|
|
||||||
|
Support `<bob>` publishes
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
"id": "aaaaa",
|
||||||
|
"kind": 1,
|
||||||
|
"pubkey": "<bob>",
|
||||||
|
"content": "ehllo"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And now, for whatever, reason, he wants to edit the note to say "hello", so his client will publish the following two events:
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
"id": "bbbbbb",
|
||||||
|
"kind": 1,
|
||||||
|
"pubkey": "<bob>",
|
||||||
|
"content": "hello",
|
||||||
|
"tags": [
|
||||||
|
["s", "aaaaaa"] // this indicates the note that is being replaced
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"kind": 5,
|
||||||
|
"pubkey": "<bob>",
|
||||||
|
"tags": [
|
||||||
|
["e", "aaaaaa"], // this indicates the note that will be deleted in all non-upgraded clients
|
||||||
|
["edit", "bbbbbb"], // this indicates the notes that replaced the one just deleted
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Backwards-compatibility
|
||||||
|
|
||||||
|
For all non-upgraded clients, this operation will look like a normal delete-and-replace. Replies, likes and everything else sent to node `aaaaaa` will be lost, but the feed will be intact and fine, with no need for any custom handling or complex replaceability.
|
||||||
|
|
||||||
|
## Progressive enhancement
|
||||||
|
|
||||||
|
Progressive enhancement may be applied, for example: when a user clicks to open note `bbbbbb` the client might try to query for `{"ids": ["aaaaaa"]}` upon seeing the `s` tag. And vice-versa, upon opening any other note a client might query for `{"#s": ["..."]}` to check if any edit is available. Both operations can enhance the focused note screen, but they don't have to be performed while loading a feed, and they remain strictly optional regardless.
|
||||||
|
|
||||||
|
## Full-blown upgrade
|
||||||
|
|
||||||
|
More complex clients that want to treat edits as pure edits and note as standalone notes may choose to hide any `kind:1` note that contains an `s` tag as a standalone entity, instead choosing to attach it to its "parent" that was edited. That must be combined with a refusal to _actually_ delete notes whenever the `kind:5` deletion request includes an `edit` tag. Such deletion request would then be only used as hints that an edit was performed, so it can be fetched and the note contents replaced in-place.
|
||||||
85
46.md
85
46.md
@@ -4,6 +4,10 @@ NIP-46
|
|||||||
Nostr Remote Signing
|
Nostr Remote Signing
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
`remote-signer-key` is introduced, passed in bunker url, clients must differentiate between `remote-signer-pubkey` and `user-pubkey`, must call `get_public_key` after connect.
|
||||||
|
|
||||||
## Rationale
|
## Rationale
|
||||||
|
|
||||||
Private keys should be exposed to as few systems - apps, operating systems, devices - as possible as each system adds to the attack surface.
|
Private keys should be exposed to as few systems - apps, operating systems, devices - as possible as each system adds to the attack surface.
|
||||||
@@ -12,51 +16,53 @@ This NIP describes a method for 2-way communication between a remote signer and
|
|||||||
|
|
||||||
## Terminology
|
## Terminology
|
||||||
|
|
||||||
- **Local keypair**: A local public and private key-pair used to encrypt content and communicate with the remote signer. Usually created by the client application.
|
- **user**: A person that is trying to use Nostr.
|
||||||
- **Remote user pubkey**: The public key that the user wants to sign as. The remote signer has control of the private key that matches this public key.
|
- **client**: A user-facing application that _user_ is looking at and clicking buttons in. This application will send requests to _remote-signer_.
|
||||||
- **Remote signer pubkey**: This is the public key of the remote signer itself. This is needed in both `create_account` command because you don't yet have a remote user pubkey.
|
- **remote-signer**: A daemon or server running somewhere that will answer requests from _client_, also known as "bunker".
|
||||||
|
- **client-keypair/pubkey**: The keys generated by _client_. Used to encrypt content and communicate with _remote-signer_.
|
||||||
|
- **remote-signer-keypair/pubkey**: The keys used by _remote-signer_ to encrypt content and communicate with _client_. This keypair MAY be same as _user-keypair_, but not necessarily.
|
||||||
|
- **user-keypair/pubkey**: The actual keys representing _user_ (that will be used to sign events in response to `sign_event` requests, for example). The _remote-signer_ generally has control over these keys.
|
||||||
|
|
||||||
All pubkeys specified in this NIP are in hex format.
|
All pubkeys specified in this NIP are in hex format.
|
||||||
|
|
||||||
## Initiating a connection
|
## Initiating a connection
|
||||||
|
|
||||||
To initiate a connection between a client and a remote signer there are a few different options.
|
There are two ways to initiate a connection:
|
||||||
|
|
||||||
### Direct connection initiated by remote signer
|
### Direct connection initiated by _remote-signer_
|
||||||
|
|
||||||
This is most common in a situation where you have your own nsecbunker or other type of remote signer and want to connect through a client that supports remote signing.
|
_remote-signer_ provides connection token in the form:
|
||||||
|
|
||||||
The remote signer would provide a connection token in the form:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
bunker://<remote-user-pubkey>?relay=<wss://relay-to-connect-on>&relay=<wss://another-relay-to-connect-on>&secret=<optional-secret-value>
|
bunker://<remote-signer-pubkey>?relay=<wss://relay-to-connect-on>&relay=<wss://another-relay-to-connect-on>&secret=<optional-secret-value>
|
||||||
```
|
```
|
||||||
|
|
||||||
This token is pasted into the client by the user and the client then uses the details to connect to the remote signer via the specified relay(s). Optional secret can be used for single successfully established connection only, remote signer SHOULD ignore new attempts to establish connection with old optional secret.
|
_user_ pastes this token on _client_, which then uses the details to connect to _remote-signer_ via the specified relays. Optional secret can be used for single successfully established connection only, _remote-signer_ SHOULD ignore new attempts to establish connection with old optional secret.
|
||||||
|
|
||||||
### Direct connection initiated by the client
|
### Direct connection initiated by the client
|
||||||
|
|
||||||
In this case, basically the opposite direction of the first case, the client provides a connection token (or encodes the token in a QR code) and the signer initiates a connection to the client via the specified relay(s).
|
In this case, basically the opposite direction of the first case, _client_ provides a connection token (or encodes the token in a QR code) and _remote-signer_ initiates a connection via the specified relays.
|
||||||
|
|
||||||
```
|
```
|
||||||
nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata=<json metadata in the form: {"name":"...", "url": "...", "description": "..."}>
|
nostrconnect://<client-pubkey>?relay=<wss://relay-to-connect-on>&metadata=<json metadata in the form: {"name":"...", "url": "...", "description": "..."}>
|
||||||
```
|
```
|
||||||
|
|
||||||
## The flow
|
## The flow
|
||||||
|
|
||||||
1. Client creates a local keypair. This keypair doesn't need to be communicated to the user since it's largely disposable (i.e. the user doesn't need to see this pubkey). Clients might choose to store it locally and they should delete it when the user logs out.
|
1. _client_ generates `client-keypair`. This keypair doesn't need to be communicated to _user_ since it's largely disposable. _client_ might choose to store it locally and they should delete it on logout;
|
||||||
2. Client gets the remote user pubkey (either via a `bunker://` connection string or a NIP-05 login-flow; shown below)
|
2. _client_ gets `remote-signer-pubkey` (either via a `bunker://` connection string or a NIP-05 login-flow; shown below);
|
||||||
3. Clients use the local keypair to send requests to the remote signer by `p`-tagging and encrypting to the remote user pubkey.
|
3. _client_ use `client-keypair` to send requests to _remote-signer_ by `p`-tagging and encrypting to `remote-signer-pubkey`;
|
||||||
4. The remote signer responds to the client by `p`-tagging and encrypting to the local keypair pubkey.
|
4. _remote-signer_ responds to _client_ by `p`-tagging and encrypting to the `client-pubkey`.
|
||||||
|
|
||||||
### Example flow for signing an event
|
### Example flow for signing an event
|
||||||
|
|
||||||
- Remote user pubkey (e.g. signing as) `fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52`
|
- `remote-signer-pubkey` is `fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52`
|
||||||
- Local pubkey is `eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86`
|
- `user-pubkey` is also `fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52`
|
||||||
|
- `client-pubkey` is `eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86`
|
||||||
|
|
||||||
#### Signature request
|
#### Signature request
|
||||||
|
|
||||||
```json
|
```js
|
||||||
{
|
{
|
||||||
"kind": 24133,
|
"kind": 24133,
|
||||||
"pubkey": "eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86",
|
"pubkey": "eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86",
|
||||||
@@ -70,13 +76,13 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
|
|||||||
created_at: 1714078911
|
created_at: 1714078911
|
||||||
}>)]
|
}>)]
|
||||||
}),
|
}),
|
||||||
"tags": [["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]], // p-tags the remote user pubkey
|
"tags": [["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]], // p-tags the remote-signer-pubkey
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Response event
|
#### Response event
|
||||||
|
|
||||||
```json
|
```js
|
||||||
{
|
{
|
||||||
"kind": 24133,
|
"kind": 24133,
|
||||||
"pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
|
"pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
|
||||||
@@ -84,7 +90,7 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
|
|||||||
"id": <random_string>,
|
"id": <random_string>,
|
||||||
"result": json_stringified(<signed-event>)
|
"result": json_stringified(<signed-event>)
|
||||||
}),
|
}),
|
||||||
"tags": [["p", "eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86"]], // p-tags the local keypair pubkey
|
"tags": [["p", "eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86"]], // p-tags the client-pubkey
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -94,20 +100,18 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
|
|||||||
|
|
||||||
## Request Events `kind: 24133`
|
## Request Events `kind: 24133`
|
||||||
|
|
||||||
```jsonc
|
```js
|
||||||
{
|
{
|
||||||
"id": <id>,
|
|
||||||
"kind": 24133,
|
"kind": 24133,
|
||||||
"pubkey": <local_keypair_pubkey>,
|
"pubkey": <local_keypair_pubkey>,
|
||||||
"content": <nip04(<request>)>,
|
"content": <nip04(<request>)>,
|
||||||
"tags": [["p", <remote_user_pubkey>]], // NB: in the `create_account` event, the remote signer pubkey should be `p` tagged.
|
"tags": [["p", <remote-signer-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-04](04.md) encrypted and has the following structure:
|
||||||
|
|
||||||
```json
|
```jsonc
|
||||||
{
|
{
|
||||||
"id": <random_string>,
|
"id": <random_string>,
|
||||||
"method": <method_name>,
|
"method": <method_name>,
|
||||||
@@ -125,15 +129,16 @@ Each of the following are methods that the client sends to the remote signer.
|
|||||||
|
|
||||||
| Command | Params | Result |
|
| Command | Params | Result |
|
||||||
| ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- |
|
| ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- |
|
||||||
| `connect` | `[<remote_user_pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" |
|
| `connect` | `[<user_pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" |
|
||||||
| `sign_event` | `[<{kind, content, tags, created_at}>]` | `json_stringified(<signed_event>)` |
|
| `sign_event` | `[<{kind, content, tags, created_at}>]` | `json_stringified(<signed_event>)` |
|
||||||
| `ping` | `[]` | "pong" |
|
| `ping` | `[]` | "pong" |
|
||||||
| `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` |
|
| `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` |
|
||||||
| `get_public_key` | `[]` | `<hex-pubkey>` |
|
| `get_public_key` | `[]` | `<user-pubkey>` |
|
||||||
| `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` |
|
| `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` |
|
||||||
| `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` |
|
| `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` |
|
||||||
| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` |
|
| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` |
|
||||||
| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` |
|
| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` |
|
||||||
|
| `create_account` | `[<username>, <domain>, <optional_email>, <optional_requested_permissions>]` | `<newly_created_user_pubkey>` |
|
||||||
|
|
||||||
### Requested permissions
|
### Requested permissions
|
||||||
|
|
||||||
@@ -145,9 +150,9 @@ The `connect` method may be provided with `optional_requested_permissions` for u
|
|||||||
{
|
{
|
||||||
"id": <id>,
|
"id": <id>,
|
||||||
"kind": 24133,
|
"kind": 24133,
|
||||||
"pubkey": <remote_signer_pubkey>,
|
"pubkey": <remote-signer-pubkey>,
|
||||||
"content": <nip04(<response>)>,
|
"content": <nip04(<response>)>,
|
||||||
"tags": [["p", <local_keypair_pubkey>]],
|
"tags": [["p", <client-pubkey>]],
|
||||||
"created_at": <unix timestamp in seconds>
|
"created_at": <unix timestamp in seconds>
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -184,18 +189,6 @@ Clients should display (in a popup or new tab) the URL from the `error` field an
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Remote Signer Commands
|
|
||||||
|
|
||||||
Remote signers might support additional commands when communicating directly with it. These commands follow the same flow as noted above, the only difference is that when the client sends a request event, the `p`-tag is the pubkey of the remote signer itself and the `content` payload is encrypted to the same remote signer pubkey.
|
|
||||||
|
|
||||||
### Methods/Commands
|
|
||||||
|
|
||||||
Each of the following are methods that the client sends to the remote signer.
|
|
||||||
|
|
||||||
| Command | Params | Result |
|
|
||||||
| ---------------- | ------------------------------------------ | ------------------------------------ |
|
|
||||||
| `create_account` | `[<username>, <domain>, <optional_email>, <optional_requested_permissions>]` | `<newly_created_remote_user_pubkey>` |
|
|
||||||
|
|
||||||
## Appendix
|
## Appendix
|
||||||
|
|
||||||
### NIP-05 Login Flow
|
### NIP-05 Login Flow
|
||||||
@@ -204,7 +197,7 @@ Clients might choose to present a more familiar login flow, so users can type a
|
|||||||
|
|
||||||
When the user types a NIP-05 the client:
|
When the user types a NIP-05 the client:
|
||||||
|
|
||||||
- Queries the `/.well-known/nostr.json` file from the domain for the NIP-05 address provided to get the user's pubkey (this is the **remote user pubkey**)
|
- Queries the `/.well-known/nostr.json` file from the domain for the NIP-05 address provided to get the user's pubkey (this is the `user-pubkey`)
|
||||||
- In the same `/.well-known/nostr.json` file, queries for the `nip46` key to get the relays that the remote signer will be listening on.
|
- In the same `/.well-known/nostr.json` file, queries for the `nip46` key to get the relays that the remote signer will be listening on.
|
||||||
- Now the client has enough information to send commands to the remote signer on behalf of the user.
|
- Now the client has enough information to send commands to the remote signer on behalf of the user.
|
||||||
|
|
||||||
@@ -216,9 +209,9 @@ In this last case, most often used to facilitate an OAuth-like signin flow, the
|
|||||||
|
|
||||||
First the client will query for `kind: 31990` events that have a `k` tag of `24133`.
|
First the client will query for `kind: 31990` events that have a `k` tag of `24133`.
|
||||||
|
|
||||||
These are generally shown to a user, and once the user selects which remote signer to use and provides the remote user pubkey they want to use (via npub, pubkey, or nip-05 value), the client can initiate a connection. Note that it's on the user to select the remote signer that is actually managing the remote key that they would like to use in this case. If the remote user pubkey is managed on another remote signer, the connection will fail.
|
These are generally shown to a user, and once the user selects which remote signer to use and provides the `user-pubkey` they want to use (via npub, pubkey, or nip-05 value), the client can initiate a connection. Note that it's on the user to select the _remote-signer_ that is actually managing the `user-keypair` that they would like to use in this case. If the `user-pubkey` is managed on another _remote-signer_ the connection will fail.
|
||||||
|
|
||||||
In addition, it's important that clients validate that the pubkey of the announced remote signer matches the pubkey of the `_` entry in the `/.well-known/nostr.json` file of the remote signer's announced domain.
|
In addition, it's important that clients validate that the pubkey of the announced _remote-signer_ matches the pubkey of the `_` entry in the `/.well-known/nostr.json` file of the remote signer's announced domain.
|
||||||
|
|
||||||
Clients that allow users to create new accounts should also consider validating the availability of a given username in the namespace of remote signer's domain by checking the `/.well-known/nostr.json` file for existing usernames. Clients can then show users feedback in the UI before sending a `create_account` event to the remote signer and receiving an error in return. Ideally, remote signers would also respond with understandable error messages if a client tries to create an account with an existing username.
|
Clients that allow users to create new accounts should also consider validating the availability of a given username in the namespace of remote signer's domain by checking the `/.well-known/nostr.json` file for existing usernames. Clients can then show users feedback in the UI before sending a `create_account` event to the remote signer and receiving an error in return. Ideally, remote signers would also respond with understandable error messages if a client tries to create an account with an existing username.
|
||||||
|
|
||||||
|
|||||||
178
55.md
178
55.md
@@ -53,8 +53,8 @@ val launcher = rememberLauncherForActivityResult(
|
|||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
val signature = activityResult.data?.getStringExtra("signature")
|
val result = activityResult.data?.getStringExtra("result")
|
||||||
// Do something with signature ...
|
// Do something with result ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -101,10 +101,10 @@ launcher.launch(intent)
|
|||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- If the user approved intent it will return the **npub** in the signature field
|
- If the user approved intent it will return the **pubkey** in the result field
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val npub = intent.data?.getStringExtra("signature")
|
val pubkey = intent.data?.getStringExtra("result")
|
||||||
// The package name of the signer application
|
// The package name of the signer application
|
||||||
val packageName = intent.data?.getStringExtra("package")
|
val packageName = intent.data?.getStringExtra("package")
|
||||||
```
|
```
|
||||||
@@ -118,16 +118,16 @@ launcher.launch(intent)
|
|||||||
intent.putExtra("type", "sign_event")
|
intent.putExtra("type", "sign_event")
|
||||||
// To handle results when not waiting between intents
|
// To handle results when not waiting between intents
|
||||||
intent.putExtra("id", event.id)
|
intent.putExtra("id", event.id)
|
||||||
// Send the current logged in user npub
|
// Send the current logged in user pubkey
|
||||||
intent.putExtra("current_user", npub)
|
intent.putExtra("current_user", pubkey)
|
||||||
|
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- If the user approved intent it will return the **signature**, **id** and **event** fields
|
- If the user approved intent it will return the **result**, **id** and **event** fields
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val signature = intent.data?.getStringExtra("signature")
|
val signature = intent.data?.getStringExtra("result")
|
||||||
// The id you sent
|
// The id you sent
|
||||||
val id = intent.data?.getStringExtra("id")
|
val id = intent.data?.getStringExtra("id")
|
||||||
val signedEventJson = intent.data?.getStringExtra("event")
|
val signedEventJson = intent.data?.getStringExtra("event")
|
||||||
@@ -142,18 +142,18 @@ launcher.launch(intent)
|
|||||||
intent.putExtra("type", "nip04_encrypt")
|
intent.putExtra("type", "nip04_encrypt")
|
||||||
// to control the result in your application in case you are not waiting the result before sending another intent
|
// to control the result in your application in case you are not waiting the result before sending another intent
|
||||||
intent.putExtra("id", "some_id")
|
intent.putExtra("id", "some_id")
|
||||||
// Send the current logged in user npub
|
// Send the current logged in user pubkey
|
||||||
intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
|
intent.putExtra("current_user", account.keyPair.pubkey)
|
||||||
// Send the hex pubKey that will be used for encrypting the data
|
// Send the hex pubkey that will be used for encrypting the data
|
||||||
intent.putExtra("pubKey", pubKey)
|
intent.putExtra("pubkey", pubkey)
|
||||||
|
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- If the user approved intent it will return the **signature** and **id** fields
|
- If the user approved intent it will return the **result** and **id** fields
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val encryptedText = intent.data?.getStringExtra("signature")
|
val encryptedText = intent.data?.getStringExtra("result")
|
||||||
// the id you sent
|
// the id you sent
|
||||||
val id = intent.data?.getStringExtra("id")
|
val id = intent.data?.getStringExtra("id")
|
||||||
```
|
```
|
||||||
@@ -167,10 +167,10 @@ launcher.launch(intent)
|
|||||||
intent.putExtra("type", "nip44_encrypt")
|
intent.putExtra("type", "nip44_encrypt")
|
||||||
// to control the result in your application in case you are not waiting the result before sending another intent
|
// to control the result in your application in case you are not waiting the result before sending another intent
|
||||||
intent.putExtra("id", "some_id")
|
intent.putExtra("id", "some_id")
|
||||||
// Send the current logged in user npub
|
// Send the current logged in user pubkey
|
||||||
intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
|
intent.putExtra("current_user", account.keyPair.pubkey)
|
||||||
// Send the hex pubKey that will be used for encrypting the data
|
// Send the hex pubkey that will be used for encrypting the data
|
||||||
intent.putExtra("pubKey", pubKey)
|
intent.putExtra("pubkey", pubkey)
|
||||||
|
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
@@ -192,18 +192,18 @@ launcher.launch(intent)
|
|||||||
intent.putExtra("type", "nip04_decrypt")
|
intent.putExtra("type", "nip04_decrypt")
|
||||||
// to control the result in your application in case you are not waiting the result before sending another intent
|
// to control the result in your application in case you are not waiting the result before sending another intent
|
||||||
intent.putExtra("id", "some_id")
|
intent.putExtra("id", "some_id")
|
||||||
// Send the current logged in user npub
|
// Send the current logged in user pubkey
|
||||||
intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
|
intent.putExtra("current_user", account.keyPair.pubkey)
|
||||||
// Send the hex pubKey that will be used for decrypting the data
|
// Send the hex pubkey that will be used for decrypting the data
|
||||||
intent.putExtra("pubKey", pubKey)
|
intent.putExtra("pubkey", pubkey)
|
||||||
|
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- If the user approved intent it will return the **signature** and **id** fields
|
- If the user approved intent it will return the **result** and **id** fields
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val plainText = intent.data?.getStringExtra("signature")
|
val plainText = intent.data?.getStringExtra("result")
|
||||||
// the id you sent
|
// the id you sent
|
||||||
val id = intent.data?.getStringExtra("id")
|
val id = intent.data?.getStringExtra("id")
|
||||||
```
|
```
|
||||||
@@ -217,18 +217,41 @@ launcher.launch(intent)
|
|||||||
intent.putExtra("type", "nip04_decrypt")
|
intent.putExtra("type", "nip04_decrypt")
|
||||||
// to control the result in your application in case you are not waiting the result before sending another intent
|
// to control the result in your application in case you are not waiting the result before sending another intent
|
||||||
intent.putExtra("id", "some_id")
|
intent.putExtra("id", "some_id")
|
||||||
// Send the current logged in user npub
|
// Send the current logged in user pubkey
|
||||||
intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
|
intent.putExtra("current_user", account.keyPair.pubkey)
|
||||||
// Send the hex pubKey that will be used for decrypting the data
|
// Send the hex pubkey that will be used for decrypting the data
|
||||||
intent.putExtra("pubKey", pubKey)
|
intent.putExtra("pubkey", pubkey)
|
||||||
|
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- If the user approved intent it will return the **signature** and **id** fields
|
- If the user approved intent it will return the **result** and **id** fields
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val plainText = intent.data?.getStringExtra("signature")
|
val plainText = intent.data?.getStringExtra("result")
|
||||||
|
// the id you sent
|
||||||
|
val id = intent.data?.getStringExtra("id")
|
||||||
|
```
|
||||||
|
|
||||||
|
- **get_relays**
|
||||||
|
- params:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:"))
|
||||||
|
intent.`package` = "com.example.signer"
|
||||||
|
intent.putExtra("type", "get_relays")
|
||||||
|
// to control the result in your application in case you are not waiting the result before sending another intent
|
||||||
|
intent.putExtra("id", "some_id")
|
||||||
|
// Send the current logged in user pubkey
|
||||||
|
intent.putExtra("current_user", account.keyPair.pubkey)
|
||||||
|
|
||||||
|
context.startActivity(intent)
|
||||||
|
```
|
||||||
|
- result:
|
||||||
|
- If the user approved intent it will return the **result** and **id** fields
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val relayJsonText = intent.data?.getStringExtra("result")
|
||||||
// the id you sent
|
// the id you sent
|
||||||
val id = intent.data?.getStringExtra("id")
|
val id = intent.data?.getStringExtra("id")
|
||||||
```
|
```
|
||||||
@@ -242,15 +265,15 @@ launcher.launch(intent)
|
|||||||
intent.putExtra("type", "decrypt_zap_event")
|
intent.putExtra("type", "decrypt_zap_event")
|
||||||
// to control the result in your application in case you are not waiting the result before sending another intent
|
// to control the result in your application in case you are not waiting the result before sending another intent
|
||||||
intent.putExtra("id", "some_id")
|
intent.putExtra("id", "some_id")
|
||||||
// Send the current logged in user npub
|
// Send the current logged in user pubkey
|
||||||
intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
|
intent.putExtra("current_user", account.keyPair.pubkey)
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- If the user approved intent it will return the **signature** and **id** fields
|
- If the user approved intent it will return the **result** and **id** fields
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val eventJson = intent.data?.getStringExtra("signature")
|
val eventJson = intent.data?.getStringExtra("result")
|
||||||
// the id you sent
|
// the id you sent
|
||||||
val id = intent.data?.getStringExtra("id")
|
val id = intent.data?.getStringExtra("id")
|
||||||
```
|
```
|
||||||
@@ -259,11 +282,11 @@ launcher.launch(intent)
|
|||||||
|
|
||||||
To get the result back from Signer Application you should use contentResolver.query in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result.
|
To get the result back from Signer Application you should use contentResolver.query in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result.
|
||||||
|
|
||||||
If the user did not check the "remember my choice" option, the npub is not in Signer Application or the signer type is not recognized the `contentResolver` will return null
|
If the user did not check the "remember my choice" option, the pubkey is not in Signer Application or the signer type is not recognized the `contentResolver` will return null
|
||||||
|
|
||||||
For the SIGN_EVENT type Signer Application returns two columns "signature" and "event". The column event is the signed event json
|
For the SIGN_EVENT type Signer Application returns two columns "result" and "event". The column event is the signed event json
|
||||||
|
|
||||||
For the other types Signer Application returns the column "signature"
|
For the other types Signer Application returns the column "result"
|
||||||
|
|
||||||
If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application
|
If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application
|
||||||
|
|
||||||
@@ -282,15 +305,15 @@ If the user chose to always reject the event, signer application will return the
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **npub** in the signature column
|
- Will return the **pubkey** in the result column
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
if (index < 0) return
|
if (index < 0) return
|
||||||
val npub = it.getString(index)
|
val pubkey = it.getString(index)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -300,20 +323,20 @@ If the user chose to always reject the event, signer application will return the
|
|||||||
```kotlin
|
```kotlin
|
||||||
val result = context.contentResolver.query(
|
val result = context.contentResolver.query(
|
||||||
Uri.parse("content://com.example.signer.SIGN_EVENT"),
|
Uri.parse("content://com.example.signer.SIGN_EVENT"),
|
||||||
listOf("$eventJson", "", "${logged_in_user_npub}"),
|
listOf("$eventJson", "", "${logged_in_user_pubkey}"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **signature** and the **event** columns
|
- Will return the **result** and the **event** columns
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
val indexJson = it.getColumnIndex("event")
|
val indexJson = it.getColumnIndex("event")
|
||||||
val signature = it.getString(index)
|
val signature = it.getString(index)
|
||||||
val eventJson = it.getString(indexJson)
|
val eventJson = it.getString(indexJson)
|
||||||
@@ -326,20 +349,20 @@ If the user chose to always reject the event, signer application will return the
|
|||||||
```kotlin
|
```kotlin
|
||||||
val result = context.contentResolver.query(
|
val result = context.contentResolver.query(
|
||||||
Uri.parse("content://com.example.signer.NIP04_ENCRYPT"),
|
Uri.parse("content://com.example.signer.NIP04_ENCRYPT"),
|
||||||
listOf("$plainText", "${hex_pub_key}", "${logged_in_user_npub}"),
|
listOf("$plainText", "${hex_pub_key}", "${logged_in_user_pubkey}"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **signature** column
|
- Will return the **result** column
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
val encryptedText = it.getString(index)
|
val encryptedText = it.getString(index)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -350,20 +373,20 @@ If the user chose to always reject the event, signer application will return the
|
|||||||
```kotlin
|
```kotlin
|
||||||
val result = context.contentResolver.query(
|
val result = context.contentResolver.query(
|
||||||
Uri.parse("content://com.example.signer.NIP44_ENCRYPT"),
|
Uri.parse("content://com.example.signer.NIP44_ENCRYPT"),
|
||||||
listOf("$plainText", "${hex_pub_key}", "${logged_in_user_npub}"),
|
listOf("$plainText", "${hex_pub_key}", "${logged_in_user_pubkey}"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **signature** column
|
- Will return the **result** column
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
val encryptedText = it.getString(index)
|
val encryptedText = it.getString(index)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -374,20 +397,20 @@ If the user chose to always reject the event, signer application will return the
|
|||||||
```kotlin
|
```kotlin
|
||||||
val result = context.contentResolver.query(
|
val result = context.contentResolver.query(
|
||||||
Uri.parse("content://com.example.signer.NIP04_DECRYPT"),
|
Uri.parse("content://com.example.signer.NIP04_DECRYPT"),
|
||||||
listOf("$encryptedText", "${hex_pub_key}", "${logged_in_user_npub}"),
|
listOf("$encryptedText", "${hex_pub_key}", "${logged_in_user_pubkey}"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **signature** column
|
- Will return the **result** column
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
val encryptedText = it.getString(index)
|
val encryptedText = it.getString(index)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -398,44 +421,68 @@ If the user chose to always reject the event, signer application will return the
|
|||||||
```kotlin
|
```kotlin
|
||||||
val result = context.contentResolver.query(
|
val result = context.contentResolver.query(
|
||||||
Uri.parse("content://com.example.signer.NIP44_DECRYPT"),
|
Uri.parse("content://com.example.signer.NIP44_DECRYPT"),
|
||||||
listOf("$encryptedText", "${hex_pub_key}", "${logged_in_user_npub}"),
|
listOf("$encryptedText", "${hex_pub_key}", "${logged_in_user_pubkey}"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **signature** column
|
- Will return the **result** column
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
val encryptedText = it.getString(index)
|
val encryptedText = it.getString(index)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **get_relays**
|
||||||
|
- params:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val result = context.contentResolver.query(
|
||||||
|
Uri.parse("content://com.example.signer.GET_RELAYS"),
|
||||||
|
listOf("${logged_in_user_pubkey}"),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
```
|
||||||
|
- result:
|
||||||
|
- Will return the **result** column
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
if (result == null) return
|
||||||
|
|
||||||
|
if (result.moveToFirst()) {
|
||||||
|
val index = it.getColumnIndex("result")
|
||||||
|
val relayJsonText = it.getString(index)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- **decrypt_zap_event**
|
- **decrypt_zap_event**
|
||||||
- params:
|
- params:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val result = context.contentResolver.query(
|
val result = context.contentResolver.query(
|
||||||
Uri.parse("content://com.example.signer.DECRYPT_ZAP_EVENT"),
|
Uri.parse("content://com.example.signer.DECRYPT_ZAP_EVENT"),
|
||||||
listOf("$eventJson", "", "${logged_in_user_npub}"),
|
listOf("$eventJson", "", "${logged_in_user_pubkey}"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
- result:
|
- result:
|
||||||
- Will return the **signature** column
|
- Will return the **result** column
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
if (result == null) return
|
if (result == null) return
|
||||||
|
|
||||||
if (result.moveToFirst()) {
|
if (result.moveToFirst()) {
|
||||||
val index = it.getColumnIndex("signature")
|
val index = it.getColumnIndex("result")
|
||||||
val eventJson = it.getString(index)
|
val eventJson = it.getString(index)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -472,28 +519,35 @@ Android intents and browser urls have limitations, so if you are using the `retu
|
|||||||
- params:
|
- params:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_encrypt&callbackUrl=https://example.com/?event=`;
|
window.href = `nostrsigner:${plainText}?pubkey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_encrypt&callbackUrl=https://example.com/?event=`;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **nip44_encrypt**
|
- **nip44_encrypt**
|
||||||
- params:
|
- params:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_encrypt&callbackUrl=https://example.com/?event=`;
|
window.href = `nostrsigner:${plainText}?pubkey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_encrypt&callbackUrl=https://example.com/?event=`;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **nip04_decrypt**
|
- **nip04_decrypt**
|
||||||
- params:
|
- params:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_decrypt&callbackUrl=https://example.com/?event=`;
|
window.href = `nostrsigner:${encryptedText}?pubkey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_decrypt&callbackUrl=https://example.com/?event=`;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **nip44_decrypt**
|
- **nip44_decrypt**
|
||||||
- params:
|
- params:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&callbackUrl=https://example.com/?event=`;
|
window.href = `nostrsigner:${encryptedText}?pubkey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&callbackUrl=https://example.com/?event=`;
|
||||||
|
```
|
||||||
|
|
||||||
|
- **get_relays**
|
||||||
|
- params:
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.href = `nostrsigner:?compressionType=none&returnType=signature&type=get_relays&callbackUrl=https://example.com/?event=`;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **decrypt_zap_event**
|
- **decrypt_zap_event**
|
||||||
|
|||||||
2
60.md
2
60.md
@@ -159,7 +159,7 @@ Her client:
|
|||||||
"proofs": [
|
"proofs": [
|
||||||
{ "id": "1", "amount": 1 },
|
{ "id": "1", "amount": 1 },
|
||||||
{ "id": "2", "amount": 2 },
|
{ "id": "2", "amount": 2 },
|
||||||
{ "id": "8", "amount": 8 },
|
{ "id": "4", "amount": 8 },
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|||||||
117
71.md
117
71.md
@@ -20,21 +20,60 @@ The format uses an _addressable event_ kind `34235` for horizontal videos and `3
|
|||||||
|
|
||||||
The `.content` of these events is a summary or description on the video content.
|
The `.content` of these events is a summary or description on the video content.
|
||||||
|
|
||||||
The list of tags are as follows:
|
The primary source of video information is the `imeta` tags which is defined in [NIP-92](92.md)
|
||||||
* `d` (required) universally unique identifier (UUID). Generated by the client creating the video event.
|
|
||||||
* `url` (required) the url to the video file
|
Each `imeta` tag can be used to specify a variant of the video by the `dim` & `m` properties.
|
||||||
* `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.
|
|
||||||
|
Example:
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
["imeta",
|
||||||
|
"dim 1920x1080",
|
||||||
|
"url https://myvideo.com/1080/12345.mp4",
|
||||||
|
"x 3093509d1e0bc604ff60cb9286f4cd7c781553bc8991937befaacfdc28ec5cdc",
|
||||||
|
"m video/mp4",
|
||||||
|
"image https://myvideo.com/1080/12345.jpg",
|
||||||
|
"image https://myotherserver.com/1080/12345.jpg",
|
||||||
|
"fallback https://myotherserver.com/1080/12345.mp4",
|
||||||
|
"fallback https://andanotherserver.com/1080/12345.mp4",
|
||||||
|
"service nip96",
|
||||||
|
],
|
||||||
|
["imeta",
|
||||||
|
"dim 1280x720",
|
||||||
|
"url https://myvideo.com/720/12345.mp4",
|
||||||
|
"x e1d4f808dae475ed32fb23ce52ef8ac82e3cc760702fca10d62d382d2da3697d",
|
||||||
|
"m video/mp4",
|
||||||
|
"image https://myvideo.com/720/12345.jpg",
|
||||||
|
"image https://myotherserver.com/720/12345.jpg",
|
||||||
|
"fallback https://myotherserver.com/720/12345.mp4",
|
||||||
|
"fallback https://andanotherserver.com/720/12345.mp4",
|
||||||
|
"service nip96",
|
||||||
|
],
|
||||||
|
["imeta",
|
||||||
|
"dim 1280x720",
|
||||||
|
"url https://myvideo.com/720/12345.m3u8",
|
||||||
|
"x 704e720af2697f5d6a198ad377789d462054b6e8d790f8a3903afbc1e044014f",
|
||||||
|
"m application/x-mpegURL",
|
||||||
|
"image https://myvideo.com/720/12345.jpg",
|
||||||
|
"image https://myotherserver.com/720/12345.jpg",
|
||||||
|
"fallback https://myotherserver.com/720/12345.m3u8",
|
||||||
|
"fallback https://andanotherserver.com/720/12345.m3u8",
|
||||||
|
"service nip96",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Where `url` is the primary server url and `fallback` are other servers hosting the same file, both `url` and `fallback` should be weighted equally and clients are recommended to use any of the provided video urls.
|
||||||
|
|
||||||
|
The `image` tag contains a preview image (at the same resolution). Multiple `image` tags may be used to specify fallback copies in the same way `fallback` is used for `url`.
|
||||||
|
|
||||||
|
Additionally `service nip96` may be included to allow clients to search the authors NIP-96 server list to find the file using the hash.
|
||||||
|
|
||||||
|
### Other tags:
|
||||||
* `title` (required) title of the video
|
* `title` (required) title of the video
|
||||||
* `"published_at"`, for the timestamp in unix seconds (stringified) of the first time the video was published
|
* `published_at`, for the timestamp in unix seconds (stringified) of the first time the video was published
|
||||||
* `x` containing the SHA-256 hexencoded string of the file.
|
|
||||||
* `size` (optional) size of file in bytes
|
|
||||||
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
|
|
||||||
* `duration` (optional) video duration in seconds
|
* `duration` (optional) video duration in seconds
|
||||||
* `magnet` (optional) URI to magnet file
|
|
||||||
* `i` (optional) torrent infohash
|
|
||||||
* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
|
* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
|
||||||
* `thumb` (optional) url of thumbnail with same aspect ratio
|
|
||||||
* `image` (optional) url of preview image with same dimensions
|
|
||||||
* `content-warning` (optional) warning about content of NSFW video
|
* `content-warning` (optional) warning about content of NSFW video
|
||||||
* `alt` (optional) description for accessibility
|
* `alt` (optional) description for accessibility
|
||||||
* `segment` (optional, repeated) start timestamp in format `HH:MM:SS.sss`, end timestamp in format `HH:MM:SS.sss`, chapter/segment title, chapter thumbnail-url
|
* `segment` (optional, repeated) start timestamp in format `HH:MM:SS.sss`, end timestamp in format `HH:MM:SS.sss`, chapter/segment title, chapter thumbnail-url
|
||||||
@@ -53,19 +92,23 @@ The list of tags are as follows:
|
|||||||
["d", "<UUID>"],
|
["d", "<UUID>"],
|
||||||
|
|
||||||
["title", "<title of video>"],
|
["title", "<title of video>"],
|
||||||
["thumb", "<thumbnail image for video>"],
|
|
||||||
["published_at", "<unix timestamp>"],
|
["published_at", "<unix timestamp>"],
|
||||||
["alt", <description>],
|
["alt", <description>],
|
||||||
|
|
||||||
// Video Data
|
// Video Data
|
||||||
["url",<string with URI of file>],
|
["imeta",
|
||||||
["m", <MIME type>],
|
"dim 1920x1080",
|
||||||
["x",<Hash SHA-256>],
|
"url https://myvideo.com/1080/12345.mp4",
|
||||||
["size", <size of file in bytes>],
|
"x 3093509d1e0bc604ff60cb9286f4cd7c781553bc8991937befaacfdc28ec5cdc",
|
||||||
|
"m video/mp4",
|
||||||
|
"image https://myvideo.com/1080/12345.jpg",
|
||||||
|
"image https://myotherserver.com/1080/12345.jpg",
|
||||||
|
"fallback https://myotherserver.com/1080/12345.mp4",
|
||||||
|
"fallback https://andanotherserver.com/1080/12345.mp4",
|
||||||
|
"service nip96",
|
||||||
|
],
|
||||||
|
|
||||||
["duration", <duration of video in seconds>],
|
["duration", <duration of video in seconds>],
|
||||||
["dim", <size of file in pixels>],
|
|
||||||
["magnet",<magnet URI> ],
|
|
||||||
["i",<torrent infohash>],
|
|
||||||
["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
|
["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
|
||||||
["content-warning", "<reason>"],
|
["content-warning", "<reason>"],
|
||||||
["segment", <start>, <end>, "<title>", "<thumbnail URL>"],
|
["segment", <start>, <end>, "<title>", "<thumbnail URL>"],
|
||||||
@@ -83,36 +126,4 @@ The list of tags are as follows:
|
|||||||
["r", "<url>"]
|
["r", "<url>"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Video View
|
|
||||||
|
|
||||||
A video event view is a response to a video event to track a user's view or progress viewing the video.
|
|
||||||
|
|
||||||
### Format
|
|
||||||
|
|
||||||
The format uses an _addressable event_ kind `34237`.
|
|
||||||
|
|
||||||
The `.content` of these events is optional and could be a free-form note that acts like a bookmark for the user.
|
|
||||||
|
|
||||||
The list of tags are as follows:
|
|
||||||
* `a` (required) reference tag to kind `34235` or `34236` video event being viewed
|
|
||||||
* `d` (required) same as `a` reference tag value
|
|
||||||
* `viewed` (optional, repeated) timestamp of the user's start time in seconds, timestamp of the user's end time in seconds
|
|
||||||
|
|
||||||
|
|
||||||
```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": 34237,
|
|
||||||
"content": "<note>",
|
|
||||||
"tags": [
|
|
||||||
["a", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>", "<optional relay url>"],
|
|
||||||
["e", "<event-id", "<relay-url>"]
|
|
||||||
["d", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>"],
|
|
||||||
["viewed", <start>, <end>],
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
13
94.md
13
94.md
@@ -26,6 +26,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
|
|||||||
* `summary` (optional) text excerpt
|
* `summary` (optional) text excerpt
|
||||||
* `alt` (optional) description for accessibility
|
* `alt` (optional) description for accessibility
|
||||||
* `fallback` (optional) zero or more fallback file sources in case `url` fails
|
* `fallback` (optional) zero or more fallback file sources in case `url` fails
|
||||||
|
* `service` (optional) service type which is serving the file (eg. [NIP-96](96.md))
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
@@ -33,15 +34,15 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
|
|||||||
"tags": [
|
"tags": [
|
||||||
["url",<string with URI of file>],
|
["url",<string with URI of file>],
|
||||||
["m", <MIME type>],
|
["m", <MIME type>],
|
||||||
["x",<Hash SHA-256>],
|
["x", <Hash SHA-256>],
|
||||||
["ox",<Hash SHA-256>],
|
["ox", <Hash SHA-256>],
|
||||||
["size", <size of file in bytes>],
|
["size", <size of file in bytes>],
|
||||||
["dim", <size of file in pixels>],
|
["dim", <size of file in pixels>],
|
||||||
["magnet",<magnet URI> ],
|
["magnet", <magnet URI> ],
|
||||||
["i",<torrent infohash>],
|
["i", <torrent infohash>],
|
||||||
["blurhash", <value>],
|
["blurhash", <value>],
|
||||||
["thumb", <string with thumbnail URI>],
|
["thumb", <string with thumbnail URI>, <Hash SHA-256>],
|
||||||
["image", <string with preview URI>],
|
["image", <string with preview URI>, <Hash SHA-256>],
|
||||||
["summary", <excerpt>],
|
["summary", <excerpt>],
|
||||||
["alt", <description>]
|
["alt", <description>]
|
||||||
],
|
],
|
||||||
|
|||||||
2
99.md
2
99.md
@@ -26,7 +26,7 @@ The `.pubkey` field of these events are treated as the party creating the listin
|
|||||||
|
|
||||||
### Metadata
|
### Metadata
|
||||||
|
|
||||||
- For "tags"/"hashtags" (i.e. categories or keywords of relevance for the listing) the `"t"` event tag should be used, as per [NIP-12](12.md).
|
- For "tags"/"hashtags" (i.e. categories or keywords of relevance for the listing) the `"t"` event tag should be used.
|
||||||
- For images, whether included in the markdown content or not, clients SHOULD use `image` tags as described in [NIP-58](58.md). This allows clients to display images in carousel format more easily.
|
- For images, whether included in the markdown content or not, clients SHOULD use `image` tags as described in [NIP-58](58.md). This allows clients to display images in carousel format more easily.
|
||||||
|
|
||||||
The following tags, used for structured metadata, are standardized and SHOULD be included. Other tags may be added as necessary.
|
The following tags, used for structured metadata, are standardized and SHOULD be included. Other tags may be added as necessary.
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ reverse chronological order.
|
|||||||
|
|
||||||
| Date | Commit | NIP | Change |
|
| Date | Commit | NIP | Change |
|
||||||
| ----------- | --------- | -------- | ------ |
|
| ----------- | --------- | -------- | ------ |
|
||||||
|
| 2024-10-15 | [1cda2dcc](https://github.com/nostr-protocol/nips/commit/1cda2dcc) | [NIP-71](71.md) | some tags were replaced with `imeta` tag |
|
||||||
|
| 2024-10-15 | [1cda2dcc](https://github.com/nostr-protocol/nips/commit/1cda2dcc) | [NIP-71](71.md) | `kind: 34237` was dropped |
|
||||||
|
| 2024-10-07 | [7bb8997b](https://github.com/nostr-protocol/nips/commit/7bb8997b) | [NIP-55](55.md) | some fields and passing data were changed |
|
||||||
| 2024-08-18 | [3aff37bd](https://github.com/nostr-protocol/nips/commit/3aff37bd) | [NIP-54](54.md) | content should be Asciidoc |
|
| 2024-08-18 | [3aff37bd](https://github.com/nostr-protocol/nips/commit/3aff37bd) | [NIP-54](54.md) | content should be Asciidoc |
|
||||||
| 2024-07-31 | [3ea2f1a4](https://github.com/nostr-protocol/nips/commit/3ea2f1a4) | [NIP-45](45.md) | [444ad28d](https://github.com/nostr-protocol/nips/commit/444ad28d) was reverted |
|
| 2024-07-31 | [3ea2f1a4](https://github.com/nostr-protocol/nips/commit/3ea2f1a4) | [NIP-45](45.md) | [444ad28d](https://github.com/nostr-protocol/nips/commit/444ad28d) was reverted |
|
||||||
| 2024-07-30 | [444ad28d](https://github.com/nostr-protocol/nips/commit/444ad28d) | [NIP-45](45.md) | NIP-45 was deprecated |
|
| 2024-07-30 | [444ad28d](https://github.com/nostr-protocol/nips/commit/444ad28d) | [NIP-45](45.md) | NIP-45 was deprecated |
|
||||||
|
|||||||
106
README.md
106
README.md
@@ -76,7 +76,6 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
|||||||
- [NIP-60: Cashu Wallet](60.md)
|
- [NIP-60: Cashu Wallet](60.md)
|
||||||
- [NIP-61: Nutzaps](61.md)
|
- [NIP-61: Nutzaps](61.md)
|
||||||
- [NIP-64: Chess (PGN)](64.md)
|
- [NIP-64: Chess (PGN)](64.md)
|
||||||
- [NIP-64: Chess (PGN)](64.md)
|
|
||||||
- [NIP-65: Relay List Metadata](65.md)
|
- [NIP-65: Relay List Metadata](65.md)
|
||||||
- [NIP-70: Protected Events](70.md)
|
- [NIP-70: Protected Events](70.md)
|
||||||
- [NIP-71: Video Events](71.md)
|
- [NIP-71: Video Events](71.md)
|
||||||
@@ -199,12 +198,14 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
|||||||
| `30078` | Application-specific Data | [78](78.md) |
|
| `30078` | Application-specific Data | [78](78.md) |
|
||||||
| `30311` | Live Event | [53](53.md) |
|
| `30311` | Live Event | [53](53.md) |
|
||||||
| `30315` | User Statuses | [38](38.md) |
|
| `30315` | User Statuses | [38](38.md) |
|
||||||
|
| `30388` | Slide Set | [Corny Chat][cornychat-slideset] |
|
||||||
| `30402` | Classified Listing | [99](99.md) |
|
| `30402` | Classified Listing | [99](99.md) |
|
||||||
| `30403` | Draft Classified Listing | [99](99.md) |
|
| `30403` | Draft Classified Listing | [99](99.md) |
|
||||||
| `30617` | Repository announcements | [34](34.md) |
|
| `30617` | Repository announcements | [34](34.md) |
|
||||||
| `30618` | Repository state announcements | [34](34.md) |
|
| `30618` | Repository state announcements | [34](34.md) |
|
||||||
| `30818` | Wiki article | [54](54.md) |
|
| `30818` | Wiki article | [54](54.md) |
|
||||||
| `30819` | Redirects | [54](54.md) |
|
| `30819` | Redirects | [54](54.md) |
|
||||||
|
| `31388` | Link Set | [Corny Chat][cornychat-linkset] |
|
||||||
| `31890` | Feed | [NUD: Custom Feeds][NUD: Custom Feeds] |
|
| `31890` | Feed | [NUD: Custom Feeds][NUD: Custom Feeds] |
|
||||||
| `31922` | Date-Based Calendar Event | [52](52.md) |
|
| `31922` | Date-Based Calendar Event | [52](52.md) |
|
||||||
| `31923` | Time-Based Calendar Event | [52](52.md) |
|
| `31923` | Time-Based Calendar Event | [52](52.md) |
|
||||||
@@ -214,7 +215,6 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
|||||||
| `31990` | Handler information | [89](89.md) |
|
| `31990` | Handler information | [89](89.md) |
|
||||||
| `34235` | Video Event | [71](71.md) |
|
| `34235` | Video Event | [71](71.md) |
|
||||||
| `34236` | Short-form Portrait Video Event | [71](71.md) |
|
| `34236` | Short-form Portrait Video Event | [71](71.md) |
|
||||||
| `34237` | Video View Event | [71](71.md) |
|
|
||||||
| `34550` | Community Definition | [72](72.md) |
|
| `34550` | Community Definition | [72](72.md) |
|
||||||
| `37375` | Cashu Wallet Event | [60](60.md) |
|
| `37375` | Cashu Wallet Event | [60](60.md) |
|
||||||
| `39000-9` | Group metadata events | [29](29.md) |
|
| `39000-9` | Group metadata events | [29](29.md) |
|
||||||
@@ -222,6 +222,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
|||||||
[NUD: Custom Feeds]: https://wikifreedia.xyz/cip-01/
|
[NUD: Custom Feeds]: https://wikifreedia.xyz/cip-01/
|
||||||
[nostrocket]: https://github.com/nostrocket/NIPS/blob/main/Problems.md
|
[nostrocket]: https://github.com/nostrocket/NIPS/blob/main/Problems.md
|
||||||
[lnpub]: https://github.com/shocknet/Lightning.Pub/blob/master/proto/autogenerated/client.md
|
[lnpub]: https://github.com/shocknet/Lightning.Pub/blob/master/proto/autogenerated/client.md
|
||||||
|
[cornychat-slideset]: https://cornychat.com/datatypes#kind30388slideset
|
||||||
|
[cornychat-linkset]: https://cornychat.com/datatypes#kind31388linkset
|
||||||
[joinstr]: https://gitlab.com/1440000bytes/joinstr/-/blob/main/NIP.md
|
[joinstr]: https://gitlab.com/1440000bytes/joinstr/-/blob/main/NIP.md
|
||||||
[NKBIP-01]: https://wikistr.com/nkbip-01
|
[NKBIP-01]: https://wikistr.com/nkbip-01
|
||||||
[NKBIP-02]: https://wikistr.com/nkbip-02
|
[NKBIP-02]: https://wikistr.com/nkbip-02
|
||||||
@@ -254,56 +256,56 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
|||||||
|
|
||||||
## Standardized Tags
|
## Standardized Tags
|
||||||
|
|
||||||
| name | value | other parameters | NIP |
|
| name | value | other parameters | NIP |
|
||||||
| ----------------- | ------------------------------------ | ------------------------------- | ------------------------------------- |
|
| ----------------- | ------------------------------------ | ------------------------------- | -------------------------------------------------- |
|
||||||
| `e` | event id (hex) | relay URL, marker, pubkey (hex) | [01](01.md), [10](10.md) |
|
| `e` | event id (hex) | relay URL, marker, pubkey (hex) | [01](01.md), [10](10.md) |
|
||||||
| `p` | pubkey (hex) | relay URL, petname | [01](01.md), [02](02.md) |
|
| `p` | pubkey (hex) | relay URL, petname | [01](01.md), [02](02.md) |
|
||||||
| `a` | coordinates to an event | relay URL | [01](01.md) |
|
| `a` | coordinates to an event | relay URL | [01](01.md) |
|
||||||
| `d` | identifier | -- | [01](01.md) |
|
| `d` | identifier | -- | [01](01.md) |
|
||||||
| `-` | -- | -- | [70](70.md) |
|
| `-` | -- | -- | [70](70.md) |
|
||||||
| `g` | geohash | -- | [52](52.md) |
|
| `g` | geohash | -- | [52](52.md) |
|
||||||
| `h` | group id | -- | [29](29.md) |
|
| `h` | group id | -- | [29](29.md) |
|
||||||
| `i` | external identity | proof, url hint | [39](39.md), [73](73.md) |
|
| `i` | external identity | proof, url hint | [39](39.md), [73](73.md) |
|
||||||
| `k` | kind number (string) | -- | [18](18.md), [25](25.md), [72](72.md) |
|
| `k` | kind | -- | [18](18.md), [25](25.md), [72](72.md), [73](73.md) |
|
||||||
| `l` | label, label namespace | -- | [32](32.md) |
|
| `l` | label, label namespace | -- | [32](32.md) |
|
||||||
| `L` | label namespace | -- | [32](32.md) |
|
| `L` | label namespace | -- | [32](32.md) |
|
||||||
| `m` | MIME type | -- | [94](94.md) |
|
| `m` | MIME type | -- | [94](94.md) |
|
||||||
| `q` | event id (hex) | relay URL | [18](18.md) |
|
| `q` | event id (hex) | relay URL, pubkey (hex) | [18](18.md) |
|
||||||
| `r` | a reference (URL, etc) | -- | [24](24.md), [25](25.md) |
|
| `r` | a reference (URL, etc) | -- | [24](24.md), [25](25.md) |
|
||||||
| `r` | relay url | marker | [65](65.md) |
|
| `r` | relay url | marker | [65](65.md) |
|
||||||
| `t` | hashtag | -- | [24](24.md), [34](34.md) |
|
| `t` | hashtag | -- | [24](24.md), [34](34.md) |
|
||||||
| `alt` | summary | -- | [31](31.md) |
|
| `alt` | summary | -- | [31](31.md) |
|
||||||
| `amount` | millisatoshis, stringified | -- | [57](57.md) |
|
| `amount` | millisatoshis, stringified | -- | [57](57.md) |
|
||||||
| `bolt11` | `bolt11` invoice | -- | [57](57.md) |
|
| `bolt11` | `bolt11` invoice | -- | [57](57.md) |
|
||||||
| `challenge` | challenge string | -- | [42](42.md) |
|
| `challenge` | challenge string | -- | [42](42.md) |
|
||||||
| `client` | name, address | relay URL | [89](89.md) |
|
| `client` | name, address | relay URL | [89](89.md) |
|
||||||
| `clone` | git clone URL | -- | [34](34.md) |
|
| `clone` | git clone URL | -- | [34](34.md) |
|
||||||
| `content-warning` | reason | -- | [36](36.md) |
|
| `content-warning` | reason | -- | [36](36.md) |
|
||||||
| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) |
|
| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) |
|
||||||
| `description` | description | -- | [34](34.md), [57](57.md), [58](58.md) |
|
| `description` | description | -- | [34](34.md), [57](57.md), [58](58.md) |
|
||||||
| `emoji` | shortcode, image URL | -- | [30](30.md) |
|
| `emoji` | shortcode, image URL | -- | [30](30.md) |
|
||||||
| `encrypted` | -- | -- | [90](90.md) |
|
| `encrypted` | -- | -- | [90](90.md) |
|
||||||
| `expiration` | unix timestamp (string) | -- | [40](40.md) |
|
| `expiration` | unix timestamp (string) | -- | [40](40.md) |
|
||||||
| `goal` | event id (hex) | relay URL | [75](75.md) |
|
| `goal` | event id (hex) | relay URL | [75](75.md) |
|
||||||
| `image` | image URL | dimensions in pixels | [23](23.md), [52](52.md), [58](58.md) |
|
| `image` | image URL | dimensions in pixels | [23](23.md), [52](52.md), [58](58.md) |
|
||||||
| `imeta` | inline metadata | -- | [92](92.md) |
|
| `imeta` | inline metadata | -- | [92](92.md) |
|
||||||
| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) |
|
| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) |
|
||||||
| `location` | location string | -- | [52](52.md), [99](99.md) |
|
| `location` | location string | -- | [52](52.md), [99](99.md) |
|
||||||
| `name` | name | -- | [34](34.md), [58](58.md), [72](72.md) |
|
| `name` | name | -- | [34](34.md), [58](58.md), [72](72.md) |
|
||||||
| `nonce` | random | difficulty | [13](13.md) |
|
| `nonce` | random | difficulty | [13](13.md) |
|
||||||
| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) |
|
| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) |
|
||||||
| `price` | price | currency, frequency | [99](99.md) |
|
| `price` | price | currency, frequency | [99](99.md) |
|
||||||
| `proxy` | external ID | protocol | [48](48.md) |
|
| `proxy` | external ID | protocol | [48](48.md) |
|
||||||
| `published_at` | unix timestamp (string) | -- | [23](23.md) |
|
| `published_at` | unix timestamp (string) | -- | [23](23.md) |
|
||||||
| `relay` | relay url | -- | [42](42.md), [17](17.md) |
|
| `relay` | relay url | -- | [42](42.md), [17](17.md) |
|
||||||
| `relays` | relay list | -- | [57](57.md) |
|
| `relays` | relay list | -- | [57](57.md) |
|
||||||
| `server` | file storage server url | -- | [96](96.md) |
|
| `server` | file storage server url | -- | [96](96.md) |
|
||||||
| `subject` | subject | -- | [14](14.md), [17](17.md), [34](34.md) |
|
| `subject` | subject | -- | [14](14.md), [17](17.md), [34](34.md) |
|
||||||
| `summary` | summary | -- | [23](23.md), [52](52.md) |
|
| `summary` | summary | -- | [23](23.md), [52](52.md) |
|
||||||
| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) |
|
| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) |
|
||||||
| `title` | article title | -- | [23](23.md) |
|
| `title` | article title | -- | [23](23.md) |
|
||||||
| `web` | webpage URL | -- | [34](34.md) |
|
| `web` | webpage URL | -- | [34](34.md) |
|
||||||
| `zap` | pubkey (hex), relay URL | weight | [57](57.md) |
|
| `zap` | pubkey (hex), relay URL | weight | [57](57.md) |
|
||||||
|
|
||||||
Please update these lists when proposing new NIPs.
|
Please update these lists when proposing new NIPs.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user