toru-vault 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {toru_vault-0.2.0 → toru_vault-0.3.1}/PKG-INFO +52 -18
  2. toru_vault-0.2.0/toru_vault.egg-info/PKG-INFO → toru_vault-0.3.1/README.md +44 -40
  3. {toru_vault-0.2.0 → toru_vault-0.3.1}/pyproject.toml +8 -1
  4. {toru_vault-0.2.0 → toru_vault-0.3.1}/setup.py +1 -1
  5. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/vault.py +11 -2
  6. toru_vault-0.2.0/README.md → toru_vault-0.3.1/toru_vault.egg-info/PKG-INFO +74 -17
  7. {toru_vault-0.2.0 → toru_vault-0.3.1}/LICENSE +0 -0
  8. {toru_vault-0.2.0 → toru_vault-0.3.1}/setup.cfg +0 -0
  9. {toru_vault-0.2.0 → toru_vault-0.3.1}/tests/test_env_load.py +0 -0
  10. {toru_vault-0.2.0 → toru_vault-0.3.1}/tests/test_vault_encryption.py +0 -0
  11. {toru_vault-0.2.0 → toru_vault-0.3.1}/tests/test_vault_jit.py +0 -0
  12. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/__init__.py +0 -0
  13. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/__main__.py +0 -0
  14. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/in_env.py +0 -0
  15. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/in_memory.py +0 -0
  16. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/lazy_dict.py +0 -0
  17. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault/py.typed +0 -0
  18. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault.egg-info/SOURCES.txt +0 -0
  19. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault.egg-info/dependency_links.txt +0 -0
  20. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault.egg-info/entry_points.txt +0 -0
  21. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault.egg-info/requires.txt +0 -0
  22. {toru_vault-0.2.0 → toru_vault-0.3.1}/toru_vault.egg-info/top_level.txt +0 -0
@@ -1,15 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toru-vault
3
- Version: 0.2.0
3
+ Version: 0.3.1
4
4
  Summary: ToruVault: A simple Python package for managing Bitwarden secrets
5
5
  Author: Toru AI
6
6
  Author-email: ToruAI <mpaszynski@toruai.com>
7
7
  License: MIT
8
8
  Project-URL: Homepage, https://github.com/ToruAI/ToruVault
9
9
  Project-URL: Issues, https://github.com/ToruAI/ToruVault/issues
10
+ Keywords: env manager,api key manager,secrets manager python,bitwarden python,environment variable manager,secret management,keyring,Bitwarden integration
10
11
  Classifier: Programming Language :: Python :: 3
11
12
  Classifier: License :: OSI Approved :: MIT License
12
13
  Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Environment :: Console
18
+ Classifier: Topic :: System :: Systems Administration
19
+ Classifier: Topic :: Utilities
13
20
  Requires-Python: >=3.6
14
21
  Description-Content-Type: text/markdown
15
22
  License-File: LICENSE
@@ -25,23 +32,23 @@ Dynamic: requires-python
25
32
 
26
33
  # ToruVault
27
34
 
28
- A simple Python package for managing Bitwarden secrets with enhanced security.
35
+ A secure Python secrets manager and environment variable manager for Bitwarden integration. Safely manage API keys and secrets in your Python applications.
29
36
 
30
37
 
31
- ![Version](https://img.shields.io/badge/version-0.2.0-blue)
38
+ ![Version](https://img.shields.io/badge/version-0.3.0-blue)
32
39
  ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
33
40
  ![License](https://img.shields.io/badge/license-MIT-green)
34
41
 
35
42
  ## Features
36
43
 
37
- - Load secrets from Bitwarden Secret Manager into environment variables
38
- - Get secrets as a Python dictionary
39
- - Filter secrets by project ID
40
- - JIT decryption of individual secrets
41
- - No persistent caching of decrypted values
42
- - Secure file permissions for state storage
43
- - Machine-specific secret protection
44
- - Secure credential storage using OS keyring
44
+ - **Secrets Manager for Python**: Load secrets from Bitwarden Secret Manager into environment variables
45
+ - **API Key Management**: Access and manage API keys securely in your Python applications
46
+ - **Environment Variable Manager**: Easily inject secrets as environment variables
47
+ - **Bitwarden Python Integration**: Seamless integration with Bitwarden Secret Manager
48
+ - **Secure In-Memory Caching**: Encrypted caching with automatic expiration (5 minutes)
49
+ - **Project-Based Secret Filtering**: Filter secrets by project ID
50
+ - **Secure Storage**: Machine-specific secret protection with proper file permissions
51
+ - **OS Keyring Integration**: Secure credential storage using your operating system's keyring
45
52
 
46
53
  ## Installation
47
54
 
@@ -118,6 +125,7 @@ Alternatively, you can set the following environment variables:
118
125
  - `BWS_TOKEN`: Your Bitwarden access token
119
126
  - `ORGANIZATION_ID`: Your Bitwarden organization ID
120
127
  - `STATE_FILE`: Path to the state file (must be in an existing directory)
128
+ - `PROJECT_ID` (optional): Your Bitwarden project ID to filter secrets
121
129
  - `API_URL` (optional): Defaults to "https://api.bitwarden.com"
122
130
  - `IDENTITY_URL` (optional): Defaults to "https://identity.bitwarden.com"
123
131
 
@@ -144,7 +152,7 @@ python -m vault list --org-id YOUR_ORGANIZATION_ID
144
152
 
145
153
  ## Python Usage
146
154
 
147
- ### Loading secrets into environment variables
155
+ ### Loading secrets into environment variables (Env Manager)
148
156
 
149
157
  ```python
150
158
  import toru_vault as vault
@@ -159,6 +167,11 @@ print(os.environ.get("SECRET_NAME"))
159
167
  # Load secrets for a specific project
160
168
  vault.env_load(project_id="your-project-id")
161
169
 
170
+ # Alternatively, set PROJECT_ID environment variable and call without parameter
171
+ # export PROJECT_ID="your-project-id" # Linux/macOS
172
+ # set PROJECT_ID=your-project-id # Windows
173
+ vault.env_load() # Will use PROJECT_ID from environment
174
+
162
175
  # Override existing environment variables (default: False)
163
176
  vault.env_load(override=True)
164
177
  ```
@@ -178,6 +191,11 @@ secrets = vault.get(refresh=True)
178
191
  # Get secrets for a specific project
179
192
  secrets = vault.get(project_id="your-project-id")
180
193
 
194
+ # Alternatively, set PROJECT_ID environment variable and call without parameter
195
+ # export PROJECT_ID="your-project-id" # Linux/macOS
196
+ # set PROJECT_ID=your-project-id # Windows
197
+ secrets = vault.get() # Will use PROJECT_ID from environment
198
+
181
199
  # Use in-memory encryption instead of system keyring
182
200
  secrets = vault.get(use_keyring=False)
183
201
  ```
@@ -196,19 +214,20 @@ vault.env_load_all(override=True)
196
214
 
197
215
  ## Security Features
198
216
 
199
- The vault package includes several security enhancements:
217
+ ToruVault provides robust security for your API keys and environment variables:
200
218
 
201
219
  1. **OS Keyring Integration**: Securely stores BWS_TOKEN, ORGANIZATION_ID, and STATE_FILE in your OS keyring
202
- 2. **Memory Protection**: Secrets are individually encrypted in memory using Fernet encryption (AES-128)
203
- 3. **JIT Decryption**: Secrets are only decrypted when explicitly accessed and never stored in decrypted form
204
- 4. **Secure File Permissions**: Sets secure permissions on state files
205
- 5. **Machine-Specific Encryption**: Uses machine-specific identifiers for encryption keys
220
+ 2. **Memory Protection**: Secrets are encrypted in memory using Fernet encryption (AES-128)
221
+ 3. **Lazy Decryption**: Secrets are only decrypted when explicitly accessed
222
+ 4. **Cache Expiration**: Cached secrets expire after 5 minutes by default
223
+ 5. **Secure File Permissions**: Sets secure permissions on state files
224
+ 6. **Machine-Specific Encryption**: Uses machine-specific identifiers for encryption keys
206
225
  7. **Cache Clearing**: Automatically clears secret cache on program exit
207
226
  8. **Environment Variable Protection**: Doesn't override existing environment variables by default
208
227
  9. **Secure Key Derivation**: Uses PBKDF2 with SHA-256 for key derivation
209
228
  10. **No Direct Storage**: Never stores secrets in plain text on disk
210
229
 
211
- ## Bitwarden Secrets
230
+ ## Bitwarden Python Integration
212
231
 
213
232
  ### BWS_TOKEN
214
233
 
@@ -253,3 +272,18 @@ When working with secrets, always follow these important guidelines:
253
272
  6. **Use Environment-Specific Secrets**: Use different secrets for development, staging, and production environments.
254
273
 
255
274
  Remember that the vault package is designed to protect secrets once they're in your system, but you must handle the initial configuration securely.
275
+
276
+ ## Why Choose ToruVault
277
+
278
+ ToruVault stands out as a comprehensive solution for Python developers who need:
279
+
280
+ - A reliable **secrets manager for Python** applications
281
+ - Secure **API key management** with encryption
282
+ - An **environment variable manager** that simplifies configuration
283
+ - Seamless **Bitwarden Python integration** for team secret sharing
284
+
285
+ 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.
286
+
287
+ ## License
288
+
289
+ ToruVault is released under the MIT License. See the LICENSE file for details.
@@ -1,47 +1,24 @@
1
- Metadata-Version: 2.4
2
- Name: toru-vault
3
- Version: 0.2.0
4
- Summary: ToruVault: A simple Python package for managing Bitwarden secrets
5
- Author: Toru AI
6
- Author-email: ToruAI <mpaszynski@toruai.com>
7
- License: MIT
8
- Project-URL: Homepage, https://github.com/ToruAI/ToruVault
9
- Project-URL: Issues, https://github.com/ToruAI/ToruVault/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.6
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
- Requires-Dist: bitwarden-sdk
17
- Requires-Dist: cryptography>=36.0.0
18
- Provides-Extra: keyring
19
- Requires-Dist: keyring>=23.0.0; extra == "keyring"
20
- Dynamic: author
21
- Dynamic: license-file
22
- Dynamic: requires-python
23
-
24
1
  ![ToruVault Logo](https://toruai.com/toruai-logo.png)
25
2
 
26
3
  # ToruVault
27
4
 
28
- A simple Python package for managing Bitwarden secrets with enhanced security.
5
+ A secure Python secrets manager and environment variable manager for Bitwarden integration. Safely manage API keys and secrets in your Python applications.
29
6
 
30
7
 
31
- ![Version](https://img.shields.io/badge/version-0.2.0-blue)
8
+ ![Version](https://img.shields.io/badge/version-0.3.0-blue)
32
9
  ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
33
10
  ![License](https://img.shields.io/badge/license-MIT-green)
34
11
 
35
12
  ## Features
36
13
 
37
- - Load secrets from Bitwarden Secret Manager into environment variables
38
- - Get secrets as a Python dictionary
39
- - Filter secrets by project ID
40
- - JIT decryption of individual secrets
41
- - No persistent caching of decrypted values
42
- - Secure file permissions for state storage
43
- - Machine-specific secret protection
44
- - Secure credential storage using OS keyring
14
+ - **Secrets Manager for Python**: Load secrets from Bitwarden Secret Manager into environment variables
15
+ - **API Key Management**: Access and manage API keys securely in your Python applications
16
+ - **Environment Variable Manager**: Easily inject secrets as environment variables
17
+ - **Bitwarden Python Integration**: Seamless integration with Bitwarden Secret Manager
18
+ - **Secure In-Memory Caching**: Encrypted caching with automatic expiration (5 minutes)
19
+ - **Project-Based Secret Filtering**: Filter secrets by project ID
20
+ - **Secure Storage**: Machine-specific secret protection with proper file permissions
21
+ - **OS Keyring Integration**: Secure credential storage using your operating system's keyring
45
22
 
46
23
  ## Installation
47
24
 
@@ -118,6 +95,7 @@ Alternatively, you can set the following environment variables:
118
95
  - `BWS_TOKEN`: Your Bitwarden access token
119
96
  - `ORGANIZATION_ID`: Your Bitwarden organization ID
120
97
  - `STATE_FILE`: Path to the state file (must be in an existing directory)
98
+ - `PROJECT_ID` (optional): Your Bitwarden project ID to filter secrets
121
99
  - `API_URL` (optional): Defaults to "https://api.bitwarden.com"
122
100
  - `IDENTITY_URL` (optional): Defaults to "https://identity.bitwarden.com"
123
101
 
@@ -144,7 +122,7 @@ python -m vault list --org-id YOUR_ORGANIZATION_ID
144
122
 
145
123
  ## Python Usage
146
124
 
147
- ### Loading secrets into environment variables
125
+ ### Loading secrets into environment variables (Env Manager)
148
126
 
149
127
  ```python
150
128
  import toru_vault as vault
@@ -159,6 +137,11 @@ print(os.environ.get("SECRET_NAME"))
159
137
  # Load secrets for a specific project
160
138
  vault.env_load(project_id="your-project-id")
161
139
 
140
+ # Alternatively, set PROJECT_ID environment variable and call without parameter
141
+ # export PROJECT_ID="your-project-id" # Linux/macOS
142
+ # set PROJECT_ID=your-project-id # Windows
143
+ vault.env_load() # Will use PROJECT_ID from environment
144
+
162
145
  # Override existing environment variables (default: False)
163
146
  vault.env_load(override=True)
164
147
  ```
@@ -178,6 +161,11 @@ secrets = vault.get(refresh=True)
178
161
  # Get secrets for a specific project
179
162
  secrets = vault.get(project_id="your-project-id")
180
163
 
164
+ # Alternatively, set PROJECT_ID environment variable and call without parameter
165
+ # export PROJECT_ID="your-project-id" # Linux/macOS
166
+ # set PROJECT_ID=your-project-id # Windows
167
+ secrets = vault.get() # Will use PROJECT_ID from environment
168
+
181
169
  # Use in-memory encryption instead of system keyring
182
170
  secrets = vault.get(use_keyring=False)
183
171
  ```
@@ -196,19 +184,20 @@ vault.env_load_all(override=True)
196
184
 
197
185
  ## Security Features
198
186
 
199
- The vault package includes several security enhancements:
187
+ ToruVault provides robust security for your API keys and environment variables:
200
188
 
201
189
  1. **OS Keyring Integration**: Securely stores BWS_TOKEN, ORGANIZATION_ID, and STATE_FILE in your OS keyring
202
- 2. **Memory Protection**: Secrets are individually encrypted in memory using Fernet encryption (AES-128)
203
- 3. **JIT Decryption**: Secrets are only decrypted when explicitly accessed and never stored in decrypted form
204
- 4. **Secure File Permissions**: Sets secure permissions on state files
205
- 5. **Machine-Specific Encryption**: Uses machine-specific identifiers for encryption keys
190
+ 2. **Memory Protection**: Secrets are encrypted in memory using Fernet encryption (AES-128)
191
+ 3. **Lazy Decryption**: Secrets are only decrypted when explicitly accessed
192
+ 4. **Cache Expiration**: Cached secrets expire after 5 minutes by default
193
+ 5. **Secure File Permissions**: Sets secure permissions on state files
194
+ 6. **Machine-Specific Encryption**: Uses machine-specific identifiers for encryption keys
206
195
  7. **Cache Clearing**: Automatically clears secret cache on program exit
207
196
  8. **Environment Variable Protection**: Doesn't override existing environment variables by default
208
197
  9. **Secure Key Derivation**: Uses PBKDF2 with SHA-256 for key derivation
209
198
  10. **No Direct Storage**: Never stores secrets in plain text on disk
210
199
 
211
- ## Bitwarden Secrets
200
+ ## Bitwarden Python Integration
212
201
 
213
202
  ### BWS_TOKEN
214
203
 
@@ -253,3 +242,18 @@ When working with secrets, always follow these important guidelines:
253
242
  6. **Use Environment-Specific Secrets**: Use different secrets for development, staging, and production environments.
254
243
 
255
244
  Remember that the vault package is designed to protect secrets once they're in your system, but you must handle the initial configuration securely.
245
+
246
+ ## Why Choose ToruVault
247
+
248
+ ToruVault stands out as a comprehensive solution for Python developers who need:
249
+
250
+ - A reliable **secrets manager for Python** applications
251
+ - Secure **API key management** with encryption
252
+ - An **environment variable manager** that simplifies configuration
253
+ - Seamless **Bitwarden Python integration** for team secret sharing
254
+
255
+ 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.
256
+
257
+ ## License
258
+
259
+ ToruVault is released under the MIT License. See the LICENSE file for details.
@@ -3,8 +3,9 @@ requires = ["setuptools>=42", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
+ keywords = ["env manager", "api key manager", "secrets manager python", "bitwarden python", "environment variable manager", "secret management", "keyring", "Bitwarden integration"]
6
7
  name = "toru-vault"
7
- version = "0.2.0"
8
+ version = "0.3.1"
8
9
  description = "ToruVault: A simple Python package for managing Bitwarden secrets"
9
10
  readme = "README.md"
10
11
  authors = [
@@ -15,6 +16,12 @@ classifiers = [
15
16
  "Programming Language :: Python :: 3",
16
17
  "License :: OSI Approved :: MIT License",
17
18
  "Operating System :: OS Independent",
19
+ "Topic :: Security",
20
+ "Topic :: Software Development :: Libraries :: Python Modules",
21
+ "Intended Audience :: Developers",
22
+ "Environment :: Console",
23
+ "Topic :: System :: Systems Administration",
24
+ "Topic :: Utilities"
18
25
  ]
19
26
  requires-python = ">=3.6"
20
27
  dependencies = [
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name="toru-vault",
5
- version='0.2.0',
5
+ version='0.3.0',
6
6
  packages=["toru_vault"],
7
7
  install_requires=[
8
8
  "bitwarden-sdk",
@@ -20,6 +20,7 @@ _KEYRING_SERVICE_NAME = "bitwarden_vault"
20
20
  _KEYRING_BWS_TOKEN_KEY = "bws_token"
21
21
  _KEYRING_ORG_ID_KEY = "organization_id"
22
22
  _KEYRING_STATE_FILE_KEY = "state_file"
23
+ _KEYRING_PROJECT_ID_KEY = "project_id"
23
24
 
24
25
  def _get_from_keyring_or_env(key, env_var):
25
26
  """
@@ -125,7 +126,7 @@ def env_load(project_id=None, override=False):
125
126
  Load all secrets related to the project into environmental variables.
126
127
 
127
128
  Args:
128
- project_id (str, optional): Project ID to filter secrets
129
+ project_id (str, optional): Project ID to filter secrets. If None, will try to get from keyring or PROJECT_ID environment variable
129
130
  override (bool, optional): Whether to override existing environment variables
130
131
  """
131
132
  try:
@@ -138,6 +139,10 @@ def env_load(project_id=None, override=False):
138
139
  logger.error("ORGANIZATION_ID not found in keyring or environment variable")
139
140
  return
140
141
 
142
+ # If project_id is not provided, try to get it from keyring or environment variable
143
+ if project_id is None:
144
+ project_id = _get_from_keyring_or_env(_KEYRING_PROJECT_ID_KEY, "PROJECT_ID")
145
+
141
146
  secrets = load_secrets_env(client, organization_id, project_id)
142
147
 
143
148
  set_env_vars(secrets, override)
@@ -171,7 +176,7 @@ def get(project_id=None, use_keyring=True):
171
176
  Return a dictionary of all project secrets with JIT decryption
172
177
 
173
178
  Args:
174
- project_id (str, optional): Project ID to filter secrets
179
+ project_id (str, optional): Project ID to filter secrets. If None, will try to get from keyring or PROJECT_ID environment variable
175
180
  use_keyring (bool, optional): Whether to use system keyring (True) or in-memory encryption (False)
176
181
 
177
182
  Returns:
@@ -188,6 +193,10 @@ def get(project_id=None, use_keyring=True):
188
193
  logger.error("ORGANIZATION_ID not found in keyring or environment variable")
189
194
  return {}
190
195
 
196
+ # If project_id is not provided, try to get it from keyring or environment variable
197
+ if project_id is None:
198
+ project_id = _get_from_keyring_or_env(_KEYRING_PROJECT_ID_KEY, "PROJECT_ID")
199
+
191
200
  from .in_memory import load_secrets_memory
192
201
  all_secrets = load_secrets_memory(client, organization_id, project_id)
193
202
 
@@ -1,24 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: toru-vault
3
+ Version: 0.3.1
4
+ Summary: ToruVault: A simple Python package for managing Bitwarden secrets
5
+ Author: Toru AI
6
+ Author-email: ToruAI <mpaszynski@toruai.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/ToruAI/ToruVault
9
+ Project-URL: Issues, https://github.com/ToruAI/ToruVault/issues
10
+ Keywords: env manager,api key manager,secrets manager python,bitwarden python,environment variable manager,secret management,keyring,Bitwarden integration
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Environment :: Console
18
+ Classifier: Topic :: System :: Systems Administration
19
+ Classifier: Topic :: Utilities
20
+ Requires-Python: >=3.6
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: bitwarden-sdk
24
+ Requires-Dist: cryptography>=36.0.0
25
+ Provides-Extra: keyring
26
+ Requires-Dist: keyring>=23.0.0; extra == "keyring"
27
+ Dynamic: author
28
+ Dynamic: license-file
29
+ Dynamic: requires-python
30
+
1
31
  ![ToruVault Logo](https://toruai.com/toruai-logo.png)
2
32
 
3
33
  # ToruVault
4
34
 
5
- A simple Python package for managing Bitwarden secrets with enhanced security.
35
+ A secure Python secrets manager and environment variable manager for Bitwarden integration. Safely manage API keys and secrets in your Python applications.
6
36
 
7
37
 
8
- ![Version](https://img.shields.io/badge/version-0.2.0-blue)
38
+ ![Version](https://img.shields.io/badge/version-0.3.0-blue)
9
39
  ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
10
40
  ![License](https://img.shields.io/badge/license-MIT-green)
11
41
 
12
42
  ## Features
13
43
 
14
- - Load secrets from Bitwarden Secret Manager into environment variables
15
- - Get secrets as a Python dictionary
16
- - Filter secrets by project ID
17
- - JIT decryption of individual secrets
18
- - No persistent caching of decrypted values
19
- - Secure file permissions for state storage
20
- - Machine-specific secret protection
21
- - Secure credential storage using OS keyring
44
+ - **Secrets Manager for Python**: Load secrets from Bitwarden Secret Manager into environment variables
45
+ - **API Key Management**: Access and manage API keys securely in your Python applications
46
+ - **Environment Variable Manager**: Easily inject secrets as environment variables
47
+ - **Bitwarden Python Integration**: Seamless integration with Bitwarden Secret Manager
48
+ - **Secure In-Memory Caching**: Encrypted caching with automatic expiration (5 minutes)
49
+ - **Project-Based Secret Filtering**: Filter secrets by project ID
50
+ - **Secure Storage**: Machine-specific secret protection with proper file permissions
51
+ - **OS Keyring Integration**: Secure credential storage using your operating system's keyring
22
52
 
23
53
  ## Installation
24
54
 
@@ -95,6 +125,7 @@ Alternatively, you can set the following environment variables:
95
125
  - `BWS_TOKEN`: Your Bitwarden access token
96
126
  - `ORGANIZATION_ID`: Your Bitwarden organization ID
97
127
  - `STATE_FILE`: Path to the state file (must be in an existing directory)
128
+ - `PROJECT_ID` (optional): Your Bitwarden project ID to filter secrets
98
129
  - `API_URL` (optional): Defaults to "https://api.bitwarden.com"
99
130
  - `IDENTITY_URL` (optional): Defaults to "https://identity.bitwarden.com"
100
131
 
@@ -121,7 +152,7 @@ python -m vault list --org-id YOUR_ORGANIZATION_ID
121
152
 
122
153
  ## Python Usage
123
154
 
124
- ### Loading secrets into environment variables
155
+ ### Loading secrets into environment variables (Env Manager)
125
156
 
126
157
  ```python
127
158
  import toru_vault as vault
@@ -136,6 +167,11 @@ print(os.environ.get("SECRET_NAME"))
136
167
  # Load secrets for a specific project
137
168
  vault.env_load(project_id="your-project-id")
138
169
 
170
+ # Alternatively, set PROJECT_ID environment variable and call without parameter
171
+ # export PROJECT_ID="your-project-id" # Linux/macOS
172
+ # set PROJECT_ID=your-project-id # Windows
173
+ vault.env_load() # Will use PROJECT_ID from environment
174
+
139
175
  # Override existing environment variables (default: False)
140
176
  vault.env_load(override=True)
141
177
  ```
@@ -155,6 +191,11 @@ secrets = vault.get(refresh=True)
155
191
  # Get secrets for a specific project
156
192
  secrets = vault.get(project_id="your-project-id")
157
193
 
194
+ # Alternatively, set PROJECT_ID environment variable and call without parameter
195
+ # export PROJECT_ID="your-project-id" # Linux/macOS
196
+ # set PROJECT_ID=your-project-id # Windows
197
+ secrets = vault.get() # Will use PROJECT_ID from environment
198
+
158
199
  # Use in-memory encryption instead of system keyring
159
200
  secrets = vault.get(use_keyring=False)
160
201
  ```
@@ -173,19 +214,20 @@ vault.env_load_all(override=True)
173
214
 
174
215
  ## Security Features
175
216
 
176
- The vault package includes several security enhancements:
217
+ ToruVault provides robust security for your API keys and environment variables:
177
218
 
178
219
  1. **OS Keyring Integration**: Securely stores BWS_TOKEN, ORGANIZATION_ID, and STATE_FILE in your OS keyring
179
- 2. **Memory Protection**: Secrets are individually encrypted in memory using Fernet encryption (AES-128)
180
- 3. **JIT Decryption**: Secrets are only decrypted when explicitly accessed and never stored in decrypted form
181
- 4. **Secure File Permissions**: Sets secure permissions on state files
182
- 5. **Machine-Specific Encryption**: Uses machine-specific identifiers for encryption keys
220
+ 2. **Memory Protection**: Secrets are encrypted in memory using Fernet encryption (AES-128)
221
+ 3. **Lazy Decryption**: Secrets are only decrypted when explicitly accessed
222
+ 4. **Cache Expiration**: Cached secrets expire after 5 minutes by default
223
+ 5. **Secure File Permissions**: Sets secure permissions on state files
224
+ 6. **Machine-Specific Encryption**: Uses machine-specific identifiers for encryption keys
183
225
  7. **Cache Clearing**: Automatically clears secret cache on program exit
184
226
  8. **Environment Variable Protection**: Doesn't override existing environment variables by default
185
227
  9. **Secure Key Derivation**: Uses PBKDF2 with SHA-256 for key derivation
186
228
  10. **No Direct Storage**: Never stores secrets in plain text on disk
187
229
 
188
- ## Bitwarden Secrets
230
+ ## Bitwarden Python Integration
189
231
 
190
232
  ### BWS_TOKEN
191
233
 
@@ -230,3 +272,18 @@ When working with secrets, always follow these important guidelines:
230
272
  6. **Use Environment-Specific Secrets**: Use different secrets for development, staging, and production environments.
231
273
 
232
274
  Remember that the vault package is designed to protect secrets once they're in your system, but you must handle the initial configuration securely.
275
+
276
+ ## Why Choose ToruVault
277
+
278
+ ToruVault stands out as a comprehensive solution for Python developers who need:
279
+
280
+ - A reliable **secrets manager for Python** applications
281
+ - Secure **API key management** with encryption
282
+ - An **environment variable manager** that simplifies configuration
283
+ - Seamless **Bitwarden Python integration** for team secret sharing
284
+
285
+ 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.
286
+
287
+ ## License
288
+
289
+ ToruVault is released under the MIT License. See the LICENSE file for details.
File without changes
File without changes