Skip to content

hanzokms/python-sdk

 
 

Repository files navigation

Hanzo KMS Python SDK

Official Python SDK for Hanzo KMS -- secrets management, encryption keys, and dynamic secrets.

Installation

pip install hanzokms

Quick Start

from hanzo_kms import KMSClient

# Initialize the client
client = KMSClient(host="https://kms.hanzo.ai")

# Authenticate with Universal Auth
client.auth.universal_auth.login(
    client_id="your-client-id",
    client_secret="your-client-secret"
)

# List secrets
secrets = client.secrets.list_secrets(
    project_id="your-project-id",
    environment_slug="production",
    secret_path="/"
)

for secret in secrets.secrets:
    print(f"{secret.secretKey}={secret.secretValue}")

Authentication Methods

  • Universal Auth -- Machine identity client ID/secret
  • Token Auth -- Direct token authentication
  • AWS IAM Auth -- AWS IAM-based authentication
  • OIDC Auth -- OpenID Connect authentication
  • LDAP Auth -- LDAP username/password authentication

Features

  • Secrets -- CRUD operations on secrets with caching support
  • KMS Keys -- Create, manage, encrypt/decrypt with symmetric keys
  • Folders -- Organize secrets into folder hierarchies
  • Dynamic Secrets -- Provision short-lived credentials (databases, cloud providers, etc.)

Caching

The SDK includes built-in secrets caching with configurable TTL:

# Enable caching with 60-second TTL (default)
client = KMSClient(host="https://kms.hanzo.ai", cache_ttl=60)

# Disable caching
client = KMSClient(host="https://kms.hanzo.ai", cache_ttl=None)

Context Manager

with KMSClient(host="https://kms.hanzo.ai", token="your-token") as client:
    secrets = client.secrets.list_secrets(
        project_id="your-project-id",
        environment_slug="dev",
        secret_path="/"
    )
# Resources automatically cleaned up

License

MIT -- Copyright (c) 2025 Hanzo AI Inc.

Security

If you discover a security vulnerability, please report it to [email protected]. Do not file public issues for security vulnerabilities.

About

Hanzo KMS Python SDK

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 100.0%