Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get crypto working #958

Closed
jryans opened this issue Jun 17, 2019 · 6 comments
Closed

Unable to get crypto working #958

jryans opened this issue Jun 17, 2019 · 6 comments

Comments

@jryans
Copy link
Collaborator

jryans commented Jun 17, 2019

Originally posted by @n8fr8 in #816 (comment)

I am building a crypto-enabled Matrix chatbot here: https://github.com/guardianproject/ractive/blob/master/bot.js

It currently works sans-crypto, but when I enable it, I can't decrypt any messages, and the client exits.

Any thoughts, insights, something I missed? Thanks!


Getting saved sync token...
Getting push rules...
Got saved sync token
Getting saved sync...
Got reply from saved sync, exists? false
RIVEBOT succesfully loaded directory
Got push rules
Checking lazy load status...
Checking whether lazy loading has changed in store...
Storing client options...
Stored client options
Getting filter...
Sending first sync request...
Waiting for saved sync before starting sync processing...
Starting sync request processing...
Storing sync data...
Sync data stored
Processing sync response...
Crypto: initialising roomlist...
Starting sync request processing...
Crypto: initialising crypto object...
Crypto: initialising Olm...
Crypto: initialising Olm device...
Crypto: loading device list...
Crypto: fetching own devices...
Crypto: checking for key backup...
Checking key backup status...
Key backup is absent or missing required data
No usable key backup: not enabling key backup
Storing sync data...
Sync data stored
Processing sync response...
Starting sync request processing...
Storing sync data...
Sync data stored
Processing sync response...
Starting sync request processing...
Storing sync data...
Sync data stored
Processing sync response...
enqueueing key request for ****
Error decrypting event (id=*****): DecryptionError[msg: The sender's device has not sent us the keys for this message., session: ****
Decryption failure: [object Object]
Starting sync request processing...

Originally posted by @n8fr8 in #816 (comment)

@jryans
Copy link
Collaborator Author

jryans commented Jun 17, 2019

@n8fr8, maybe you need to use a local storage replacement like @zhaytee needed in #816?

See https://github.com/zhaytee/matrix-rpc-js/blob/057492e55991f9f62480957d0a47aa571a9031ee/src/session.ts#L51 for example.

@n8fr8
Copy link

n8fr8 commented Jun 17, 2019

Ah I will take a look. I saw that, but wasn't sure what the different was in @zhaytee s storage implementation.

@n8fr8
Copy link

n8fr8 commented Jun 17, 2019

#437 seems to cover exactly what I am seeing

@ara4n
Copy link
Member

ara4n commented Jun 17, 2019

(n.b. that https://github.com/matrix-org/pantalaimon can be a very quick way of e2eifying bots)

@n8fr8
Copy link

n8fr8 commented Jun 17, 2019

After reading through matrix-recorder closely, I realized I need to do the following:

  1. createClient() with minimal params
  2. login() with user/pass and handle callback function
  3. in callback, get response, and do a full createClient()

I also think, timing and order of operations mattered. After a lot of tinkering, I have a working bot client that can send/recv encrypted messages.

Here is the "working" commit:
guardianproject/ractive@16fcc6d

@uhoreg
Copy link
Member

uhoreg commented Feb 4, 2022

This looks like it can be closed

@uhoreg uhoreg closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants