signal-golang / textsecure

TextSecure(signal) client package for Go
GNU General Public License v3.0
57 stars 26 forks source link

Library doesn't work with current Signal Desktop #13

Closed selfbc closed 4 years ago

selfbc commented 4 years ago

Looks like due to envelope timestamps, the messages from this library don't show up with Signal Desktop version 1.32.0 and above. I tested with the CLI client to confirm. I can give more information from Signal Desktop commits if needed.

nanu-c commented 4 years ago

I think it's a duplicate of https://github.com/nanu-c/axolotl/issues/110

nanu-c commented 4 years ago

i would love it if you find the reason. I thought that textsecure isn't sending the messages to the linked devices and signal server doesn't forward it.

selfbc commented 4 years ago

If this helps, it's from this commit: signalapp/Signal-Desktop@7ca0dfd#diff-0b3c72f8fa053c9f175d037847bb9b32R124

I can give more information as needed.

morph027 commented 4 years ago

noticed this too this week:

signal[181]: time="2020/04/06 17:47:24" level=debug msg="[textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1586188043845}\n"
selfbc commented 4 years ago

Yes, the library no longer works with Signal Desktop as of 1.32.0 due to these changes.

nanu-c commented 4 years ago

timestamp is currently set here https://github.com/signal-golang/textsecure/blob/306535efb3d80b9a5d4b973e269b6c644cdaf118/server.go#L704-L808 and doesn't respect the envelope timestamp. We have to rebuild the message with the correct timestamp

selfbc commented 4 years ago

Looks like the API document hasn't been updated since 2014 - https://github.com/signalapp/Signal-Server/wiki/API-Protocol

WanderingGlitch commented 4 years ago

For what it's worth, modifying the check at https://github.com/signalapp/Signal-Desktop/blob/37ad95af2735f18ed33e9cc5808adae05d542bba/libtextsecure/message_receiver.js#L1378 shows that the envelope does have a timestamp but that the decrypted message does not.

Additionally, commenting out these lines in Signal Desktop allows messages to be received (including the queued ones that haven't been successfully processed): https://github.com/signalapp/Signal-Desktop/blob/37ad95af2735f18ed33e9cc5808adae05d542bba/libtextsecure/message_receiver.js#L1378-L1389

From what I can tell, createMessage needs to set the timestamp in the DataMessage and buildAndSendMessage needs to use the same value

nanu-c commented 4 years ago

Will do that later that week, maybe this evening :)

nanu-c commented 4 years ago

fixed in 6c66a38d5a81341d189e0425698ab022501189c1

morph027 commented 4 years ago

Jip, confirmed working, thank you! :heart:

selfbc commented 4 years ago

Everything is going good on my end. Thanks for the speedy work!

nanu-c commented 4 years ago

We can continue to solve the remaining problems that way. If someone does the research in the original signal sources, then it's way more easy for me to provide a solution