This commit is contained in:
aloslider
2026-03-30 15:10:08 +03:00
commit 5dea52c6fa
23 changed files with 2495 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail
KEY_DIR="$HOME/.config/chezmoi"
KEY_FILE="$KEY_DIR/key.txt"
mkdir -p "$KEY_DIR"
chmod 700 "$KEY_DIR"
if (bw status | grep -q '"status": "locked"';) then
export BW_SESSION=$(bw unlock --raw)
fi
bw sync
bw get item "age-keys" \
| jq -r '.fields[] | select(.name == "private_key") | .value' \
> "$KEY_FILE"
if [[ -s "$KEY_FILE" ]]; then
chmod 600 "$KEY_FILE"
else
exit 1
fi