weechat-matrix-protocol-script
weechat-matrix-protocol-script copied to clipboard
Encryption Does Not Work
Going through the process of getting encryption to work, got all the pieces into place, but running /encrypt on is unsuccessful. My "matrix" buffer contains the following errors.
14:41:01 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
14:41:02 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
14:41:16 | Enabling encryption for outgoing messages in room !<redacted>:matrix.org
14:41:17 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
14:41:17 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
14:41:17 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
14:41:17 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
I enabled debugging and I see that matrix/olm is requested keys from the room's participants and the matrix.org homeserver is returning M_UNRECOGNIZED, presumably (this is my guess) due to the use of the legacy v2_alpha endpoint (https://matrix.org/docs/spec/legacy/#api-calls-using-the-user-interactive-authentication-mechanism).
Debugging output of one such request
14:46:58 =!= | olm: querying user_ids
14:46:58 | 1: @brycec:matrix.org
14:46:58 =!= | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14:46:58 | request:
14:46:58 | post:
14:46:58 | postfields: {"device_keys":{"@brycec:matrix.org":[false]}}
14:46:58 | accept_encoding: application/json
14:46:58 | header: 1
14:46:58 | url: https://matrix.org/_matrix/client/v2_alpha/keys/query/?access_token=[redacted]
14:46:59 =!= | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14:46:59 | reply:
14:46:59 | stderr:
14:46:59 | rc: 0
14:46:59 | command: url:https://matrix.org/_matrix/client/v2_alpha/keys/query/?access_token=[redacted]
14:46:59 | stdout: HTTP/1.1 400 Bad Request
14:46:59 | Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
14:46:59 | Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
14:46:59 | Access-Control-Allow-Origin: *
14:46:59 | Content-Length: 59
14:46:59 | Content-Type: application/json
14:46:59 | Date: Fri, 16 Dec 2016 22:46:59 GMT
14:46:59 | Server: Synapse/0.18.5-rc3 (b=release-v0.18.5,t=v0.18.5-rc3,bae1115,dirty)
14:46:59 |
14:46:59 | {"errcode":"M_UNRECOGNIZED","error":"Unrecognized request"}
14:46:59 | extra:
14:46:59 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
I found the encryption docs at http://matrix.org/speculator/spec/drafts%2Fe2e/client_server/unstable.html#post-matrix-client-unstable-keys-query and tried swapping v2_alpha with unstable as documented, but I get the same response and outcome. Digging through the debug logs, there are other failed calls regarding encryption.
15:13:19 =!= | Unknown event type m.room.encryption in room !<redacted>:matrix.org
15:13:19 =!= | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15:13:19 | chunk:
15:13:19 | state_key:
15:13:19 | sender: @brycec:matrix.org
15:13:19 | event_id: $1479774869751664OSzEP:matrix.org
15:13:19 | unsigned:
15:13:19 | age: 2155128838
15:13:19 | origin_server_ts: 1479774869203
15:13:19 | content:
15:13:19 | algorithm: m.megolm.v1.aes-sha2
15:13:19 | type: m.room.encryption
15:13:20 =!= | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15:13:20 | reply:
15:13:20 | stderr:
15:13:20 | rc: 0
15:13:20 | command: url:https://matrix.org/_matrix/client/unstable/keys/query/?access_token=[redacted]
15:13:20 | stdout: HTTP/1.1 400 Bad Request
15:13:20 | Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
15:13:20 | Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
15:13:20 | Access-Control-Allow-Origin: *
15:13:20 | Content-Length: 59
15:13:20 | Content-Type: application/json
15:13:20 | Date: Fri, 16 Dec 2016 23:13:20 GMT
15:13:20 | Server: Synapse/0.18.5-rc3 (b=release-v0.18.5,t=v0.18.5-rc3,bae1115,dirty)
15:13:20 |
15:13:20 | {"errcode":"M_UNRECOGNIZED","error":"Unrecognized request"}
15:13:20 | extra:
15:13:20 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
15:13:20 =!= | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15:13:20 | reply:
15:13:20 | stderr:
15:13:20 | rc: 0
15:13:20 | command:
| url:https://matrix.org/_matrix/client/unstable/keys/upload/FWqxAmrp2rK7vNfjwHYIZP5j7jaWUWDPErUSfbrhEP4?access_token=[redacted]
15:13:20 | stdout: HTTP/1.1 400 Bad Request
15:13:20 | Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
15:13:20 | Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
15:13:20 | Access-Control-Allow-Origin: *
15:13:20 | Content-Length: 59
15:13:20 | Content-Type: application/json
15:13:20 | Date: Fri, 16 Dec 2016 23:13:20 GMT
15:13:20 | Server: Synapse/0.18.5-rc3 (b=release-v0.18.5,t=v0.18.5-rc3,bae1115,dirty)
15:13:20 |
15:13:20 | {"errcode":"M_UNRECOGNIZED","error":"Unrecognized request"}
15:13:20 | extra:
15:13:20 =!= | API call returned error: Unrecognized request(M_UNRECOGNIZED)
And after reading the docs, I can see that weechat-matrix-protocol-script isn't using the current API instances and parameters.
If I've done something wrong, let me know. But as far as I can tell, encryption is simply broken at this time.
yup, it's completely broken, sadly. it implements matrix's original crypto PoC which was plain double rethet (Olm), similar to Signal. the final e2e implementation is quite different (Megolm) and more complicated, and the script hasn't bern updated yet.
If this is the unfortunate case, then may I recommend the Encryption section of the README.md be updated accordingly. Something like...
# Encryption
The current encryption implementation in weechat-matrix-protocol is incompatible with Matrix. It was written for an early proof-of-concept version of the protocol that used Olm, and does not work with thge current Matrix protocol which utilises Megolm.
I noticed this change to README.md hasn't been published - is it still an issue?
@chrisbward Yes, it is still an issue.
Still an issue.
Any chance of getting the README updated?
I just spent about an hour fighting with luajit, cjson + olm to get it to a point where Weechat would finally open without any errors... only to find that it still couldn't decrypt messages.
Thanks!
All too familiar with your pain - I tried to reach out to them, project is dead
Surprisingly, Tor is active and responsive in the project matrix room #weechat:hveem.no
https://github.com/torhve/weechat-matrix-protocol-script/commit/25ec2f48357dd17178e2fffd4310ec50c722a0e0
I've (finally) updated the readme to better reflect the current status.
Is there documentation of what needs revision? The megolm documentation seems to suggest that olm is still used for underlying point-to-point cryptography, so presumably that part still works fine?
let's vote for an Megolm implematation for Weechat Matrix script ?
@sachaz voting accomplishes nothing unless someone has code for the implementation
There's an alternative python script for weechat( https://github.com/poljar/weechat-matrix ), and there exists a megolm python implementation ( https://github.com/matrix-org/matrix-python-sdk ). That's a more likely way forward.