dpgpid/dpgpid

70 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-05-13 19:40:16 +02:00
#!/bin/sh
# link: https://git.p2p.legal/aya/dpgpid/
# desc: dpgpid (Decentralized PGP IDentifiers) shares PGP keys with DIDs on IPFS
2022-05-16 22:34:47 +02:00
# Copyleft 2022 Yann Autissier <aya@asycn.io>
2022-05-13 19:40:16 +02:00
# This program is free software: you can redistribute it and/or modify
2022-05-16 22:34:47 +02:00
# it under the terms of the GNU Affero General Public License as published by
2022-05-13 19:40:16 +02:00
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2022-05-16 22:34:47 +02:00
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2022-05-13 19:40:16 +02:00
set -eu
2022-05-16 22:34:47 +02:00
DATE=$(date -u +%FT%TZ%Z)
2022-05-13 19:40:16 +02:00
USAGE='[--help] [--version] show'
VERSION='0.0.1'
dpgpid() {
while test $# != 0; do
case "$1" in
-h|--help)
help
;;
-v|--version)
version
;;
--)
shift
break
;;
-*)
usage
;;
show)
show
;;
*)
break
;;
esac
shift
done
}
help() {
usage
}
show() {
gpg --list-keys --with-colons |awk -F: '$1 == "pub" {print "did:pgp:"$5}'
}
usage() {
printf "%s\n" "Usage: $(basename "$0") ${USAGE}"
}
version() {
printf "%s\n" "Version: $(basename "$0") v${VERSION}"
}
dpgpid "$@"