aboutsummaryrefslogtreecommitdiff
path: root/lib/_ak_ns
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2025-07-22 02:29:12 +0300
committerkaotisk <kaotisk@arching-kaos.org>2025-07-22 02:29:12 +0300
commitde3fab3c70befe6920d5436ce0bef62f3e70ba29 (patch)
tree63af5d628c62c846a436d006674ddc66f80137ea /lib/_ak_ns
parentfd12421d9e9589cc8d68a8a64bc2630266e3288f (diff)
downloadarching-kaos-tools-de3fab3c70befe6920d5436ce0bef62f3e70ba29.tar.gz
arching-kaos-tools-de3fab3c70befe6920d5436ce0bef62f3e70ba29.tar.bz2
arching-kaos-tools-de3fab3c70befe6920d5436ce0bef62f3e70ba29.zip
[api+ns] ns tool outputs JSON format and it's used for the API
Diffstat (limited to 'lib/_ak_ns')
-rwxr-xr-xlib/_ak_ns17
1 files changed, 17 insertions, 0 deletions
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" ]