#!/bin/sh
if test -z "${*}"
then
	OUTPUT="$(wayprompt --title "SSH Password:" --button-ok Ok --button-cancel Abort --get-pin)"
else
	OUTPUT="$(wayprompt --title "${*}" --button-ok Ok --button-cancel Abort --get-pin)"
fi

if test $? -eq 0
then
	PIN="$(echo "${OUTPUT}" | tail -1 | sed -e 's/pin: //')"
	if test "${PIN}" = "no pin"
	then
		echo
	else
		echo "${PIN}"
	fi
	exit 0
else
	exit 1
fi

