From 4fc1037dfb7e95fc11e851d2907e5289d3c2224d Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Wed, 14 Jun 2023 15:47:20 -0300 Subject: [PATCH] Add NIP-35 - Member List --- 35.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 35.md diff --git a/35.md b/35.md new file mode 100644 index 00000000..b84a12ce --- /dev/null +++ b/35.md @@ -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 `::` if PRE or `:` if replaceable or `` if regular event; +- `k` tag as `` 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": "", + "kind": 34549, + "tags": [ + ["d", "f39e9b451a73d62abc5016cffdd294b1a904e2f34536a208874fe5e22bbd47cf"], + ["k", "40"], + ["status", "Feeling gOoOod"] + ["expiration", ""] + ], + "content": "{}" + "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"