Skip to main content

Keepsafe: Securely store and distribute sensitive information like passwords and keys.

Project description

Keepsafe: Securely store and distribute sensitive information like passwords and keys

PyPI Version PyPI Downloads License CodeQL Python Versions Issues Pull Requests Last Commit Contributors Sponsor

Table of Contents

Keepsafe is a Python library that helps you securely store and retrieve sensitive information like passwords, API keys, and other secrets. It uses encryption techniques to ensure that your sensitive data is safe, and only accessible using the correct master password or decryption key.

Features

  • Securely store and retrieve secrets (e.g., passwords, API keys).
  • Encryption based on Fernet and PBKDF2 for password-based key derivation.
  • Supports adding secrets using either the master password or decryption key.
  • Export secrets to .env files for use in applications.
  • Easily integrated into existing projects.

Installation

You can install keepsafe via pip from PyPI:

pip install keepsafe

Usage

Initialize a new file with a master password

First, create a Keepsafe object and initialize the file:

from keepsafe import KeepSafe

ks = KeepSafe("./secrets.keepsafe")
decryption_key = ks.initialize_file(password="your_master_password")

Add secrets

You can add secrets either using the master password or the decryption key:

ks.add_secret("api_key", "super_secret_api_key", password_or_decryption_key="your_master_password")
ks.add_secret("email_password", "super_secret_email_password", password_or_decryption_key=decryption_key)

Retrieve secrets

You can retrieve secrets using the master password or the decryption key:

api_key = ks.get_secret("api_key", password_or_decryption_key="your_master_password")
email_password = ks.get_secret("email_password", password_or_decryption_key=decryption_key)

print(f"API Key: {api_key}")
print(f"Email Password: {email_password}")

Export secrets to .env file

To unlock the file and export all secrets to a .env file:

ks.unlock(password="your_master_password", env_file_path=".env")

This will export the secrets into the .env file, where each secret will be written as KEY=VALUE.

Testing

To run tests, you can use pytest. This package includes basic tests to verify that the core functionality works as expected.

Run the tests with:

pytest

License

Keepsafe is distributed under the MIT License. See LICENSE for more information.

Contributing

We welcome contributions to Keepsafe! Before contributing, please make sure to read our Code of Conduct and follow the guidelines below to ensure a smooth collaboration process.

Please ensure you follow the Code of Conduct when contributing.

If you encounter any issues or need assistance, feel free to open an issue or contact the maintainers.

Thank you for your contributions!

Contact

For any issues, bugs, or feature requests, please open an issue on the GitHub repository.

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

keepsafe-0.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

keepsafe-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file keepsafe-0.0.1.tar.gz.

File metadata

  • Download URL: keepsafe-0.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for keepsafe-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f78e2d5f2338f6f73840ee806598eba4e9d8115ddd505a6997edb0c87e778c28
MD5 cfa19571e73e4383530d21760597ff32
BLAKE2b-256 bd6cfeee700f1ca9c70c3ac15fe590681b688aed4d65317c7e08a081e0fc059d

See more details on using hashes here.

File details

Details for the file keepsafe-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: keepsafe-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for keepsafe-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9e2f131ae480f8d55f6cc8de6383caf331b9e8c7797c0e0f3da046edd0ce4e6
MD5 f029bb0269e95ff9f1d64493d42d672d
BLAKE2b-256 ed2aa3b08cb0fe206b2c90f10907e128320ffc0631f5c4bcd9d18d681f596134

See more details on using hashes here.

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