gpg: add helper scripts

This commit is contained in:
Roman Zeyde
2016-10-21 23:07:58 +03:00
parent 513e99dd57
commit 742136b22d
2 changed files with 32 additions and 0 deletions

16
scripts/gpg-init Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -eux
USER_ID="${1}"
HOMEDIR=~/.gnupg/trezor
CURVE="ed25519" # or "nist256p1"
rm -rf "${HOMEDIR}"
mkdir -p "${HOMEDIR}"
chmod 700 "${HOMEDIR}"
trezor-gpg -v create "${USER_ID}" -e "${CURVE}" > "${HOMEDIR}/pubkey.asc"
gpg2 --homedir "${HOMEDIR}" --import < "${HOMEDIR}/pubkey.asc"
gpg2 --homedir "${HOMEDIR}" --edit-key "${USER_ID}" trust
$(dirname $0)/gpg-shell

16
scripts/gpg-shell Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -eu
export GNUPGHOME=~/.gnupg/trezor
gpg2 -k --with-keygrip
killall -q trezor-gpg || true
trezor-gpg agent &
AGENT_PID=$!
sleep 1
echo "Starting GPG-enabled shell..."
${SHELL}
echo "Stopping GPG-enabled shell..."
kill ${AGENT_PID}