toru-vault 0.1.1__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/__main__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- Command-line interface for the vault package.
3
+ Command-line interface for the ToruVault package.
4
4
  """
5
5
  import argparse
6
6
  import os
@@ -48,7 +48,7 @@ def list_projects(organization_id=None):
48
48
 
49
49
  def init_vault():
50
50
  """
51
- Initialize vault by storing BWS_TOKEN, ORGANIZATION_ID, and STATE_FILE in keyring.
51
+ Initialize ToruVault by storing BWS_TOKEN, ORGANIZATION_ID, and STATE_FILE in keyring.
52
52
 
53
53
  Returns:
54
54
  bool: True if initialization was successful
@@ -138,7 +138,7 @@ def init_vault():
138
138
  except Exception as e:
139
139
  print(f"Warning: Could not create state directory: {e}")
140
140
 
141
- print("\nVault initialization completed successfully")
141
+ print("\nToruVault initialization completed successfully")
142
142
  return True
143
143
 
144
144
 
@@ -146,7 +146,7 @@ def main():
146
146
  """
147
147
  Main entry point for the command-line interface.
148
148
  """
149
- parser = argparse.ArgumentParser(description="Bitwarden Secret Manager CLI")
149
+ parser = argparse.ArgumentParser(description="ToruVault: Bitwarden Secret Manager CLI")
150
150
  subparsers = parser.add_subparsers(dest="command", help="Command to run")
151
151
 
152
152
  # List command
@@ -154,7 +154,7 @@ def main():
154
154
  list_parser.add_argument("--org-id", "-o", help="Organization ID")
155
155
 
156
156
  # Init command
157
- subparsers.add_parser("init", help="Initialize vault with BWS_TOKEN and ORGANIZATION_ID")
157
+ subparsers.add_parser("init", help="Initialize ToruVault with BWS_TOKEN and ORGANIZATION_ID")
158
158
 
159
159
  # Parse arguments
160
160
  args = parser.parse_args()
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,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toru-vault
3
- Version: 0.1.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>
7
7
  License: MIT
8
- Project-URL: Homepage, https://github.com/ToruAI/vault
9
- Project-URL: Issues, https://github.com/ToruAI/vault/issues
8
+ Project-URL: Homepage, https://github.com/ToruAI/ToruVault
9
+ Project-URL: Issues, https://github.com/ToruAI/ToruVault/issues
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Operating System :: OS Independent
@@ -19,9 +19,7 @@ Dynamic: author
19
19
  Dynamic: license-file
20
20
  Dynamic: requires-python
21
21
 
22
- <p align="center">
23
- <img src="img/logo.svg" alt="ToruVault Logo" width="300"/>
24
- </p>
22
+ ![ToruVault Logo](https://toruai.com/toruai-logo.png)
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,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +0,0 @@
1
- toru_vault/__init__.py,sha256=Co9SSa9gFFTME0YcMzA1vEqJxs045-0kYfdP9GxGasU,177
2
- toru_vault/__main__.py,sha256=KRw1dF3tK71DDmAac30tbBgSBRCNyCLOe1NylNXxRi4,6702
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.1.dist-info/licenses/LICENSE,sha256=TbuuchABSutbmmaI1M232F22GsaI88_hwEvto5w_Ux4,1063
7
- toru_vault-0.1.1.dist-info/METADATA,sha256=gWmsLz2s7X-8pnnf-8TBvSpV4CnIXjjCsfI1RvORCC4,7665
8
- toru_vault-0.1.1.dist-info/WHEEL,sha256=A8Eltl-h0W-qZDVezsLjjslosEH_pdYC2lQ0JcbgCzs,91
9
- toru_vault-0.1.1.dist-info/entry_points.txt,sha256=dfqkbNftpmAv0iKzVgdkjymkCfj3TwzUrQm2PO7Xgxs,56
10
- toru_vault-0.1.1.dist-info/top_level.txt,sha256=c9ulQ18kKs3HbkI5oeoLmnFTknjC0rY1BwsNLJKDua8,11
11
- toru_vault-0.1.1.dist-info/RECORD,,