<h1 align="center">Keepsafe: Securely store and distribute sensitive information like passwords and keys</h1>
<p align="center">
<img src="https://img.shields.io/pypi/v/keepsafe" alt="PyPI Version" />
<img src="https://img.shields.io/pypi/dm/keepsafe" alt="PyPI Downloads" />
<img src="https://img.shields.io/pypi/l/keepsafe" alt="License" />
<a href="https://github.com/muhammad-fiaz/keepsafe/actions/workflows/github-code-scanning/codeql">
<img src="https://github.com/muhammad-fiaz/keepsafe/actions/workflows/github-code-scanning/codeql/badge.svg" alt="CodeQL" />
</a> <img src="https://img.shields.io/pypi/pyversions/keepsafe" alt="Python Versions" />
<img src="https://img.shields.io/github/issues/muhammad-fiaz/keepsafe" alt="Issues" />
<img src="https://img.shields.io/github/issues-pr/muhammad-fiaz/keepsafe" alt="Pull Requests" />
<img src="https://img.shields.io/github/last-commit/muhammad-fiaz/keepsafe" alt="Last Commit" />
<img src="https://img.shields.io/github/contributors/muhammad-fiaz/keepsafe" alt="Contributors" />
<a href="https://github.com/sponsors/muhammad-fiaz">
<img src="https://img.shields.io/badge/sponsor-muhammad--fiaz-ff69b4" alt="Sponsor" />
</a>
</p>
## Table of Contents
- [Introduction](#)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Initialize a new file with a master password](#initialize-a-new-file-with-a-master-password)
- [Add secrets](#add-secrets)
- [Retrieve secrets](#retrieve-secrets)
- [Export secrets to `.env` file](#export-secrets-to-env-file)
- [Testing](#testing)
- [License](#license)
- [Contributing](#contributing)
- [Contact](#contact)
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:
```bash
pip install keepsafe
```
## Usage
### Initialize a new file with a master password
First, create a `Keepsafe` object and initialize the file:
```python
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:
```python
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:
```python
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:
```python
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:
```bash
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](CODE_OF_CONDUCT.md) and follow the guidelines below to ensure a smooth collaboration process.
**Please ensure you follow the [Code of Conduct](CODE_OF_CONDUCT.md) 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](https://github.com/muhammad-fiaz/keepsafe).
Raw data
{
"_id": null,
"home_page": "https://github.com/muhammad-fiaz/keepsafe",
"name": "keepsafe",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Muhammad Fiaz",
"author_email": "contact@muhammadfiaz.com",
"download_url": "https://files.pythonhosted.org/packages/bd/6c/feee700f1ca9c70c3ac15fe590681b688aed4d65317c7e08a081e0fc059d/keepsafe-0.0.1.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">Keepsafe: Securely store and distribute sensitive information like passwords and keys</h1>\r\n<p align=\"center\">\r\n <img src=\"https://img.shields.io/pypi/v/keepsafe\" alt=\"PyPI Version\" />\r\n <img src=\"https://img.shields.io/pypi/dm/keepsafe\" alt=\"PyPI Downloads\" />\r\n <img src=\"https://img.shields.io/pypi/l/keepsafe\" alt=\"License\" />\r\n <a href=\"https://github.com/muhammad-fiaz/keepsafe/actions/workflows/github-code-scanning/codeql\">\r\n <img src=\"https://github.com/muhammad-fiaz/keepsafe/actions/workflows/github-code-scanning/codeql/badge.svg\" alt=\"CodeQL\" />\r\n </a> <img src=\"https://img.shields.io/pypi/pyversions/keepsafe\" alt=\"Python Versions\" />\r\n <img src=\"https://img.shields.io/github/issues/muhammad-fiaz/keepsafe\" alt=\"Issues\" />\r\n <img src=\"https://img.shields.io/github/issues-pr/muhammad-fiaz/keepsafe\" alt=\"Pull Requests\" />\r\n <img src=\"https://img.shields.io/github/last-commit/muhammad-fiaz/keepsafe\" alt=\"Last Commit\" />\r\n <img src=\"https://img.shields.io/github/contributors/muhammad-fiaz/keepsafe\" alt=\"Contributors\" />\r\n <a href=\"https://github.com/sponsors/muhammad-fiaz\">\r\n <img src=\"https://img.shields.io/badge/sponsor-muhammad--fiaz-ff69b4\" alt=\"Sponsor\" />\r\n </a>\r\n</p>\r\n\r\n## Table of Contents\r\n\r\n- [Introduction](#)\r\n- [Features](#features)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n - [Initialize a new file with a master password](#initialize-a-new-file-with-a-master-password)\r\n - [Add secrets](#add-secrets)\r\n - [Retrieve secrets](#retrieve-secrets)\r\n - [Export secrets to `.env` file](#export-secrets-to-env-file)\r\n- [Testing](#testing)\r\n- [License](#license)\r\n- [Contributing](#contributing)\r\n- [Contact](#contact)\r\n\r\n\r\nKeepsafe 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.\r\n\r\n## Features\r\n\r\n- Securely store and retrieve secrets (e.g., passwords, API keys).\r\n- Encryption based on `Fernet` and `PBKDF2` for password-based key derivation.\r\n- Supports adding secrets using either the master password or decryption key.\r\n- Export secrets to `.env` files for use in applications.\r\n- Easily integrated into existing projects.\r\n\r\n## Installation\r\n\r\nYou can install `keepsafe` via `pip` from PyPI:\r\n\r\n```bash\r\npip install keepsafe\r\n```\r\n\r\n## Usage\r\n\r\n### Initialize a new file with a master password\r\n\r\nFirst, create a `Keepsafe` object and initialize the file:\r\n\r\n```python\r\nfrom keepsafe import KeepSafe\r\n\r\nks = KeepSafe(\"./secrets.keepsafe\")\r\ndecryption_key = ks.initialize_file(password=\"your_master_password\")\r\n```\r\n\r\n### Add secrets\r\n\r\nYou can add secrets either using the master password or the decryption key:\r\n\r\n```python\r\nks.add_secret(\"api_key\", \"super_secret_api_key\", password_or_decryption_key=\"your_master_password\")\r\nks.add_secret(\"email_password\", \"super_secret_email_password\", password_or_decryption_key=decryption_key)\r\n```\r\n\r\n### Retrieve secrets\r\n\r\nYou can retrieve secrets using the master password or the decryption key:\r\n\r\n```python\r\napi_key = ks.get_secret(\"api_key\", password_or_decryption_key=\"your_master_password\")\r\nemail_password = ks.get_secret(\"email_password\", password_or_decryption_key=decryption_key)\r\n\r\nprint(f\"API Key: {api_key}\")\r\nprint(f\"Email Password: {email_password}\")\r\n```\r\n\r\n### Export secrets to `.env` file\r\n\r\nTo unlock the file and export all secrets to a `.env` file:\r\n\r\n```python\r\nks.unlock(password=\"your_master_password\", env_file_path=\".env\")\r\n```\r\n\r\nThis will export the secrets into the `.env` file, where each secret will be written as `KEY=VALUE`.\r\n\r\n## Testing\r\n\r\nTo run tests, you can use `pytest`. This package includes basic tests to verify that the core functionality works as expected.\r\n\r\nRun the tests with:\r\n\r\n```bash\r\npytest\r\n```\r\n\r\n## License\r\n\r\nKeepsafe is distributed under the MIT License. See `LICENSE` for more information.\r\n\r\n## Contributing\r\n\r\nWe welcome contributions to Keepsafe! Before contributing, please make sure to read our [Code of Conduct](CODE_OF_CONDUCT.md) and follow the guidelines below to ensure a smooth collaboration process.\r\n\r\n**Please ensure you follow the [Code of Conduct](CODE_OF_CONDUCT.md) when contributing.**\r\n\r\nIf you encounter any issues or need assistance, feel free to open an issue or contact the maintainers.\r\n\r\nThank you for your contributions!\r\n\r\n## Contact\r\n\r\nFor any issues, bugs, or feature requests, please open an issue on the [GitHub repository](https://github.com/muhammad-fiaz/keepsafe).\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Keepsafe: Securely store and distribute sensitive information like passwords and keys.",
"version": "0.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/muhammad-fiaz/keepsafe/issues",
"Documentation": "https://github.com/muhammad-fiaz/keepsafe#readme",
"Homepage": "https://github.com/muhammad-fiaz/keepsafe",
"Source Code": "https://github.com/muhammad-fiaz/keepsafe"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ed2aa3b08cb0fe206b2c90f10907e128320ffc0631f5c4bcd9d18d681f596134",
"md5": "f029bb0269e95ff9f1d64493d42d672d",
"sha256": "e9e2f131ae480f8d55f6cc8de6383caf331b9e8c7797c0e0f3da046edd0ce4e6"
},
"downloads": -1,
"filename": "keepsafe-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f029bb0269e95ff9f1d64493d42d672d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5818,
"upload_time": "2024-11-19T11:01:21",
"upload_time_iso_8601": "2024-11-19T11:01:21.741665Z",
"url": "https://files.pythonhosted.org/packages/ed/2a/a3b08cb0fe206b2c90f10907e128320ffc0631f5c4bcd9d18d681f596134/keepsafe-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bd6cfeee700f1ca9c70c3ac15fe590681b688aed4d65317c7e08a081e0fc059d",
"md5": "cfa19571e73e4383530d21760597ff32",
"sha256": "f78e2d5f2338f6f73840ee806598eba4e9d8115ddd505a6997edb0c87e778c28"
},
"downloads": -1,
"filename": "keepsafe-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "cfa19571e73e4383530d21760597ff32",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6735,
"upload_time": "2024-11-19T11:01:24",
"upload_time_iso_8601": "2024-11-19T11:01:24.405646Z",
"url": "https://files.pythonhosted.org/packages/bd/6c/feee700f1ca9c70c3ac15fe590681b688aed4d65317c7e08a081e0fc059d/keepsafe-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-19 11:01:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "muhammad-fiaz",
"github_project": "keepsafe",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "keepsafe"
}