Hi Jeff. About message encryption, Nostrat fully reuses the Signal protocol (X3DH + double ratchet) and reuses libsignal.
First, let's return to the mechanism of the Signal app. The Signal app uses phone numbers as user IDs. When Alice downloads the Signal app and knows Bob's phone number, she adds Bob as a Signal friend by entering Bob's phone number in the Signal app. The Signal server then returns the following data associated with Bob's phone number:
Bob's identity key IKB,
Bob's signed prekey SPKB,
Bob's prekey signature Sig(IKB, Encode(SPKB)),
(Optionally) Bob's one-time prekey OPKB.
Alice then combines this with her own identity key IKA and her ephemeral key EKA to complete the X3DH operation, and then initiates the double ratchet algorithm to start encrypting messages. When Bob receives the message, he can also initiate the double ratchet to decrypt the message.
Let's now assume that Alice and Bob have both downloaded Keychat and want to communicate using it. Bob displays his QR code, which contains his Nostr key and Signal-related keys. Alice scans it. Alice can then complete the X3DH operation and start the double ratchet encryption. It can be said that Keychat, unlike Signal, does not use a server to pass the related Signal keys. Keychat treats the Nostr key as a phone number. If Alice only knows Bob’s Nostr key, she can send a special NIP4 message to retrieve Bob’s related Signal keys.
>>Keychat fully reuse signal protocol.
Sure that all makes sense. I just wrote NIP-104 basically codifying that into the spec. Just curious how your implementation is done. Is your code open source somewhere? Would love to have a look.
Have you looked into syncing on multiple devices yet?
Code will be released soon.
Keychat doesn’t support syncing on multiple devices. Every device has its own ID. And those devices can communicate through group chat.
It’s very hard to support syncing for double ratchet algorithm. More difficult in conditions there is no coordination server.
yeah! it's tricky. if you want ot work on figuring out all the details together I'm currently working on adapting the Signal sesame protocol to make it work for Nostr.