twofactor_gateway icon indicating copy to clipboard operation
twofactor_gateway copied to clipboard

Hiding the one-time pass code using style approach in Signal

Open oleua opened this issue 2 years ago • 0 comments

Hi! With the recent update in the bbernhard's Signal CLI REST API, dev branch it is possible to use styles:

**bold**
*italic*
`monospaced`
~stricken-through~ 
||this is a spoiler||

My suggestion is to hide the one-time passcode from unintended eyes by hiding it under the cut, so it will look like this:

image

A user will click on blurred rectangle and see it.

For that I've made a small workaround to the code: lib/Provider/AProvider.php:

108 + $secret = '||'.$secret.'||'

and

lib/Service/Gateway/Signal/Gateway.php:

80                     $response = $client->post(
81                             $this->config->getUrl() . '/v2/send',
82                             [
83                                     'json' => [
84 +                                           'text_mode' => 'styled',
85                                             'message' => $message,
86                                             'number' => $registered_acct,
87                                             'recipients' => $recipient_acct
88                                              ],
89
90                             ]
91                     );

I understand that this is a workaround, and there should be a nicer solution, eg

  1. to detach $secret from the whole var $message
  2. to rewrite the Signal provider Gateway.php: apply styling to $secret and concatenate with the rest in $message.

oleua avatar Nov 18 '23 08:11 oleua