Skip to content

Commit 9cd849f

Browse files
authored
First release (#1)
* run project with docker ok * docker compose ok * fuck tox, long live to Makefile * polish skins/themes * decrypt using POSt, what the hell were u thinki? * wip on tests * tests ok * wip on docs * wip on docs * Create FUNDING.yml * wip on docs * wip on docs * docs wip wip * wip on docs * wip on themes * wip on themes * wip on themes * wip on docs * polish README
1 parent 4ee5378 commit 9cd849f

File tree

103 files changed

+20414
-3171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+20414
-3171
lines changed

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: [hamkee-dev-group, hamkee]
4+
ko_fi: edvmfoss

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ ENV/
9898
# Rope project settings
9999
.ropeproject
100100

101-
# mkdocs documentation
102-
/site
103-
104101
# mypy
105102
.mypy_cache/
106103

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ Before you submit a pull request, check that it meets these guidelines:
101101
1. The pull request should include tests.
102102

103103
2. If the pull request adds functionality, the docs should be updated.
104-
Put your new functionality into a function with a docstring, and add the feature to the list in `README.md`.
104+
Put your new functionality into a function with a docstring.

Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
# Install uv
21
FROM python:3.13-slim
32
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
43

5-
# Change the working directory to the `app` directory
64
WORKDIR /app
75

8-
# Copy the lockfile and `pyproject.toml` into the image
96
COPY uv.lock /app/uv.lock
107
COPY pyproject.toml /app/pyproject.toml
118

12-
# Install dependencies
139
RUN uv sync --frozen --no-install-project
1410

15-
# Copy the project into the image
1611
COPY . /app
1712

18-
# Sync the project
1913
RUN uv sync --frozen
2014

21-
CMD ["uvicorn", "topsecret.adapters.webapi:api", "--host", "0.0.0.0", "--port", "8000"]
15+
CMD ["uv", "run", "fastapi", "run", "topsecret/adapters/webapi.py"]

LICENSE.txt

Lines changed: 619 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ clean-build: ## Clean build artifacts
3030
@echo "🚀 Removing build artifacts"
3131
@uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None"
3232

33-
.PHONY: docs-test
34-
docs-test: ## Test if documentation can be built without warnings or errors
35-
@uv run mkdocs build -s
36-
3733
.PHONY: docs
38-
docs: ## Build and serve the documentation
34+
docs: ## Make / build / compile/ whatever the documentation
35+
@uv run mkdocs build
36+
37+
.PHONY: see-docs
38+
see-docs: ## Serve the documentation
3939
@uv run mkdocs serve
4040

4141
.PHONY: help

README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# TopSecret
22

3+
![TopSecret](static/screenshots/default.png)
4+
35
TopSecret is an encryption and decryption service with a REST API.
46

57
It provides two primary methods of encryption:
@@ -9,6 +11,11 @@ It provides two primary methods of encryption:
911

1012
The project includes a FastAPI web service that expose encryption functionality through HTTP endpoints, allowing users to encrypt sensitive information and share decryption URLs.
1113

14+
15+
## Documentation
16+
17+
Project documentation is available at [https://edvm.github.io/secrets-py/](https://edvm.github.io/secrets-py/).
18+
1219
## Sponsorship
1320

1421
A special thanks to [Hamkee](https://hamkee.net/) for sponsoring the project and providing hosting services.
@@ -21,7 +28,7 @@ If you find this project useful, consider supporting its development:
2128

2229
### Prerequisites
2330

24-
- Python 3.10 or higher and `make` installed.
31+
0- Python 3.10 or higher and `make` installed.
2532

2633
1- Install `uv` (Linux and MacOS)
2734
```bash
@@ -44,12 +51,12 @@ Clone the repository:
4451

4552
```bash
4653
git clone https://github.com/edvm/secrets-py.git
47-
cd secrets-py
54+
cd secrets-py
4855
```
4956

5057
### Using the Makefile
5158

52-
The project includes a Makefile trying to make your life easier. You can use it to automate common tasks.
59+
The project includes a Makefile trying to make your life easier. You can use it to automate common tasks.
5360

5461
Be sure to have `make` and `uv` installed.
5562

@@ -80,11 +87,14 @@ make run
8087

8188
The API will be available at http://localhost:8000.
8289

83-
## Testing the API
84-
85-
### Using the API Documentation
90+
### Running with Docker Compose
91+
If you prefer to run the API using Docker Compose, you can use the provided `compose.yml` file.
92+
1. Build and run the Docker container:
8693

87-
Visit http://localhost:8000/docs for an interactive Swagger UI to test the API endpoints.
94+
```bash
95+
docker compose up --build
96+
```
97+
2. Access the API at http://localhost:8000.
8898

8999
### Using curl
90100

@@ -104,25 +114,19 @@ curl -X POST http://localhost:8000/encrypt \
104114
#### Testing the decrypt endpoint
105115
```sh
106116
# Example 3: Decrypt a secret (replace HASH_VALUE with the actual hash from the encrypt response)
107-
curl -X GET http://localhost:8000/decrypt/HASH_VALUE
117+
curl -X POST http://localhost:8000/decrypt/HASH_VALUE
108118

109119
# Example 4: Decrypt a passphrase-protected secret
110-
curl -X GET "http://localhost:8000/decrypt/HASH_VALUE?passphrase=mysecretpassword123"
120+
curl -X POST http://localhost:8000/decrypt/HASH_VALUE \
121+
-H "Content-Type: application/json" \
122+
-d '{"passphrase": "mysecretpassword123"}'
111123
```
112124

113-
#### Example workflow
125+
### Skins / Themes
114126

115-
```sh
116-
# Step 1: Encrypt a secret and capture the hash
117-
RESPONSE=$(curl -s -X POST http://localhost:8000/encrypt \
118-
-H "Content-Type: application/json" \
119-
-d '{"secret": "My super secret info"}'
120-
)
127+
You can create your own skins by modifying the HTML and CSS files in the `static/themes` directory. Use `default.html` as base template and create your own theme by copying it to a new file, e.g., `mytheme.html`. Then, you can specify the theme by query parameter in the URL, e.g., `http://localhost:8000/encrypt?theme=mytheme` or override `default.html` with your
128+
custom skin.
121129

122-
# Step 2: Extract the hash from the response (requires jq)
123-
HASH=$(echo $RESPONSE | jq -r '.hash')
124-
echo "Hash: $HASH"
130+
Here are some screenshots of built-in themes:
125131

126-
# Step 3: Decrypt using the hash
127-
curl -X GET http://localhost:8000/decrypt/$HASH
128-
```
132+
![Sakura](static/screenshots/sakura.png)

compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
app:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
ports:
7+
- "8000:8000"
8+
volumes:
9+
- .:/app
10+
restart: unless-stopped
11+
environment:
12+
- PYTHONUNBUFFERED=1

docs-md/adapters/webapi.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
WebAPI Adapter is a component that expose the functionality of the TopSecret application through a web API. It allows external systems to interact with the application using standard HTTP methods.
2+
3+
::: topsecret.adapters.webapi

docs-md/domain.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Domain layer is the core of the application. It contains interfaces and business logic. It is independent of any framework or technology. It should not depend on any other layer. It should only depend on the entities and value objects.
2+
3+
::: topsecret.domain

docs-md/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# topsecret
2+
3+
`top secret` is an encryption and decryption service with a REST API.
4+
5+
It provides two primary methods of encryption:
6+
7+
1. **Auto encryption**: Generates keys automatically and stores them securely
8+
2. **Passphrase encryption**: Uses a user-provided passphrase for more secure encryption
9+
10+
The project includes a FastAPI web service that expose encryption functionality through HTTP endpoints, allowing users to encrypt sensitive information and share decryption URLs.
11+
12+
## Sponsorship
13+
14+
A special thanks to [Hamkee](https://hamkee.net/) for sponsoring the project and providing hosting services.
15+
16+
If you find this project useful, consider supporting its development:
17+
[![Ko-fi](https://img.shields.io/badge/Ko--fi-Donate-blue?style=social)](https://ko-fi.com/edvmfoss)
18+
19+
20+
## Run API on three simple steps
21+
22+
### Prerequisites
23+
24+
- Python 3.10 or higher and `make` installed.
25+
26+
1- Install `uv` (Linux and MacOS)
27+
```bash
28+
curl -LsSf https://astral.sh/uv/install.sh | sh
29+
```
30+
31+
2- Run `make install` to install dependencies.
32+
```bash
33+
make install
34+
```
35+
36+
3- Run `make run` to start the API server.
37+
```bash
38+
make run
39+
```
File renamed without changes.

docs-md/infra/cipher/aes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
AES is a symmetric encryption algorithm that is widely used for securing data. It operates on fixed-size blocks of data and uses a secret key for both encryption and decryption. AES is known for its speed and security, making it a popular choice for various applications.
2+
3+
::: topsecret.infra.cipher.aes

docs-md/infra/storage/__init__.py

Whitespace-only changes.

docs-md/infra/storage/inmem.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In-Memory Storage is a simple key-value store that keeps data in memory. It is useful for testing and development purposes, but not suitable for production use due to its volatility.
2+
3+
::: topsecret.infra.storage.inmem

docs-md/services/encryption.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Encryption Service provides encryption and decryption functionality for sensitive data.
2+
3+
::: topsecret.services.encryption
4+
options:
5+
members:
6+
- EncryptionService

0 commit comments

Comments
 (0)