You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/templates/README.template.md
+84-67Lines changed: 84 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
<imgalign="center"width="1048"height="512"alt="Secure Proxy for Signal REST API"src="https://github.com/CodeShellDev/secured-signal-api/raw/refs/heads/main/logo/landscape" />
2
2
3
-
<h5align="center">Secure Proxy for <ahref="https://github.com/bbernhard/signal-cli-rest-api">Signal REST API</a></h5>
3
+
<h5align="center">Secure Proxy for <ahref="https://github.com/bbernhard/signal-cli-rest-api">Signal Messenger REST API</a></h5>
4
4
5
-
## Installation
5
+
## Getting Started
6
6
7
7
Get the latest version of the `docker-compose.yaml` file:
8
8
9
-
And add secure Token(s) to `API__TOKEN` / `API__TOKENS`. See [API TOKEN(s)](#api-tokens)
9
+
```yaml
10
+
{ { file.docker-compose.yaml } }
11
+
```
12
+
13
+
And add secure Token(s) to `api.tokens`. See [API TOKEN(s)](#api-tokens).
10
14
11
15
> [!IMPORTANT]
12
16
> This Documentation will be using `sec-signal-api:8880` as the service host,
13
17
> this **is just for simplicty**, instead use your containers or hosts IP + Port.
14
18
> Or a hostname if applicable. See [Reverse Proxy](#reverse-proxy)
15
19
16
-
```yaml
17
-
{ { file.docker-compose.yaml } }
18
-
```
19
-
20
20
### Reverse proxy
21
21
22
22
Take a look at the [traefik](https://github.com/traefik/traefik) implementation:
If you are not comfortable / don't want to hardcode your Number and/or Recipients in you may use **Placeholders** in your Request.
94
-
95
-
Built-in Placeholders: `{{ .NUMBER }}` and `{{ .RECIPIENTS }}`
93
+
If you are not comfortable / don't want to hardcode your Number for example and/or Recipients in you, may use **Placeholders** in your Request. See [Custom Variables](#variables).
96
94
97
95
These Placeholders can be used in the Request Query or the Body of a Request like so:
98
96
@@ -128,15 +126,42 @@ you have to add `@` in front of any KeyValue Pair assignment.
128
126
129
127
Supported types include **strings**, **ints** and **arrays**. See [Formatting](#string-to-type).
130
128
131
-
## Environment Variables
129
+
## Configuration
130
+
131
+
There are multiple ways to configure Secured Signal API, you can optionally use `config.yml` aswell as Environment Variables to override the config.
132
+
133
+
### Config File
134
+
135
+
Config files allow **YML** formatting and also `${ENV}` to get Environment Variables.
136
+
137
+
To change the internal config file location set `CONFIG_PATH` in your **Environment** to an absolute path including the filename.extension. (default: `/config/config.yml`)
138
+
139
+
This example config shows all of the individual settings that can be applied:
140
+
141
+
```yaml
142
+
{ { file.examples/config.yml } }
143
+
```
144
+
145
+
### Environment
146
+
147
+
Suppose you want to set a new [Placeholder](#placeholders)`NUMBER` in your Environment...
148
+
149
+
```yaml
150
+
environment:
151
+
VARIABLES__NUMBER: "000"
152
+
```
153
+
154
+
This would internally be converted into `variables.number` matching the config formatting.
155
+
156
+
> [!IMPORTANT]
157
+
> Underscores `_` are removed during Conversion, Double Underscores `__` on the other hand convert the Variable into a nested Object (`__` replaced by `.`)
132
158
133
159
### String To Type
134
160
135
161
> [!TIP]
136
162
> This formatting applies to almost every situation where the only (allowed) Input Type is a string and other Output Types are needed.
137
163
138
-
In the Environment the only allowed type is a string so to not have to always use a json string you can use the following types,
139
-
if you format them correctly...
164
+
If you are using Environment Variables as an example you won't be able to specify an Array or a Dictionary of items, in that case you can provide a specifically formatted string which will be translated into the correct type...
140
165
141
166
| type | example |
142
167
| :--------- | :---------------- |
@@ -149,30 +174,33 @@ if you format them correctly...
149
174
| array(str) | [a,b,c] |
150
175
151
176
> [!NOTE]
152
-
> If you have a string that should not be turned into any other type, then you will need to escape all Type Denotations, `[]` or `{}` (also `-`) with a `\`**Backslash** > **Double Backslashes** do exist in that case you could just leave them out completly.
177
+
> If you have a string that should not be turned into any other type, then you will need to escape all Type Denotations, `[]` or `{}` (also `-`) with a `\` **Backslash**.
178
+
> **Double Backslashes** do exist but you could just leave them out completly.
153
179
> An **Odd** number of **Backslashes** **escape** the character in front of them and an **Even** number leave the character **as-is**.
154
180
155
181
### API Token(s)
156
182
157
-
Both `API__TOKEN` and `API__TOKENS` support multiple Tokens seperated by a `,`**Comma** and `[]`**Brackets**. See [Formatting](#string-to-type).
158
183
During Authentication Secured Signal API will try to match the given Token against the list of Tokens inside of these Variables.
159
184
185
+
> [!NOTE]
186
+
> Both `api.token` and `api.tokens` support multiple Tokens.
187
+
160
188
```yaml
161
-
environment:
162
-
API__TOKEN: [token1, token2, token3]
163
-
API__TOKENS: [token1, token2, token3]
189
+
api:
190
+
token: [token1, token2, token3]
191
+
tokens: [token1, token2, token3]
164
192
```
165
193
166
194
> [!IMPORTANT]
167
-
> It is highly recommended to set this Environment Variable
195
+
> It is highly recommended use API Tokens
168
196
169
197
> _What if I just don't?_
170
198
171
199
Secured Signal API will still work, but important Security Features won't be available
172
200
like Blocked Endpoints and any sort of Auth.
173
201
174
202
> [!NOTE]
175
-
> Blocked Endpoints can be reactivated by manually setting them in the Environment
203
+
> Blocked Endpoints can be reactivated by manually configuring them
176
204
177
205
### Blocked Endpoints
178
206
@@ -189,53 +217,27 @@ Because Secured Signal API is just a Proxy you can use all of the [Signal REST A
189
217
| **/v1/accounts** |
190
218
| **/v1/contacts** |
191
219
192
-
These Endpoints are blocked by default due to Security Risks, but can be modified by setting `BLOCKED_ENDPOINTS` to a Comma seperated List:
220
+
These Endpoints are blocked by default due to Security Risks, but can be modified by setting `blockedEndpoints` in your config:
By default Secured Signal API provides the following Placeholders:
226
+
### Variables
206
227
207
-
- **NUMBER** = _ENV_: `NUMBER`
208
-
- **RECIPIENTS** = _ENV_: `RECIPIENTS`
228
+
Placeholders can be added under `variables` and can then be referenced in the Body, Query or URL.
229
+
See [Placeholders](#placeholders).
209
230
210
-
### Customization
211
-
212
-
Placeholders can be added by setting `VARIABLES` inside your Environment.
213
-
214
-
```yaml
215
-
environment:
216
-
VARIABLES: |
217
-
"NUMBER2": "002",
218
-
"GROUP_CHAT_1": [
219
-
"user.id", "000", "001", "group.id"
220
-
]
221
-
```
222
-
223
-
### Recipients
224
-
225
-
Set this Environment Variable to automatically provide default Recipients:
231
+
> [!NOTE]
232
+
> Every Placeholder Key will be converted into an Uppercase String.
233
+
> Example: `number` becomes `NUMBER` in `{{.NUMBER}}`
226
234
227
235
```yaml
228
-
environment:
229
-
RECIPIENTS: |
230
-
[ user.id, 000, 001, group.id ]
231
-
```
232
-
233
-
example:
234
-
235
-
```json
236
-
{
237
-
"recipients": "{{.RECIPIENTS}}"
238
-
}
236
+
variables:
237
+
number: "001",
238
+
recipients: [
239
+
"user.id", "000", "001", "group.id"
240
+
]
239
241
```
240
242
241
243
### Message Aliases
@@ -256,18 +258,33 @@ To improve compatibility with other services Secured Signal API provides aliases
256
258
257
259
Secured Signal API will pick the best scoring Message Alias (if available) to extract the correct message from the Request Body.
258
260
259
-
Message Aliases can be added by setting `MESSAGE_ALIASES` to a valid json array containing dictionaries of `alias`, the json key to be used for lookup (use `.` dots for using values from a nested dictionary and `[i]` to get values from an array):
261
+
Message Aliases can be added by setting `messageAliases` in your config:
260
262
261
263
```yaml
262
-
environment:
263
-
MESSAGE_ALIASES: |
264
-
[
265
-
{ "alias": "msg", "score": 80 },
266
-
{ "alias": "data.message", "score": 79 },
267
-
{ "alias": "array[0].message", "score": 78 },
268
-
]
264
+
messageAliases:
265
+
[
266
+
{ alias: "msg", score: 80 },
267
+
{ alias: "data.message", score: 79 },
268
+
{ alias: "array[0].message", score: 78 },
269
+
]
269
270
```
270
271
272
+
### Port
273
+
274
+
To change the Port which Secured Signal API uses, you need to set `server.port` in your config. (default: `8880`)
275
+
276
+
### Log Level
277
+
278
+
To change the Log Level set `logLevel` to: (default: `info`)
0 commit comments