Skip to main content

Crypto Vault (off-chain)

Version 0.1.0

Version Build Status License


password-store


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.

Currently deployed on the Polygon Mumbai testnet only.

Requirements

  • Python 3.9^
  • Polygon wallet with enough MATIC to pay gas
  • HTTP provider URL (Polygon-mumbai RPC)

Installation

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.
Code Examples

Generate secure encryption key with Encryption

from crypto_vault import Encryption

# Generate encryption key
encryption_key = Encryption.generate_key()

Initialize Crypto Vault:

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

# 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

# Encrypt
encrypted_data = crypto_vault.encrypt(data="secret")

# Decrypt
decrypted_data = crypto_vault.decrypt(data=encrypted_data)

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

Crypto Vault Smart Contract

The smart contract is designed to store encrypted data on-chain. It is deployed on the Polygon Mumbai testnet.

Crypto Vault Smart Contract on mumbai-polygonscan

Release files for crypto-vault 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crypto-vault 0.1.1
File Size Uploaded
crypto-vault-0.1.1.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crypto-vault 0.1.1
File Interpreter ABI Platform
crypto_vault-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / crypto-vault-0.1.1.tar.gz

Download URL crypto-vault-0.1.1.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a32a0123f480da1dd4787c0fef5c0f0c202a1f2ddf85cc6963006f7a70f6f711
BLAKE2b-256 checksum
How to use checksums
07b18586c8ad108feaaa4a96875316e8ff60a33bed0a9950e4df88eb7d8c1214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release files / crypto_vault-0.1.1-py3-none-any.whl

Download URL crypto_vault-0.1.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c161863451f7469d7ef6c02541980dce133d1edd38b9bf6317de03cc8aa01de
BLAKE2b-256 checksum
How to use checksums
f27030bd922d1e044af869acd978cd116bb22919ad71600bfbe53f867054d395
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page