From ccbb1fa262715c1c8a989e85efdf334116456015 Mon Sep 17 00:00:00 2001 From: dannym Date: Wed, 16 Apr 2025 21:33:00 +0000 Subject: [PATCH] CCN Invitation Event Signed-off-by: dannym --- kinds/9999 - CCN Invitation.md | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 kinds/9999 - CCN Invitation.md diff --git a/kinds/9999 - CCN Invitation.md b/kinds/9999 - CCN Invitation.md new file mode 100644 index 0000000..0123c79 --- /dev/null +++ b/kinds/9999 - CCN Invitation.md @@ -0,0 +1,48 @@ +# Kind 9999: CCN Invitation + +## Description +Kind 9999 is used for invitation codes to join a CCN. This event type facilitates a secure invitation process where a CCN member can generate and broadcast an invitation code that can be used by potential one-time new members to join the network. + +## Event Structure + +```json +{ + "id": "<32-byte hex string>", + "pubkey": "<32-byte hex string>", + "created_at": , + "kind": 9999, + "tags": [ + ["i", ""] + ], + "content": "", + "sig": "<64-byte hex string>" +} +``` + +## Tag Specifications + +| Tag | Value | Description | +|-----|-------|-------------| +| i | `` | The SHA-512 hash of the randomly generated 32-byte invite code | + +## Workflow + +1. A CCN member generates a random 32-byte invite code +2. The member broadcasts a kind 9999 event with the SHA-512 hash of the invite code in the "i" tag +3. The invitee receives the invite code (typically via QR code or direct message) +4. The invitee generates their nsec (private key) +5. The invitee sends a direct message to the CCN with their invite code +6. Upon receipt of a message where the SHA-512 hash matches a valid invite code, the CCN (actioned by the inviter only) broadcasts an accept invite event +7. The CCN (actioned by the inviter only) sends the CCN seed to the invitee via direct message +8. The CCN invalidates the used invite code + +## Invite Code Format + +The invite code is encoded as a bech32m string with the prefix "eveinvite" and contains: +- The CCN's npub (32 bytes) +- The random invite code (32 bytes) + +## References + +* NIP-01: Basic protocol flow description +* NIP-17: Private Direct Messages \ No newline at end of file