Signald

From NixOS Wiki
Revision as of 20:46, 19 April 2024 by Klinger (talk | contribs) (Category:Applications)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Signald is a program that enables users to send and receive end-to-end encrypted messages using the Signal protocol. It serves as a bridge between the Signal messaging app and other applications or services, allowing developers to integrate secure messaging capabilities into their own projects.

Installation

Enable signald daemon, running as the user myuser which should be equivalent to the user who should interact with signald

 
/etc/nixos/configuration.nix
services.signald = {
  enable = true;
  user = "myuser";
};

environment.systemPackages = [ pkgs.signaldctl ];

Registration

Connect and register a phone number of an existing Signal account using following command. It will print a QR code which you can scan on your mobile device. Navigate to "Settings -> Linked devices" on your mobile app.

# signaldctl account link

Alternativley register a new real phone number or a virtual disposable one which can be bought with services like sms-man.com.

# signaldctl account register [phone number]

Sometimes you'll have to generate and supply a captcha verification code to this command by using the --captcha parameter. The registration process described here might be currently broken, please refer the troubleshooting section here for a workaround.

In the last step, enter the verification number you received via SMS using this command

# signaldctl account verify [phone number] [code]

Usage

Configuration

Set profile name of account +12025555555

# signaldctl account set-profile -a +12025555555 "my signal user"

Messaging

Send a message to the recipient number +12026666666 using the account +12025555555

# signaldctl message send -a +12025555555 +12026666666 "hello, joe"

Send message to a group using the account +12025555555. You'll find the group id by generating a group link of an existing group in the settings section, for example on your mobile phone with the Signal app.

# signaldctl message send -a +12025555555 EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE= "hello, everyone"

Group handling

Join a chat group with the account +12025555555

# signaldctl group join -a +12025555555 EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=

Troubleshooting

Registration fails with "error registering with server"

This registration error might be related to an open bug in Signald. As an alternative, it is possible to use the client signal-cli to register and verify a new phone number and use Signald as a secondary "device" by linking it

# nix-shell -p nixos.signal-cli
# Register account with the phone number +12025555555. You'll most likley need to generate a captcha and specify it with a parameter. See registration section above on how to do this.
# signal-cli -a "+12025555555" register --captcha "abcd"
Enter the verification number received via SMS
# signal-cli -a "+12025555555" verify "1234"
Generate the device uri in Signald to link the existing account
# signaldctl account link --output-format json
Use the uri generated above in the following command
# signal-cli -a "+12025555555" addDevice --uri "abcd"

Now Signald is able to use the phone number +12025555555, registered with signal-cli, as a secondary device.

Tips and tricks

Python chat bot

The Python module semaphore can be used to interact with your Signald account and to create simple chat bots.