mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-23 17:05:51 -05:00
Add NIP-35 - Member List
This commit is contained in:
parent
3331b5610c
commit
4fc1037dfb
81
35.md
Normal file
81
35.md
Normal file
|
@ -0,0 +1,81 @@
|
|||
NIP-35
|
||||
======
|
||||
|
||||
Member List
|
||||
-----------
|
||||
|
||||
`draft` `optional` `author:arthurfranca`
|
||||
|
||||
Groups, channels, communities and the like may use status events
|
||||
to dynamically build a member list.
|
||||
|
||||
## Motivation
|
||||
|
||||
An user may never send a message to a group but still want
|
||||
to be on a group member list for receiving DMs.
|
||||
|
||||
Also one may want to discover his friends' groups.
|
||||
|
||||
## Status Event
|
||||
|
||||
It is a kind `34549` parameterized replaceable event (PRE) with:
|
||||
- `d` tag is a reference to the group creation event as `<kind>:<pubkey>:<d-identifier>` if PRE or `<kind>:<pubkey>` if replaceable or `<event id>` if regular event;
|
||||
- `k` tag as `<group creation event kind>` for discoverability;
|
||||
- optional `status` tag (see ["Custom Status" section](#custom-status));
|
||||
- [NIP-40](40.md) `expiration` tag that should be 60 days ahead of the `created_at` tag value;
|
||||
- `.content` as stringified author kind 0 event JSON for fast lookup.
|
||||
|
||||
The event should be replaced by clients from time to time
|
||||
(lower than 10 min window - see ["Basic Status" section](#custom-status)),
|
||||
for example every 7 minutes the user is browsing a group.
|
||||
|
||||
If the `created_at` tag age (`now - created_at`) is higher than 10 minutes,
|
||||
the client should consider the `.content` stale for important things such as zap address.
|
||||
|
||||
|
||||
```js
|
||||
{
|
||||
"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": 34549,
|
||||
"tags": [
|
||||
["d", "f39e9b451a73d62abc5016cffdd294b1a904e2f34536a208874fe5e22bbd47cf"],
|
||||
["k", "40"],
|
||||
["status", "Feeling gOoOod"]
|
||||
["expiration", "<Unix timestamp in seconds>"]
|
||||
],
|
||||
"content": "{<author kind 0 JSON>}"
|
||||
"sig": "<64-bytes hex of the signature of the sha256 hash of the serialized event data>"
|
||||
}
|
||||
```
|
||||
|
||||
## Basic Status
|
||||
|
||||
Basic status don't rely on `status` tags.
|
||||
Clients find out the user status by the following rules regarding status event's `created_at` age:
|
||||
|
||||
| Age | Status |
|
||||
| -------------------------------------- | ------------------------------ |
|
||||
| (now - created_at) < 0 | *invalid status, not a member* |
|
||||
| 0 <= (now - created_at) < 10min | online |
|
||||
| 10 min <= (now - created_at) < 30 min | away |
|
||||
| 30 min <= (now - created_at) < 5 days | offline |
|
||||
| 5 days <= (now - created_at) < 60 days | inactive |
|
||||
| 60 days <= (now - created_at)` | *not a member* |
|
||||
|
||||
An user is invisible if it deletes the status event or had never published it.
|
||||
Invisible should be the default status when joining (browsing) a group.
|
||||
|
||||
## Custom Status
|
||||
|
||||
Clients can choose to support extra custom status that may override the basic ones
|
||||
by using `status` tags; even multiple `status` tags at once.
|
||||
|
||||
The following are the standardized `status` tag values:
|
||||
- "online"
|
||||
- "away"
|
||||
- "offline"
|
||||
- "inactive"
|
||||
- "busy"
|
||||
- "free-for-chat"
|
Loading…
Reference in New Issue
Block a user