@Dan Are you building keychat? If so, I'd love to chat with you abot how you're implementing the Signal protocol. I have an open PR on the NIPs repo right now to bring Signal like double ratchest to Nostr.

Replies (1)

Keychat's avatar
Keychat 1 year ago
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.