bitwarden-helper-scripts/bwunlock.sh

20 lines
387 B
Bash
Raw Normal View History

2020-07-02 10:29:54 -04:00
#!/bin/bash
# To unlock and set session vars for bitwarden vault
unset BWPASSWORD
prompt="Enter Bitwarden Master Password: "
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]
then
break
fi
prompt='*'
BWPASSWORD+="$char"
done
echo
export BW_SESSION="$(bw unlock $BWPASSWORD --raw)"
echo "Bitwarden vault unlocked, session variable set"
echo
unset BWPASSWORD