toru-vault 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
- toru_vault/vault.py +43 -0
- {toru_vault-0.1.2.dist-info → toru_vault-0.1.3.dist-info}/METADATA +2 -4
- toru_vault-0.1.3.dist-info/RECORD +11 -0
- toru_vault-0.1.2.dist-info/RECORD +0 -11
- {toru_vault-0.1.2.dist-info → toru_vault-0.1.3.dist-info}/WHEEL +0 -0
- {toru_vault-0.1.2.dist-info → toru_vault-0.1.3.dist-info}/entry_points.txt +0 -0
- {toru_vault-0.1.2.dist-info → toru_vault-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {toru_vault-0.1.2.dist-info → toru_vault-0.1.3.dist-info}/top_level.txt +0 -0
toru_vault/vault.py
CHANGED
@@ -530,3 +530,46 @@ def get(project_id=None, refresh=False, use_keyring=True):
|
|
530
530
|
|
531
531
|
# Create the lazy dictionary with keyring getter/setter/deleter
|
532
532
|
return LazySecretsDict(secret_keys, _keyring_getter, _keyring_setter, _keyring_deleter)
|
533
|
+
|
534
|
+
|
535
|
+
def get_all(refresh=False, use_keyring=True):
|
536
|
+
"""
|
537
|
+
Return a combined dictionary of secrets from all projects that user has access to
|
538
|
+
|
539
|
+
Args:
|
540
|
+
refresh (bool, optional): Force refresh the secrets cache
|
541
|
+
use_keyring (bool, optional): Whether to use system keyring (True) or in-memory encryption (False)
|
542
|
+
|
543
|
+
Returns:
|
544
|
+
dict: Dictionary of secrets with their names as keys, using lazy loading
|
545
|
+
"""
|
546
|
+
# Initialize the client
|
547
|
+
client = _initialize_client()
|
548
|
+
if not client:
|
549
|
+
logging.error("Failed to initialize Bitwarden client")
|
550
|
+
return {}
|
551
|
+
|
552
|
+
# Get organization ID
|
553
|
+
organization_id = _get_from_keyring_or_env("ORGANIZATION_ID", "ORGANIZATION_ID")
|
554
|
+
if not organization_id:
|
555
|
+
logging.error("Organization ID not found in keyring or environment variables")
|
556
|
+
return {}
|
557
|
+
|
558
|
+
try:
|
559
|
+
# Get all projects
|
560
|
+
projects = client.projects_api.get_projects(organization_id)
|
561
|
+
if not projects or not projects.data:
|
562
|
+
logging.warning("No projects found in the organization")
|
563
|
+
return {}
|
564
|
+
|
565
|
+
# Create a combined dictionary with all secrets
|
566
|
+
all_secrets = {}
|
567
|
+
for project in projects.data:
|
568
|
+
project_secrets = get(project.id, refresh=refresh, use_keyring=use_keyring)
|
569
|
+
# Update the combined dictionary (note: this will overwrite duplicate keys)
|
570
|
+
all_secrets.update(project_secrets)
|
571
|
+
|
572
|
+
return all_secrets
|
573
|
+
except Exception as e:
|
574
|
+
logging.error(f"Error retrieving projects: {str(e)}")
|
575
|
+
return {}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: toru-vault
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
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>
|
@@ -19,9 +19,7 @@ Dynamic: author
|
|
19
19
|
Dynamic: license-file
|
20
20
|
Dynamic: requires-python
|
21
21
|
|
22
|
-
|
23
|
-
<img src="img/logo.svg" alt="ToruVault Logo" width="300"/>
|
24
|
-
</p>
|
22
|
+

|
25
23
|
|
26
24
|
# ToruVault
|
27
25
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
toru_vault/__init__.py,sha256=Co9SSa9gFFTME0YcMzA1vEqJxs045-0kYfdP9GxGasU,177
|
2
|
+
toru_vault/__main__.py,sha256=C7_IR95L9yMpwx_Nj31lQDnA9q9bo56j7lk1s6aoL9I,6729
|
3
|
+
toru_vault/lazy_dict.py,sha256=OZVD-VYQHFRzMw1dOPXpagnddAJNNCZKtcdmTiio4lk,3232
|
4
|
+
toru_vault/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
5
|
+
toru_vault/vault.py,sha256=Mrkhf2AXoEIwMNj4N8psO-sga1E_XtHhKiTm_haS_nE,20551
|
6
|
+
toru_vault-0.1.3.dist-info/licenses/LICENSE,sha256=TbuuchABSutbmmaI1M232F22GsaI88_hwEvto5w_Ux4,1063
|
7
|
+
toru_vault-0.1.3.dist-info/METADATA,sha256=6eeUJQXNFR2XiY-8HgjlrpWrfFE1hkLZROgp7telEBM,7642
|
8
|
+
toru_vault-0.1.3.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
9
|
+
toru_vault-0.1.3.dist-info/entry_points.txt,sha256=dfqkbNftpmAv0iKzVgdkjymkCfj3TwzUrQm2PO7Xgxs,56
|
10
|
+
toru_vault-0.1.3.dist-info/top_level.txt,sha256=c9ulQ18kKs3HbkI5oeoLmnFTknjC0rY1BwsNLJKDua8,11
|
11
|
+
toru_vault-0.1.3.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
toru_vault/__init__.py,sha256=Co9SSa9gFFTME0YcMzA1vEqJxs045-0kYfdP9GxGasU,177
|
2
|
-
toru_vault/__main__.py,sha256=C7_IR95L9yMpwx_Nj31lQDnA9q9bo56j7lk1s6aoL9I,6729
|
3
|
-
toru_vault/lazy_dict.py,sha256=OZVD-VYQHFRzMw1dOPXpagnddAJNNCZKtcdmTiio4lk,3232
|
4
|
-
toru_vault/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
5
|
-
toru_vault/vault.py,sha256=RLJanRaVnOb4SCvKjJiZJYlUX2QBHRzqpI-Z_vp32Jk,18981
|
6
|
-
toru_vault-0.1.2.dist-info/licenses/LICENSE,sha256=TbuuchABSutbmmaI1M232F22GsaI88_hwEvto5w_Ux4,1063
|
7
|
-
toru_vault-0.1.2.dist-info/METADATA,sha256=PjjMbtMSXK2etqyMFVTTVA9GJtUXTGQTchioAaUYrQI,7673
|
8
|
-
toru_vault-0.1.2.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
9
|
-
toru_vault-0.1.2.dist-info/entry_points.txt,sha256=dfqkbNftpmAv0iKzVgdkjymkCfj3TwzUrQm2PO7Xgxs,56
|
10
|
-
toru_vault-0.1.2.dist-info/top_level.txt,sha256=c9ulQ18kKs3HbkI5oeoLmnFTknjC0rY1BwsNLJKDua8,11
|
11
|
-
toru_vault-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|