Skip to main content

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 set and rotate creates a new version; full history retained
  • Automatic rotationRotationDecorator wraps any service method with age-checked rotation
  • 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.)

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

lexigram_secrets-0.1.3005-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for lexigram_secrets-0.1.3005-py3-none-any.whl
Algorithm Hash digest
SHA256 0b6a4adb00483c12c57a3b79d7f04c1bb08ac02cced7e8c7d4fcdd63def0a918
MD5 7001685903c2b51502d7cef0df85ff77
BLAKE2b-256 8694e5e447583406e40927ff5cbc47135075f7b18af8b1af52fab0ed7eb2be07

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

This release

0.1.3005 This release

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