bbernhard / signal-cli-rest-api

Dockerized Signal Messenger REST API
https://bbernhard.github.io/signal-cli-rest-api/
MIT License
1.37k stars 160 forks source link

Allow setting --trust-new-identities #240

Open etlweather opened 2 years ago

etlweather commented 2 years ago

Feature Request

Per the signal-cli documentation, one can run it with --trust-new-identities TRUST-MODE. I would like to be able to pass this parameter such that signal-cli-rest-api calls signal-cli with it set.

I can't find how to do that. I looked at the code and I am pretty sure it can't be done as it is right now.

bbernhard commented 2 years ago

You are right, that flag isn't exposed yet. But instead you could list all identities via the GET request, iterate over them and you use the trust endpoint (with the trust_all_known_keys flag set to true) to trust all identities. Would that work for your use case or is there a specific reason you would prefer the --trust-new-identities flag over the identities endpoint?

etlweather commented 2 years ago

We are doing this for right now, but it is not optimum for us because it means the first message sent in with a new key does not decrypt. We then have to tell the sender to send their message again (after we trusted the new key). It make sense security wise but in reality, all the users do is trust the new key regardless.

bbernhard commented 2 years ago

I see. I'll have a look (but it probably takes a bit)

bbernhard commented 2 years ago

I think I should be able to have a first version ready in the next few days. Unfortunately this feature is a bit of a pain to test. Do you have a setup where you can easily test this & could you help with testing?

etlweather commented 2 years ago

That's great. I can definitely help testing.

bbernhard commented 2 years ago

There's now a docker image available for testing: bbernhard/signal-cli-rest-api:0.107-dev

The sourcecode can be found in the trust_mode git branch.

The trust mode can be set with the [post] /v1/configuration/<signal number>/settings endpoint. (you only need to set it once per registered signal number; the settings will be persistently stored on the filesystem). Once it is configured, the trust mode will be appended to every signal-cli invocation.

etlweather commented 2 years ago

Awesome. We're going to give it a go. Will let you know.

ced-b commented 2 years ago

@bbernhard I am helping @etlweather with this and ran this through the scenarios that were previously causing trouble and this seems to be resolved with this update. Thank you very much.

bbernhard commented 2 years ago

Cool! Many thanks for testing! I'll merge the changes then into the master branch - so it will be included in the next productive release.

mattdale77 commented 4 weeks ago

I realise that this is an old ticket but I recently had to solve exactly this problem and while I haven't actually tested it yet I was able to edit the mode as described. If this was incorporated into the code then maybe this ticket can be closed? Or are you waiting on something?