aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ak-gpg3
-rwxr-xr-xinit.sh3
-rwxr-xr-xlib/_ak_config5
-rwxr-xr-xlib/_ak_gpg2
4 files changed, 9 insertions, 4 deletions
diff --git a/bin/ak-gpg b/bin/ak-gpg
index b33a952..f14c257 100755
--- a/bin/ak-gpg
+++ b/bin/ak-gpg
@@ -12,6 +12,8 @@
##
## --get-key-fingerprint-from-ipfs Returns the fingerprint of a given key
##
+## --export-key-self-to-file Exports self public key as 'self.pub'
+##
## -l, --list-keys Returns a list of known GPG keys
##
## -lp, --list-keys-plain Returns a list of known GPG keys as
@@ -53,6 +55,7 @@ if [ ! -z $1 ]; then
--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;;
+ --export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
--list-keys | -l) _ak_gpg_list_keys; exit;;
--list-keys-long | -ll) _ak_gpg_list_keys_long; exit;;
--list-keys-plain | -lp) _ak_gpg_list_keys_plain; exit;;
diff --git a/init.sh b/init.sh
index b96d674..51a32a0 100755
--- a/init.sh
+++ b/init.sh
@@ -1,6 +1,7 @@
#!/bin/bash
set -x
source lib/_ak_ipfs
+source lib/_ak_settings
# TODO GPG/PGP setup:: possibly done
# eg gpg2 --full-key-generate and/or gpg2 --set-default key
@@ -12,7 +13,7 @@ ak_gpg_check_or_create(){
then
gpg2 --homedir $AK_GPGHOME --batch --passphrase '' --quick-gen-key kaos@kaos.kaos rsa3072 sign 0
AK_FINGERPRINT="$(gpg2 --homedir $AK_GPGHOME --list-keys | grep kaos@kaos.kaos -B 1 | head -n 1 | awk '{print $1}')"
- printf '%s' "$AK_FINGERPRINT" > $AK_WORKDIR/current_key
+ _ak_settings_set "gpg.fingerprint" "$AK_FINGERPRINT"
gpg2 --homedir $AK_GPGHOME --batch --passphrase '' --quick-add-key $AK_FINGERPRINT rsa3072 encrypt 0
fi
}
diff --git a/lib/_ak_config b/lib/_ak_config
index f47a7c5..45d0112 100755
--- a/lib/_ak_config
+++ b/lib/_ak_config
@@ -3,8 +3,9 @@ source $AK_LIBDIR/_ak_node
_ak_config_show(){
# We will be using our public key also to put it in the block later
- KEY="tmp-gpg.pub"
- _ak_gpg_key_self_export $KEY
+ KEY="self.pub"
+ ak-gpg --export-key-self-to-file
+ _ak_log_debug "$KEY"
GPG_PUB_KEY=$(_ak_ipfs_add $KEY)
rm $KEY
profile="$(ak-profile -l)"
diff --git a/lib/_ak_gpg b/lib/_ak_gpg
index a2cca7a..a214965 100755
--- a/lib/_ak_gpg
+++ b/lib/_ak_gpg
@@ -208,7 +208,7 @@ _ak_gpg_select_key(){
if [ -n "$x" ]
then
_ak_log_info "$x was selected"
- printf '%s' "$x" > $AK_WORKDIR/selected_key
+ _ak_settings_set "gpg.fingerprint" "$x"
break
else
_ak_log_warning "You didn't select a key"