Skip to main content

lexigram-secrets

Secret vaults with rotation, tenant isolation, and audit logging for the Lexigram Framework. Supports HashiCorp Vault, AWS Secrets Manager, GCP Secret Manager, Azure Key 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
uv add "lexigram-secrets[azure]"    # Azure Key Vault backend

Quick Start

from lexigram import Application
from lexigram.secrets import SecretsModule
from lexigram.secrets.types import RotatableSecretStoreProtocol


async def main() -> None:
    async with Application.boot(modules=[SecretsModule.configure()]) as app:
        store = await app.container.resolve(RotatableSecretStoreProtocol)
        # ... work with the secret store ...


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Configuration

Field Default Env var Description
name "secrets" LEX_SECRETS__NAME Configuration name
enabled true LEX_SECRETS__ENABLED Enable the secrets subsystem
backend_type memory LEX_SECRETS__BACKEND_TYPE Backend store type (memory, vault, aws, gcp, azure)
backend_options {} Keyword arguments forwarded to the backend constructor
max_age_seconds 7776000 LEX_SECRETS__MAX_AGE_SECONDS Max age before automatic rotation
warning_before_seconds 86400 LEX_SECRETS__WARNING_BEFORE_SECONDS Seconds before expiry to emit warnings
tenant_id null LEX_SECRETS__TENANT_ID Optional tenant namespace
audit_actor_id "secrets-system" LEX_SECRETS__AUDIT_ACTOR_ID Actor identifier for audit logs

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 set and rotate creates a new version; full history retained
  • Automatic rotationRotationDecorator (get_rotated, get_current_version, check_warnings) serves a fresh secret when the current version is past max_age_seconds
  • Tenant isolationTenantScopedSecretStore prefixes keys per tenant for multi-tenant apps
  • Audit loggingSecretAuditDecorator logs all store operations through AuditLoggerProtocol
  • Pluggable backendsHashicorpVaultStore (KV v2) and in-memory (FakeRotatableSecretStore)
  • Bulk operationsget_bulk for fetching multiple secrets at once
  • Version introspectionlist_versions and get_version for 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.)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lexigram_secrets-0.1.4.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lexigram_secrets-0.1.4-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file lexigram_secrets-0.1.4.tar.gz.

File metadata

  • Download URL: lexigram_secrets-0.1.4.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for lexigram_secrets-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a24c5717c84b89c54acf6813a0949800440de30e719493267027fe50bcd37829
MD5 8879ec4588126adface9a72a1f32daf1
BLAKE2b-256 6a2afb3410ef93d23507ecd2e8bb5b8b7816ca5b6f7480106ce83bdfff7d3555

See more details on using hashes here.

File details

Details for the file lexigram_secrets-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lexigram_secrets-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b0832dec2c9fb63e94cc023066dc0b7f945ddd3c5ad483d1073a3d388ff0f28c
MD5 bc2129aab805a09c180629f761e6d45a
BLAKE2b-256 4b850bc9a0405be977981e7d186c4c27e9d3b76815c6fc932e51f6bea91e11f6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5008

1 file

0.1.5004

2 files

0.1.5001

2 files

0.1.3007

1 file

0.1.3006

1 file

0.1.3005

1 file

This release

0.1.4 This release

2 files

0.1.2

1 file

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