Skip to content

BWS SDK Documentation

Welcome to the BWS SDK documentation! BWS SDK is a pure Python implementation of the Bitwarden Secrets Manager API, allowing secure access to and management of Bitwarden secrets.

License: MIT Python Versions

Overview

BWS SDK provides a simple, Pythonic interface to interact with the Bitwarden Secrets Manager. It handles authentication, decryption, and secure communication with the Bitwarden API, allowing you to easily integrate Bitwarden Secrets into your Python applications.

Features

  • Secure Authentication: Robust authentication with Bitwarden Secrets Manager
  • Secret Management: Retrieve and create secrets programmatically
  • Automatic Encryption/Decryption: Seamless encryption and decryption of secrets
  • State Persistence: Optional state persistence for improved performance
  • Multi-Region Support: Support for different Bitwarden regions
  • Synchronization: Efficient secret updates with sync capabilities
  • Error Handling: Comprehensive error handling and reporting

Quick Start

Get started with BWS SDK in just a few lines of code:

from bws_sdk import BWSecretClient, Region

# Define the Bitwarden region
region = Region(
    api_url="https://api.bitwarden.com",
    identity_url="https://identity.bitwarden.com"
)

# Create a client instance
client = BWSecretClient(
    region=region,
    access_token="your-access-token"
)

# Retrieve a secret
secret = client.get_by_id("your-secret-id")
print(f"Secret: {secret.key} = {secret.value}")

# Create a new secret
new_secret = client.create(
    key="api_key",
    value="secret_value_123",
    note="API key for external service",
    project_ids=["your-project-id"]
)
print(f"Created: {new_secret.key} ({new_secret.id})")

Installation

Install BWS SDK using your preferred package manager:

pip install bws-sdk
poetry add bws-sdk

Next Steps

Support

License

This project is licensed under the MIT License. See the full license for details.