diff options
-rw-r--r-- | flake.nix | 1 | ||||
-rwxr-xr-x | scripts/mk_key.sh | 42 |
2 files changed, 16 insertions, 27 deletions
diff --git a/flake.nix b/flake.nix index a6a49ce..d9d418b 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,7 @@ devShells.default = pkgs.mkShell { packages = with pkgs; [ reuse + sequoia-sq ]; }; }); diff --git a/scripts/mk_key.sh b/scripts/mk_key.sh index 1e38025..85ea8af 100755 --- a/scripts/mk_key.sh +++ b/scripts/mk_key.sh @@ -17,42 +17,32 @@ die() { help() { cat <<EOF -A helper script to add an gpg key to the wkd. +A helper script to add an pgp key to the wkd. USAGE: - mk_key KEY_ID KEY_EMAIL_DOMAIN KEY_HASH + mk_key FQDN EMAIL_ADDRESS OPTIONS: --help | -h Display this help and exit. ARGUMENTS: - KEY_ID := [[ gpg --list-keys --with-colons | awk -F: '/^uid:/ { print \$10 }' ]] - The key to use, as specified by the key id. - - KEY_EMAIL_DOMAIN + FQDN The email domain of this key. For example 'key@example.org' would have an KEY_EMAIL_DOMAIN of 'example.org'. - KEY_HASH - This is the hashed name of the key as specified in the WKD spec. - Get this by running: 'gpg --with-wkd-hash --list-keys <KEY_ID>'. + EMAIL_ADDRESS + Add these keys with this email address included in their user ID. EOF } add() { - key_id="$1" - key_email="$2" - key_hash="$3" + fqdn="$1" + email_address="$2" cd "$(git rev-parse --show-toplevel)" || die "No source dir!" - dir="./src/.well-known/openpgpkey/$key_email/hu" - - full_key_id="$(gpg --list-keys --with-colons "$key_id" | awk -F: '/^uid:/ { print $10 }' | tail -n 1)" - - mkdir --parents "$dir" - gpg --no-armor --export "$key_id" >"$dir/$key_hash" && - printf "%s%s%s%s\n" '`' "$dir/$key_hash" '`' " -> $full_key_id" >>stored_keys.md && + sq network wkd publish src --method=advanced --create --cert-email="$email_address" --domain="$fqdn" && + printf "%s\n" "$fqdn ($email_address)" >>stored_keys.md && echo "Key export done!" } @@ -65,17 +55,15 @@ for arg in "$@"; do esac done -key_id="$1" -key_email="$2" -key_hash="$3" -shift 3 +fqdn="$1" +email_address="$2" +shift 2 -[ -z "$key_id" ] && die "No KEY_ID specified, see '--help'!" -[ -z "$key_email" ] && die "No KEY_EMAIL_DOMAIN specified, see '--help'!" -[ -z "$key_hash" ] && die "No KEY_HASH specified, see '--help'!" +[ -z "$fqdn" ] && die "No FQDN specified, see '--help'!" +[ -z "$email_address" ] && die "No EMAIL_ADDRESS specified, see '--help'!" [ -n "$*" ] && die "The arguments '$*' are not recognized; see '--help' for a list!" -add "$key_id" "$key_email" "$key_hash" +add "$fqdn" "$email_address" # vim: ft=sh |