
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
A secure Python secrets manager and environment variable manager for Bitwarden integration. Safely manage API keys and secrets in your Python applications.
# Install UV if you don't have it already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install toru-vault package (basic installation)
uv pip install toru-vault
# Or install with keyring support (recommended for secure storage)
uv pip install toru-vault[keyring]
# Or install in a virtual environment (recommended)
uv venv create -p python3.10 .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install toru-vault[keyring]
This will install all required dependencies:
And when installed with the keyring option:
Note: Keyring is now optional but recommended. Without keyring, some features like
toru-vault init
won't work, and you'll need to use theuse_keyring=False
parameter with theget()
function to use in-memory encryption instead of the system keyring.
# Clone the repository
git clone https://github.com/ToruAI/vault.git
cd vault
uv venv create -p python3.10 .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
uv pip install -r requirements.txt
# Install in development mode
uv pip install -e .
You have two options for configuring the vault:
The most secure way to set up vault is to use your operating system's secure keyring:
# Initialize vault with secure keyring storage
python -m vault init
This will prompt you to enter:
How to get the BWS_TOKEN, ORGANIZATION_ID, and STATE_FILE
These credentials will be securely stored in your OS keyring and used automatically by the vault.
Alternatively, you can set the following environment variables:
BWS_TOKEN
: Your Bitwarden access tokenORGANIZATION_ID
: Your Bitwarden organization IDSTATE_FILE
: Path to the state file (must be in an existing directory)PROJECT_ID
(optional): Your Bitwarden project ID to filter secretsAPI_URL
(optional): Defaults to "https://api.bitwarden.com"IDENTITY_URL
(optional): Defaults to "https://identity.bitwarden.com"Setting these environment variables is useful for container environments or when keyring is not available.
# Set up vault with secure credential storage
python -m vault init
# List all projects in your organization
python -m vault list
# With a specific organization ID
python -m vault list --org-id YOUR_ORGANIZATION_ID
import toru_vault as vault
# Load all secrets into environment variables
vault.env_load()
# Now you can access secrets as environment variables
import os
print(os.environ.get("SECRET_NAME"))
# Load secrets for a specific project
vault.env_load(project_id="your-project-id")
# Alternatively, set PROJECT_ID environment variable and call without parameter
# export PROJECT_ID="your-project-id" # Linux/macOS
# set PROJECT_ID=your-project-id # Windows
vault.env_load() # Will use PROJECT_ID from environment
# Override existing environment variables (default: False)
vault.env_load(override=True)
import toru_vault as vault
# Get all secrets as a dictionary
secrets = vault.get()
print(secrets["SECRET_NAME"]) # Secret is only decrypted when accessed
# Force refresh the cache
secrets = vault.get(refresh=True)
# Get secrets for a specific project
secrets = vault.get(project_id="your-project-id")
# Alternatively, set PROJECT_ID environment variable and call without parameter
# export PROJECT_ID="your-project-id" # Linux/macOS
# set PROJECT_ID=your-project-id # Windows
secrets = vault.get() # Will use PROJECT_ID from environment
# Use in-memory encryption instead of system keyring
secrets = vault.get(use_keyring=False)
import toru_vault as vault
# Load secrets from all projects you have access to into environment variables
vault.env_load_all()
# Override existing environment variables (default: False)
vault.env_load_all(override=True)
ToruVault provides robust security for your API keys and environment variables:
Your Bitwarden access token. You can get it from the Bitwarden web app:
BWS_TOKEN
.Remember that you need to assign access to the machine account for the projects you want to use.
Your Bitwarden organization ID. You can get it from the Bitwarden web app:
ORGANIZATION_ID
.The STATE_FILE
is used by the login_access_token method to store persistent authentication state information after successfully logging in with an access token.
You can set it to any existing file path.
When working with secrets, always follow these important guidelines:
.gitignore
file.Remember that the vault package is designed to protect secrets once they're in your system, but you must handle the initial configuration securely.
ToruVault stands out as a comprehensive solution for Python developers who need:
By combining the security of Bitwarden with the convenience of Python's environment variables, ToruVault provides a robust solution for managing sensitive information in your applications.
ToruVault is released under the MIT License. See the LICENSE file for details.
FAQs
ToruVault: A simple Python package for managing Bitwarden secrets
We found that toru-vault demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.