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). 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:

op item list --format json | jq '.[].title | select(. | contains("OpenAI"))' 
# "OpenAI-API-Key"
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 disable autoloading:

$XONTRIBS_AUTOLOAD_DISABLED = ["1password", ]
# if you have set this for other xontribs, you should append the value

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.5.tar.gz (3.4 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.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file xontrib_1password-0.1.5.tar.gz.

File metadata

  • Download URL: xontrib_1password-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for xontrib_1password-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d90e1a52b953fdb4e0fa606fc2cca4b7d523891f1cd343f459014febdaaae894
MD5 f08c9647687fa8cb03ced3b28b09a5fa
BLAKE2b-256 db5799b37386b498efcee71d7b9f6215da2c455cf6ea35d8f703d646e2f6a67b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xontrib_1password-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8e4bd24ca5260557c7c6c51069a4dfca6d29f27c6675c0e3b32f4766e7ba41ec
MD5 41afc52398f77c96cbe898c390581afb
BLAKE2b-256 7eb9534684380cbe6f0c3e8657185916a08aa0f296c55f44cde5ad5795732783

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