Skip to main content

Package for seamless interaction with the Bitwarden.

Project description

T-Vault

Package for seamless interaction with the Bitwarden and others Password Managers.


Installation

pip install t-vault-manager

Usage

Login to Bitwarden

from t_vault import bw_login, bw_login_from_env
from RPA.Robocorp.Vault import Vault

if Config.LOCAL_RUN:
    bw_login_from_env()
else:
    bw_login(**Vault().get_secret("bitwarden_credentials"))

To use bw_login_from_env() you need the following environment variables set:

  • BW_PASSWORD

  • BW_CLIENTID

  • BW_CLIENTSECRET

To use if you do not have those env vars set, you can use bw_login:

bw_login(client_id, client_secret, password, username)

Getting Vault Items:

There is no need of adding CREDENTIALS variable to config.py anymore.

You can get the a Vault Item like this:

from t_vault import bw_get_item

vault_item = bw_get_item(item_name)

The method will return a T - Object with the vault item data.

Getting Attachments

There is two ways to get an attachment:

downloaded_path = bw_get_item(item_name).get_attachment(attachment_name, file_path)
downloaded_path = bw_get_attachment(item_name, attachment_name, file_path)

in both methods, file_path is optional. If it is not set, it will download to the cwd .

Updating passwords

There is two ways to reset a password with the lib:

from t_vault import bw_update_password

new_password = bw_update_password(item_name, new_password)
from t_vault import bw_get_item
new_password = bw_get_item(item_name).update_password(new_passord)

The new_password argument is optional, and if is not passed, the library will generate a strong password for you.

Those methods returns the newly created password.

Troubleshooting

If you are getting the following error: Failed to login: You are already logged in as... it is probably a problem with the CLI executable. A potential fix to this is to force the library to download the latest version of the CLI (currently, by default, the library will use a stable version of the executable). To do this you can add the force_latest=True argument to the login methods:

bw_login(client_id="...", client_secret="...", password="...", force_latest=True)

or

bw_login_from_env(force_latest=True)

Replacing old credentials dictionary:

Use this if you just want to replace the old credentials dictionary that is in most AIAs:

from t_vault import bw_login, bw_get_item

bw_login(**Vault().get_secret("bitwarden_credentials"))
credentials = {k: bw_get_item(v).to_dict() for k, v in collection.items()}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

t_vault_manager-0.1.20.tar.gz (10.9 kB view details)

Uploaded Source

File details

Details for the file t_vault_manager-0.1.20.tar.gz.

File metadata

  • Download URL: t_vault_manager-0.1.20.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for t_vault_manager-0.1.20.tar.gz
Algorithm Hash digest
SHA256 20d7f87c75c5ab2a1b4c9ada62f8a70439e46ac9973f5683cbb0e37a6660dca0
MD5 42349abf144c84f5248c2b28677b9bf2
BLAKE2b-256 99820972debf87bb57cc99902988eec93b8ee2dcdd90d3dfe6de5eadd2fc6ab8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page