mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-10-01 06:55:46 -04:00
2.4 KiB
2.4 KiB
Sending an invitation
- Generate writer keypair to share with new contact
- Encrypt secret with requested encryption type
- Create Local Chat DHT record (no content yet, will be encrypted with DH of contact identity key)
- Create ContactRequestPrivate and encrypt with the writer secret
- Create ContactRequest and embed possibly encrypted ContactRequestPrivate
- Create DHT unicast inbox for ContactRequest and store ContactRequest in owner subkey
- Create ContactInvitation and add invitation record to local table
- Create SignedContactInvitation embedding ContactInvitation
- Render SignedContactInvitation to shareable encoding (qr code, text blob, etc)
- Share SignedContactInvitation out of band to desired contact, along with password somehow if used
Receiving an invitation
- Receive SignedContactInvitation from out of band, and the password somehow if used
- Get the ContactRequest record unicastinbox DHT record owner subkey from the network
- Decrypt the writer secret with the password if necessary
- Decrypt the ContactRequestPrivate chunk with the writer secret
- Get the contact's AccountMaster record key
- Verify identity signature on the SignedContactInvitation
- Verify expiration
- Display the profile and ask if the user wants to accept or reject the invitation
Accepting an invitation
- Create a Local Chat DHT record (no content yet, will be encrypted with DH of contact identity key)
- Create ContactAccept with chat dht record and account master
- Create SignedContactResponse with accept=true signed with identity
- Set ContactRequest unicastinbox DHT record writer subkey with SignedContactResponse, encrypted with writer secret
- Add a local contact with the remote chat dht record, updating from the remote profile in it
Rejecting an invitation
- Create ContactReject with account master
- Create SignedContactResponse with accept=false signed with identity
- Set ContactRequest unicastinbox DHT record writer subkey with SignedContactResponse, encrypted with writer secret
Receiving an accept/reject
- Decrypt with writer secret
- Get DHT record for contact's AccountMaster
- Validate the SignedContactResponse signature
If accept == false:
- Announce rejection
- Delete local invitation from table
If accept == true:
- Add a local contact with the remote chat dht record, updating from the remote profile in it.
- Delete local invitation from table