CCN Invitation Event

Signed-off-by: dannym <danny@arx-ccn.com>
This commit is contained in:
Danny Morabito 2025-04-16 21:33:00 +00:00
commit ccbb1fa262

View file

@ -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": <unix timestamp in seconds>,
"kind": 9999,
"tags": [
["i", "<sha512 hash of the invite code>"]
],
"content": "",
"sig": "<64-byte hex string>"
}
```
## Tag Specifications
| Tag | Value | Description |
|-----|-------|-------------|
| i | `<sha512 hash of the invite code>` | 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