pass: enable otp generation
This commit is contained in:
parent
4ad060e795
commit
89cef20b3c
|
@ -19,6 +19,10 @@ let
|
|||
}));
|
||||
create_scripts =
|
||||
lib.mapAttrs (name: deps: create_script name ./${name} deps);
|
||||
|
||||
pass = pkgs.pass.withExtensions (ex: with ex; [
|
||||
pass-otp
|
||||
]);
|
||||
in
|
||||
create_scripts
|
||||
{
|
||||
|
|
|
@ -9,6 +9,17 @@ find_file() {
|
|||
wdmenu -p "Password" $@
|
||||
}
|
||||
|
||||
print_actions_for_entry() {
|
||||
echo "Autotype"
|
||||
if test -n "$username"; then
|
||||
echo "Username -> $username"
|
||||
fi
|
||||
echo "Password"
|
||||
if test -n "$otp"; then
|
||||
echo "OTP"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
test -n "$PASSWORD_STORE_DIR" &&
|
||||
cd "$PASSWORD_STORE_DIR" ||
|
||||
|
@ -20,8 +31,9 @@ main() {
|
|||
|
||||
username=`pass show "$entry" 2>/dev/null | perl -ne 'print $2 if /^(login|user|email): (.*)/'`
|
||||
password=`pass show "$entry" 2>/dev/null | head -n 1`
|
||||
otp=`pass otp "$entry" 2>/dev/null`
|
||||
|
||||
action=`printf "Autotype\nUsername -> $username\nPassword" | wdmenu -p Action`
|
||||
action="$(print_actions_for_entry | wdmenu -p Action)"
|
||||
|
||||
case $action in
|
||||
Autotype)
|
||||
|
@ -31,6 +43,8 @@ main() {
|
|||
printf '%s' "$username" | wl-copy;;
|
||||
Password)
|
||||
printf '%s' "$password" | wl-copy;;
|
||||
OTP)
|
||||
pass otp "$entry" | wl-copy;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
|
2
user/fish/completions/pass.fish
Normal file
2
user/fish/completions/pass.fish
Normal file
|
@ -0,0 +1,2 @@
|
|||
complete -c $PROG -f -n '__fish_pass_needs_command' -s c -l clip -d 'Generate an OTP code'
|
||||
complete --no-files pass -a '(__fish_pass_print_entries)' -n '__fish_pass_uses_command otp'
|
|
@ -1,10 +1,15 @@
|
|||
{ config, pkgs, lib, inputs, ... }: {
|
||||
config = {
|
||||
programs.password-store.enable = true;
|
||||
programs.password-store = {
|
||||
enable = true;
|
||||
package = pkgs.pass.withExtensions (ex: with ex; [
|
||||
pass-otp
|
||||
]);
|
||||
};
|
||||
services = {
|
||||
pass-secret-service.enable = true;
|
||||
password-store-sync.enable = true;
|
||||
};
|
||||
home.packages = with pkgs; [ pass wpass _gpg-unlock ];
|
||||
home.packages = with pkgs; [ wpass _gpg-unlock ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue