Skip to content

Commit 99f3aeb

Browse files
Update README.md
1 parent 378118b commit 99f3aeb

File tree

1 file changed

+87
-49
lines changed

1 file changed

+87
-49
lines changed

README.md

Lines changed: 87 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
# Secured Signal Api
1+
# Secured Signal API
22

3-
Secured Signal Api acts as a secure proxy for signal-rest-api.
3+
Secured Signal API acts as a secure proxy for [Signal rAPI](https://github.com/bbernhard/signal-cli-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
9+
And set `API_TOKEN` to a long secure string.
10+
11+
> [!IMPORTANT]
12+
> This Documentation will be using `sec-signal-api:8880` as the service host,
13+
> this **won't work**, instead use your containers IP + Port.
14+
> Or a hostname if applicable. See [Reverse Proxy](#reverse-proxy)
1015
1116
```yaml
1217
---
@@ -46,7 +51,7 @@ networks:
4651
4752
### Reverse proxy
4853
49-
Take a look at traefik implementation:
54+
Take a look at the [traefik](https://github.com/traefik/traefik) implementation:
5055
5156
```yaml
5257
services:
@@ -83,61 +88,74 @@ networks:
8388
8489
## Setup
8590
86-
Before you can send messages via `secured-signal-api` you must first setup [`signal-api`](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md),
91+
Before you can send messages via Secured Signal API you must first setup [Signal rAPI](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md)
8792
88-
to be able to use the API you have to either:
93+
To be able to use the API you have to either:
8994
90-
- **register a Signal Account**
95+
- **register with your Signal Account**
9196
9297
OR
9398
9499
- **link Signal API to an already registered Signal Device**
95100
96101
> [!TIP]
97-
> It is advised to do this by directly accessing `signal-api`
98-
> As Secured Signal API blocks the `/register` and `/qrcodelink` by default.
99-
> If you really want to you can do this with Secured Signal API by removing these endpoints from the Blocklist
102+
> It is advised to do Setup directly with Signal rAPI
103+
> if you try to Setup with Secured Signal API you will be blocked from doing so. See [Blocked Endpoints](#blocked-endpoints).
100104
101105
## Usage
102106
103-
Secured Signal API implements 3 Ways to Authenticate
107+
Secured Signal API provides 3 Ways to Authenticate
104108
105109
### Bearer
106110
107-
To Authenticate with `secured-signal-api` add `Authorization: Bearer TOKEN` to your request Headers
111+
To Authenticate add `Authorization: Bearer API_TOKEN` to your request Headers
108112

109113
### Basic Auth
110114

111-
To use Basic Auth as Authorization Method add `Authorization: Basic base64{user:pw}` to your Headers
115+
To use Basic Auth as Authorization Method add `Authorization: Basic BASE64_STRING` to your Headers
116+
117+
User is `api` (LOWERCASE)
118+
119+
Formatting for `BASE64_STRING` = `user:API_KEY`.
120+
121+
example:
122+
123+
```bash
124+
echo "api:API_KEY" | base64
125+
```
126+
127+
=> `YXBpOkFQSV9LRVkK`
112128

113129
### Query Auth
114130

115131
If you are working with a limited Application you may **not** be able to modify Headers or the Request Body
116-
in this case you should use **Query Auth**.
132+
in this case you can use **Query Auth**.
117133

118134
Here is a simple example:
119135

120136
```bash
121-
curl -X POST http://signal-api:8880/v2/send?@authorization=TOKEN
137+
curl -X POST http://sec-signal-api:8880/v2/send?@authorization=API_TOKEN
122138
```
123139

140+
Notice the `@` infront of `authorization`. See [Formatting](#format)
141+
124142
### Example
125143

126-
To send a message to `number`: `1234567`:
144+
To send a message to 1234567:
127145

128146
```bash
129-
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d '{"message": "Hello World!", "recipients": ["1234567"]}' http://signal-api:8880/v2/send
147+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d '{"message": "Hello World!", "recipients": ["1234567"]}' http://sec-signal-api:8880/v2/send
130148
```
131149

132150
### Advanced
133151

134152
#### Placeholders
135153

136-
If you are not comfortable with hardcoding your Number and/or Recipients in you may use **Placeholders** in your request like:
154+
If you are not comfortable / don't want to hardcode your Number and/or Recipients in you may use **Placeholders** in your Request.
137155

138-
`{{ .NUMBER }}` or `{{ .RECIPIENTS }}`
156+
Built-in Placeholders: `{{ .NUMBER }}` and `{{ .RECIPIENTS }}`
139157

140-
These _Placeholders_ can be used in the Query or the Body of a Request like so:
158+
These Placeholders can be used in the Request Query or the Body of a Request like so:
141159

142160
**Body**
143161

@@ -151,45 +169,46 @@ These _Placeholders_ can be used in the Query or the Body of a Request like so:
151169
**Query**
152170

153171
```
154-
http://.../?@number={{.NUMBER}}
172+
http://sec-signal-api:8880/v1/receive/?@number={{.NUMBER}}
155173
```
156174
157175
**Path**
158176
159177
```
160-
http://signal-api:8880/v1/receive/{{.NUMBER}}
178+
http://sec-signal-api:8880/v1/receive/{{.NUMBER}}
161179
```
162180
163181
#### KeyValue Pair Injection
164182
165-
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:
183+
In some cases you may not be able to access / modify the Request Body, in that case specify needed values in the Request Query:
166184
167185
```
168-
http://signal-api:8880/?@key=value
186+
http://sec-signal-api:8880/?@key=value
169187
```
170188
171-
**Format**
189+
##### Format
190+
172191
In order to differentiate Injection Queries and _regular_ Queries
173-
you have to add `@` in front of any KeyValue Pair assignment
192+
you have to add `@` in front of any KeyValue Pair assignment.
174193
175194
### Environment Variables
176195
177196
#### API Token
178197
179198
> [!IMPORTANT]
180-
> It is highly recommended to set this Environment Variable to a long secure string
199+
> It is highly recommended to set this Environment Variable
181200
182-
_What if I just don't?_
201+
> _What if I just don't?_
183202
184-
Well Secured Signal API will still work, but important Security Features won't be available
185-
like Blocked Endpoints and anyone with access to your Docker Container will be able to send Messages in your Name
203+
Well, Secured Signal API will still work, but important Security Features won't be available
204+
like Blocked Endpoints and any sort of Auth.
186205
187206
> [!NOTE]
188-
> Blocked Endpoints can be reactivated by manually setting them in the environment
207+
> Blocked Endpoints can be reactivated by manually setting them in the Environment
189208
190209
#### Blocked Endpoints
191210
192-
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:
211+
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 except for...
193212
194213
- **/v1/about**
195214
@@ -207,7 +226,7 @@ Because Secured Signal API is just a secure Proxy you can use all of the [Signal
207226
208227
- **/v1/contacts**
209228
210-
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
229+
These Endpoints are blocked by default due to Security Risks, but can be modified by setting `BLOCKED_ENDPOINTS` to a valid json array string
211230
212231
```yaml
213232
environment:
@@ -216,12 +235,14 @@ environment:
216235

217236
#### Variables
218237

219-
By default Secured Signal API provides the following **Placeholders**:
238+
By default Secured Signal API provides the following Placeholders:
220239

221240
- **NUMBER** = _ENV_: `SENDER`
222241
- **RECIPIENTS** = _ENV_: `DEFAULT_RECIPIENTS`
223242

224-
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
243+
#### Customization
244+
245+
Placeholders can be added by setting `VARIABLES` inside your Environment.
225246

226247
```yaml
227248
environment:
@@ -230,32 +251,43 @@ environment:
230251
231252
#### Default Recipients
232253
233-
Set this environment variable to automatically provide default Recipients:
254+
Set this Environment Variable to automatically provide default Recipients:
234255
235256
```yaml
236257
environment:
237258
DEFAULT_RECIPIENTS: ' [ "user.id", "000", "001", "group.id" ] '
238259
```
239260
261+
> [!NOTE] > `DEFAULT_RECIPIENTS` becomes `RECIPIENTS`
262+
> But this will change...
263+
264+
example:
265+
266+
```json
267+
{
268+
"recipients": "{{.RECIPIENTS}}"
269+
}
270+
```
271+
240272
#### Message Aliases
241273

242274
To improve compatibility with other services Secured Signal API provides aliases for the `message` attribute by default:
243275

244-
| Alias | Priority |
245-
| ----------- | ----------- |
246-
| msg | 100 |
247-
| content | 99 |
248-
| description | 98 |
249-
| text | 20 |
250-
| body | 15 |
251-
| summary | 10 |
252-
| details | 9 |
253-
| payload | 2 |
254-
| data | 1 |
276+
| Alias | Priority |
277+
| ----------- | -------- |
278+
| msg | 100 |
279+
| content | 99 |
280+
| description | 98 |
281+
| text | 20 |
282+
| body | 15 |
283+
| summary | 10 |
284+
| details | 9 |
285+
| payload | 2 |
286+
| data | 1 |
255287

256-
Secured Signal API will use the highest priority Message Alias to get the correct message from the Request Body.
288+
Secured Signal API will use the highest priority Message Alias to extract the correct message from the Request Body.
257289

258-
If you are missing a Message Alias to have Secured Signal API integrated with a Service you can simply set `MESSAGE_ALIASES` in ENV:
290+
Message Aliases can be added by setting `MESSAGE_ALIASES`:
259291

260292
```yaml
261293
environment:
@@ -269,6 +301,12 @@ Feel free to open up an issue or create a Pull Request!
269301

270302
_This is a small project so don't expect any huge changes in the future_
271303

304+
## Support
305+
306+
Has this Repo been helpful 👍️ to you? Then consider ⭐️'ing this Project.
307+
308+
:)
309+
272310
## License
273311

274312
[MIT](https://choosealicense.com/licenses/mit/)

0 commit comments

Comments
 (0)