Python wrapper for the easykey CLI - secure keychain access
Project description
EasyKey Python Package
A simple Python wrapper for the easykey CLI that provides secure keychain access on macOS.
Installation
Prerequisites
- First, ensure you have the
easykeyCLI installed and available in your PATH - Install this Python package:
pip install easykey
Local Development Installation
If you're working with the source code:
cd python
pip install -e .
Usage
Basic Secret Retrieval
import easykey
# Get a secret (this will trigger biometric authentication)
secret = easykey.secret("MySecretName")
print(secret)
# Get a secret with a reason for audit logging
secret = easykey.secret("MySecretName", "Connecting to production database")
Listing and Status
import easykey
# List all secret names
secrets = easykey.list()
for secret in secrets:
print(f"Secret: {secret['name']}")
# List secrets with creation timestamps
secrets = easykey.list(include_timestamps=True)
for secret in secrets:
print(f"Secret: {secret['name']}, Created: {secret.get('createdAt', 'Unknown')}")
# Get vault status
status = easykey.status()
print(f"Total secrets: {status['secrets']}")
print(f"Last access: {status['last_access']}")
API Reference
Functions
secret(name, reason=None)- Retrieve a secret valueget_secret(name, reason=None)- Alias forsecret()list(include_timestamps=False)- List all secretsstatus()- Get vault status information
Parameters
name(str): The name/identifier of the secretreason(str, optional): Reason for the operation (for audit logging)include_timestamps(bool): Whether to include creation timestamps in list results
Return Values
secret()returns the secret value as a stringlist()returns a list of dictionaries with secret informationstatus()returns a dictionary with vault status
Exceptions
All functions may raise EasyKeyError if the underlying CLI operation fails.
Security Notes
- This package is a thin wrapper around the easykey CLI
- All security features (biometric authentication, keychain integration) are handled by the CLI
- Secrets are retrieved through subprocess calls and are not cached in Python
- The package automatically locates the easykey binary in common installation paths
Requirements
- macOS (required by the underlying easykey CLI)
- Python 3.7+
- easykey CLI installed and accessible
Quick Start Example
import easykey
# Check vault status
status = easykey.status()
print(f"Vault contains {status['secrets']} secrets")
# List all secrets
secrets = easykey.list()
for secret in secrets:
print(f"Found secret: {secret['name']}")
# Retrieve a specific secret (requires biometric authentication)
secret_value = easykey.secret("MySecretName", "Accessing for API call")
print(f"Secret value: {secret_value}")
Note: This is a read-only package. To store or manage secrets, use the easykey CLI directly.
License
MIT License - see the main easykey project for details.
Project details
Release history Release notifications | RSS feed
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 easykey-0.1.0.tar.gz.
File metadata
- Download URL: easykey-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb7fb42f7d4a0ba947e327129f67000dcac65a1cfea71bc7f161fb6905f8c6d0
|
|
| MD5 |
9a49950ce17bcf6eb28463a914554bdd
|
|
| BLAKE2b-256 |
70ff5e3a719a38ce60fbee072ca9ed585dbc324ffd07d0fd2ebdc5be5f1e1485
|
File details
Details for the file easykey-0.1.0-py3-none-any.whl.
File metadata
- Download URL: easykey-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3426221b33c684aec6ee910e8ad7d2af85b357338cc7803191166a419ce66a5
|
|
| MD5 |
504252b9276fd24667df6d9e5355ea50
|
|
| BLAKE2b-256 |
08eedd1ee4dc345db247164cc234d7d523ff71611edb61f525589bc86943dc83
|