Metadata-Version: 2.1
Name: keyway
Version: 1.0.3
Summary: A solution for persistent environment variables.
Author-email: hardchaos <hardchaos.com@gmail.com>
Project-URL: Homepage, https://github.com/hardchaos/keyway
Project-URL: Bug Tracker, https://github.com/hardchaos/keyway/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# 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.

```python 
pip install keyway 
```

Import with
```python
import keyway
kw = keyway.Keyway()
```
Set, access, and delete keys like a dictionary.
```python
kw["alpha"] = "an api key"
kw["bravo"] = "a setting"
kw["charlie"] = 42

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

del kw["alpha"]
```

Missing keys return None.
```python
kw["alpha"]
#>> None
```

Keys are not stored in memory.
```python
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. 
```python
kw[all]
#>> {'bravo': 'a variable', 'charlie': '42'}
```

To delete all of a user's keys, use the "all" keyword.
```python
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:
    * ``` python
      kw = keyway.Keyway(path = "your/custom/path", db_name = "custom_name")
      ```
  * You can also optionally set a user for the keyway instance: 
    * ```python
      kw = keyway.Keyway(user = "username")
      ```
  * The "all" keyword can be disabled with
    * ```python
      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
