# Crypto Vault (off-chain)
#### Version 0.1.0
[![Version](https://img.shields.io/badge/version-0.1.0-blue.svg)](https://github.com/yourusername/crypto-vault)
[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)]()
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
<br/>
<p align="center">
<img src="./logo.webp" width="400" alt="password-store">
</p>
<br/>
## About
Crypto Vault is a Python library designed to securely encrypt and store secrets on-chain. It facilitates
off-chain encryption followed by on-chain storage through smart contracts, offering a robust solution for managing
sensitive data in blockchain applications.
## Requirements
- Python 3.9^
- Polygon wallet with enough MATIC to pay gas
- HTTP provider URL (Polygon-mumbai RPC)
## Installation
```bash
pip install crypto-vault
```
## Usage
### Basic Workflow:
1. Initialize Crypto Vault with a private key and HTTP provider.
2. Store, retrieve, and update secrets on-chain.
3. Encrypt and decrypt data off-chain.
<details>
<summary>Code Examples</summary>
Generate secure encryption key with Encryption
```python
from crypto_vault import Encryption
# Generate encryption key
encryption_key = Encryption.generate_key()
```
Initialize Crypto Vault:
```python
from crypto_vault.crypto_vault import CryptoVault
crypto_vault = CryptoVault(
app="myApp",
env="prod",
private_key="private_key",
encryption_key=encryption_key,
http_provider="http-provider-url-with-api-key",
)
```
Store, retrieve, and update secrets
```python
# Store
crypto_vault.store(data={"password": "secret", "foo": "bar"})
# Retrieve secrets
secrets = crypto_vault.retrieve()
# Retrieve single secret
password = crypto_vault.retrieve(value_name="password")
# Update single secret
crypto_vault.update(data={"foo": "Hello world!"})
# Update secrets -> To update all secrets use crypto_vault.store()
```
Encrypt and decrypt data
```python
# Encrypt
encrypted_data = crypto_vault.encrypt(data="secret")
# Decrypt
decrypted_data = crypto_vault.decrypt(data=encrypted_data)
```
</details>
## Crypto Vault API
1. Storage
- Store data. Input parameters: data(k: v)
- Retrieve data. Params: value_name(optional)
- Update parameter. Params: data
2. Encryption
- Generate encryption key
- Encrypt data(str, int, list, dict). Params: value, key
- Decrypt data(bytes32). Params: value, key
Raw data
{
"_id": null,
"home_page": "https://github.com/allelementary/crypto-vault-off-chain",
"name": "crypto-vault",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Mikhail Antonov",
"author_email": "allelementaryfor@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/74/06/0de835ed51fe50ec6744a2b438ee7dfe3ac8a5d865e604b3b15c558030e7/crypto-vault-0.1.0.tar.gz",
"platform": null,
"description": "# Crypto Vault (off-chain)\n#### Version 0.1.0\n\n[![Version](https://img.shields.io/badge/version-0.1.0-blue.svg)](https://github.com/yourusername/crypto-vault)\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)]()\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n\n<br/>\n<p align=\"center\">\n<img src=\"./logo.webp\" width=\"400\" alt=\"password-store\">\n</p>\n<br/>\n\n## About\n\nCrypto Vault is a Python library designed to securely encrypt and store secrets on-chain. It facilitates \noff-chain encryption followed by on-chain storage through smart contracts, offering a robust solution for managing \nsensitive data in blockchain applications.\n\n\n## Requirements\n- Python 3.9^\n- Polygon wallet with enough MATIC to pay gas\n- HTTP provider URL (Polygon-mumbai RPC)\n\n## Installation\n\n```bash\npip install crypto-vault\n```\n\n## Usage\n\n### Basic Workflow:\n\n1. Initialize Crypto Vault with a private key and HTTP provider.\n2. Store, retrieve, and update secrets on-chain.\n3. Encrypt and decrypt data off-chain.\n\n<details>\n<summary>Code Examples</summary>\n\nGenerate secure encryption key with Encryption\n```python\nfrom crypto_vault import Encryption\n\n# Generate encryption key\nencryption_key = Encryption.generate_key()\n```\n\nInitialize Crypto Vault:\n```python\nfrom crypto_vault.crypto_vault import CryptoVault\n\ncrypto_vault = CryptoVault(\n app=\"myApp\",\n env=\"prod\",\n private_key=\"private_key\",\n encryption_key=encryption_key,\n http_provider=\"http-provider-url-with-api-key\",\n)\n```\n\nStore, retrieve, and update secrets\n```python\n# Store\ncrypto_vault.store(data={\"password\": \"secret\", \"foo\": \"bar\"})\n\n# Retrieve secrets\nsecrets = crypto_vault.retrieve()\n\n# Retrieve single secret\npassword = crypto_vault.retrieve(value_name=\"password\")\n\n# Update single secret\ncrypto_vault.update(data={\"foo\": \"Hello world!\"})\n\n# Update secrets -> To update all secrets use crypto_vault.store()\n```\n\nEncrypt and decrypt data\n```python\n# Encrypt\nencrypted_data = crypto_vault.encrypt(data=\"secret\")\n\n# Decrypt\ndecrypted_data = crypto_vault.decrypt(data=encrypted_data)\n```\n\n\n \n</details>\n\n## Crypto Vault API\n\n1. Storage\n - Store data. Input parameters: data(k: v)\n - Retrieve data. Params: value_name(optional)\n - Update parameter. Params: data\n2. Encryption\n - Generate encryption key\n - Encrypt data(str, int, list, dict). Params: value, key\n - Decrypt data(bytes32). Params: value, key\n",
"bugtrack_url": null,
"license": null,
"summary": "Efficiently encrypt data off-chain and store securely on the blockchain",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/allelementary/crypto-vault-off-chain"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a27d5598149ff1783a6b8df57a2152d798a9792f4830a5f7fcec1b862f3ff7be",
"md5": "954eec89bacbc928ea5275a4b04c78ad",
"sha256": "730e2aef796a0dfc51038ccbab09c9c7ac8b43f285d9bc7cc227f6662e211bd4"
},
"downloads": -1,
"filename": "crypto_vault-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "954eec89bacbc928ea5275a4b04c78ad",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9763,
"upload_time": "2024-03-26T19:37:09",
"upload_time_iso_8601": "2024-03-26T19:37:09.574693Z",
"url": "https://files.pythonhosted.org/packages/a2/7d/5598149ff1783a6b8df57a2152d798a9792f4830a5f7fcec1b862f3ff7be/crypto_vault-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "74060de835ed51fe50ec6744a2b438ee7dfe3ac8a5d865e604b3b15c558030e7",
"md5": "47bc06befe50d772feec882fd479e264",
"sha256": "3c2e213f532575c4ac490d51d436a5ba8c83fb2aaff3f43e579ddc4daa4c186b"
},
"downloads": -1,
"filename": "crypto-vault-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "47bc06befe50d772feec882fd479e264",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10650,
"upload_time": "2024-03-26T19:37:11",
"upload_time_iso_8601": "2024-03-26T19:37:11.280887Z",
"url": "https://files.pythonhosted.org/packages/74/06/0de835ed51fe50ec6744a2b438ee7dfe3ac8a5d865e604b3b15c558030e7/crypto-vault-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-26 19:37:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "allelementary",
"github_project": "crypto-vault-off-chain",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "crypto-vault"
}