1password support for xonsh
Project description
1password support for xonsh
If you like the idea click ⭐ on the repo and tweet.
ALPHA: This is the initial release. Issues/pull requests are welcome.
Introduction
This xontrib adds support for 1Password secrets to the xonsh shell by utilizing the [op (1password CLI)][https://developer.1password.com/docs/cli/]. It works by allowing you to securely store and access your passwords in 1Password. To use:
- Store your passwords in 1Password.
- In your xonsh environment, reference the passwords using the OnePass function:
$OPENAI_API_KEY = OnePass("op://Private/OpenAI-API-Key/api-key")
- To expose the variables in your environment, set:
$ONEPASS_ENABLED = 1
This approach ensures your sensitive information remains secure while being easily accessible in your xonsh shell. The URL is basically: op://<Vault>/<title>/<field>. To find this, here's the commands I used to determine these fields:
➜ xonsh op item list --format json | jq '.[].title | select(. | contains("OpenAI"))'
"OpenAI-API-Key"
➜ xonsh op item get OpenAI-API-Key --format json | jq '.fields[] | select(.type == "CONCEALED") | .label'
"api-key"
Installation
To install use pip:
xpip install xontrib-1password
# or: xpip install -U git+https://github.com/drmikecrowe/xontrib-1password
Usage
This xontrib will get loaded automatically for interactive sessions. To stop this, set
$XONTRIBS_AUTOLOAD_DISABLED = ["1password", ]
# if you have set this for other xontribs, you should append the vale
Examples
Known issues
None
Development
- activate pre-commit hooks
# install pre-commit plugins and activate the commit hook
pre-commit install
pre-commit autoupdate
Releasing your package
- Bump the version of your package.
- Create a GitHub release (The release notes are automatically generated as a draft release after each push).
- And publish with
poetry publish --buildortwine
Credits
This package was created with xontrib template.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xontrib_1password-0.1.1.tar.gz.
File metadata
- Download URL: xontrib_1password-0.1.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff6296da64e8c12a2b629bc0bc74460081c41279d6f6a70bd9630fc33935f417
|
|
| MD5 |
b567028f9d7bb4c4db4b4916edca61ea
|
|
| BLAKE2b-256 |
c5680ebe6b62ba2550e7052bd5b0c4152557a8bda0555b0df5921d5e0f092265
|
File details
Details for the file xontrib_1password-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xontrib_1password-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b893d22cf9a49afc7b46e970f85a73ea4f4639e9e9ae1574bef3100626eb700
|
|
| MD5 |
20b15de331d7a356973e69851ec8b24e
|
|
| BLAKE2b-256 |
3f7c17b36c25fb1eb7f5d79215d47c15d4a4f33b649dfeb5536deffcd34e35cc
|