lexigram-secrets
Secret vaults with rotation, tenant isolation, and audit logging for the Lexigram Framework. Supports HashiCorp Vault and in-memory backends with automatic key rotation, version tracking, and tenant-scoped secret stores.
Overview
lexigram-secrets provides a RotatableSecretStoreProtocol-based secret management system
with versioned rotation, tenant isolation, audit logging, and pluggable backends. All services
are wired via SecretsProvider, which registers the secret store and rotation decorator
with the DI container.
Full documentation: docs.lexigram.dev
Install
uv add lexigram-secrets
# Optional extras
uv add "lexigram-secrets[vault]" # HashiCorp Vault backend
uv add "lexigram-secrets[aws]" # AWS Secrets Manager backend
uv add "lexigram-secrets[gcp]" # GCP Secret Manager backend
Quick Start
from lexigram import Application
from lexigram.di.module import Module, module
from lexigram.secrets import SecretsModule
@module(imports=[SecretsModule.configure()])
class AppModule(Module):
pass
app = Application(modules=[AppModule])
if __name__ == "__main__":
app.run()
Module Factory Methods
| Method | Description |
|---|---|
SecretsModule.configure(config) |
Configure with explicit SecretsConfig |
SecretsModule.stub() |
Minimal config for testing (memory backend) |
Key Features
- Versioned secrets — Every
setandrotatecreates a new version; full history retained - Automatic rotation —
RotationDecoratorwraps any service method with age-checked rotation - Tenant isolation —
TenantScopedSecretStoreprefixes keys per tenant for multi-tenant apps - Audit logging —
SecretAuditDecoratorlogs all store operations throughAuditLoggerProtocol - Pluggable backends —
HashicorpVaultStore(KV v2) and in-memory (FakeRotatableSecretStore) - Bulk operations —
get_bulkfor fetching multiple secrets at once - Version introspection —
list_versionsandget_versionfor audit and rollback workflows
Testing
from lexigram.testing.fakes import FakeRotatableSecretStore
from lexigram.testing.compliance import StoreConformanceSuite
class TestMyStore(StoreConformanceSuite):
@pytest.fixture
def make_store(self):
return FakeRotatableSecretStore
Key Source Files
| File | What it contains |
|---|---|
src/lexigram/secrets/module.py |
SecretsModule class with factory methods |
src/lexigram/secrets/di/provider.py |
SecretsProvider — wires secret store into DI container |
src/lexigram/secrets/config.py |
SecretsConfig and backend selection |
src/lexigram/secrets/types.py |
RotatableSecretStoreProtocol, VersionedSecret, SecretVersion |
src/lexigram/secrets/rotation/ |
RotationDecorator and RotationSchedule for automatic key rotation |
src/lexigram/secrets/tenancy/ |
TenantScopedSecretStore for multi-tenant key isolation |
src/lexigram/secrets/audit/ |
SecretAuditDecorator for operation audit logging |
src/lexigram/secrets/backends/ |
Backend implementations (Vault, etc.) |
Config Reference
| Field | Default | Env var | Description |
|---|---|---|---|
secrets.enabled |
true |
LEX_SECRETS__ENABLED |
Enable the secrets subsystem |
secrets.backend_type |
memory |
LEX_SECRETS__BACKEND_TYPE |
Backend store type (memory, vault) |
secrets.max_age_seconds |
86400 |
LEX_SECRETS__MAX_AGE_SECONDS |
Max age before automatic rotation |
secrets.warning_before_seconds |
3600 |
LEX_SECRETS__WARNING_BEFORE_SECONDS |
Seconds before expiry to emit warnings |
secrets.tenant_id |
null |
LEX_SECRETS__TENANT_ID |
Optional tenant namespace |
secrets.audit_actor_id |
secrets |
LEX_SECRETS__AUDIT_ACTOR_ID |
Actor identifier for audit logs |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 lexigram_secrets-0.1.3006-py3-none-any.whl.
File metadata
- Download URL: lexigram_secrets-0.1.3006-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3a4830bef8df179ff9a7d9db8b33b5fd5528a3e820babd1fb7ef71020b9f2bd
|
|
| MD5 |
9956dde2f11948f322560bdf8e7fe841
|
|
| BLAKE2b-256 |
97cd560f1ab20ece1e71835e9291c5b70e5ab6370698692689f7dfa2cd2e1633
|