SecuredFiles 1.1.0
Python's library for protect your files.
Requires Python: >=3.7
Keywords: File, Files, Secured

<div align="center">

# SecuredFiles

[![LassaInora - SecuredFiles](https://img.shields.io/static/v1?label=LassaInora&message=SecuredFiles&color=yellow&logo=github)](https://github.com/LassaInora/Tyradex "Go to GitHub repo")
[![GitHub tag](https://img.shields.io/github/tag/LassaInora/SecuredFiles?include_prereleases=&sort=semver&color=orange)](https://github.com/LassaInora/SecuredFiles/releases/)
[![stars - SecuredFiles](https://img.shields.io/github/stars/LassaInora/SecuredFiles?style=social)](https://github.com/LassaInora/SecuredFiles)
[![forks - SecuredFiles](https://img.shields.io/github/forks/LassaInora/SecuredFiles?style=social)](https://github.com/LassaInora/SecuredFiles)

[![PyPI version](https://badge.fury.io/py/SecuredFiles.svg)](https://badge.fury.io/py/SecuredFiles)
[![Supported Versions](https://img.shields.io/pypi/pyversions/SecuredFiles.svg)](https://pypi.org/project/SecuredFiles)
[![License](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)

___

</div>

# Overview

SecuredFiles is a Python library that provides a simple and secure way to work with encrypted and unencrypted files.
It offers a set of classes that allow you to seamlessly lock and unlock files, making sure your sensitive data remains
protected.

# How to use

## Installation

- Unix/ macOS :

```bash
python3 -m pip install --upgrade SecuredFiles
```

- Windows :

```bash
py -m pip install --upgrade SecuredFiles
```

## Library Interface

SecuredFiles offers simple file management.  
Declare the file path using `SecuredFiles.File(path)` and the library will automatically determine whether the file
is a `.lck` or not.

```python
import SecuredFiles

file = SecuredFiles.File('your/file/path')  # SecureFile or UnsecureFile
```

You can also directly declare the class of your file, but if you declare a file encrypted that is not, or decrypt a
file that is, you risk encountering errors.

```python
import SecuredFiles

secure = SecuredFiles.File.SecureFile('your/file/path.lck')  # SecureFile
unsecure = SecuredFiles.File.UnsecureFile('your/file/path')  # UnsecureFile
```

`.lck` files are encrypted files generated by the library, whose key is generated and stored on your computer in the
`~/.keys/SecuredFilesKey.key` file. File data is always available in clear text using the library as follows:

```python
import SecuredFiles

file = SecuredFiles.File('your/file/path.lck')  # SecureFile
print(file.data)
```

To convert a `.lck` file to a standard file, do:

```python
import SecuredFiles

file = SecuredFiles.File('your/file/path.lck')  # SecureFile
file = file.unlock()  # UnsecureFile
```

To convert a standard file to a `.lck` file, do:

```python
import SecuredFiles

file = SecuredFiles.File('your/file/path')  # UnsecureFile
file = file.lock()  # SecureFile
```

### Modifying and Saving

Regardless of the chosen option, you can retrieve and modify the data using the .data attribute:

```python
import SecuredFiles

file = SecuredFiles.File('your/file/path')  # SecureFile or UnsecureFile
file.data = "some new data"
data = file.data
file.save()
```

Make sure to use `.save()` to push changes back to the file after modification.

## Command Line Interface

This library also has a command-line interface.

* Unix/ macOS :

```cmd
python3 -m SecuredFiles [options] <read | lock | unlock> <filepath>
```

* Windows :

```cmd
py -m SecuredFiles [options] <read | lock | unlock> <filepath>
```

### Options:

* `-h`, `--help` : Display help message and exit.
* `-v`, `--version` : Display the version and exit.

# Contributors

### Library created by

* [LassaInora](https://github.com/LassaInora)

# License

This project is licensed under the GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007.