From de3fab3c70befe6920d5436ce0bef62f3e70ba29 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 22 Jul 2025 02:29:12 +0300 Subject: [api+ns] ns tool outputs JSON format and it's used for the API --- lib/_ak_ns | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib') diff --git a/lib/_ak_ns b/lib/_ak_ns index 8afef83..3499232 100755 --- a/lib/_ak_ns +++ b/lib/_ak_ns @@ -99,6 +99,23 @@ function _ak_ns_resolve_from_key_with_proof(){ cat ${AK_NS_DIR}/${key}.map } +function _ak_ns_resolve_from_key_with_proof_json(){ + # $1; exit;; + if [ -z $1 ] || [ ! -n "$1" ] + then + _ak_log_error "No key was given" + exit 1 + fi + key="$1" + json=$(_ak_ns_resolve_from_key_with_proof $key | while read proof resolved; do printf '{"fingerprint":"%s","proof":"%s","resolved":"%s"}' "$1" "$proof" "$resolved"; done) + if [ $? -ne 0 ] + then + _ak_log_error "Something happened" + exit 1 + fi + echo $json +} + function _ak_ns_encode_key(){ # $1; exit;; if [ -z $1 ] || [ ! -n "$1" ] -- cgit v1.2.3