Flexpass
========
A simple yet flexible library (and command-line application) to access passwords from various backends (GPG/pass, Linux SecretService, Windows Credentials Manager, etc).
See [full documentation](https://flexpass.readthedocs.io/) and [API reference](https://flexpass.readthedocs.io/en/latest/api-reference.html) on _Read the Docs_.
## Installation
Flexpass package is [available on PyPI.org](https://pypi.org/project/flexpass/):
```sh
pip install flexpass
```
## Usage
Flexpass may be used as a library in your Python code:
```py
import flexpass
flexpass.list_passwords()
flexpass.set_password(name, password)
flexpass.get_password(name)
flexpass.delete_password(name)
```
Flexpass may also be invoked as a command-line application (`flexpass` executable is installed with the package):
```sh
flexpass --help
```
Flexpass may also be invoked as a Python module:
```sh
python -m flexpass --help
```
## Main features
This library provides read and write access to passwords, identified by a name, through the following functions:
```py
def get_password(name: str) -> str|None:
...
def set_password(name: str, password: str, **options) -> None:
...
def delete_password(name: str) -> bool:
...
def list_passwords() -> list[PasswordInfo]:
...
```
Function `get_password` scans all registered backends, ordered by decreasing priority, and returns the first password found with the given name.
Function `set_password` sets the given password in the writable backend with the highest priority.
Function `delete_password` deletes the given password in all writable backends where the password was set. Returns `True` if the password was deleted from at least one backend, `False` otherwise.
Function `list_passwords` lists all available passwords.
Access to passwords is also possible for a specific backend, by using this backend method. Examples:
```py
backend = get_backend('gpg')
backend.get_password('my/password')
```
Example of invokation of `flexpass` command-line application with the `list` command (which is the default command when no argument is given).
It retrives passwords using function `list_passwords` and format the results:
![Result of `--list` command (example)](https://gitlab.com/ipamo/flexpass/-/raw/main/docs/static/list-result.png "Result of `--list` command (example)")
N.B.: by default, names are displayed truncated to 40 characters. Add option `--full` to disable truncation.
## Backends
The following backends are included in Flexpass package:
| Name | Priority | Description |
|--------------------------|----------|--------------|
| `gpg` | 80 | [GPG](https://www.gnupg.org/) encrypted files following the layout defined by [pass](https://www.passwordstore.org/), the _standard unix password manager_. |
| `secretservice` | 60 | [Secret Service D-Bus API](https://www.freedesktop.org/wiki/Specifications/secret-storage-spec/), a _FreeDesktop.org_ standard usually accessed through [libsecret](https://wiki.gnome.org/Projects/Libsecret) and its frontends ([secret-tool](https://manpages.debian.org/bookworm/libsecret-tools/secret-tool.1.en.html), [Gnome Keyring](https://wiki.gnome.org/Projects/GnomeKeyring), [KDE Wallet Manager](https://apps.kde.org/fr/kwalletmanager5/) or [KeyPassXC](https://keepassxc.org/)). |
| `wincred` | 50 | [Windows Credential Manager](https://support.microsoft.com/en-us/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0), the password manager integrated in Windows. |
These backends are planned to be added later (ROADMAP):
| Name | Priority | Description |
|--------------------------|----------|--------------|
| `dockersecrets` | 30 | [Docker Compose secrets](https://docs.docker.com/compose/use-secrets/), made available in the containers at path `/run/secrets/{name}` or in `/run/secrets/misc` (or at local path `secrets/{name}.txt` or in `secrets/misc.ini`: usefull during development). **Read-only**. |
| `dir` | 20 | Unencrypted files in a root directory (by default `/root/passwords`). |
| `env` | 10 | Environment variables. **Read-only**. |
Custom backends may be registered in your Python code using the `register_backend` function. Example:
```py
from flexpass import register_backend
register_backend(MyCustomBackend, priority=70)
```
Pre-defined priorities may be modified by calling the `register_backend` with the new `priority` value. Example:
```py
register_backend(WincredBackend, priority=5, replace_if_exists=True)
```
## License
This project is licensed under the terms of the [MIT license](https://gitlab.com/ipamo/flexpass/-/raw/main/LICENSE.txt).
## Credits
Inspired by:
- [pass](https://www.passwordstore.org/): the _standard unix password manager_ based on GPG. It has very few requirements and may be installed on most workstations and servers. It is cross-platform because only GPG is actually required to read or write passwords.
- [keyring](https://github.com/jaraco/keyring): a most wildly used Python library to access passwords.
Logo based on a creation by _Pixel perfect_ on [Flaticon](https://www.flaticon.com/free-icons/open-source).
Raw data
{
"_id": null,
"home_page": "",
"name": "flexpass",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "pass,keyring,secrets,passwords,password,manager,gpg,wallet,kwallet,kwalletmanager,keepass,keepassxc",
"author": "",
"author_email": "Ipamo <dev@ipamo.net>",
"download_url": "",
"platform": null,
"description": "Flexpass\n========\n\nA simple yet flexible library (and command-line application) to access passwords from various backends (GPG/pass, Linux SecretService, Windows Credentials Manager, etc).\n\nSee [full documentation](https://flexpass.readthedocs.io/) and [API reference](https://flexpass.readthedocs.io/en/latest/api-reference.html) on _Read the Docs_.\n\n\n## Installation\n\nFlexpass package is [available on PyPI.org](https://pypi.org/project/flexpass/):\n\n```sh\npip install flexpass\n```\n\n\n## Usage\n\nFlexpass may be used as a library in your Python code:\n\n```py\nimport flexpass\nflexpass.list_passwords()\nflexpass.set_password(name, password)\nflexpass.get_password(name)\nflexpass.delete_password(name)\n```\n\nFlexpass may also be invoked as a command-line application (`flexpass` executable is installed with the package):\n\n```sh\nflexpass --help\n```\n\nFlexpass may also be invoked as a Python module:\n\n```sh\npython -m flexpass --help\n```\n\n\n## Main features\n\nThis library provides read and write access to passwords, identified by a name, through the following functions:\n\n```py\ndef get_password(name: str) -> str|None:\n ...\n\ndef set_password(name: str, password: str, **options) -> None:\n ...\n\ndef delete_password(name: str) -> bool:\n ...\n\ndef list_passwords() -> list[PasswordInfo]:\n ...\n```\n\nFunction `get_password` scans all registered backends, ordered by decreasing priority, and returns the first password found with the given name.\n\nFunction `set_password` sets the given password in the writable backend with the highest priority.\n\nFunction `delete_password` deletes the given password in all writable backends where the password was set. Returns `True` if the password was deleted from at least one backend, `False` otherwise.\n\nFunction `list_passwords` lists all available passwords.\n\nAccess to passwords is also possible for a specific backend, by using this backend method. Examples:\n\n```py\nbackend = get_backend('gpg')\nbackend.get_password('my/password')\n```\n\nExample of invokation of `flexpass` command-line application with the `list` command (which is the default command when no argument is given).\nIt retrives passwords using function `list_passwords` and format the results:\n\n![Result of `--list` command (example)](https://gitlab.com/ipamo/flexpass/-/raw/main/docs/static/list-result.png \"Result of `--list` command (example)\")\n\nN.B.: by default, names are displayed truncated to 40 characters. Add option `--full` to disable truncation.\n\n\n## Backends\n\nThe following backends are included in Flexpass package:\n\n| Name | Priority | Description |\n|--------------------------|----------|--------------|\n| `gpg` | 80 | [GPG](https://www.gnupg.org/) encrypted files following the layout defined by [pass](https://www.passwordstore.org/), the _standard unix password manager_. |\n| `secretservice` | 60 | [Secret Service D-Bus API](https://www.freedesktop.org/wiki/Specifications/secret-storage-spec/), a _FreeDesktop.org_ standard usually accessed through [libsecret](https://wiki.gnome.org/Projects/Libsecret) and its frontends ([secret-tool](https://manpages.debian.org/bookworm/libsecret-tools/secret-tool.1.en.html), [Gnome Keyring](https://wiki.gnome.org/Projects/GnomeKeyring), [KDE Wallet Manager](https://apps.kde.org/fr/kwalletmanager5/) or [KeyPassXC](https://keepassxc.org/)). |\n| `wincred` | 50 | [Windows Credential Manager](https://support.microsoft.com/en-us/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0), the password manager integrated in Windows. |\n\nThese backends are planned to be added later (ROADMAP):\n\n| Name | Priority | Description |\n|--------------------------|----------|--------------|\n| `dockersecrets` | 30 | [Docker Compose secrets](https://docs.docker.com/compose/use-secrets/), made available in the containers at path `/run/secrets/{name}` or in `/run/secrets/misc` (or at local path `secrets/{name}.txt` or in `secrets/misc.ini`: usefull during development). **Read-only**. |\n| `dir` | 20 | Unencrypted files in a root directory (by default `/root/passwords`). |\n| `env` | 10 | Environment variables. **Read-only**. |\n\nCustom backends may be registered in your Python code using the `register_backend` function. Example:\n\n```py\nfrom flexpass import register_backend\nregister_backend(MyCustomBackend, priority=70)\n```\n\nPre-defined priorities may be modified by calling the `register_backend` with the new `priority` value. Example:\n\n```py\nregister_backend(WincredBackend, priority=5, replace_if_exists=True)\n```\n\n\n## License\n\nThis project is licensed under the terms of the [MIT license](https://gitlab.com/ipamo/flexpass/-/raw/main/LICENSE.txt).\n\n\n## Credits\n\nInspired by:\n\n- [pass](https://www.passwordstore.org/): the _standard unix password manager_ based on GPG. It has very few requirements and may be installed on most workstations and servers. It is cross-platform because only GPG is actually required to read or write passwords.\n- [keyring](https://github.com/jaraco/keyring): a most wildly used Python library to access passwords.\n\nLogo based on a creation by _Pixel perfect_ on [Flaticon](https://www.flaticon.com/free-icons/open-source).\n",
"bugtrack_url": null,
"license": "",
"summary": "A simple yet flexible library (and command-line application) to access passwords from various backends (GPG/pass, Linux SecretService, Windows Credentials Manager, etc).",
"version": "0.1.2",
"project_urls": {
"Bug Tracker": "https://gitlab.com/ipamo/flexpass/issues",
"Homepage": "https://gitlab.com/ipamo/flexpass"
},
"split_keywords": [
"pass",
"keyring",
"secrets",
"passwords",
"password",
"manager",
"gpg",
"wallet",
"kwallet",
"kwalletmanager",
"keepass",
"keepassxc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ee4e2a089b489131d8585d2648e559acf687802aa486172f06a79768eaa84be4",
"md5": "217beca58a6bfef56a56a43d75e084b1",
"sha256": "96c5f9345bfbfe1e4c3aaffd1168af1f7a6bb68c5eddd922587337dc2b4a2264"
},
"downloads": -1,
"filename": "flexpass-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "217beca58a6bfef56a56a43d75e084b1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 21251,
"upload_time": "2024-02-21T20:26:03",
"upload_time_iso_8601": "2024-02-21T20:26:03.756105Z",
"url": "https://files.pythonhosted.org/packages/ee/4e/2a089b489131d8585d2648e559acf687802aa486172f06a79768eaa84be4/flexpass-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-21 20:26:03",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "ipamo",
"gitlab_project": "flexpass",
"lcname": "flexpass"
}