From 9144dbd13f02215a424f7cdf8ec78c59463b5a19 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 21 Jul 2025 00:27:59 +0300 Subject: [bin] [api] Supports and resolves base64 encoded fingerprints --- lib/_ak_ns | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'lib/_ak_ns') diff --git a/lib/_ak_ns b/lib/_ak_ns index 683f572..f412c93 100755 --- a/lib/_ak_ns +++ b/lib/_ak_ns @@ -56,7 +56,12 @@ function _ak_ns_list(){ } function _ak_ns_list_long(){ - _ak_gpg_list_secret_keys_long | grep '@keynames.kaos.kaos' + _ak_gpg_list_secret_keys_long \ + | grep '@keynames.kaos.kaos' \ + | while read key name + do + printf '%s %s %s\n' "${key}" "$(_ak_ns_encode_key ${key})" "${name}" + done } function _ak_ns_resolve_from_key(){ @@ -76,6 +81,30 @@ function _ak_ns_resolve_from_key(){ _ak_gpg_verify_clear_signature ${AK_NS_DIR}/${key} } +function _ak_ns_encode_key(){ + # $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" + printf '%s' "$(echo -n ${key}|xxd -r -p|base64)" +} + +function _ak_ns_decode_key(){ + # $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" + printf '%s' "$(echo -n ${key}|base64 -d|xxd -p|tr '[:lower:]' '[:upper:]')" +} + function _ak_ns_resolve_from_name(){ # $1; exit;; if [ -z $1 ] || [ ! -n "$1" ] -- cgit v1.2.3