veilidchat/doc/invitations.md

52 lines
2.6 KiB
Markdown
Raw Normal View History

2023-07-29 15:27:35 -04:00
## Sending an invitation
1. Generate writer keypair to share with new contact
2. Encrypt secret with requested encryption type
3. Create Local Chat DHT record (no content yet, will be encrypted with DH of contact identity key)
4. Create ContactRequestPrivate and encrypt with the writer secret
2023-08-02 21:09:28 -04:00
5. Create ContactRequest and embed encrypted ContactRequestPrivate
2023-07-29 15:27:35 -04:00
6. Create DHT unicast inbox for ContactRequest and store ContactRequest in owner subkey
2023-08-02 21:09:28 -04:00
7. Create ContactInvitation
2023-07-29 15:27:35 -04:00
8. Create SignedContactInvitation embedding ContactInvitation
2023-08-02 21:09:28 -04:00
9. Create ContactInvitationRecord and add to local table in Account
10. Render SignedContactInvitation to shareable encoding (qr code, text blob, etc)
11. Share SignedContactInvitation out of band to desired contact, along with password somehow if used
2023-07-29 15:27:35 -04:00
## Receiving an invitation
1. Receive SignedContactInvitation from out of band, and the password somehow if used
2. Get the ContactRequest record unicastinbox DHT record owner subkey from the network
3. Decrypt the writer secret with the password if necessary
4. Decrypt the ContactRequestPrivate chunk with the writer secret
5. Get the contact's AccountMaster record key
6. Verify identity signature on the SignedContactInvitation
7. Verify expiration
8. Display the profile and ask if the user wants to accept or reject the invitation
## Accepting an invitation
1. Create a Local Chat DHT record (no content yet, will be encrypted with DH of contact identity key)
2023-08-05 13:50:31 -04:00
2. Create ContactResponse with chat dht record and account master
2023-07-29 15:27:35 -04:00
3. Create SignedContactResponse with accept=true signed with identity
4. Set ContactRequest unicastinbox DHT record writer subkey with SignedContactResponse, encrypted with writer secret
5. Add a local contact with the remote chat dht record, updating from the remote profile in it
## Rejecting an invitation
2023-08-05 13:50:31 -04:00
1. Create ContactResponse with account master
2023-07-29 15:27:35 -04:00
2. Create SignedContactResponse with accept=false signed with identity
3. Set ContactRequest unicastinbox DHT record writer subkey with SignedContactResponse, encrypted with writer secret
## Receiving an accept/reject
2023-08-05 21:01:27 -04:00
1. Open and get SignedContactResponse from ContactRequest unicastinbox DHT record
2023-08-05 19:34:00 -04:00
2. Decrypt with writer secret
3. Get DHT record for contact's AccountMaster
4. Validate the SignedContactResponse signature
2023-07-29 15:27:35 -04:00
If accept == false:
1. Announce rejection
2. Delete local invitation from table
2023-08-05 21:01:27 -04:00
3. Overwrite and delete ContactRequest inbox
2023-07-29 15:27:35 -04:00
If accept == true:
1. Add a local contact with the remote chat dht record, updating from the remote profile in it.
2. Delete local invitation from table
2023-08-05 21:01:27 -04:00
3. Overwrite and delete ContactRequest inbox