host secure, password-protected static sites
Project description
StatiCrypt
StatiCrypt is a Python-based tool designed to help users host secure, password-protected static sites including markdown content. It provides the following functionality:
- Markdown to HTML Conversion: Converts Markdown files into HTML using the
md2html.pyscript. - HTML Encryption: Encrypts HTML files with a password using the
encrypt.pyscript, ensuring secure storage and transmission. - Decryption via Static HTML: Generates a static HTML file with embedded encrypted content that can be decrypted in the browser using JavaScript.
Features
- Secure Static Hosting: Host password-protected static sites without requiring server-side processing.
- Markdown Conversion: Easily convert Markdown files to HTML.
- Secure Encryption: Protect your HTML content with AES encryption.
- Browser-Based Decryption: Decrypt and render encrypted content directly in the browser.
Usage
Protect Command
Use the protect command to convert, encrypt, and embed Markdown or HTML content into a password-protected static site:
python -m staticrypt protect \
-i <path-to-input> \
--password <encryption-password> \
[--style <path-to-css>] \
[--allow-unsafe-password]
<path-to-input>: Path to the input file. Can be a Markdown (.md) or HTML (.html) file.--style: Optional. Path to a CSS file to style the generated HTML. For Markdown files, the CSS is applied during the conversion to HTML. For HTML files, the CSS is directly injected into the<head>section.--allow-unsafe-password: Optional. Skip strength validation on the supplied password. Use with caution; weak passwords are insecure.
Convert Command
Use the convert command to convert a Markdown file to HTML:
python -m staticrypt convert -i <path-to-markdown> [-o <path-to-html>] [--style <path-to-css>]
--style: Optional. Path to a CSS file to style the generated HTML.
Encrypt Command
Use the encrypt command to encrypt an HTML file:
python -m staticrypt encrypt \
-i <path-to-html> \
--password <encryption-password> \
[--allow-unsafe-password]
--allow-unsafe-password: Optional. Skip strength validation on the supplied password. Use with caution.
Decrypt Command
Use the decrypt command to decrypt an encrypted HTML file:
python -m staticrypt decrypt -i <path-to-encrypted-html> --password <encryption-password>
Example
python -m staticrypt protect -i ./resources/sample.md --password "YourPassword123" --style ./resources/style.css
This will:
- Convert
sample.mdto HTML. - Encrypt the HTML with the provided password.
- Generate a static HTML file (e.g.,
sample.protected.html) that can decrypt and display the content in the browser.
Requirements
- UV
- Python 3.8+
cryptographylibrarymarkdownlibrary
uv sync
Contributing
Contributions are welcome! If you encounter issues or have suggestions for improvement, please open an issue or submit a pull request.
# Clone the repository
git clone https://github.com/Au2mater/StatiCrypt.git
# installing StatiCrypt locally for development:
uv sync --dev
uv pip install -e .
# run StatiCrypt with the example file:
staticrypt --help
staticrypt protect -i ./resources/sample.md --password "YourPassword123!" --style ./resources/style.css
# run tests:
pytest
# uninstall StatiCrypt after development:
uv pip uninstall staticrypt
License
This repository is licensed under the MIT License. See the LICENSE file for more details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file staticrypt-0.1.2.tar.gz.
File metadata
- Download URL: staticrypt-0.1.2.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ddf3cdf996c69a047f2b9bb3710ba5605592ba0de955e98861d0aa0e1b3eb2
|
|
| MD5 |
7c9f0a3a3934c33f82a3acac3de3b374
|
|
| BLAKE2b-256 |
9bdc45b4ded4aa523d4e66cf7ccce6f50aa649ea7355f48d7c4c2c2d592a5e93
|
File details
Details for the file staticrypt-0.1.2-py3-none-any.whl.
File metadata
- Download URL: staticrypt-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7493d7720e1ce2299acbe77d3a23fc21beb1cb960f44ec6aea627ec4f6f2cc36
|
|
| MD5 |
ff3b06d9e63233a1ff073c3fde7c84af
|
|
| BLAKE2b-256 |
e9f36418fe3caaeca9364b831b8ee7f72b3104262507b86403b36b38f0b0c2b1
|