summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-11-22 10:54:12 +0100
committerErich Eckner <git@eckner.net>2020-11-22 10:54:12 +0100
commit6cea1344cb3bdfa2352a7893817be257ce166104 (patch)
tree292118b6d8417e89dce6196461d5d1db5fc60119
downloadautocrypt-6cea1344cb3bdfa2352a7893817be257ce166104.tar.xz
initial CommitHEADmaster
-rwxr-xr-xgenerate-header19
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