diff options
-rwxr-xr-x | generate-header | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/generate-header b/generate-header new file mode 100755 index 0000000..2828c7a --- /dev/null +++ b/generate-header @@ -0,0 +1,19 @@ +#!/bin/bash + +# TODO: extract uid from 'From: ' header +uid='eeerich@eckner.net' +key=$( + gpg \ + --export \ + --export-options=export-minimal \ + --export-filter "keep-uid='uid =~ ${uid}'" \ + "${uid}" \ + | base64 -w72 +) + +if [ -n "${key}" ]; then + printf 'Autocrypt: addr=%s; prefer-encrypt=mutual; keydata=\n' \ + "${uid}" + printf '%s\n' "${key}" \ + | sed 's/^/ /' +fi |