Skip to main content

host secure, password-protected static sites

Project description

StatiCrypt

StatiCrypt is a CLI tool designed to help users host secure, password-protected static sites including markdown content.

alt text

It provides the following functionality:

  1. HTML/Markdown Encryption: Locally encrypts any HTML or Markdown document with a user-provided password.
  2. Decryption via password: Embeds the encrypted content in a static HTML file wrapper that allows any user to decrypt and preview it in the browser provided the correct password. The password itself is never stored in the HTML file.
  3. Markdown to HTML Conversion: Converts Markdown files into HTML.
  4. Custom Styling: Allows users to apply custom CSS styles to the generated HTML content.

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, client side.

Usage

Protect Command

Use the protect command to convert, encrypt, and embed Markdown or HTML content into a password-protected static site:

# with uvx - no installation required
uvx staticrypt@latest protect \
    -i <path-to-input> \
    --password <encryption-password> \
    -o <path-to-output> \
    [--style <path-to-css>] \
    [--allow-unsafe-password]

# with pip:
pip install staticrypt
staticrypt protect \
    -i <path-to-input> \
    --password <encryption-password> \
    -o <path-to-output> \
    [--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:

  1. Convert sample.md to HTML.
  2. Encrypt the HTML with the provided password.
  3. 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+
  • cryptography library
  • markdown library
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

staticrypt-0.1.4.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

staticrypt-0.1.4-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file staticrypt-0.1.4.tar.gz.

File metadata

  • Download URL: staticrypt-0.1.4.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for staticrypt-0.1.4.tar.gz
Algorithm Hash digest
SHA256 577117f1dd75fdc5a907c8d8cb2cafb60297903e94458d8ba2a8e21926236e87
MD5 5e70efd8a7e0860eded71a06e79129b3
BLAKE2b-256 14ba6a247789d6ef0aaf95dea0b9b1d23f2a9d0d802cc899daba0a0ee93f49f8

See more details on using hashes here.

File details

Details for the file staticrypt-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: staticrypt-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for staticrypt-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d64ea1fd5696d64ba1f92f121c0893941cce26e8577f339152272ee4abbafb45
MD5 665903db1f70baacb8c0a8ffd5c061b7
BLAKE2b-256 c9eb7d9053a3eff560317f441efe3d7700b9a6344b5ba9e0d4515a46ce96babc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page