# Bitwarden Keyring
[![Build Status](https://travis-ci.org/ewjoachim/bitwarden-keyring.svg?branch=master)](https://travis-ci.org/ewjoachim/bitwarden-keyring)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/bitwarden-keyring.svg)](https://badge.fury.io/py/bitwarden-keyring)
[![codecov](https://codecov.io/gh/ewjoachim/bitwarden-keyring/branch/master/graph/badge.svg)](https://codecov.io/gh/ewjoachim/bitwarden-keyring)
Implementation of the [Keyring](https://pypi.org/project/keyring/) backend code reading secrets from [Bitwarden](https://bitwarden.com) using [Bitwarden-cli](https://help.bitwarden.com/article/cli/)
## Overview
The [Keyring](https://pypi.org/project/keyring/) python package provides a handy single point of entry for any secret holding system, allowing for seemless integration of those systems into applications needing secrets, like [twine]().
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 using `sdtin`, `stdout` and `stderr`. We could implement an additional backend for use in a library assuming that everything is already unlocked, or another one using `pinentry` to ask the user.
## Requirements
This project uses the official [bitwarden CLI](https://help.bitwarden.com/article/cli/) under the hood, because there's no simple official Python bitwarden lib. Here are the installation instructions as of October 2018 and the link to the [up to date instructions](https://github.com/bitwarden/cli#downloadinstall)
You can install the Bitwarden CLI multiple different ways:
**NPM**
If 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.
```bash
npm install -g @bitwarden/cli
```
**Native Executable**
Natively 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 the [downloads section](https://help.bitwarden.com/article/cli/#download--install) in the Bitwarden documentation.
**Other Package Managers**
- [Chocolatey](https://chocolatey.org/packages/bitwarden-cli)
```powershell
choco install bitwarden-cli
```
- [Homebrew](https://formulae.brew.sh/formula/bitwarden-cli)
```bash
brew install bitwarden-cli
```
- [Snap](https://snapcraft.io/bw)
```bash
sudo snap install bw
```
## Installation and configuration
```
pip install bitwarden-keyring
```
The Python packaging ecosystem can be quite a mess.
[<img title="XKCD 1987: Python Environment. The Python environmental protection agency wants to seal it in a cement chamber, with pictorial messages to future civilizations warning them about the danger of using sudo to install random Python packages." src="https://imgs.xkcd.com/comics/python_environment_2x.png" width="400">](https://xkcd.com/1987/)
Because of this, it's likely that your setup and my setup are nothing alike. Keyring [supports](https://pypi.org/project/keyring/#config-file-content) a configuration file with an option allowing to explicitely define the path to a backend. You may need that for your installation, or maybe not.
## Usage
Use 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 with [twine](https://pypi.org/project/twine/), good news, you're already set. Just make sure that this package is installed in the same location as twine.
`bitwarden-keyring` will automatically ask for credentials when needed. If you don't want to unlock your vault every time, export the vault session to your environment (use `bw unlock` and follow the instructions, or launch `export BW_SESSION=$(bw unlock --raw)`).
## Caveats
`bitwarden-keyring` was only tested with:
- macOS, using the `bitwarden-cli` from `brew`
- ubuntu, using the `bw` from `snap`
As mentionned, `bitwarden-keyring` only 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.
## Licensing
`bitwarden-keyring` is published under the terms of the [MIT License](LICENSE.md).
The name Bitwarden is most probably the property of 8bit Solutions LLC.
## Contributions and Code of Conduct
Contributions are welcome, please refer to the [Contributing](CONTRIBUTING.md) guide.
Please keep in mind that all interactions with the project are required to follow the
[Code of Conduct](CODE_OF_CONDUCT.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/ewjoachim/bitwarden-keyring",
"name": "bitwarden-keyring",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "bitwarden keyring password",
"author": "Joachim Jablon",
"author_email": "ewjoachim@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4d/a3/c44874b6b28f2c0d002922bed5b871cbb446671f1ae0584d6896bb301179/bitwarden-keyring-0.3.1.tar.gz",
"platform": null,
"description": "# Bitwarden Keyring\n\n[![Build Status](https://travis-ci.org/ewjoachim/bitwarden-keyring.svg?branch=master)](https://travis-ci.org/ewjoachim/bitwarden-keyring)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/bitwarden-keyring.svg)](https://badge.fury.io/py/bitwarden-keyring)\n[![codecov](https://codecov.io/gh/ewjoachim/bitwarden-keyring/branch/master/graph/badge.svg)](https://codecov.io/gh/ewjoachim/bitwarden-keyring)\n\n\nImplementation of the [Keyring](https://pypi.org/project/keyring/) backend code reading secrets from [Bitwarden](https://bitwarden.com) using [Bitwarden-cli](https://help.bitwarden.com/article/cli/)\n\n## Overview\n\nThe [Keyring](https://pypi.org/project/keyring/) python package provides a handy single point of entry for any secret holding system, allowing for seemless integration of those systems into applications needing secrets, like [twine]().\n\nThis projects implement Keyring to be able to read secrets from Bitwarden, an open source multiplatform cloud/self-hostable password manager.\n\nThis backend assumes that it will be used in the context of a CLI application, and that it can communicate with the user using `sdtin`, `stdout` and `stderr`. We could implement an additional backend for use in a library assuming that everything is already unlocked, or another one using `pinentry` to ask the user.\n\n\n## Requirements\n\nThis project uses the official [bitwarden CLI](https://help.bitwarden.com/article/cli/) under the hood, because there's no simple official Python bitwarden lib. Here are the installation instructions as of October 2018 and the link to the [up to date instructions](https://github.com/bitwarden/cli#downloadinstall)\n\nYou can install the Bitwarden CLI multiple different ways:\n\n**NPM**\n\nIf 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.\n\n```bash\nnpm install -g @bitwarden/cli\n```\n\n**Native Executable**\n\nNatively 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 the [downloads section](https://help.bitwarden.com/article/cli/#download--install) in the Bitwarden documentation.\n\n**Other Package Managers**\n\n- [Chocolatey](https://chocolatey.org/packages/bitwarden-cli)\n ```powershell\n choco install bitwarden-cli\n ```\n- [Homebrew](https://formulae.brew.sh/formula/bitwarden-cli)\n ```bash\n brew install bitwarden-cli\n ```\n- [Snap](https://snapcraft.io/bw)\n ```bash\n sudo snap install bw\n ```\n\n## Installation and configuration\n\n```\npip install bitwarden-keyring\n```\n\nThe Python packaging ecosystem can be quite a mess.\n\n[<img title=\"XKCD 1987: Python Environment. The Python environmental protection agency wants to seal it in a cement chamber, with pictorial messages to future civilizations warning them about the danger of using sudo to install random Python packages.\" src=\"https://imgs.xkcd.com/comics/python_environment_2x.png\" width=\"400\">](https://xkcd.com/1987/)\n\nBecause of this, it's likely that your setup and my setup are nothing alike. Keyring [supports](https://pypi.org/project/keyring/#config-file-content) a configuration file with an option allowing to explicitely define the path to a backend. You may need that for your installation, or maybe not.\n\n## Usage\n\nUse as a normal keyring backend. It is installed with priority 10 so it's likely going to be selected\nfirst.\n\nIf you want to use it with [twine](https://pypi.org/project/twine/), good news, you're already set. Just make sure that this package is installed in the same location as twine.\n\n`bitwarden-keyring` will automatically ask for credentials when needed. If you don't want to unlock your vault every time, export the vault session to your environment (use `bw unlock` and follow the instructions, or launch `export BW_SESSION=$(bw unlock --raw)`).\n\n## Caveats\n\n`bitwarden-keyring` was only tested with:\n- macOS, using the `bitwarden-cli` from `brew`\n- ubuntu, using the `bw` from `snap`\n\nAs mentionned, `bitwarden-keyring` only 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.\n\n## Licensing\n\n`bitwarden-keyring` is published under the terms of the [MIT License](LICENSE.md).\nThe name Bitwarden is most probably the property of 8bit Solutions LLC.\n\n\n## Contributions and Code of Conduct\n\nContributions are welcome, please refer to the [Contributing](CONTRIBUTING.md) guide.\nPlease keep in mind that all interactions with the project are required to follow the\n[Code of Conduct](CODE_OF_CONDUCT.md).\n",
"bugtrack_url": null,
"license": "Apache Software License",
"summary": "Keyring backend reading password data from Bitwarden",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/ewjoachim/bitwarden-keyring"
},
"split_keywords": [
"bitwarden",
"keyring",
"password"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0563e01e94bd3b7415692d5e53c2a7f5109f8aafd75015b199061affd73f05f9",
"md5": "9b1879b3db11916fd362fa279621e446",
"sha256": "9b46661b8551b215de64da0e5764fd5734c0a7fae34b190fe602af2f97160f7a"
},
"downloads": -1,
"filename": "bitwarden_keyring-0.3.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b1879b3db11916fd362fa279621e446",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 6663,
"upload_time": "2023-06-20T19:51:34",
"upload_time_iso_8601": "2023-06-20T19:51:34.769382Z",
"url": "https://files.pythonhosted.org/packages/05/63/e01e94bd3b7415692d5e53c2a7f5109f8aafd75015b199061affd73f05f9/bitwarden_keyring-0.3.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4da3c44874b6b28f2c0d002922bed5b871cbb446671f1ae0584d6896bb301179",
"md5": "98d3b2f67de714989e93a3b8fc1bf7f5",
"sha256": "c46e15c2fcb3cfbf99636be9911166bfe5a813c8029e1bf2730e65870640617f"
},
"downloads": -1,
"filename": "bitwarden-keyring-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "98d3b2f67de714989e93a3b8fc1bf7f5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8299,
"upload_time": "2023-06-20T19:51:35",
"upload_time_iso_8601": "2023-06-20T19:51:35.863058Z",
"url": "https://files.pythonhosted.org/packages/4d/a3/c44874b6b28f2c0d002922bed5b871cbb446671f1ae0584d6896bb301179/bitwarden-keyring-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-20 19:51:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ewjoachim",
"github_project": "bitwarden-keyring",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "bitwarden-keyring"
}