Skip to main content

A solution for persistent environment variables.

Project description

Keyway

Persistent environment variables!

A simple solution to prevent accidentally uploading your API keys to GitHub. Functions similarly to normal environment variables, except the keys and values persist through restarts.

pip install keyway 

Import with

import keyway
kw = keyway.Keyway()

Set, access, and delete keys like a dictionary.

kw["alpha"] = "an api key"
kw["bravo"] = "a setting"
kw["charlie"] = 42

kw["alpha"]
#>> "an api key"

del kw["alpha"]

Missing keys return None.

kw["alpha"]
#>> None

Keys are not stored in memory.

kw.keys()
#>> dict_keys([])

To retrieve a dictionary of all of a user's keys, use the "all" keyword. All keys are stored as text for simplicity.

kw[all]
#>> {'bravo': 'a variable', 'charlie': '42'}

To delete all of a user's keys, use the "all" keyword.

del kw[all]
kw[all]
#>> {}
  • By default, keys are stored in a sqlite database in the active environment folder

    • Never upload your virtual environment to github.
    • Optionally set a custom path and/or database name like:
      • kw = keyway.Keyway(path = "your/custom/path", db_name = "custom_name")
        
    • You can also optionally set a user for the keyway instance:
      • kw = keyway.Keyway(user = "username")
        
    • The "all" keyword can be disabled with
      • kw = keyway.Keyway(use_all = False)
        
    • Keys are encrypted using fernet.
      • This way, there is not a plaintext or easily accessible record of any of the keys.
      • Moving the database from its original location will cause the data to become unreadable. This is by design, so that even if someone has the database file, they are unable to access the keys without knowing the original path.
      • The cryptography library is the only external dependency.
  • License: MIT

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

keyway-1.0.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keyway-1.0.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file keyway-1.0.3.tar.gz.

File metadata

  • Download URL: keyway-1.0.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for keyway-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c97f79b269b58263679bc075bccfc4ec04296708b2420af63f51853bcdaf3c03
MD5 51d36c2dbc1624b378500b8019775f7f
BLAKE2b-256 ab5253bf30d5fff41a6e584dbe360c0faa3a848dfe1950c45f7da806c2173d18

See more details on using hashes here.

File details

Details for the file keyway-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: keyway-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for keyway-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c4200a1535c1ad16057ab451d0df6a4d360c3324ffa3e799bbbb10ee67c5f570
MD5 82fbaf34e0bc3ad235701a0aa4504ff4
BLAKE2b-256 52b03a464d5a66c8065640cd0ec3999a6e75cd4be0014bfa43300f59d4e29a04

See more details on using hashes here.

Supported by

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