1
0
Fork 0
dotfiles/.config/zsh/functions/ssh-sign

19 lines
442 B
Bash
Executable File

#!/usr/bin/env zsh
# Sign files with SSH
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
autoload -U die
zmodload zsh/zutil
local -a keyfile=(-f ~/.ssh/id_ed25519)
local -a namespace=(-n file)
local -a help=()
zparseopts -D -K -- f:=keyfile n:=namespace h=help
if [[ ${#help} -ne 0 ]]; then
print "Usage: ${0} [-h] [-f KEYFILE] [-n NAMESPACE] <file> …"
return 0
fi
ssh-keygen -Y sign -f ${keyfile[2]} -n ${namespace[2]} ${@}