-### -*-sh-*-
+#! /bin/sh
###
### Stash a recovery blob of a secret
###
. "$KEYSLIB"/keyfunc.sh
defhelp <<HELP
-RECOV LABEL [SECRET]
+RECOV LABEL
Store a secret encrypted under the recovery key RECOV.
The LABEL is used to identify the encrypted secret later to the \`recover'
-command. The secret is read from SECRET, or stdin if SECRET is omitted or
-\`-'.
+command. The secret is read from stdin.
HELP
## Parse the command line.
-case $# in
- 2) if [ -t 0 ]; then echo >&2 "$quis: stdin is a terminal"; exit 1; fi ;;
- 3) ;;
- *) usage_err ;;
-esac
+case $# in 2) ;; *) usage_err ;; esac
recov=$1 label=$2; shift 2
checkword "recovery key label" "$recov"
checklabel "secret" "$label"
## Do the thing.
mktmp
-cat -- "$@" >$tmp/secret
+cat >$tmp/secret
stash $recov $label <$tmp/secret
###----- That's all, folks --------------------------------------------------