matrix-hacks / matrix-puppet-signal

A Signal bridge for Matrix
57 stars 15 forks source link

Unable to load crypto module: crypto will be disabled: Error: global.Olm is not defined #16

Closed niekp closed 5 years ago

niekp commented 5 years ago

I've setup the bridge and am logged into signal, but when is start typing into my signal app this error appears: Unable to load crypto module: crypto will be disabled: Error: global.Olm is not defined

I've found this related page on the signal-sdk github: https://github.com/matrix-org/matrix-js-sdk#end-to-end-encryption-support

I also don't see any signal contacts/chats in my riot app.

This is the full message (i replaced my phonenumber with +0000):

Unable to load crypto module: crypto will be disabled: Error: global.Olm is not defined
pre-main prep time: 2 ms
Next signed key rotation scheduled for 2019-03-18T12:59:07.912Z
starting matrix client
Got push rules
synced
starting signal client
opening message socket https://textsecure-service-ca.whispersystems.org:80
Matrix-side listening on port 8448
websocket open
got request PUT /api/v1/queue/empty
prekey message from +0000
Duplicate PreKeyMessage for session
decrypting message for closed session
Possibly Unhandled Rejection at: Promise  Promise {
  <rejected> Error: Got Content message with no dataMessage and no syncMessage
    at MessageReceiver.<anonymous> (/home/niek/matrix-puppet-signal/node_modules/signal-desktop/js/libtextsecure.js:38404:23)
    at <anonymous> }  reason:  Error: Got Content message with no dataMessage and no syncMessage
    at MessageReceiver.<anonymous> (/home/niek/matrix-puppet-signal/node_modules/signal-desktop/js/libtextsecure.js:38404:23)
    at <anonymous>
prekey message from +0000.1 
(node:10868) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
Duplicate PreKeyMessage for session
decrypting message for closed session
sent message to +0000  from +0000.1
Possibly Unhandled Rejection at: Promise  { state: 'rejected',
  reason: 
   { [M_EXCLUSIVE: This application service has not reserved this kind of alias.]
     errcode: 'M_EXCLUSIVE',
     name: 'M_EXCLUSIVE',
     message: 'This application service has not reserved this kind of alias.',
     data: 
      { errcode: 'M_EXCLUSIVE',
        error: 'This application service has not reserved this kind of alias.' },
     httpStatus: 400 } }  reason:  { [M_EXCLUSIVE: This application service has not reserved this kind of alias.]
  errcode: 'M_EXCLUSIVE',
  name: 'M_EXCLUSIVE',
  message: 'This application service has not reserved this kind of alias.',
  data: 
   { errcode: 'M_EXCLUSIVE',
     error: 'This application service has not reserved this kind of alias.' },
  httpStatus: 400 }
^C
niekp commented 5 years ago

Okay so the Error: global.Olm is not defined is a red herring and the issue was the M_EXCLUSIVE alias stuff.

The signal-registration.yaml put alias: [] by default and that was the error. When i added an alias to the yaml it worked.

So this is the signal-registration.yaml:

id: xxxxx
hs_token: xxxxx
as_token: xxxxx
namespaces:
  users:
    - exclusive: true
      regex: '@signal_.*'
  aliases:
    - exclusive: true
      regex: '#signal_.*'
  rooms: []
url: 'https://matrix.example.com'
sender_localpart: signalbot
rate_limited: true
protocols: null

I guess the issue is that the node index.js -r -u "http://your-bridge-server:8090" doesn't add the alias by default.