diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..3ad7af7
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,4 @@
+# These are supported funding model platforms
+
+github: [hamkee-dev-group, hamkee]
+ko_fi: edvmfoss
diff --git a/.gitignore b/.gitignore
index d51c95b..396d3ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,9 +98,6 @@ ENV/
# Rope project settings
.ropeproject
-# mkdocs documentation
-/site
-
# mypy
.mypy_cache/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bee0be7..01f5980 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -101,4 +101,4 @@ Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated.
- Put your new functionality into a function with a docstring, and add the feature to the list in `README.md`.
+ Put your new functionality into a function with a docstring.
diff --git a/Dockerfile b/Dockerfile
index 754dd67..57b5088 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,21 +1,15 @@
-# Install uv
FROM python:3.13-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
-# Change the working directory to the `app` directory
WORKDIR /app
-# Copy the lockfile and `pyproject.toml` into the image
COPY uv.lock /app/uv.lock
COPY pyproject.toml /app/pyproject.toml
-# Install dependencies
RUN uv sync --frozen --no-install-project
-# Copy the project into the image
COPY . /app
-# Sync the project
RUN uv sync --frozen
-CMD ["uvicorn", "topsecret.adapters.webapi:api", "--host", "0.0.0.0", "--port", "8000"]
+CMD ["uv", "run", "fastapi", "run", "topsecret/adapters/webapi.py"]
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..f4aa842
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,619 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
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.
+ + +DecryptRequest
+
+
+¶
+ Bases: BaseModel
Request model for decryption.
+ + + + + + + +topsecret/adapters/webapi.py55 +56 +57 +58 | |
DecryptResponse
+
+
+¶
+ Bases: BaseModel
Response model for decryption.
+ + + + + + + +topsecret/adapters/webapi.py61 +62 +63 +64 | |
EncryptRequest
+
+
+¶
+ Bases: BaseModel
Request model for encryption.
+ + + + + + + +topsecret/adapters/webapi.py41 +42 +43 +44 +45 | |
EncryptResponse
+
+
+¶
+ Bases: BaseModel
Response model for encryption.
+ + + + + + + +topsecret/adapters/webapi.py48 +49 +50 +51 +52 | |
api_info()
+
+
+ async
+
+
+¶Return API information.
+ + +topsecret/adapters/webapi.py160 +161 +162 +163 +164 +165 +166 +167 | |
decrypt_secret(hash_value, request=Body(default=None))
+
+
+ async
+
+
+¶Decrypt a secret given its hash value.
+This endpoint attempts to decrypt a secret identified by its hash.
+An optional passphrase can be provided in the request body.
+Args:
+ hash_value: The hash identifier of the secret to be decrypted.
+ request: An optional request body containing the passphrase.
+ If not provided or if passphrase is None, decryption
+ will be attempted without a passphrase.
+Returns:
+ A DecryptResponse object containing the decrypted secret text.
+Raises:
+ HTTPException: If decryption fails (e.g., due to an incorrect
+ passphrase or invalid hash), an HTTP 401 Unauthorized
+ error is raised with details of the decryption error.
topsecret/adapters/webapi.py124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 | |
encrypt_secret(request, base_url=Depends(get_base_url))
+
+
+ async
+
+
+¶Encrypts a secret provided in the request.
+This endpoint takes a secret string and a passphrase, encrypts the secret, +and returns a hash representing the encrypted data along with a URL +that can be used to decrypt it.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ request
+ |
+
+ EncryptRequest
+ |
+
+
+
+ An |
+ + required + | +
+ base_url
+ |
+
+ str
+ |
+
+
+
+ The base URL of the application, injected as a dependency. +Used to construct the decryption URL. + |
+
+ Depends(get_base_url)
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ EncryptResponse
+ |
+
+
+
+ An |
+
+ EncryptResponse
+ |
+
+
+
+ and the full URL for decryption. + |
+
Raises:
+| Type | +Description | +
|---|---|
+ HTTPException
+ |
+
+
+
+ If the |
+
topsecret/adapters/webapi.py90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 | |
get_base_url(request)
+
+¶Extract base URL from request.
+ + +topsecret/adapters/webapi.py67 +68 +69 | |
get_theme_path(name)
+
+¶Get path to the HTML skin/theme.
+ + +topsecret/adapters/webapi.py72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 | |
root(theme=None)
+
+
+ async
+
+
+¶Serve the HTML frontend.
+ + +topsecret/adapters/webapi.py151 +152 +153 +154 +155 +156 +157 | |