Skip to content

Commit dcf0663

Browse files
Update README.md
1 parent 7c3fc58 commit dcf0663

File tree

1 file changed

+126
-19
lines changed

1 file changed

+126
-19
lines changed

README.md

Lines changed: 126 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Secured Signal Api
22

3-
Secured Signal Api acts as a secured proxy for signal-rest-api.
3+
Secured Signal Api acts as a secure proxy for signal-rest-api.
44

55
## Installation
66

77
Get the latest version of the `docker-compose.yaml` file:
88

9+
And set `API_TOKEN` to a long secure string
10+
911
```yaml
1012
---
1113
services:
@@ -83,44 +85,149 @@ Before you can send messages via `secured-signal-api` you must first setup [`sig
8385

8486
to send messages you have to either:
8587

86-
- register a Signal Account
88+
- **register a Signal Account**
8789

8890
OR
8991

90-
- link Signal Api to a already registered Signal Device
92+
- **link Signal API to an already registered Signal Device**
9193

9294
## Usage
9395

96+
Secured Signal API implements 3 Ways to Authenticate
97+
98+
### Bearer
99+
100+
To Authenticate with `secured-signal-api` add `Authorization: Bearer TOKEN` to your request Headers
101+
102+
### Basic Auth
103+
104+
To use Basic Auth as Authorization Method add `Authorization: Basic base64{user:pw}` to your Headers
105+
106+
### Query Auth
107+
108+
If you are working with a limited Application you may **not** be able to modify Headers or the Request Body
109+
in this case you should use **Query Auth**.
110+
111+
Here is a simple example:
112+
113+
```bash
114+
curl -X POST http://signal-api:8880/v2/send?@authorization=TOKEN
115+
```
116+
94117
To send a message to `number`: `1234567`:
95118

96119
```bash
97120
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d '{"message": "Hello World!", "recipients": ["1234567"]}' http://signal-api:8880/v2/send
98121
```
99122

100-
### Configuration
101-
102-
Because `secured-signal-api` is just a secure proxy you can use all of the [Signal REST Api](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md) endpoints with an Exception of:
103-
104-
```python
105-
DEFAULT_BLOCKED_ENDPOINTS = [
106-
"/v1/about",
107-
"/v1/configuration",
108-
"/v1/devices",
109-
"/v1/register",
110-
"/v1/unregister",
111-
"/v1/qrcodelink",
112-
"/v1/accounts",
113-
"/v1/contacts"
114-
]
123+
### Advanced
124+
125+
#### Placeholders
126+
127+
If you are not comfortable with hardcoding your Number and/or Recipients in you may use **Placeholders** in your request like:
128+
129+
`{{ .NUMBER }}` or `{{ .RECIPIENTS }}`
130+
131+
These _Placeholders_ can be used in the Query or the Body of a Request like so:
132+
133+
**Body**
134+
135+
```json
136+
{
137+
"number": "{{ .NUMBER }}",
138+
"recipients": {{ .RECIPIENTS }}
139+
}
140+
```
141+
142+
**Query**
143+
144+
```
145+
http://.../?@number={{.NUMBER}}
146+
```
147+
148+
**Path**
149+
150+
```
151+
http://signal-api:8880/v1/receive/{{.NUMBER}}
152+
```
153+
154+
#### KeyValue Pair Injection
155+
156+
In some cases you may not be able to access / modify the Request Body, if that is the case specify needed values in the Requests Query:
157+
158+
```
159+
http://signal-api:8880/?@key=value
115160
```
116161
117-
Which are blocked by default to increase Security, but you these can be modified by setting the `BLOCKED_ENDPOINTS` environment variable as a valid json array
162+
**Format**
163+
In order to differentiate Injection Queries and _regular_ Queries
164+
you have to add `@` in front of any KeyValue Pair assignment
165+
166+
### Environment Variables
167+
168+
#### API Token
169+
170+
> [!IMPORTANT]
171+
> It is highly recommended to set this Environment Variable to a long secure string
172+
173+
_What if I just don't?_
174+
175+
Well Secured Signal API will still work, but important Security Features won't be available
176+
like Blocked Endpoints and anyone with access to your Docker Container will be able to send Messages in your Name
177+
178+
> [!NOTE]
179+
> Blocked Endpoints can be reactivated by manually setting them in the environment
180+
181+
#### Blocked Endpoints
182+
183+
Because Secured Signal API is just a secure Proxy you can use all of the [Signal REST API](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md) endpoints with an Exception of:
184+
185+
- **/v1/about**
186+
187+
- **/v1/configuration**
188+
189+
- **/v1/devices**
190+
191+
- **/v1/register**
192+
193+
- **/v1/unregister**
194+
195+
- **/v1/qrcodelink**
196+
197+
- **/v1/accounts**
198+
199+
- **/v1/contacts**
200+
201+
These Endpoints are blocked by default to Security Risks, but can be modified by setting `BLOCKED_ENDPOINTS` in the environment variable to a valid json array string
118202
119203
```yaml
120204
environment:
121205
BLOCKED_ENDPOINTS: '[ "/v1/register","/v1/unregister","/v1/qrcodelink","/v1/contacts" ]'
122206
```
123207

208+
#### Variables
209+
210+
By default Secured Signal API provides the following **Placeholders**:
211+
212+
- **NUMBER** = _ENV_: `SENDER`
213+
- **RECIPIENTS** = _ENV_: `DEFAULT_RECIPIENTS`
214+
215+
If you are ever missing any **Placeholder** (that isn't built-in) you can add as many as you like to `VARIABLES` inside your environment
216+
217+
```yaml
218+
environment:
219+
VARIABLES: ' "NUMBER2": "002", "GROUP_CHAT_1": [ "user.id", "000", "001", "group.id" ] '
220+
```
221+
222+
#### Default Recipients
223+
224+
Set this environment variable to automatically provide default Recipients:
225+
226+
```yaml
227+
environment:
228+
DEFAULT_RECIPIENTS: ' [ "user.id", "000", "001", "group.id" ] '
229+
```
230+
124231
## Contributing
125232
126233
Found a bug? Want to change or add something?

0 commit comments

Comments
 (0)