Metadata-Version: 2.4
Name: sanctum-locker
Version: 0.1.1
Summary: Authenticated file locking with a small Python API and CLI
Author: Phani Kumar Kodukulla
License: MIT License
        
        Copyright (c) 2026 Phani Kumar Kodukulla
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# Sanctum Locker

Sanctum Locker is a dependency-free Python package for authenticated file locking. It uses PBKDF2-HMAC-SHA256 for key derivation and HMAC-SHA256 for encryption integrity.

Author: Phani Kumar Kodukulla

Licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.

This preserves the container format and behavior of the original `filehandle.py`. The format is not AES-GCM or ChaCha20-Poly1305 and has not received an independent cryptographic audit. Use a vetted cryptography library for high-value secrets. Disk and memory wiping are best effort only.

## Install

```text
python -m pip install .
```

For development:

```text
python -m pip install -e ".[test]"
python -m pytest
```

## Python API

```python
from sanctum_locker import restrict_file, unrestrict_file

locked = restrict_file("report.pdf", "a-long-passphrase")
restored = unrestrict_file(locked, "a-long-passphrase", "restored")
```

`restrict_file` replaces the input by default. Pass `output_path` to write a separate encrypted copy; the original is then best-effort shredded. `unrestrict_file_in_place` restores the encrypted file over itself after authentication succeeds.

## CLI

```text
sanctum-locker lock report.pdf
sanctum-locker unlock report.pdf --output-dir restored
sanctum-locker unlock report.pdf --in-place
```

The CLI reads passphrases without echoing them and returns a non-zero exit status on invalid input, authentication failure, or filesystem errors.

> ✅ **Author**
>
> **K. V. K. Phani Kumar**  
> Verified Fellow of the Official Python Developer Society

## References

- [Sanctum Locker GitHub repository](https://github.com/workwithphanikumarkodukulla/sanctum-locker)
