Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2acbd64
Add Private DM
arthurfranca Jan 9, 2024
13177b2
Add info about where to publish events
arthurfranca Jan 9, 2024
43fe354
Add chat session confirmation event
arthurfranca Jan 9, 2024
49d1f73
Change wording from confirm to accept
arthurfranca Jan 9, 2024
d8e8ec1
Minor update
arthurfranca Jan 10, 2024
dc7ac14
Change dm status kind numbers
arthurfranca Jan 17, 2024
7e9083d
Rename session-privkey-A to session-privkey
arthurfranca Jan 17, 2024
d1f2199
Explain conversation keys generation
arthurfranca Jan 17, 2024
d5baa6e
Use descending order when resolving session conflict
arthurfranca Jan 18, 2024
f9921e6
Fix sealing arg when encrypting
arthurfranca Jan 29, 2024
ae1e3a6
Move the session acceptance rumor to the session channel
arthurfranca Jan 29, 2024
84dff71
Change from salt suffix to full salt
arthurfranca Feb 4, 2024
e732e56
Add AUTH suggestion
arthurfranca Feb 5, 2024
1ed44ba
Add summary flow
arthurfranca Feb 6, 2024
1d421b4
Minor fix
arthurfranca Feb 6, 2024
f50c650
Remove min PoW requirement
arthurfranca Feb 6, 2024
46ad13c
Add rate limit
arthurfranca Feb 6, 2024
1415d76
Expirement using private kind range
arthurfranca Feb 14, 2024
6ddce9f
Move rumor kinds to numbers no one is using
arthurfranca Feb 20, 2024
dbaa40d
Ditch private event kinds
arthurfranca Mar 8, 2024
f86bb32
Add closing rumor
arthurfranca Mar 19, 2024
40342cc
Detect when new device is used
arthurfranca Mar 20, 2024
2255a5c
Use lid_proof tag on LID Tracker event
arthurfranca Mar 22, 2024
995ee77
Remove PoW
arthurfranca Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Expirement using private kind range
  • Loading branch information
arthurfranca committed Feb 14, 2024
commit 1415d76c23a280962b78afdbbb6c132bd253b3bd
27 changes: 16 additions & 11 deletions 43.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,19 @@ when sending new DMs.

## Chat Session

The "Chat Session Envelope" is a [NIP-59](59.md) gift wrap event but with a specific kind: `1043`.
The "Chat Session Envelope" is a regular [NIP-59](59.md) gift wrap event but with a specific kind: `40043`.

The NIP-44 encryption when wrapping use the random author's privkey and the recipient's pubkey to generate the conversation key (CK).
When sealing the encryption uses the main sender's privkey and the recipient's pubkey.
Both encryptions use the default salt to generate the CK.

It MAY include [NIP-13](13.md) PoW.
Relays MAY block it if below a PoW difficulty such as if less than 16.
Relays MAY require increasing PoW difficulty the more `kind:1043` events are sent to the same pubkey in a short time.
Relays MAY require increasing PoW difficulty the more `kind:40043` events are sent to the same pubkey in a short time.
Relays SHOULD block it if of byte size higher than 3KB.
Relays SHOULD limit the rate at which `kind:1043` events are published with the same `p` tag per client IP.
Relays SHOULD limit the rate at which `kind:40043` events are published with the same `p` tag per client IP.

It has a `p` tag set to the recipient's pubkey.
Relays SHOULD require users to [NIP-42](42.md) `AUTH` as the `p` tagged pubkey when requesting the event.
It has a [NIP-42](42.md) `A` tag and a `p` tag both set to the recipient's pubkey.

The NIP-59 rumor is a `kind:1044` "Chat Session Request" event.
It's `.content` is the session's privkey.
Expand All @@ -66,11 +65,13 @@ Event example:

```js
{
"kind": 1043,
"kind": 40043,
"pubkey": "<random-pubkey>",
"tags": [
["d", "<random>"],
["A", "<pubkey-B>"],
["p", "<pubkey-B>"],
["nonce", "65962", "16"] // atleast 16 PoW difficulty
["nonce", "65962", "16"]
],
"content": "<nip44EncryptV2(JSON.stringify({
"kind": 13, // seal
Expand All @@ -95,7 +96,7 @@ Event example:

## Chat Session List

The [NIP-51](51.md) `kind:10043` is the user's "Chat Session List" event.
The replaceable [NIP-51](51.md) `kind:40143` is the user's "Chat Session List" event.

It encrypts `s` (session) tags using the author's own keypair with default salt
as arguments to generate the NIP-44 conversation key.
Expand All @@ -109,16 +110,20 @@ The 4th value if present is set to "1", meaning the other chat participant accep

`s` tags of expired sessions should be kept to indicate active chats.

Relays SHOULD require users to [NIP-42](42.md) `AUTH` as the event author when requesting the event.
It has a NIP-42 `A` tag set to the event author's pubkey.

The user should publish the event to all of their own NIP-65 `write` relays.

Event example:

```js
{
"kind": 10043,
"pubkey": "<pubkey-B>"
"kind": 40143,
"pubkey": "<pubkey-B>",
"tags: [
["d", ""], // empty string
["A", "<pubkey-B>"]
]
"content": "<nip44EncryptV2(JSON.stringify([
["s", "<pubkey-A>", "<session-privkey>", "1704525400", "1"],
// other "s" tags
Expand Down