No project description provided
Project description
Secured
Secure your Python data structures and secrets with Secured. This package provides a straightforward solution for obscuring sensitive data in applications. It's specifically designed for developers who need to protect API keys, database credentials, and other critical configuration details from accidental exposure. Featuring customizable security measures, our tool allows you to control how sensitive information is represented and managed securely. It's ideal for projects that demand high data confidentiality and integrity. Please note that this provides a thin layer of protection.
Installation
To install Secured, run the following command:
pip install secured
Usage
Below are some examples on how to use Secured to protect your sensitive data:
Example 1: Basic Usage
from secured import Secure
# Protect a sensitive string
DATABASE_URL = "mysql://user:password@localhost/dbname"
secure_database_url = Secure(DATABASE_URL, "<Data Hidden>")
# Usage in code
print(secure_database_url) # Output: <Data Hidden>
Example 2: Custom Usage
from secured import Secure
# Protect an API key with a custom message
API_KEY = "12345-abcdef-67890-ghijk"
secure_api_key = Secure(API_KEY, "API Key Protected")
# Usage in code
print(secure_api_key) # Output: API Key Protected
Example 3: Config Usage
The Secured
class allows you to securely read configuration files containing sensitive data. Here's how you can use it:
from secured import Secured
# Create a Secured object to read a YAML configuration file
secured = Secured('config.yaml', secure=True)
# Access configuration attributes securely
print(secured.config.name) # Using dot notation
print(secured.config["name"]) # Using dictionary-like notation
Example 4: Compose
from secured import Secured
# Define the custom secure message
message = "🔒 <Data Secured> 🔒"
# Example secured object
CONFIG_PATH = "examples/config.yaml"
DATABASE_URL = "mysql://{user}:{password}@localhost/dbname"
secure = Secured(CONFIG_PATH, secure=True, message=message)
# Usage in code
secure_database_url = secure.compose(DATABASE_URL, user="guest", password="guest_password")
print(secure_database_url) # Output: 🔒 <Data Secured> 🔒
print(secure_database_url.get_original()) # Careful! This will print the original data, do not use it.
print(secure_database_url == "mysql://guest:guest_password@localhost/dbname") # Output: True
Features
- Data Protection: Helps prevent the accidental logging or display of sensitive information.
- Customizable Representations: Set how your data is displayed when being secured.
- Ease of Use: Integrate seamlessly into existing Python applications.
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
File details
Details for the file secured-0.1.6.tar.gz
.
File metadata
- Download URL: secured-0.1.6.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6af6476e2803856471f5724d61c3fbf97f2887fe27ed62a64e80f2d89d4664f2 |
|
MD5 | 549bd0fe35a8bffb81a50a2056fa877e |
|
BLAKE2b-256 | 5eedfc4112cf703709e6412c5e7873384dd92adb71aaf446f9c8399e6dfe5d3c |
File details
Details for the file secured-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: secured-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd7360b288ce202595de8cb810eb98fb29d6020f72a9a541363a15313d6eff9e |
|
MD5 | 295ff60a140dabeb94fd72257f3610cf |
|
BLAKE2b-256 | 7ed15c8a159ae830ee1802fa63d0c419ec7120c70b2df9019ab12c5a42d87a5d |