Metadata-Version: 2.4
Name: bxmarshall
Version: 0.2.0
Summary: Local encryption, compression, project integrity and Python source utilities
Author: BXCODE
License: MIT
Keywords: encryption,AES-GCM,integrity,compression
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42
Provides-Extra: cython
Requires-Dist: Cython>=3; extra == "cython"
Requires-Dist: setuptools>=68; extra == "cython"
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Provides-Extra: release
Requires-Dist: build; extra == "release"
Requires-Dist: twine; extra == "release"
Dynamic: license-file

# BX Marshall

**BX Marshall** (`bxmarshall`) is a local-first Python toolkit for password-based file protection, compression, Unicode text representation, project checksums and conservative Python-source utilities. Version 0.2.0, by BXCODE. Supports Python 3.11–3.13.

## Security model and limitations

BXM v1 uses AES-256-GCM authenticated encryption and a per-package random 16-byte salt and 12-byte nonce. A 32-byte key is derived from the password using scrypt (`N=2^15, r=8, p=1`). There are no embedded keys or network calls. **Use a long, unique password and keep it separately**: there is no password recovery. GCM detects tampering. File decryption writes to a temporary file and only publishes the output after authentication completes. Memory usage is bounded for file operations, though scrypt itself requires memory.

BXM v1 currently protects integrity/confidentiality but does not compress files automatically; explicitly compress first if desired. Passwords are not stored. The format is not a substitute for key management, backups, or independent security review. Hashes alone do not establish legal ownership. Character Engine is reversible representation, not encryption. Cython compilation can make casual inspection harder but is neither encryption nor absolute protection. Do not treat minification as a security boundary.

The required `cryptography` dependency supplies vetted AES-GCM and Ed25519 primitives. A C compiler and Cython are optional and only needed for `compile_file`. Android/Pydroid may install cryptography wheels on supported ARM64/Python combinations, but availability depends on the specific platform and package index; native compilation is not guaranteed.

## Install

```bash
python -m pip install bxmarshall
# From a source checkout, including tests:
python -m pip install -e '.[test]'
# Build and publishing tools are separate and generally best installed on a desktop/CI machine:
python -m pip install -e '.[release]'
# Optional Cython integration:
python -m pip install -e '.[cython]'
```

## Quick start

```python
import bxmarshall

package = bxmarshall.protect("Hello BX بالعربية", password="use-a-long-unique-password")
text = bxmarshall.unprotect(package, password="use-a-long-unique-password", as_text=True)

bxmarshall.protect_file("main.py", "main.bxm", password="use-a-long-unique-password")
bxmarshall.unprotect_file("main.bxm", "restored.py", password="use-a-long-unique-password")
print(bxmarshall.inspect("main.bxm"))
print(bxmarshall.compress_file("main.py", "main.zip"))
bxmarshall.minify_file("main.py", "main.min.py")
```

API overview: `protect` / `unprotect` handle bytes or UTF-8 text; `protect_file` / `unprotect_file` stream files; `compress_data` and `decompress_data` support zlib or raw data, while `compress_file` emits ZIP for `.zip` destinations and otherwise zlib/auto; `encode_text` / `decode_text` are Unicode-safe representations; `sha256_file`, `create_manifest`, and `verify_manifest` support integrity workflows; `signatures.generate_keypair`, `sign`, `verify` provide optional Ed25519 signing; `compile_file` optionally builds an extension; `minify_file` removes comments conservatively and AST-checks the result. See docstrings for arguments and returned values.

Manifest output must be outside the project root to avoid including its own output. A manifest is an integrity aid, not a legal ownership certificate. Verify signed release manifests with a public key obtained through a trusted channel.

## Development and tests

```bash
python -m pip install -e '.[test]'
python -m pytest -q
```

## Build and publish

```bash
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
# Configure a PyPI API token in ~/.pypirc with mode 600, or enter it interactively:
python -m twine upload dist/*
```

Never commit tokens. Recommended interactive upload: use `__token__` as username and paste the token only at the prompt. Alternatively set `TWINE_USERNAME=__token__` and `TWINE_PASSWORD` in a temporary shell environment; avoid writing credentials into source files or shell history.

## GitHub release starter files

The repository includes GitHub Actions tests, Dependabot, `SECURITY.md`, `CONTRIBUTING.md`, secret-scanning guidance and a project `.gitignore`. Review them before adoption. GitHub's native secret scanning availability depends on repository plan/settings; local checks are advisory, not a guarantee.

```bash
git init
git add .
git commit -m "BX Marshall 0.2.0"
git branch -M main
git remote add origin YOUR_GITHUB_REPOSITORY
git push -u origin main
```

Create a GitHub release from the repository's **Releases → Draft a new release**, tag `v0.2.0`, title `BX Marshall 0.2.0`; attach the wheel, source archive, and checksums. Confirm the release notes and artifacts before publishing.

## License

MIT; see `LICENSE`.
