This package helps you to call secret words used in your script (such as passwords) with the help of Environment Variables without specifying it.
Project description
KeyCrypt
Have you ever found yourself needing to include sensitive information like passwords or cookies in your code? Often, as you're about to type out these confidential words, your programming instincts kick in and raise a red flag. You start to wonder, "Is it really safe to embed the password directly into the code?"
A quick search usually confirms your suspicion – it's not a recommended practice. So, what's the solution?
The solution is actually quite straightforward. Instead of hardcoding the sensitive word directly into your script, you can define it once as an environment variable with a unique name. Then, whenever you need to use it in your code, simply call the variable by its name.
After doing this for a project, I thought it could be helpful to simplify this process for both myself and others. So, I developed a simple package that does this automatically. I'll encode the sensitive word exclusively for you and securely store it. When you need to use the secret word, it will be decoded with your private key, allowing you to seamlessly integrate it into your code.
This approach adds an extra layer of security, making it more challenging for anyone, even if they have access to your environment variables, to discern your secret word easily. While your secret word isn't entirely invulnerable, this method certainly makes it more time-consuming and complex for unauthorized access.
Installation
KeyCrypt requires the following packages:
- cryptography == 41.0.1
pip install cryptography == 41.0.1
Usage
from keycrypt import get_secret, set_secret
set_secret:
at the first time you should set your secret in environment variables. so :
set_secret(name='gmail_pass' , value='your_password')
get_secret:
all the next time you can just call your password with it's name. so :
- Create a connection
set_secret(name='gmail_pass') # --> returns 'your_password'
usage sample:
Project details
Release history Release notifications | RSS feed
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 keycrypt-1.0.0.tar.gz
.
File metadata
- Download URL: keycrypt-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0cb08a0ea9780eed43a0f6c8cf27a8ddefee223b73fb6e02d3822f401f1a598 |
|
MD5 | d8403ccf28f53e0ddfc0b302bcf08814 |
|
BLAKE2b-256 | e10af47630fdf3d83b7f2a7b7aeb7f1ca3344e9c09022a421015f86d52b02143 |
File details
Details for the file keycrypt-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: keycrypt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ef81c3a0571897d38f72c6e90d957b3f588459854bfd87fe062bf037923253 |
|
MD5 | f96b6d1f18c916736915582135635ce9 |
|
BLAKE2b-256 | 1a028c6c0718a7547278e415b3975d8f9f94cf23f02cac50f82f5880bf95e2a0 |