Skip to main content

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:

  1. Store your passwords in 1Password.
  2. In your xonsh environment, reference the passwords using the OnePass function:
$OPENAI_API_KEY = OnePass("op://Private/OpenAI-API-Key/api-key")
  1. 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

Example

Known issues

None

Development

# 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 --build or twine

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

xontrib_1password-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xontrib_1password-0.1.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

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

Hashes for xontrib_1password-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ff6296da64e8c12a2b629bc0bc74460081c41279d6f6a70bd9630fc33935f417
MD5 b567028f9d7bb4c4db4b4916edca61ea
BLAKE2b-256 c5680ebe6b62ba2550e7052bd5b0c4152557a8bda0555b0df5921d5e0f092265

See more details on using hashes here.

File details

Details for the file xontrib_1password-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for xontrib_1password-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b893d22cf9a49afc7b46e970f85a73ea4f4639e9e9ae1574bef3100626eb700
MD5 20b15de331d7a356973e69851ec8b24e
BLAKE2b-256 3f7c17b36c25fb1eb7f5d79215d47c15d4a4f33b649dfeb5536deffcd34e35cc

See more details on using hashes here.

Supported by

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