Package: bitwarden-keyring
Bitwarden KeyringImplementation of theKeyringbackend code reading secrets fromBitwardenusingBitwarden-cliOverviewTheKeyringpython package provides a handy single point of entry for any secret holding system, allowing for seemless integration of those systems into applications needing secrets, liketwine.This projects implement Keyring to be able to read secrets from Bitwarden, an open source multiplatform cloud/self-hostable password manager.This backend assumes that it will be used in the context of a CLI application, and that it can communicate with the user usingsdtin,stdoutandstderr. We could implement an additional backend for use in a library assuming that everything is already unlocked, or another one usingpinentryto ask the user.RequirementsThis project uses the officialbitwarden CLIunder the hood, because there's no simple official Python bitwarden lib. Here are the installation instructions as of October 2018 and the link to theup to date instructionsYou can install the Bitwarden CLI multiple different ways:NPMIf you already have the Node.js runtime installed on your system, you can install the CLI using NPM. NPM makes it easy to keep your installation updated and should be the preferred installation method if you are already using Node.js.npminstall-g@bitwarden/cliNative ExecutableNatively packaged versions of the CLI are provided for each platform which have no requirements on installing the Node.js runtime. You can obtain these from thedownloads sectionin the Bitwarden documentation.Other Package ManagersChocolateychocoinstallbitwarden-cliHomebrewbrewinstallbitwarden-cliSnapsudosnapinstallbwInstallation and configurationpip install bitwarden-keyringThe Python packaging ecosystem can be quite a mess.Because of this, it's likely that your setup and my setup are nothing alike. Keyringsupportsa configuration file with an option allowing to explicitely define the path to a backend. You may need that for your installation, or maybe not.UsageUse as a normal keyring backend. It is installed with priority 10 so it's likely going to be selected
first.If you want to use it withtwine, good news, you're already set. Just make sure that this package is installed in the same location as twine.bitwarden-keyringwill automatically ask for credentials when needed. If you don't want to unlock your vault every time, export the vault session to your environment (usebw unlockand follow the instructions, or launchexport BW_SESSION=$(bw unlock --raw)).Caveatsbitwarden-keyringwas only tested with:macOS, using thebitwarden-clifrombrewubuntu, using thebwfromsnapAs mentionned,bitwarden-keyringonly works in the context of a CLI application with access to standard inputs and output. If you need something that either reads silently or using another method of communication, the best is probably to make another backend and most of the functions can be reused.Licensingbitwarden-keyringis published under the terms of theMIT License.
The name Bitwarden is most probably the property of 8bit Solutions LLC.Contributions and Code of ConductContributions are welcome, please refer to theContributingguide.
Please keep in mind that all interactions with the project are required to follow theCode of Conduct.