Skip to main content

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.

Sublime's custom image


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:

Sublime's custom image

Sublime's custom image

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

keycrypt-1.0.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

keycrypt-1.0.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page