Skip to content

Commit

Permalink
Update nip 87 to use 10024 address as group id
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Staab committed Oct 19, 2023
1 parent f5b300b commit 3114383
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions 87.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,24 @@ For example, if a kind 1 is sent by `a` to a key derived from `a`'s private key

## Admin key

Groups are defined by a dedicated pubkey, which allows a group to post as an entity in its own right. Key management can be accomplished the same way it would be for a regular account.
Groups are bootstrapped using a dedicated pubkey called the "admin key", and identified by the address of the admin's replaceable 10024 event (regardless of whether it has been published).

This dedicated key will be referred to below as the "admin key", and is used for performing privileged actions, such as publishing group metadata and key rotations.
This key is used for performing privileged actions, such as publishing group metadata and key rotations. Non-administrative events MAY be published to the group by the admin.

## Shared key

Distinct from the admin key, a shared key is generated and shared with group members. Posession of a shared key constitutes membership in the group. The shared key allows group members to post to the group and decrypt group messages.

When posting to the group as a member, events MUST follow this scheme: `any:author shared_key->[shared_key]`.
When posting to the group, events MUST follow this scheme: `any:author shared_key->[shared_key]`.

When posting to the group as an admin, events MUST follow this scheme: `any:admin_key shared_key->[shared_key]`.

New members are invited using this scheme: `24:admin_key ?->[recipient]`. Multiple events are sent, each addressed to a single invitee directly. The rumor's `tags` MUST contain a single `privkey` tag containing the shared key and SHOULD contain one or more `r` tags to help clients find group messages. It MAY also include any number of `p` tags to help clients build member lists.
New members are invited using this scheme: `24:admin_key ?->[recipient]`. Multiple events are sent, each addressed to a single invitee directly. The rumor's `tags` MUST contain a single `shared_key` tag containing the shared key and SHOULD contain one or more `r` tags to help clients find group messages. It MAY also include any number of `p` tags to help clients build member lists.

```json
{
"kind": 24,
"content": "Just a regular key rotation, nothing to worry about, we definitely didn't leak a key",
"tags": [
["privkey", "<new shared key>"],
["shared_key", "<new shared key>"],
["r", "wss://some-relay.com"],
["p", "<pubkey>"],
["p", "<pubkey>"]
Expand All @@ -70,7 +68,7 @@ New members are invited using this scheme: `24:admin_key ?->[recipient]`. Multip

To rotate the shared key, the admin must publish a new `24:admin_key ?->[recipient]` to each group member as described above. A `grace_period` tag MAY be included on the inner event indicating how many seconds after the new event's `created_at` timestamp previous keys are valid. This invalidates previous keys and replaces them with a new shared key.

An `expiration` tag (defined by NIP-40) MAY be included on the wrapper to support a weak form of forward secrecy (weak, since it relies on relays to delete the event). This can reduce the impact of a member's private key being leaked, which could otherwise expose old shared keys and messages addressed to those keys to the attacker.
An `expiration` tag (defined by NIP-40) MAY be included on the wrapper to support a weak form of forward secrecy (weak, since it relies on relays to delete the event). This can reduce the impact of a member's private key being leaked, which could otherwise expose old shared keys and messages addressed to those keys.

If new members are added when a key rotation occurs, the group admin SHOULD re-publish any private `10024` or `10025` events using the new shared key so that new members have access to metadata for the group.

Expand All @@ -86,7 +84,7 @@ Anyone may request access to a group using a `25:author ?->[admin_key]`. The rum
}
```

If the admin chooses to admit the new member, they may choose one of the following:
If the admin chooses to admit the new member, clients may do one of the following:

- Inititate a new key rotation in order to prevent the new member from seeing any group history.
- Re-send the most recent `kind 24` event to the new member, granting access to all messages since the most recent key rotation.
Expand All @@ -107,7 +105,7 @@ This event is sent to the group rather than the admin so that group members (inc

## Members Added Notifications

When a key rotation is performed, the admin MAY publish a `27:admin_key shared_key->[shared_key]` with a `p` tag for each member in the group. The rumor MUST be addressed to the **new** shared key. This helps people build member lists and know what groups they are a part of. If the member list is very large, multiple events MAY be published with the same key, each with a subset of `p` tags.
When a key rotation is performed, the admin MAY publish a `27:admin_key shared_key->[shared_key]` with a `p` tag for each member in the group. The event MUST be addressed to the **new** shared key. This helps people build member lists and know what groups they are a part of. If the member list is very large, multiple events MAY be published with the same key, each with a subset of `p` tags.

```json
{
Expand Down Expand Up @@ -165,7 +163,7 @@ Group metadata may be published using a `kind 10024` event. `content` MUST be a
}
```

Whether a `kind 10024` exists or not, the corresponding naddr is the canonical way to refer to the group for sharing purposes, rather than pubkey alone. This is to avoid confusion with user pubkeys.
Whether a `kind 10024` exists or not, the corresponding event address is the canonical way to refer to the group for sharing purposes, rather than pubkey alone. This is to avoid confusion with user pubkeys.

## Moderator lists

Expand All @@ -185,7 +183,7 @@ Members MAY use moderator lists to inform what `kind 1985` opinions to follow. A

## Anonymous membership

To post to a group, you must reveal your public key, doxxing yourself to all other members of a group, all of whom are able in turn to reveal your identity outside the group. To avoid this, users may join groups anonymously by generating a new keypair separate from their primary key. They may then publish an alternative kind0 to the group to maintain a different. Clients should help users to manage their alternative key using an appropriate strategy.
To post to a group, you must reveal your public key, doxxing yourself to all other members of a group, all of whom are able in turn to reveal your identity outside the group. To avoid this, users may join groups anonymously by generating a new keypair separate from their primary key. They may then publish an alternative kind0 to the group to maintain a different identity. Clients should help users to manage their alternative key using an appropriate strategy.

## Always-on admin key

Expand Down

0 comments on commit 3114383

Please sign in to comment.