Passsssword
Utilize 1Password vault data with Python decorators and context managers. Driven by the 1Password CLI interface. 🐍🔐
Introduction
Passsssword is a Python-based utility designed to securely use your 1Password vault data right within your Python scripts. Utilizing Python decorators and context managers, the project interfaces with the 1Password CLI to automatically fetch and inject sensitive data, such as passwords or API-keys.
Passsssword offers two features:
-
Decorator (
decjector): Apply this decorator to any Python function to inject sensitive data automatically securely before its execution. The temporary.envfile containing these variables is safely deleted after the function runs. -
Context Manager (
contextor): This sets up a secure temporary environment for your code to run in, injecting the necessary passwords,etc. and ensuring their secure deletion afterward.
Setup
Requirements
- Python 3.8 - 3.11
- 1Password CLI
Installation Steps
-
Clone the Repository:
git clone https://github.com/chrislemke/passsssword.git -
Navigate to Project Directory:
cd Passsssword -
Install Required Packages:
pip install -r requirements.txt -
Set Up
.env.opFile: Create an.env.opfile either in the project directory or one of its parent directories. This file will store the 1Password vault item paths, looking like thisAPI_KEY = op://MyVault/MyItem/MyAPIKey ... -
Sign in to 1Password CLI: Make sure you've signed into your 1Password account through the CLI.
op signin <your-domain>
Usage
Using the decjector Decorator
To auto-inject the API-key automatically into your Python function, simply apply the decjector decorator:
from Passsssword import decjector
@decjector
def sensitive_function():
api_key = os.environ.get('API_KEY')
# Your function logic here
sensitive_function()
The decjector decorator will securely fetch API_KEY from your 1Password vault and make it available within sensitive_function.
Using the contextor Context Manager
You can also use the contextor context manager in a with statement:
from Passsssword import contextor
with contextor():
api_key = os.environ.get('API_KEY')
# Your function logic here
Within the with block, any sensitive data from your 1Password vault specified in .env.op will be accessible as environment variables.
Metadata
Release files for Passsssword 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| passsssword-0.1.0.tar.gz | 4.8 kB | Without provenance | Details for passsssword-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| passsssword-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for passsssword-0.1.0-py3-none-any.whl |
Total release size: 9.8 kB
Release files / passsssword-0.1.0.tar.gz
| Download URL | passsssword-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f0e05ceceffcb4ce1216fab3b727ea0468bbf3db9e2128f73794c927e5b6be4
|
|
BLAKE2b-256 checksum How to use checksums |
a5951df98ce702bfad789cee172ab0ba3873d842c09aec1a49914b2ea050bfff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.12.0 Darwin/23.1.0
|
Release files / passsssword-0.1.0-py3-none-any.whl
| Download URL | passsssword-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02e28dd164bc95e328611f585525888a571aa3f30fd6b648852dcae975daa85d
|
|
BLAKE2b-256 checksum How to use checksums |
86ce5022868c07d1807fbbf8c133c93b50fd103291a105e284ddfc770671536c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.12.0 Darwin/23.1.0
|
Security for Passsssword 0.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.