This commit is contained in:
fiatjaf 2025-10-08 09:52:21 +00:00
parent db85e13a58
commit 5de76542c3
1 changed files with 7 additions and 7 deletions

14
4e.md
View File

@ -40,9 +40,9 @@ There are probably other advantages to not tying the user's identity to the keys
}
```
5. Now **Bob** (keypairs `(b, B)`) will send a DM to **Alice**. Because Bob's client fetched Alice's `kind:10044` event, instead of computing the conversation key with `ecdh(b, A)` he does `ecdh(b, E) = S`
6. Because Alice knows `e` Alice can decrypt Bob's message doing `ecdh(e, B) = S` and all is good
7. Now the fun part starts: Alice has decided to use a client called **Tortilla** to chat on her phone, and **Tortilla* wants to do encryption stuff.
5. Now **Bob** (keypair `(b, B)`) will send a DM to **Alice**. Because Bob's client fetched Alice's `kind:10044` event, instead of computing the conversation key with `ecdh(b, A)` he does `ecdh(b, E) = S`
6. Because Alice knows `e`, she can decrypt Bob's message doing `ecdh(e, B) = S` and all is good
7. Now the fun part starts: Alice has decided to use a client called **Tortilla** to chat on her phone, and **Tortilla** wants to do encryption stuff.
8. **Tortilla** sees that Alice has a `kind:10044` published, which means **Tortilla** won't create a new key, **Tortilla** will have to ask for **Cope** to share that key securely. So **Tortilla** generates a local keypair `(t, T)` that won't be shown or leave the device ever, and **Tortilla** publishes an announcement (`kind:4454`) for that local key (signed by Alice):
```jsonc
@ -56,22 +56,22 @@ There are probably other advantages to not tying the user's identity to the keys
}
```
9. **Tortilla** cannot proceed without known the secret key `e`, so it has to tell the user to turn **Cope** on.
9. **Tortilla** cannot proceed without knowing the secret key `e`, so it has to tell the user to turn **Cope** on.
10. Alice opens up **Cope** and **Cope** immediately looks for all `kind:4454` events from Alice, and sees that there is this app called "Tortilla on Android" signed by Alice herself, so **Cope** publishes the secret key `e` nip44-encrypted to `ecdh(c, T)` -- in which `c` is the secret key of a keypair that **Cope** has just generated locally. **Cope** does that using a new event, `kind:4455`:
```jsonc
{
"kind": 4455,
"pubkey": "<A>"
"pubkey": "<A>",
"tags": [
["P", "<C>"]
["P", "<C>"],
["p", "<T>"]
],
"content": "<nip44(content=e, conversationkey=get_conversation_key(c, T))>"
}
```
12. Immediately **Tortilla** wakes up and sees the `kind:4455` that had just been published by **Cope**, decrypts the content using `ecdh(t, C)` and now **Tortilla** also knows the secret key `e`. **Tortilla** can now decrypt and encrypt the same things **Cope** could before.
11. Immediately **Tortilla** wakes up and sees the `kind:4455` that has just been published by **Cope**, decrypts the content using `ecdh(t, C)` and now **Tortilla** also knows the secret key `e`. **Tortilla** can now decrypt and encrypt the same things **Cope** could before.
### The protocol flow again, now in a colorful infographic