Skip to content

Commit c15e20b

Browse files
authored
Merge pull request #42 from CodeShellDev/dev
revamped README
2 parents d8ecb1d + bb0ff13 commit c15e20b

File tree

1 file changed

+73
-43
lines changed

1 file changed

+73
-43
lines changed

.github/templates/README.template.md

Lines changed: 73 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,48 @@
11
<img align="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" />
22

3-
<h5 align="center">Secure Proxy for <a href="https://github.com/bbernhard/signal-cli-rest-api">Signal Messenger REST API</a></h5>
3+
<h3 align="center">Secure Proxy for <a href="https://github.com/bbernhard/signal-cli-rest-api">Signal Messenger REST API</a></h3>
4+
5+
<p align="center">
6+
adding token-based authentication,
7+
endpoint restrictions, placeholders, and flexible configuration.
8+
</p>
9+
10+
<p align="center">
11+
⭐️ Secure · 🔒 Configurable · 🚀 Easy to Deploy with Docker
12+
</p>
13+
14+
<div align="center">
15+
<a href="https://github.com/codeshelldev/secured-signal-api/releases">
16+
<img src="https://img.shields.io/github/v/release/codeshelldev/secured-signal-api?sort=semver&logo=github" alt="GitHub release">
17+
</a>
18+
<a href="https://github.com/codeshelldev/secured-signal-api/pkgs/container/secured-signal-api">
19+
<img src="https://ghcr-badge.egpl.dev/codeshelldev/secured-signal-api/size?color=%2344cc11&tag=latest&label=image+size&trim=" alt="GHCR pulls">
20+
</a>
21+
<a href="./LICENSE">
22+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT">
23+
</a>
24+
<a href="https://github.com/codeshelldev/secured-signal-api/stargazers">
25+
<img src="https://img.shields.io/github/stars/codeshelldev/secured-signal-api?style=social" alt="GitHub stars">
26+
</a>
27+
</div>
28+
29+
## Contents
30+
31+
- [Getting Started](#getting-started)
32+
- [Setup](#setup)
33+
- [Usage](#usage)
34+
- [Best Practices](#security-best-practices)
35+
- [Configuration](#configuration)
36+
- [Endpoints](#endpoints)
37+
- [Variables](#variables)
38+
- [Contributing](#contributing)
39+
- [Support](#support)
40+
- [License](#license)
441

542
## Getting Started
643

44+
> **Prerequisites**: You need Docker and Docker Compose installed.
45+
746
Get the latest version of the `docker-compose.yaml` file:
847

948
```yaml
@@ -13,11 +52,10 @@ Get the latest version of the `docker-compose.yaml` file:
1352
And add secure Token(s) to `api.tokens`. See [API TOKENs](#api-tokens).
1453

1554
> [!IMPORTANT]
16-
> This Documentation will be using `sec-signal-api:8880` as the service host,
17-
> this **is just for simplicty**, instead use your containers or hosts IP + Port.
18-
> Or a hostname if applicable. See [Reverse Proxy](#reverse-proxy)
55+
> In this documentation, we use `sec-signal-api:8880` as the host for simplicity.
56+
> Replace it with your actual container/host IP, port, or hostname.
1957
20-
### Reverse proxy
58+
### Reverse Proxy
2159

2260
Take a look at the [traefik](https://github.com/traefik/traefik) implementation:
2361

@@ -27,7 +65,7 @@ Take a look at the [traefik](https://github.com/traefik/traefik) implementation:
2765

2866
## Setup
2967

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)
68+
Before you can send messages via Secured Signal API you must first set up [Signal rAPI](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md)
3169

3270
To be able to use the API you have to either:
3371

@@ -37,46 +75,27 @@ OR
3775

3876
- **link Signal API to an already registered Signal Device**
3977

40-
> [!TIP]
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).
43-
44-
## Usage
45-
46-
Secured Signal API provides 3 Ways to Authenticate
47-
48-
### Bearer
49-
50-
To Authenticate add `Authorization: Bearer API_TOKEN` to your request Headers
51-
52-
### Basic Auth
53-
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_TOKEN`.
78+
1. **Register** or **link** a Signal account with `signal-cli-rest-api`
5979

60-
example:
80+
2. Deploy `secured-signal-api` with at least one API token
6181

62-
```bash
63-
echo "api:API_TOKEN" | base64
64-
```
65-
66-
=> `YXBpOkFQSV9LRVkK`
82+
3. Confirm you can send a test message (see [Usage](#usage))
6783

68-
### Query Auth
84+
> [!TIP]
85+
> Run setup directly with Signal rAPI.
86+
> Setup requests via Secured Signal API are blocked. See [Blocked Endpoints](#blocked-endpoints).
6987
70-
If you are working with a limited Application you may **not** be able to modify Headers or the Request Body
71-
in this case you can use **Query Auth**.
88+
## Usage
7289

73-
Here is a simple example:
90+
Secured Signal API provides 3 Ways to Authenticate
7491

75-
```bash
76-
curl -X POST http://sec-signal-api:8880/v2/send?@authorization=API_TOKEN
77-
```
92+
### Auth
7893

79-
Notice the `@` infront of `authorization`. See [KeyValue Pair Injection](#keyvalue-pair-injection).
94+
| Method | Example |
95+
| :---------- | :--------------------------------------------------------- |
96+
| Bearer Auth | Add `Authorization: Bearer API_TOKEN` to headers |
97+
| Basic Auth | Add `Authorization: Basic BASE64_STRING` (`api:API_TOKEN`) |
98+
| Query Auth | Append `@authorization=API_TOKEN` to request URL |
8099

81100
### Example
82101

@@ -126,6 +145,13 @@ you have to add `@` in front of any KeyValue Pair assignment.
126145

127146
Supported types include **strings**, **ints** and **arrays**. See [Formatting](#string-to-type).
128147

148+
## Security: Best Practices
149+
150+
- Always use API tokens in production
151+
- Run behind a TLS-enabled [Reverse Proxy](#reverse-proxy) (Traefik, Nginx, Caddy)
152+
- Be cautious when overriding Blocked Endpoints
153+
- Use per-token overrides to enforce least privilege
154+
129155
## Configuration
130156

131157
There are multiple ways to configure Secured Signal API, you can optionally use `config.yml` aswell as Environment Variables to override the config.
@@ -186,8 +212,7 @@ If you are using Environment Variables as an example you won't be able to specif
186212
| array(str) | [a,b,c] |
187213

188214
> [!NOTE]
189-
> 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**.
190-
> **Double Backslashes** do exist but you could just leave them out completly.
215+
> 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** (or Double Backslash).
191216
> An **Odd** number of **Backslashes** **escape** the character in front of them and an **Even** number leave the character **as-is**.
192217

193218
### API Token(s)
@@ -214,7 +239,7 @@ Since Secured Signal API is just a Proxy you can use all of the [Signal REST API
214239
| :-------------------- | ------------------ |
215240
| **/v1/about** | **/v1/unregister** |
216241
| **/v1/configuration** | **/v1/qrcodelink** |
217-
| **/v1/devives** | **/v1/contacts** |
242+
| **/v1/devices** | **/v1/contacts** |
218243
| **/v1/register** | **/v1/accounts** |
219244

220245
These Endpoints are blocked by default due to Security Risks.
@@ -260,7 +285,10 @@ settings:
260285

261286
### Message Aliases
262287

263-
To improve compatibility with other services Secured Signal API provides aliases for the `message` attribute by default:
288+
To improve compatibility with other services Secured Signal API provides **Message Aliases** for the `message` attribute.
289+
290+
<details>
291+
<summary><strong>Default Message Aliases</strong></summary>
264292

265293
| Alias | Score | Alias | Score |
266294
| ------------ | ----- | ---------------- | ----- |
@@ -272,6 +300,8 @@ To improve compatibility with other services Secured Signal API provides aliases
272300
| details | 14 | body | 2 |
273301
| data.message | 10 | data | 1 |
274302

303+
</details>
304+
275305
Secured Signal API will pick the best scoring Message Alias (if available) to extract the correct message from the Request Body.
276306

277307
Message Aliases can be added by setting `messageAliases` in your config:

0 commit comments

Comments
 (0)