Extensible passphrase resolver, supporting prompting as well as passphrases stored in environment variables, files or keychains
Project description
get-passphrase
Extensible passphrase resolver, supporting prompting as well as passphrases stored in environment variables, files or keyrings
Some examples of smart passphrase descriptors:
pass:<passphrase>
to directly provide a passphrase inlineenv:<env-var-name>
to get the passphrase from an environment variable. The application may configure a custom environment dictionary, oros.osenviron()
is usedfile:<file-name>
to get the passphrase from the file at location pathname. The application may configure a base directory for relative paths, or the current working directory is used.fd:<file-descriptor-number>
read the passphrase from the provided file descriptor numberstdin:
to read from standard inputprompt:
to prompt the user with "Password: " and read from console with typed characters hidden (uses getpass)prompt:<prompt-string>
to prompt the user with a custom prompt string and read from console with typed characters hidden (uses getpass)keyring:<service-name>,<key-name>
to load the passphrase from keyring. The application may configure a prefix that will be prepended to either the service-name or the key-name or both, to define a unique namespace for the application.keyring:<key-name>
to load the passphrase from keyring, using a default service name configured by the application. The application may configure a prefix that will be prepended to key-name, to define a unique namespace for the application.none:
To provide aNone
value for the passphrase (useful for chaining defaults)empty:
To provide an empty passphrase
Command tool
A command tool, get-passphrase
, is provided that will expand a smart passphrase descriptor provided as an argument.
Usage:
usage: get-passphrase [-h] [--version] [passphrase [passphrase ...]]
Resolve a passphrase in a number of ways.
positional arguments:
passphrase A list of smart passphrase descriptors to be checked in order. The first one that produces a passphrase is used.
optional arguments:
-h, --help show this help message and exit
--version Display version
Library
Usage
from get_passphrase import resolve_passphrase
descriptor = input("Enter smart passphrase descriptor:")
print("Passphrase is: ", resolve_passphrase(descriptor).get_cleartext())
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
get-passphrase-1.0.0.tar.gz
(9.2 kB
view details)
Built Distribution
File details
Details for the file get-passphrase-1.0.0.tar.gz
.
File metadata
- Download URL: get-passphrase-1.0.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.4.0-99-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddb3b6cc289a4660a2940b07e970b68c328feeb5bcc54f7ed3c19193f5f7da16 |
|
MD5 | 1e3eea2f5bd7ab54d895bc897724adda |
|
BLAKE2b-256 | 6f8aa94e88d0ea09495fb70612802b87554248f47f092025a1f9829512c99294 |
File details
Details for the file get_passphrase-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: get_passphrase-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.4.0-99-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ccb1ad8560505c0f62938baa1324084bf4c31c4a9cbcb4e95f7ac44ec5a8b79 |
|
MD5 | 6ca22ad27947fce975da284b6b96698e |
|
BLAKE2b-256 | fb4d9902c7a49fdf6881bf344076c12227998071630608fa34ef129a8fe1e05f |