Commit 98268270 authored by Vojtech Myslivec's avatar Vojtech Myslivec 🚀

Add draft for cached Omnia serial-number command

parent 707ab951
......@@ -12,6 +12,8 @@ HASH_TYPE='sha256'
CRYPTO_WRAPPER_ROOT_PREFIX='/tmp/crypto_wrapper'
CRYPTO_KEY_SERIAL='serial'
# --------------------------------------------------------------------
stderr_mesage() {
......@@ -150,3 +152,20 @@ cache_get_string() {
}
echo "$value"
}
# --------------------------------------------------------------------
cached_atsha_serial() {
local output
if output=$(cache_get_string "$CRYPTO_KEY_SERIAL"); then
debug "key '$CRYPTO_KEY_SERIAL' found in cache"
else
debug "key '$CRYPTO_KEY_SERIAL' was not found in cache, run atsha204cmd"
output=$(atsha204cmd serial-number)
debug 'store output of atsha204cmd to cache'
cache_set_string "$CRYPTO_KEY_SERIAL" "$output"
fi
echo "$output"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment