summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorgabrix73 <gabriel1@frozenstar.info>2026-05-31 03:13:09 +0200
committergabrix73 <gabriel1@frozenstar.info>2026-05-31 03:19:13 +0200
commit9bdfa72f032c9c8f29affabf850d23b1591f7f98 (patch)
tree84ccbcdec0335e51d6556cc9fc76e290593326e8 /scripts
parent7a56f6df0853305666f70b906966de19f2fb388c (diff)
downloadneomutt-config-9bdfa72f032c9c8f29affabf850d23b1591f7f98.tar.gz
neomutt-config-9bdfa72f032c9c8f29affabf850d23b1591f7f98.tar.xz
neomutt-config-9bdfa72f032c9c8f29affabf850d23b1591f7f98.zip
Add vim-yubisigner wrapper and installation instructions
- Add scripts/vim-yubisigner (editor wrapper for YubiKey signing) - Update README with complete installation steps for yubisigner-cli - Include code blocks for building and installing wrapper
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vim-yubisigner65
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/vim-yubisigner b/scripts/vim-yubisigner
new file mode 100755
index 0000000..45d1c3d
--- /dev/null
+++ b/scripts/vim-yubisigner
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Vim wrapper that auto-signs with yubisigner-cli after editing
+# Used by NeoMutt mail2news account
+# Creates PGP-like clearsign format with yubisigner signature
+
+set -euo pipefail
+
+# First argument is the file to edit
+FILE="$1"
+
+# Open vim for editing
+vim "$FILE"
+
+# Save original message
+ORIGINAL_MSG=$(cat "$FILE")
+
+# After vim exits, sign the message
+echo ""
+echo "Signing message with YubiKey..."
+
+# Kill gpg-agent to release YubiKey (it will auto-restart later)
+echo "Releasing YubiKey from gpg-agent..."
+gpgconf --kill gpg-agent 2>/dev/null || true
+sleep 1
+
+# Sign with yubisigner-cli (PIN will be prompted)
+if ! "$HOME/bin/yubisigner-cli/yubisigner-cli" \
+ --input "$FILE" \
+ --author "Gab Virebent" \
+ --email "gabriel1@virebent.art" \
+ --url "https://contact.virebent.art" \
+ --comment "Posted via NeoMutt mail2news"; then
+ echo ""
+ echo "ERROR: yubisigner-cli failed!"
+ echo "Press ENTER to continue WITHOUT signature..."
+ read
+ exit 0
+fi
+
+# Check if signature was created
+if [ ! -f "$FILE.sig" ]; then
+ echo ""
+ echo "ERROR: Signature file not created!"
+ echo "Press ENTER to continue WITHOUT signature..."
+ read
+ exit 0
+fi
+
+# Create clearsign format (like PGP clearsign but with yubisigner signature)
+{
+ echo "-----BEGIN YUBISIGNER SIGNED MESSAGE-----"
+ echo "Hash: SHA256"
+ echo ""
+ echo "$ORIGINAL_MSG"
+ echo ""
+ cat "$FILE.sig"
+} > "$FILE.tmp"
+
+# Replace original file with clearsign version
+mv "$FILE.tmp" "$FILE"
+
+# Cleanup
+rm -f "$FILE.sig"
+
+echo "Message signed successfully"