Skip to main content

1pass

A command line interface (and Python library) for reading passwords from 1Password.

Command line usage

To get a password:

1pass mail.google.com

By default this will look in ~/Dropbox/1Password.agilekeychain. If that’s not where you keep your keychain:

1pass --path ~/whatever/1Password.agilekeychain mail.google.com

Or, you can set your keychain path as an enviornment variable:

export ONEPASSWORD_KEYCHAIN=/path/to/keychain

1pass mail.google.com

By default, the name you pass on the command line must match the name of an item in your 1Password keychain exactly. To avoid this, fuzzy matching is made possible with the --fuzzy flag:

1pass --fuzzy mail.goog

If you don’t want to be prompted for your password, you can use the --no-prompt flag and provide the password via standard input instead:

emit_master_password | 1pass --no-prompt mail.google.com

Python usage

The interface is very simple:

from onepassword import Keychain

my_keychain = Keychain(path="~/Dropbox/1Password.agilekeychain")
my_keychain.unlock("my-master-password")
my_keychain.item("An item's name").password

An example of real-world use

I wrote this so I could add the following line to my .muttrc file:

set imap_pass = "`1pass 'Google: personal'`"

Now, whenever I start mutt, I am prompted for my 1Password Master Password and not my Gmail password.

The --no-prompt flag is very useful when configuring mutt and PGP. mutt passes the PGP passphrase via standard in, so by inserting 1pass into this pipline I can use my 1Password master password when prompted for my PGP keyphrase:

set pgp_decrypt_command="1pass --no-prompt pgp-passphrase | gpg --passphrase-fd 0 ..."

Contributors

License

1pass is licensed under the MIT license. See the license file for details.

While it is designed to read .agilekeychain bundles created by 1Password, 1pass isn’t officially sanctioned or supported by AgileBits. I do hope they like it though.

Metadata

Release files for 1pass 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for 1pass 0.2.1
File Size Uploaded Provenance
1pass-0.2.1.tar.gz 5.4 kB Without provenance Details

Release files / 1pass-0.2.1.tar.gz

Download URL 1pass-0.2.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0542ce118e2adbb203db70d1ab685e3902de474d5a26040f322ab98f000c524a
BLAKE2b-256 checksum
How to use checksums
9452256afae40ca6b8083c13165a5068d848844709c928302efaacaeb9e361c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for 1pass 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page