diff options
-rwxr-xr-x | bin/ak-ns | 3 | ||||
-rwxr-xr-x | lib/_ak_ns | 26 |
2 files changed, 26 insertions, 3 deletions
@@ -28,6 +28,8 @@ ## -ll, --list-long List names with keys ## -rn, --resolve-name <name> Resolves value from name ## -rk, --resolve-key <key> Resolves value from key +## -rp, --resolve-key-proof <key> Resolves value from key and provides +## an akfs_map_v3 to clear signed proof ## -p, --publish <key> <value> Publishes value to key ## -pn, --publish2name <name> <value> Publishes value to name ## -pz, --publish-zchain Publishes zchain @@ -53,6 +55,7 @@ then -ll | --list-long) shift; _ak_ns_list_long; exit;; -rn | --resolve-name) shift; _ak_ns_resolve_from_name $1; exit;; -rk | --resolve-key) shift; _ak_ns_resolve_from_key $1; exit;; + -rp | --resolve-key-proof) shift; _ak_ns_resolve_from_key_with_proof $1; exit;; -ek | --encode-key) shift; _ak_ns_encode_key $1; exit;; -dk | --decode-key) shift; _ak_ns_decode_key $1; exit;; -p | --publish) shift; _ak_ns_publish $1 $2; exit;; @@ -82,6 +82,23 @@ function _ak_ns_resolve_from_key(){ _ak_gpg_verify_clear_signature ${AK_NS_DIR}/${key} } +function _ak_ns_resolve_from_key_with_proof(){ + # $1; exit;; + if [ -z $1 ] || [ ! -n "$1" ] + then + _ak_log_error "No key was given" + exit 1 + fi + key="$1" + _ak_log_info "${key} was given" + if [ ! -f ${AK_NS_DIR}/${key}.map ] + then + _ak_log_error "${key} was not found" + exit 1 + fi + cat ${AK_NS_DIR}/${key}.map +} + function _ak_ns_encode_key(){ # $1; exit;; if [ -z $1 ] || [ ! -n "$1" ] @@ -211,10 +228,11 @@ function _ak_ns_publish_zchain(){ printf '%s %s\n' "$(echo -n $signed_akfs_map)" \ "$(_ak_gpg_verify_clear_signature ${AK_NS_DIR}/${zchain_key})" \ >> ${AK_NS_DIR}/${zchain_key}.history_map - fi - echo ${signed_akfs_map} > ${AK_NS_DIR}/${zchain_key}.map mv ${zlatest_csigned_file} ${AK_NS_DIR}/${zchain_key} + printf '%s %s\n' "$(echo -n $signed_akfs_map)" \ + "$(_ak_gpg_verify_clear_signature ${AK_NS_DIR}/${zchain_key})" \ + > ${AK_NS_DIR}/${zchain_key}.map } function _ak_ns_publish_config(){ @@ -243,8 +261,10 @@ function _ak_ns_publish_config(){ >> ${AK_NS_DIR}/${zconfig_key}.history_map fi - echo ${signed_akfs_map} > ${AK_NS_DIR}/${zconfig_key}.map mv ${zconfig_csigned_file} ${AK_NS_DIR}/${zconfig_key} + printf '%s %s\n' "$(echo -n $signed_akfs_map)" \ + "$(_ak_gpg_verify_clear_signature ${AK_NS_DIR}/${zconfig_key})" \ + > ${AK_NS_DIR}/${zconfig_key}.map } _ak_log_debug "_ak_ns loaded $(caller)" |