+ || failure "You don't appear to have a Monkeysphere host key on this server.
+Please run 'monkeysphere-host import-key' import a key."
+}
+
+# key input to functions, outputs full fingerprint of specified key if
+# found
+check_key_input() {
+ local keyID="$1"
+ # array of fingerprints
+ local fprs=($(host_fingerprints))
+
+ case ${#fprs[@]} in
+ 0)
+ failure "You don't appear to have any Monkeysphere host keys.
+Please run 'monkeysphere-host import-key' to import a key."
+ ;;
+ 1)
+ :
+ ;;
+ *)
+ if [ -z "$keyID" ] ; then
+ failure "Your host keyring contains multiple keys.
+Please specify one to act on (see 'monkeysphere-host show-key')."
+ fi
+ ;;
+ esac
+ printf '%s\n' "${fprs[@]}" | grep "${keyID}$" \
+ || failure "Host key '$keyID' not found."