From b8ea131be9d6c57d01cf04ed04a685094e5c130e Mon Sep 17 00:00:00 2001 From: Lucid One Date: Tue, 5 Feb 2019 01:47:41 -0500 Subject: [PATCH] Host app support for [pass-otp](https://github.com/tadfisher/pass-otp) --- README.md | 6 ++++++ src/passff.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 46de870..9201316 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,12 @@ In the preferences of PassFF, you can enable the status bar and debug logs in th * The typical output for an empty store is: * `{"stderr": "", "version": "1.0.1", "exitCode": 0, "stdout": "Password Store\n"}` +#### Testing OTP support +```console +$ echo -e "\x19\x00\x00\x00[\"otp\",\"/www/github.com\"]" | /path/to/passff.py | tail -c +4; echo +{"exitCode": 0, "stderr": "", "stdout": "123456\n", "version": "1.0.1"} +``` + ### Preferences If you use a customized `pass` installation: environment variables, customized repository path or extensions, you may have to customize the *preferences section* in `passff.py`. diff --git a/src/passff.py b/src/passff.py index 96fd6e2..fffd0ac 100755 --- a/src/passff.py +++ b/src/passff.py @@ -62,6 +62,11 @@ if __name__ == "__main__": pos_args = [receivedMessage[1], receivedMessage[2]] if "-n" in receivedMessage[3:]: opt_args.append("-n") + elif receivedMessage[0] == "otp" and len(receivedMessage) == 2: + opt_args = ["otp"] + key = receivedMessage[1] + key = "/" + (key[1:] if key[0] == "/" else key) + pos_args = [key] else: opt_args = ["show"] key = receivedMessage[0]