Skip to content

Commit 378118b

Browse files
committed
updated README
- fixed inconsistent names, declarations, etc. - overall improvements
1 parent 058094d commit 378118b

File tree

1 file changed

+87
-49
lines changed

1 file changed

+87
-49
lines changed
Lines changed: 87 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,100 @@
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
{ { file.docker-compose.yaml } }
1318
```
1419

1520
### Reverse proxy
1621

17-
Take a look at traefik implementation:
22+
Take a look at the [traefik](https://github.com/traefik/traefik) implementation:
1823

1924
```yaml
2025
{ { file.examples/traefik.docker-compose.yaml } }
2126
```
2227

2328
## Setup
2429

25-
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),
30+
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)
2631

27-
to be able to use the API you have to either:
32+
To be able to use the API you have to either:
2833

29-
- **register a Signal Account**
34+
- **register with your Signal Account**
3035

3136
OR
3237

3338
- **link Signal API to an already registered Signal Device**
3439

3540
> [!TIP]
36-
> It is advised to do this by directly accessing `signal-api`
37-
> As Secured Signal API blocks the `/register` and `/qrcodelink` by default.
38-
> If you really want to you can do this with Secured Signal API by removing these endpoints from the Blocklist
41+
> It is advised to do Setup directly with Signal rAPI
42+
> if you try to Setup with Secured Signal API you will be blocked from doing so. See [Blocked Endpoints](#blocked-endpoints).
3943
4044
## Usage
4145

42-
Secured Signal API implements 3 Ways to Authenticate
46+
Secured Signal API provides 3 Ways to Authenticate
4347

4448
### Bearer
4549

46-
To Authenticate with `secured-signal-api` add `Authorization: Bearer TOKEN` to your request Headers
50+
To Authenticate add `Authorization: Bearer API_TOKEN` to your request Headers
4751

4852
### Basic Auth
4953

50-
To use Basic Auth as Authorization Method add `Authorization: Basic base64{user:pw}` to your Headers
54+
To use Basic Auth as Authorization Method add `Authorization: Basic BASE64_STRING` to your Headers
55+
56+
User is `api` (LOWERCASE)
57+
58+
Formatting for `BASE64_STRING` = `user:API_KEY`.
59+
60+
example:
61+
62+
```bash
63+
echo "api:API_KEY" | base64
64+
```
65+
66+
=> `YXBpOkFQSV9LRVkK`
5167

5268
### Query Auth
5369

5470
If you are working with a limited Application you may **not** be able to modify Headers or the Request Body
55-
in this case you should use **Query Auth**.
71+
in this case you can use **Query Auth**.
5672

5773
Here is a simple example:
5874

5975
```bash
60-
curl -X POST http://signal-api:8880/v2/send?@authorization=TOKEN
76+
curl -X POST http://sec-signal-api:8880/v2/send?@authorization=API_TOKEN
6177
```
6278

79+
Notice the `@` infront of `authorization`. See [Formatting](#format)
80+
6381
### Example
6482

65-
To send a message to `number`: `1234567`:
83+
To send a message to 1234567:
6684

6785
```bash
68-
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d '{"message": "Hello World!", "recipients": ["1234567"]}' http://signal-api:8880/v2/send
86+
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
6987
```
7088

7189
### Advanced
7290

7391
#### Placeholders
7492

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

77-
`{{ .NUMBER }}` or `{{ .RECIPIENTS }}`
95+
Built-in Placeholders: `{{ .NUMBER }}` and `{{ .RECIPIENTS }}`
7896

79-
These _Placeholders_ can be used in the Query or the Body of a Request like so:
97+
These Placeholders can be used in the Request Query or the Body of a Request like so:
8098

8199
**Body**
82100

@@ -90,45 +108,46 @@ These _Placeholders_ can be used in the Query or the Body of a Request like so:
90108
**Query**
91109

92110
```
93-
http://.../?@number={{.NUMBER}}
111+
http://sec-signal-api:8880/v1/receive/?@number={{.NUMBER}}
94112
```
95113

96114
**Path**
97115

98116
```
99-
http://signal-api:8880/v1/receive/{{.NUMBER}}
117+
http://sec-signal-api:8880/v1/receive/{{.NUMBER}}
100118
```
101119

102120
#### KeyValue Pair Injection
103121

104-
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:
122+
In some cases you may not be able to access / modify the Request Body, in that case specify needed values in the Request Query:
105123

106124
```
107-
http://signal-api:8880/?@key=value
125+
http://sec-signal-api:8880/?@key=value
108126
```
109127

110-
**Format**
128+
##### Format
129+
111130
In order to differentiate Injection Queries and _regular_ Queries
112-
you have to add `@` in front of any KeyValue Pair assignment
131+
you have to add `@` in front of any KeyValue Pair assignment.
113132

114133
### Environment Variables
115134

116135
#### API Token
117136

118137
> [!IMPORTANT]
119-
> It is highly recommended to set this Environment Variable to a long secure string
138+
> It is highly recommended to set this Environment Variable
120139
121-
_What if I just don't?_
140+
> _What if I just don't?_
122141
123-
Well Secured Signal API will still work, but important Security Features won't be available
124-
like Blocked Endpoints and anyone with access to your Docker Container will be able to send Messages in your Name
142+
Well, Secured Signal API will still work, but important Security Features won't be available
143+
like Blocked Endpoints and any sort of Auth.
125144

126145
> [!NOTE]
127-
> Blocked Endpoints can be reactivated by manually setting them in the environment
146+
> Blocked Endpoints can be reactivated by manually setting them in the Environment
128147
129148
#### Blocked Endpoints
130149

131-
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:
150+
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...
132151

133152
- **/v1/about**
134153

@@ -146,7 +165,7 @@ Because Secured Signal API is just a secure Proxy you can use all of the [Signal
146165

147166
- **/v1/contacts**
148167

149-
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
168+
These Endpoints are blocked by default due to Security Risks, but can be modified by setting `BLOCKED_ENDPOINTS` to a valid json array string
150169

151170
```yaml
152171
environment:
@@ -155,12 +174,14 @@ environment:
155174
156175
#### Variables
157176
158-
By default Secured Signal API provides the following **Placeholders**:
177+
By default Secured Signal API provides the following Placeholders:
159178
160179
- **NUMBER** = _ENV_: `SENDER`
161180
- **RECIPIENTS** = _ENV_: `DEFAULT_RECIPIENTS`
162181

163-
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
182+
#### Customization
183+
184+
Placeholders can be added by setting `VARIABLES` inside your Environment.
164185

165186
```yaml
166187
environment:
@@ -169,32 +190,43 @@ environment:
169190

170191
#### Default Recipients
171192

172-
Set this environment variable to automatically provide default Recipients:
193+
Set this Environment Variable to automatically provide default Recipients:
173194

174195
```yaml
175196
environment:
176197
DEFAULT_RECIPIENTS: ' [ "user.id", "000", "001", "group.id" ] '
177198
```
178199

200+
> [!NOTE] > `DEFAULT_RECIPIENTS` becomes `RECIPIENTS`
201+
> But this will change...
202+
203+
example:
204+
205+
```json
206+
{
207+
"recipients": "{{.RECIPIENTS}}"
208+
}
209+
```
210+
179211
#### Message Aliases
180212

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

183-
| Alias | Priority |
184-
| ----------- | ----------- |
185-
| msg | 100 |
186-
| content | 99 |
187-
| description | 98 |
188-
| text | 20 |
189-
| body | 15 |
190-
| summary | 10 |
191-
| details | 9 |
192-
| payload | 2 |
193-
| data | 1 |
215+
| Alias | Priority |
216+
| ----------- | -------- |
217+
| msg | 100 |
218+
| content | 99 |
219+
| description | 98 |
220+
| text | 20 |
221+
| body | 15 |
222+
| summary | 10 |
223+
| details | 9 |
224+
| payload | 2 |
225+
| data | 1 |
194226

195-
Secured Signal API will use the highest priority Message Alias to get the correct message from the Request Body.
227+
Secured Signal API will use the highest priority Message Alias to extract the correct message from the Request Body.
196228

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

199231
```yaml
200232
environment:
@@ -208,6 +240,12 @@ Feel free to open up an issue or create a Pull Request!
208240

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

243+
## Support
244+
245+
Has this Repo been helpful 👍️ to you? Then consider ⭐️'ing this Project.
246+
247+
:)
248+
211249
## License
212250

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

0 commit comments

Comments
 (0)