mirror of
https://github.com/Cian-H/My_NixOS_Config.git
synced 2026-02-24 16:48:04 +00:00
Refactored rbw-autofill
This commit is contained in:
@@ -2,27 +2,5 @@
|
||||
pkgs.writeShellApplication {
|
||||
name = "rbw-autofill";
|
||||
runtimeInputs = [pkgs.bash pkgs.libsecret pkgs.zenity];
|
||||
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
echo "OK"
|
||||
while read -r line; do
|
||||
if [[ "$line" == "GETPIN" ]]; then
|
||||
pass=$(secret-tool lookup application rbw 2>/dev/null)
|
||||
if [[ -z "$pass" ]]; then
|
||||
pass=$(zenity --password --title="rbw Setup" --text="Enter Bitwarden Master Password to save to Keyring:")
|
||||
if [[ -n "$pass" ]]; then
|
||||
printf "%s" "$pass" | secret-tool store --label="rbw" application rbw
|
||||
else
|
||||
echo "ERR 100 Password retrieval cancelled"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
printf "D %s\n" "$pass"
|
||||
echo "OK"
|
||||
exit 0
|
||||
fi
|
||||
echo "OK"
|
||||
done
|
||||
'';
|
||||
text = builtins.readFile ./rbw_autofill.sh;
|
||||
}
|
||||
|
||||
21
home-manager/worklaptop/packages/rbw_autofill.sh
Normal file
21
home-manager/worklaptop/packages/rbw_autofill.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "OK"
|
||||
while read -r line; do
|
||||
if [[ "$line" == "GETPIN" ]]; then
|
||||
pass=$(secret-tool lookup application rbw 2>/dev/null)
|
||||
if [[ -z "$pass" ]]; then
|
||||
pass=$(zenity --password --title="rbw Setup" --text="Enter Bitwarden Master Password to save to Keyring:")
|
||||
if [[ -n "$pass" ]]; then
|
||||
printf "%s" "$pass" | secret-tool store --label="rbw" application rbw
|
||||
else
|
||||
echo "ERR 100 Password retrieval cancelled"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
printf "D %s\n" "$pass"
|
||||
echo "OK"
|
||||
exit 0
|
||||
fi
|
||||
echo "OK"
|
||||
done
|
||||
Reference in New Issue
Block a user