From fe0c8dd2026febd527dcf65a330324de6cad0567 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Sun, 5 Jul 2020 01:02:45 +0000 Subject: [PATCH] feat(unitproc):Add checkAgePubkey function Add checkAgePubkey: a function to check whether or not a string is accepted by age (an encryption function). Reference: https://github.com/FiloSottile/age/releases/tag/v1.0.0-beta2 --- unitproc/bktemp-checkAgePubkey | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 unitproc/bktemp-checkAgePubkey diff --git a/unitproc/bktemp-checkAgePubkey b/unitproc/bktemp-checkAgePubkey new file mode 100644 index 0000000..8089111 --- /dev/null +++ b/unitproc/bktemp-checkAgePubkey @@ -0,0 +1,19 @@ +#!/bin/bash +# Desc: Checks if string is an age-compatible public key string +checkAgePubkey() { + # Desc: Checks if string is an age-compatible pubkey + # Usage: checkAgePubkey [str pubkey] + # Version: 0.1.0 + # Input: arg1: string + # Output: return code 0: string is age-compatible pubkey + # return code 1: string is NOT an age-compatible pubkey + # Depends: age (v0.1.0-beta2; https://github.com/FiloSottile/age/releases/tag/v1.0.0-beta2 ) + + argPubkey="$1"; + + if echo "test" | age -a -r "$argPubkey" 1>/dev/null; then + return 0; + else + return 1; + fi; +} # Check age pubkey -- 2.30.2