witchent / matrix-puppet-signal

A Signal bridge for Matrix
35 stars 2 forks source link

This bridge is superseded by https://github.com/tulir/mautrix-signal

signal-bridge #matrix-puppet-bridge:matrix.org

This is a Matrix bridge for Signal, messenger app by Open Whisper Systems.

It's based on the official Signal-Desktop Client that has been ported to Node.js with minor modifications. They are necessary to remove things that are related to Electron that provides the graphical interface. You can find that here: https://github.com/witchent/Signal-Desktop / https://github.com/witchent/node-signal-client

Features

requirements

You need an iOS and Android phone with an existing Signal account that you are willing to link with the Signal client in this bridge.

required software:

Please verify if yarn -v outputs something like 1.17.3. If your output is ERROR: There are no scenarios; must have at least one. you have installed cmdtests instead of yarn. Please install yarn before you continue.

In the past we saw various issues with node versions different from the one that the official Signal-Desktop client uses. If you run into any issues you might try that version. The easiest way to change your version is using n. You can install it using npm install -g n and switch to Node.js 12.13.0 using n 12.13.0.

installation

clone this repo

cd into the directory

run npm install

Note: Run neither the installation command nor the bridge itself with root rights.

extra step if you are using ARM or any other architecture not supported by signal-desktop

install rust (and cargo if not automatically installed)

clone https://github.com/signalapp/zkgroup

cd into zkgroup

run make libzkgroup

copy target/release/libzkgroup.so (or .dll/.dylib) to matrix-puppet-signal/node_modules/signal-desktop/node_modules/zkgroup/, overwriting the existing file in that directory.

register/link with your signal mobile app

Before configuring the bridge with Matrix, you need to setup the Signal link with your phone. Open up your Signal app and go to Settings and then Linked Devices. You should see your camera preview open up.

In the terminal, run npm run link and you should soon see a giant QR code. Scan that with Signal. As soon as no new messages appear on the terminal (SQL channel job ... (createOrUpdateSignedPreKey) succeeded in ...ms) you can ctrl+c out of the program and continue with configuring. If you get something "cannot read property 'version' of undefined" just run npm run link again and now it should work.

If you get an error, restart the node process so that you can try with a different QR (it may have expired).

If you ever need to unlink it and cleanup the data and keys, run npm run clean. Make sure to delete the linked device from the Signal mobile app as well.

configure

Copy config.sample.json to config.json and update it to match your setup.

register the app service

Generate an signal-registration.yaml file with node index.js -r -u "http://your-bridge-server:8090"

Note: The 'registration' setting in the config.json needs to set to the path of this file. By default, it already is.

Copy this signal-registration.yaml file to your home server, then edit it, setting its url to point to your bridge server. e.g. url: 'http://your-bridge-server.example.org:8090'

Edit your homeserver.yaml file and update the app_service_config_files with the path to the signal-registration.yaml file.

Restart your HS.

Launch the bridge with start.sh or node index.js. If you want to run the bridge as a service you can use the matrix-puppet-signal.service file as a template for every systemd based operating system. You need to at least adjust WorkingDirectory, ExecStart and User.

FAQ

See also https://github.com/witchent/matrix-puppet-bridge

Can I enable encryption for the signal rooms?

No! See https://github.com/witchent/matrix-puppet-signal/issues/14.

I get Error: Cannot find module 'matrix-puppet-signal/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node' while building the app

Make sure you are using a new enough node version, either the newest (13.13.0 at the time of writing) or 12.13.0

I get an error about "Cannot read property 'upsertEvent' of null"

Make sure your config.json contains the eventStore property, see config.sample.json

I get an "M_UNKNOWN_TOKEN" error

Your access token from your matrix account is not working anymore. Replace it with a new one in your config.json

npm run link complains about missing library (libzkgroup.so) even though it is there

Follow the "extra step if you are using ARM or any other architecture not supported by signal-desktop" from above, you need to compile the library for your architecture.

I want to use the bridge with the official docker-ansible-deploy

See here for an unofficial guide: https://paste.sr.ht/~e-v/e34a498ecce0fa2b7f7d6d16c7adb01cf072d014 (thanks @edgar.vincent)

Discussion, Help and Support

Join us in the Matrix Puppet Bridge room