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.5001.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.5001-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lexigram_secrets-0.1.5001.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.5001.tar.gz
Algorithm Hash digest
SHA256 572296cb80e7af7b2d1b221b92a1077916327b6ddc863270150a6e4578c08ed4
MD5 88f6a393e8967b6718aefc87877673ad
BLAKE2b-256 de7027211d05e8b87346a238c54ec30408b5bd1cbecbf035f2a02c09e2518443

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lexigram_secrets-0.1.5001-py3-none-any.whl
Algorithm Hash digest
SHA256 3a401e97286e48185378ad36d4de92b80987d3196f7789daf50f2f9d9b93558a
MD5 e5ac2e57a3c5316bb68a4ebbe1133d66
BLAKE2b-256 44aff1d3d90643a803dd51e5d8174da44da0459b41500fe541030c263d7e5e7a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5008

1 file

0.1.5004

2 files

This release

0.1.5001 This release

2 files

0.1.3007

1 file

0.1.3006

1 file

0.1.3005

1 file

0.1.4

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