From 4af1aa4a4da19b5ab8313e91243e0de6d258d16c Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 22 Feb 2025 18:51:36 +0800 Subject: [PATCH] feat(sagent): sagt op --- tools/sagent-op.sh | 9 +++++++++ tools/sagent.sh | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100755 tools/sagent-op.sh diff --git a/tools/sagent-op.sh b/tools/sagent-op.sh new file mode 100755 index 0000000..a167e08 --- /dev/null +++ b/tools/sagent-op.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +op=$(command -v op || command -v op.exe) +if [[ ! -x $op ]]; then + echo "1password cli not found" + exit -1 +fi +"$op" read "op://Personal/id25519-passphrase/$(hostname)" diff --git a/tools/sagent.sh b/tools/sagent.sh index 9b317a3..570ce35 100755 --- a/tools/sagent.sh +++ b/tools/sagent.sh @@ -47,6 +47,12 @@ add_piv() list } +add_id25519_with_op() +{ + SSH_ASKPASS_REQUIRE=force SSH_ASKPASS="$THIS_DIR/sagent-op.sh" timeout 30s ssh-add ~/.ssh/id_ed25519 || fmt_fatal "timed out when adding the key. probably the passphrase is wrong" + list +} + list() { echo echo "available keys:" @@ -96,6 +102,9 @@ route() piv) add_piv ;; + op) + add_id25519_with_op + ;; reset) reset ;;