signal-golang / textsecure

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

Unable to send messages using latest build #31

Open morph027 opened 3 years ago

morph027 commented 3 years ago

I've just rebuild the signal commandline binary using the latest build and can't send messages.

The log says:

INFO[2021/01/24 20:39:56] Registration done.                           
DEBU[2021/01/24 20:39:56] [textsecure] missing my uuid defer           
DEBU[2021/01/24 20:39:56] [textsecure] get my uuid                     
DEBU[2021/01/24 20:39:57] [textsecure] GET /v1/accounts/whoami 200     
DEBU[2021/01/24 20:39:57] [textsecure] PUT /v1/messages/+.... 409 
DEBU[2021/01/24 20:39:57] [textsecure] Mismatched devices: {MissingDevices:[2] ExtraDevices:[]} 
DEBU[2021/01/24 20:39:57] [textsecure] PUT /v1/messages/+.... 200 
DEBU[2021/01/24 20:39:57] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1611517197065}

The mobile phone only says "Unterhaltungssitzung aktualisert"

signal-2021-01-24-204355

nanu-c commented 3 years ago

that's because signal is starting to disable sending message by phone number and also you can't get the public key anymore: PUT /v1/messages/+.... 409

Therefore i am writing the support for the contact discovery service.

nanu-c commented 3 years ago

To fetch the uuid and then send the message to the uuid. With that latest version, try to reset the conversation, then textsecure gets the uuid

nanu-c commented 3 years ago

try this branch: https://github.com/signal-golang/textsecure/tree/new_contacts

morph027 commented 3 years ago

Ah, okay. Just had a quick look into the branch already. Will try and let you know. As always, thanks for the work!!

bertwesarg commented 3 years ago

One, question though. I use the CLI for 2FA with Nextcloud. Do you have an ETA, when the sending by number wont work anymore without your #27?

morph027 commented 3 years ago

compiled w/ new_contacts branch:

INFO[2021/01/25 08:48:41] Registration done.                           
DEBU[2021/01/25 08:48:41] [textsecure] missing my uuid defer           
DEBU[2021/01/25 08:48:41] [textsecure] get my uuid                     
DEBU[2021/01/25 08:48:42] GET /v1/accounts/whoami 200                  
DEBU[2021/01/25 08:48:42] GET /v1/directory/auth 200                   
DEBU[2021/01/25 08:48:42] [textsecure] getCredentials                  
DEBU[2021/01/25 08:48:42] [textsecure] GetAndVerifyMultiRemoteAttestation 
DEBU[2021/01/25 08:48:43] [textsecure] PUT /v1/attestation/xxx 200 
DEBU[2021/01/25 08:48:43] [textsecure] GetAndVerifyMultiRemoteAttestation key  
DEBU[2021/01/25 08:48:43] [textsecure] validateAndBuildRemoteAttestation  <nil> 
DEBU[2021/01/25 08:48:43] [textsecure] GetRegisteredContacts assestations 
DEBU[2021/01/25 08:48:43] [textsecure] GetRegisteredContacts contactDiscoveryRequest 
DEBU[2021/01/25 08:48:43] [textsecure] getContactDiscoveryRegisteredUser 
DEBU[2021/01/25 08:48:45] [textsecure] PUT with auth & cookoie /v1/discovery/xxx 200  
DEBU[2021/01/25 08:48:45] [textsecure] GetAndVerifyMultiRemoteAttestation resp 
DEBU[2021/01/25 08:48:45] [textsecure] PUT /v1/messages/+xxx 409 
DEBU[2021/01/25 08:48:45] [textsecure] Mismatched devices: {MissingDevices:[2] ExtraDevices:[]} 
DEBU[2021/01/25 08:48:45] [textsecure] PUT /v1/messages/+xxx 200 
DEBU[2021/01/25 08:48:45] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1611560925669}
nanu-c commented 3 years ago

Do you have added the user you are sending to the contacts?

morph027 commented 3 years ago

Via id or via tel ?

nanu-c commented 3 years ago

I have added a WriteContactsToPath() call in the GetRegisteredContacts() so it should update the contacts.yml with the uuid and can you try if it works when you change in cmd/textsecure/main.go line 580 to to = c.UUID ?

morph027 commented 3 years ago
INFO[2021/01/26 08:25:54] Registration done.                           
DEBU[2021/01/26 08:25:54] [textsecure] missing my uuid defer           
DEBU[2021/01/26 08:25:54] [textsecure] get my uuid                     
DEBU[2021/01/26 08:25:54] GET /v1/accounts/whoami 200                  
DEBU[2021/01/26 08:25:54] GET /v1/directory/auth 200                   
DEBU[2021/01/26 08:25:54] [textsecure] getCredentials                  
DEBU[2021/01/26 08:25:54] [textsecure] GetAndVerifyMultiRemoteAttestation 
DEBU[2021/01/26 08:25:55] [textsecure] PUT /v1/attestation/xxx 200 
DEBU[2021/01/26 08:25:55] [textsecure] GetAndVerifyMultiRemoteAttestation key  
DEBU[2021/01/26 08:25:55] [textsecure] validateAndBuildRemoteAttestation  <nil> 
DEBU[2021/01/26 08:25:55] [textsecure] GetRegisteredContacts assestations 
DEBU[2021/01/26 08:25:55] [textsecure] GetRegisteredContacts contactDiscoveryRequest 
DEBU[2021/01/26 08:25:55] [textsecure] getContactDiscoveryRegisteredUser 
DEBU[2021/01/26 08:25:57] [textsecure] PUT with auth & cookoie /v1/discovery/xxx 200  
DEBU[2021/01/26 08:25:57] [textsecure] GetAndVerifyMultiRemoteAttestation resp 
DEBU[2021/01/26 08:25:57] GET /v2/keys/xxx/1 404 
FATA[2021/01/26 08:25:57] status code 404

The contacts.yml has been updated with uuid and more data :+1: But sending still fails.

morph027 commented 3 years ago

Hint: It works for devices already present (sent messages in the past). It just fails for any new device.

nanu-c commented 3 years ago

I missed the correct byte to string mapping for uuids, see if https://github.com/signal-golang/textsecure/pull/27/commits/16b9c6092d7b01cfc71a6b1dae242ddcc6619f72 works

morph027 commented 3 years ago

Ahhh....yes, it works!

morph027 commented 3 years ago

Update: works for single contact, not for groups (might be missing code in cli ... something related to the sendGroupHelper, as it's still using a tel number according to debug output)

nanu-c commented 3 years ago

https://github.com/signal-golang/textsecure/pull/27/commits/054ae628d054e1ba67a7e9f1aff845bd960fa15c maybe this?

morph027 commented 3 years ago

Hehe... works with group, but doesn't work with single contacts anymore ;) Sending to group does segfault also.

Group:

INFO[2021/01/26 20:39:12] Registration done.                           
DEBU[2021/01/26 20:39:12] [textsecure] missing my uuid defer           
DEBU[2021/01/26 20:39:12] [textsecure] get my uuid                     
DEBU[2021/01/26 20:39:12] GET /v1/accounts/whoami 200                  
DEBU[2021/01/26 20:39:12] [textsecure] GetRegisteredContacts           
DEBU[2021/01/26 20:39:12] GET /v1/directory/auth 200                   
DEBU[2021/01/26 20:39:12] [textsecure] getCredentials                  
DEBU[2021/01/26 20:39:12] [textsecure] GetAndVerifyMultiRemoteAttestation 
DEBU[2021/01/26 20:39:13] [textsecure] PUT /v1/attestation/xxx 200 
DEBU[2021/01/26 20:39:13] [textsecure] GetAndVerifyMultiRemoteAttestation key  
DEBU[2021/01/26 20:39:13] [textsecure] validateAndBuildRemoteAttestation  <nil> 
DEBU[2021/01/26 20:39:13] [textsecure] GetRegisteredContacts assestations 
DEBU[2021/01/26 20:39:13] [textsecure] GetRegisteredContacts contactDiscoveryRequest 
DEBU[2021/01/26 20:39:13] [textsecure] getContactDiscoveryRegisteredUser 
DEBU[2021/01/26 20:39:15] [textsecure] PUT with auth & cookoie /v1/discovery/xxx 200  
DEBU[2021/01/26 20:39:15] [textsecure] GetAndVerifyMultiRemoteAttestation resp 
DEBU[2021/01/26 20:39:15] GET /v2/keys/xxx/1 200 
DEBU[2021/01/26 20:39:15] no prekey for contact xxx, device 1 
DEBU[2021/01/26 20:39:15] [textsecure] PUT /v1/messages/xxx 409 
DEBU[2021/01/26 20:39:15] [textsecure] Mismatched devices: {MissingDevices:[2 5 6] ExtraDevices:[]} 
DEBU[2021/01/26 20:39:15] GET /v2/keys/xxx/2 200 
DEBU[2021/01/26 20:39:15] no prekey for contact xxx, device 2 
DEBU[2021/01/26 20:39:15] GET /v2/keys/xxx/5 200 
DEBU[2021/01/26 20:39:15] no prekey for contact xxx, device 5 
DEBU[2021/01/26 20:39:15] GET /v2/keys/xxx/6 200 
DEBU[2021/01/26 20:39:15] no prekey for contact xxx, device 6 
DEBU[2021/01/26 20:39:16] [textsecure] PUT /v1/messages/xxx 200 
DEBU[2021/01/26 20:39:16] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1611689955275} 
DEBU[2021/01/26 20:39:16] [textsecure] sendGroupHelper message to group sent xxx 
DEBU[2021/01/26 20:39:16] [textsecure] PUT /v1/messages/xxx 409 
DEBU[2021/01/26 20:39:16] [textsecure] Mismatched devices: {MissingDevices:[2] ExtraDevices:[]} 
DEBU[2021/01/26 20:39:16] [textsecure] PUT /v1/messages/xxx 200 
DEBU[2021/01/26 20:39:16] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1611689955275} 
DEBU[2021/01/26 20:39:16] [textsecure] sendGroupHelper message to group sent xxx 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x92fd3a]

goroutine 1 [running]:
github.com/signal-golang/textsecure.sendGroupHelper(0x7ffdd8592791, 0x20, 0x7ffdd859277f, 0xd, 0x0, 0xc4bda62b00000000, 0xc0001e4a20, 0xc400000000a487c0, 0x1)
    /go/src/github.com/signal-golang/textsecure/groups.go:246 +0x21a
github.com/signal-golang/textsecure.SendGroupMessage(...)
    /go/src/github.com/signal-golang/textsecure/groups.go:274
main.sendMessage(0xc0002b2101, 0x7ffdd8592791, 0x20, 0x7ffdd859277f, 0xd, 0x0, 0xc00000e460)
    /go/src/github.com/signal-golang/textsecure/cmd/textsecure/main.go:145 +0x77
main.main()
    /go/src/github.com/signal-golang/textsecure/cmd/textsecure/main.go:622 +0x65c

Sending to single contact works for one device (desktop client) but my mobile just shows the same error as above (Unterhaltungssitzung aktualisert).

INFO[2021/01/26 20:43:54] Registration done.                           
DEBU[2021/01/26 20:43:54] [textsecure] missing my uuid defer           
DEBU[2021/01/26 20:43:54] [textsecure] get my uuid                     
DEBU[2021/01/26 20:43:55] GET /v1/accounts/whoami 200                  
DEBU[2021/01/26 20:43:55] [textsecure] GetRegisteredContacts           
DEBU[2021/01/26 20:43:55] GET /v1/directory/auth 200                   
DEBU[2021/01/26 20:43:55] [textsecure] getCredentials                  
DEBU[2021/01/26 20:43:55] [textsecure] GetAndVerifyMultiRemoteAttestation 
DEBU[2021/01/26 20:43:55] [textsecure] PUT /v1/attestation/xxx 200 
DEBU[2021/01/26 20:43:55] [textsecure] GetAndVerifyMultiRemoteAttestation key  
DEBU[2021/01/26 20:43:55] [textsecure] validateAndBuildRemoteAttestation  <nil> 
DEBU[2021/01/26 20:43:55] [textsecure] GetRegisteredContacts assestations 
DEBU[2021/01/26 20:43:55] [textsecure] GetRegisteredContacts contactDiscoveryRequest 
DEBU[2021/01/26 20:43:55] [textsecure] getContactDiscoveryRegisteredUser 
DEBU[2021/01/26 20:43:57] [textsecure] PUT with auth & cookoie /v1/discovery/xxx 200  
DEBU[2021/01/26 20:43:57] [textsecure] GetAndVerifyMultiRemoteAttestation resp 
DEBU[2021/01/26 20:43:58] [textsecure] PUT /v1/messages/xxx 409 
DEBU[2021/01/26 20:43:58] [textsecure] Mismatched devices: {MissingDevices:[2 5 6] ExtraDevices:[]} 
DEBU[2021/01/26 20:43:58] [textsecure] PUT /v1/messages/xxx 200 
DEBU[2021/01/26 20:43:58] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1611690237887}
nanu-c commented 3 years ago

i found a check for invalid pointer, the problem is, we don't save uuid's for group members that aren't in our contact list, yet

nanu-c commented 3 years ago

I had to merge it, will work further on the groups uuid, the merge request already improves the situation

teutat3s commented 3 years ago

For me with the latest build v1.2.14 the no prekey for contact error is gone - messages can be send out fine again! Thank you very much!

Hetti commented 3 years ago

I'm encountering this behaviour with the latest build in a different way: I am getting the messages on my local phone when sending it with the CLI. But on the Desktop Client it says it has the same behaviour with the: "Unterhaltungssitzung aktualisert" Message.

Although, I am getting the messages on the textsecure client, when sending it from the Desktop App.

The debug log:

DEBU[DATE] [textsecure] Websocket sending message
DEBU[DATE] GET /v2/keys/NUMBER/1 200
DEBU[DATE] GET /v2/keys/NUMBER/2 200
DEBU[DATE] [textsecure] makePreKeyBundle no prekey for contact NUMBER, device 2 DEBU[DATE] [textsecure] PUT /v1/messages/NUMBER 200 DEBU[DATE] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:TIMESTAMP}

Resetting the Session on the Desktop App doesn't make it work. Interestingly, when resetting the session on the Desktop Client, I am not able to send a message to the textsecure client with the Desktop Client (Mobile works fine)

Any Ideas? :-) Or is this still Work in Progress (WiP)?

nanu-c commented 3 years ago

Actually what's wrong here is, that PUT /v1/messages/NUMBER 200 and DEBU[DATE] GET /v2/keys/NUMBER/1 200 should be DEBU[DATE] GET /v2/keys/UUID/1 200. Is there a phone number or a uuid?

Hetti commented 3 years ago

NUMBER was in this Case the Phone Number and Not the UUID.