aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-gpg
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ak-gpg')
-rwxr-xr-xbin/ak-gpg40
1 files changed, 33 insertions, 7 deletions
diff --git a/bin/ak-gpg b/bin/ak-gpg
index 2c8bbdc..e76f407 100755
--- a/bin/ak-gpg
+++ b/bin/ak-gpg
@@ -1,4 +1,22 @@
-#!/bin/bash
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### 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.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
##
## It is a minimal wrapper aroung lib/_ak_gpg.
##
@@ -8,6 +26,8 @@
## --get-key-self-as-ipfs Returns your key as an IPFS hash
## --get-key-self-as-fingerprint Returns the fingerprint of your key
## --get-key-fingerprint-from-ipfs Returns the fingerprint of a given key
+## --export-key <fingerprint> <out> Exports a public key as <out> filename
+## --export-selected-key Selects a key to export
## --export-key-self-to-file Exports self public key as 'self.pub'
## --clear-sign <file> <output> Sign a file clearly
## --verify-file <file> Verify a clear signed file
@@ -26,15 +46,17 @@
## -d, --delete-key Delete GPG keys from your keyring
## -ds, --delete-secret-key <fingerprint>
## Delete GPG keys from your keyring
+## -r, --run Runs a command with gpg2
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="GPG cli tool"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_gpg
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_gpg
@@ -45,8 +67,10 @@ if [ ! -z $1 ]; then
--example) example; exit;;
--get-key-self-as-ipfs) _ak_gpg_key_self_get_fingerprint_from_config; exit;;
--get-key-self-as-fingerprint) _ak_gpg_key_self_get_fingerprint; exit;;
- --get-key-fingerprint-from-ipfs) _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
+ --get-key-fingerprint-from-ipfs) shift; _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
--export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
+ --export-selected-key) _ak_gpg_select_key_to_export; exit;;
+ --export-key) _ak_gpg_key_export "$2" "$3"; exit;;
--clear-sign) shift; _ak_gpg_sign_clear "$2" "$1"; exit;;
--verify-file) shift; _ak_gpg_verify_clear_signature "$1"; exit;;
--list-keys | -l) _ak_gpg_list_keys; exit;;
@@ -59,7 +83,9 @@ if [ ! -z $1 ]; then
--select-key | -s) _ak_gpg_select_key; exit;;
--delete-key | -d) _ak_gpg_delete_key; exit;;
--delete-secret-key | -ds) shift; _ak_gpg_delete_secret_key $1; exit;;
- * ) _ak_usage;;
+ --run | -r) shift; _ak_gpg $*; exit;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi