credentials: redefine SEKRIT_DIR
Instead of adding a prefix to all keys.
This commit is contained in:
parent
a830563ebd
commit
aa6636e6a5
@ -33,13 +33,13 @@ clip()
|
||||
get_user()
|
||||
{
|
||||
printf user
|
||||
sekrit cp "services/$1/user" && printf "\n"
|
||||
sekrit cp "$1/user" && printf "\n"
|
||||
}
|
||||
|
||||
get_pass()
|
||||
{
|
||||
printf pass
|
||||
sekrit cp "services/$1/pass" && printf "\n"
|
||||
sekrit cp "$1/pass" && printf "\n"
|
||||
}
|
||||
|
||||
get_2fa()
|
||||
@ -50,7 +50,7 @@ get_2fa()
|
||||
isnic) otpcli_opts="-H sha512 -d 8"
|
||||
;;
|
||||
esac
|
||||
sekrit get "services/$1/2fa" | otpcli $otpcli_opts | clip && printf "\n"
|
||||
sekrit get "$1/2fa" | otpcli $otpcli_opts | clip && printf "\n"
|
||||
}
|
||||
|
||||
get_service()
|
||||
@ -61,25 +61,25 @@ get_service()
|
||||
sfa=$4
|
||||
|
||||
if [ $user = no ] && [ $pass = no ] && [ $sfa = no ]; then
|
||||
sekrit has "services/$service/pass" ||
|
||||
sekrit has "$service/pass" ||
|
||||
err "unknown service $service"
|
||||
pass=yes
|
||||
sekrit has "services/$service/user" && user=yes
|
||||
sekrit has "services/$service/2fa" && sfa=yes
|
||||
sekrit has "$service/user" && user=yes
|
||||
sekrit has "$service/2fa" && sfa=yes
|
||||
fi
|
||||
|
||||
if [ $user = check ]; then
|
||||
sekrit has "services/$service/user" ||
|
||||
sekrit has "$service/user" ||
|
||||
err "service $service has no user"
|
||||
user=yes
|
||||
fi
|
||||
if [ $pass = check ]; then
|
||||
sekrit has "services/$service/pass" ||
|
||||
sekrit has "$service/pass" ||
|
||||
err "service $service has no pass"
|
||||
pass=yes
|
||||
fi
|
||||
if [ $sfa = check ]; then
|
||||
sekrit has "services/$service/2fa" ||
|
||||
sekrit has "$service/2fa" ||
|
||||
err "service $service has no 2fa"
|
||||
sfa=yes
|
||||
fi
|
||||
@ -109,4 +109,6 @@ shift $((OPTIND - 1))
|
||||
[ $# -eq 1 ] && [ -n "$1" ] || usage
|
||||
key=$1
|
||||
|
||||
get_service "$key" $user $pass $sfa
|
||||
: ${SEKRIT_DIR:=~/keep/sekrit/services}
|
||||
export SEKRIT_DIR
|
||||
get_account "$key" $user $pass $mfa
|
||||
|
Loading…
Reference in New Issue
Block a user