Secure and extensible credential management SDK for Python applications.
Project description
🔐 infra-core-sdk
Secure, extensible, and production-ready credential management SDK for Python.
🚀 Why this exists
Managing credentials securely is hard.
This SDK solves:
- ❌ Scattered secrets across projects
- ❌ Manual encryption handling
- ❌ Inconsistent file structures
- ❌ Hardcoded paths
👉 With a consistent, secure and extensible system
🚀 Features
- 🔐 Automatic encryption (Fernet)
- 📦 Multiple credential profiles (
name) - ⚙️ Decoupled setup and load flows
- 📁 Dynamic path configuration
- 🧠 Smart dependency resolution
- 🧩 Extensible architecture
📦 Installation
pip install infra-core-sdk
🧩 Quick Start
from dataclasses import dataclass
from infra_core import BaseCredentials, FernetEncryption, CredentialsLoader
from infra_core.credentials.setup.credentials_setup_service import CredentialsSetupService
@dataclass(frozen=True)
class MyCredentials(BaseCredentials):
api_token: str
# Setup
setup = CredentialsSetupService(FernetEncryption)
setup.setup(MyCredentials(api_token="123"), name="default")
# Load
creds = CredentialsLoader.load(MyCredentials, FernetEncryption, name="default")
print(creds.api_token)
📁 Generated Structure
project/
└── secret/
├── secret.key
└── default.json
⚙️ Path Configuration (Power Feature)
from infra_core import PathConfig
config = PathConfig.getDefault()
config = config.addDirectory("logs", "logs")
config = config.updateDirectory("downloads", "downloads_v2")
config = config.updateDirectory("secret_dir", "new_secret")
print(config.directories)
🧠 Behavior Model
| Type | Control |
|---|---|
| secret_dir | user |
| secret_key | derived |
| credentials | derived |
| downloads | user |
| custom dirs | user |
🔁 Dependency Example
config = config.updateDirectory("secret_dir", "new_secret")
secret_key -> new_secret/secret.key
credentials -> new_secret/{name}.json
✋ Override Example
config = config.updateDirectory("secret_key", "custom.key")
✔ stops automatic updates
🧪 Real Usage Pattern
config = PathConfig.getDefault()
config = config.addDirectory("logs", "logs")
config = config.updateDirectory("downloads", "downloads_v2")
config = config.updateDirectory("secret_dir", "new_secret")
🔐 Encryption
Default:
from infra_core import FernetEncryption
Custom:
class CustomEncryption:
def encrypt(self, value: str) -> str: ...
def decrypt(self, value: str) -> str: ...
⚠️ Important Rules
❌ Do NOT manage keys manually
✅ Let the SDK handle encryption lifecycle
🧪 Development
pip install -e .[dev]
pytest
mypy src/
📄 License
MIT
👨💻 Author
Rafael Cavalcante
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 infra_core_sdk-0.1.2.tar.gz.
File metadata
- Download URL: infra_core_sdk-0.1.2.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47a9f8d7845bd7bbdd8416543b35990940357feccfdbb0f63bbadad1b31d6ded
|
|
| MD5 |
612d322bf909fde9b856c17dfb409c1b
|
|
| BLAKE2b-256 |
4e422b48a589a1b770d2159d31f1004c01a2def3f1d84e04df49018af0e73823
|
File details
Details for the file infra_core_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: infra_core_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
528f9911939fd1e5a34c64cdb7ee9f7b7f556debac8cdca55572a7e39dccdfda
|
|
| MD5 |
6b549d25b566d431898026a0f1ce3738
|
|
| BLAKE2b-256 |
9345965c094f2c3a81b37f9da78a91f758eb145deb23117c4dc500e46c34428c
|