Encrypted secrets management for Python applications
Project description
VibeLock Python SDK v1
Cross-platform secrets management for Python applications, encrypted with VibeLock.
Status: Core implementation complete — crypto, vault, master key, SDK, CLI, and interoperability tests done.
Features
- AES-256-GCM encryption with 600k PBKDF2-SHA512 iterations
- File-based master key storage with atomic operations
- Configurable master key path (
keys_path/VIBELOCK_KEYS_PATH) - 100% compatible with VibeLock TypeScript SDK
- Simple async API:
init(),set(),get(),list(),remove() - Multi-project isolation
- Atomic vault operations
Quick Start
import vibelock
import asyncio
async def main():
# Initialize new vault
await vibelock.init()
# Store secrets
await vibelock.set("API_KEY", "sk-abc123def456")
await vibelock.set("DATABASE_URL", "postgresql://user:pass@localhost/db")
# Retrieve secrets
api_key = await vibelock.get("API_KEY")
db_url = await vibelock.get("DATABASE_URL")
# List all secrets
secrets = await vibelock.list()
print(f"Available secrets: {secrets}")
if __name__ == "__main__":
asyncio.run(main())
Installation
# Install from PyPI (when released)
pip install vibelock
# Install from source
git clone https://github.com/ismaibz/vibelock.git
cd vibelock/python-sdk
pip install -e .
API Reference
vibelock.init(options=None)
Initialize a new vault with master key.
async def init(options: VibeLockOptions = None) -> None:
Parameters:
options(VibeLockOptions, optional): Configuration optionsvault_path(str): Path to vault file (default: "./secrets.vibe")project_id(str): Project identifier (default: "default")keys_path(str, optional): Custom master key storage directory
Raises:
FileExistsError: If vault or master key already exists
vibelock.set(key, value, options=None)
Encrypt and store a secret.
async def set(key: str, value: str, options: VibeLockOptions = None) -> None:
vibelock.get(key, options=None)
Decrypt and retrieve a secret.
async def get(key: str, options: VibeLockOptions = None) -> str:
vibelock.list(options=None)
List all secret names.
async def list(options: VibeLockOptions = None) -> list[str]:
vibelock.remove(key, options=None)
Delete a secret.
async def remove(key: str, options: VibeLockOptions = None) -> None:
Configuration
VibeLockOptions
@dataclass
class VibeLockOptions:
vault_path: str = "./secrets.vibe"
project_id: str = "default"
keys_path: Optional[str] = None
Custom Keys Path
# Store master keys in a custom location
options = vibelock.VibeLockOptions(
project_id="production",
vault_path="./production.secrets",
keys_path="/etc/vibelock/keys"
)
# Or via environment variable
import os
os.environ["VIBELOCK_KEYS_PATH"] = "/etc/vibelock/keys"
Example
import asyncio
from vibelock import get, get_env
from vibelock.config import VibeLockOptions
opts = VibeLockOptions(
project_id="my-app",
vault_path="./secrets.vibe"
)
async def main():
# Retrieve an encrypted secret
api_key = await get("API_KEY", options=opts)
# Retrieve plaintext configuration
db_url = await get_env("DB_URL", options=opts)
print(f"Connecting to {db_url} with API key...")
asyncio.run(main())
Multi-Project Example
# Production vault
prod_options = vibelock.VibeLockOptions(
project_id="production",
vault_path="./secrets.prod.vibe"
)
# Staging vault
staging_options = vibelock.VibeLockOptions(
project_id="staging",
vault_path="./staging.secrets"
)
await vibelock.set("API_KEY", "prod-key-123", prod_options)
await vibelock.set("API_KEY", "staging-key-456", staging_options)
prod_key = await vibelock.get("API_KEY", prod_options)
staging_key = await vibelock.get("API_KEY", staging_options)
Security Features
Encryption
- Algorithm: AES-256-GCM
- Key Derivation: PBKDF2-SHA512 with 600,000 iterations
- IV Length: 12 bytes (24 hex chars)
- Auth Tag: 16 bytes (32 hex chars)
Storage
- Master Key: 32 bytes random, stored as file
- File Permissions: 0o600 for keys, 0o700 for directories
- Vault Format: JSON with atomic writes
- Per-Salt: Each secret gets unique salt for forward security
Key Path Resolution
keys_pathoption (explicit)VIBELOCK_KEYS_PATHenvironment variable- Default:
~/.vibelock/keys/
Interoperability
The Python SDK is 100% compatible with the TypeScript SDK:
# Python and TypeScript SDKs can read each other's vaults
await vibelock.set("SHARED_SECRET", "cross-platform-value")
# TypeScript SDK can read: await get("SHARED_SECRET")
# Python SDK can read: await vibelock.get("SHARED_SECRET")
Vault Format: Identical JSON structure, encoding, and cryptographic operations.
Development
Running Tests
# All tests
pytest
# With coverage
pytest --cov=vibelock
# Specific test categories
pytest tests/test_crypto.py
pytest tests/interoperability/
Code Quality
# Format code
black .
# Lint code
ruff check .
# Type checking
mypy src/
Contributing
- Fork the repository
- Create feature branch
- Add tests for new functionality
- Ensure all linting checks pass
- Submit pull request
Architecture
src/vibelock/
├── __init__.py # Public API exports
├── crypto.py # AES-256-GCM, PBKDF2-SHA512
├── vault.py # Vault JSON operations
├── masterkey.py # File-based key management
└── sdk.py # High-level API coordination
Implementation Phases
- Crypto: Core cryptographic primitives
- Vault: JSON file operations and validation
- Master Key: Storage and retrieval
- SDK: Public API coordination
- Interoperability: Cross-SDK compatibility
- Packaging: Distribution and documentation
License
MIT License - see LICENSE file for details.
Issues
Report bugs and request features on GitHub Issues.
Support
- Documentation: Full docs
- Issues: GitHub Issues
VibeLock - Secrets management for developers, encrypted and portable.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vibelock-1.0.0.tar.gz.
File metadata
- Download URL: vibelock-1.0.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
979194ad04d2bd6c0c084b7a3e65a45b24b6b93922b188ba83601fc89d0d5c5e
|
|
| MD5 |
41523eea90e7bfe8673c3bdfbce72b5f
|
|
| BLAKE2b-256 |
f93c6b8f8023474070a7e058fbdb99352601163bd2c3befca96d2042bbc44bc8
|
Provenance
The following attestation bundles were made for vibelock-1.0.0.tar.gz:
Publisher:
release-python.yml on irequena-dev/VibeLock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vibelock-1.0.0.tar.gz -
Subject digest:
979194ad04d2bd6c0c084b7a3e65a45b24b6b93922b188ba83601fc89d0d5c5e - Sigstore transparency entry: 1474381395
- Sigstore integration time:
-
Permalink:
irequena-dev/VibeLock@8274c4ea63179359b824cf9db075cc0e769ca1c8 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/irequena-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@8274c4ea63179359b824cf9db075cc0e769ca1c8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vibelock-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vibelock-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26173dfb4d844702aeb1cae5320bc4255ba1414856c7d7f84da5bf0b6f2fcc98
|
|
| MD5 |
ff12fb061bae295f19ef8fc71c05fd39
|
|
| BLAKE2b-256 |
4e214fba026918eb19ab8815c1192f2af65239368dad12936f14553037a0a490
|
Provenance
The following attestation bundles were made for vibelock-1.0.0-py3-none-any.whl:
Publisher:
release-python.yml on irequena-dev/VibeLock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vibelock-1.0.0-py3-none-any.whl -
Subject digest:
26173dfb4d844702aeb1cae5320bc4255ba1414856c7d7f84da5bf0b6f2fcc98 - Sigstore transparency entry: 1474381452
- Sigstore integration time:
-
Permalink:
irequena-dev/VibeLock@8274c4ea63179359b824cf9db075cc0e769ca1c8 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/irequena-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@8274c4ea63179359b824cf9db075cc0e769ca1c8 -
Trigger Event:
release
-
Statement type: