mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-12-18 04:24:29 -05:00
2.6 KiB
2.6 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 encrypted ContactRequestPrivate
- Create DHT unicast inbox for ContactRequest and store ContactRequest in owner subkey
- Create ContactInvitation
- Create SignedContactInvitation embedding ContactInvitation
- Create ContactInvitationRecord and add to local table in Account
- 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 ContactResponse 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 ContactResponse 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
- Open and get SignedContactResponse from ContactRequest unicastinbox DHT record
- 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
- Overwrite and delete ContactRequest inbox
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
- Overwrite and delete ContactRequest inbox