Bash script for copying and autotyping data from password-store, gopass or prs.

add prs support #2

merged opened by jcg.re targeting main from push-vwswylplsrxo
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:cposd2qe5gzl2nvkbxqiupy5/sh.tangled.repo.pull/3m47eqaojvy22
+48 -33
Diff #8
+4
CHANGELOG.md
··· 10 Tessen has been first archived by the original developer and maintainer, and then forked. This marks 11 the first new release under new maintenance. 12 13 ## [2.2.3] - 2024-03-05 14 15 ### Fixed
··· 10 Tessen has been first archived by the original developer and maintainer, and then forked. This marks 11 the first new release under new maintenance. 12 13 + ### Added 14 + 15 + - support for `prs` as a third password backend besides `pass` and `gopass` 16 + 17 ## [2.2.3] - 2024-03-05 18 19 ### Fixed
+9 -8
README.md
··· 2 3 [![tangled](https://img.shields.io/badge/repository-tangled-blue)](https://tangled.org/@jcg.re/tessen) 4 5 - `tessen` is a bash script that can autotype and copy data from [password-store][1] and [gopass][2] 6 - files. A wayland native dmenu is required to use tessen and the following dmenu backends are 7 - recognized 8 9 - [fuzzel][4] 10 - [tofi][15] ··· 24 25 ### Why use `tessen`? 26 27 - - `tessen` can autotype or copy (or do both at the same time!) your password store and gopass data 28 - including all of your key-value pair data 29 30 From what the original author observed, most scripts out there do not autotype and copy all of 31 your key-value pair data. They also do not offer choices about autotyping or copying data with the ··· 51 52 - [bash][16] 53 54 - - at least one pass backend is needed - either [password-store][1] or [gopass][2] 55 56 - at least one Wayland native dmenu backend, preferably [fuzzel][4], or [tofi][15], [bemenu][5], 57 [yofi][32], [wofi][6], [rofi][3] ··· 130 131 ## Features 132 133 - - autotype or copy (or both at the same time!) data, including all valid key-value pairs, in pass 134 - and gopass 135 - generate TOTP/HOTP 136 - open URLs 137 - use custom values for `user`, `password`, `url`, `autotype` keys ··· 228 [33]: https://social.treehouse.systems/@psykose/109967460650885493 229 [34]: https://pkgs.alpinelinux.org/packages?name=tessen 230 [35]: https://search.nixos.org/packages?query=tessen
··· 2 3 [![tangled](https://img.shields.io/badge/repository-tangled-blue)](https://tangled.org/@jcg.re/tessen) 4 5 + `tessen` is a bash script that can autotype and copy data from [password-store][1], [gopass][2] 6 + and [prs][36]. A wayland native dmenu is required to use tessen and the following dmenu backends 7 + are recognized 8 9 - [fuzzel][4] 10 - [tofi][15] ··· 24 25 ### Why use `tessen`? 26 27 + - `tessen` can autotype or copy (or do both at the same time!) your password store, gopass and prs 28 + data including all of your key-value pair data 29 30 From what the original author observed, most scripts out there do not autotype and copy all of 31 your key-value pair data. They also do not offer choices about autotyping or copying data with the ··· 51 52 - [bash][16] 53 54 + - at least one pass backend is needed - either [password-store][1], [gopass][2] or [prs][36] 55 56 - at least one Wayland native dmenu backend, preferably [fuzzel][4], or [tofi][15], [bemenu][5], 57 [yofi][32], [wofi][6], [rofi][3] ··· 130 131 ## Features 132 133 + - autotype or copy (or both at the same time!) data, including all valid key-value pairs, in pass, 134 + gopass and prs 135 - generate TOTP/HOTP 136 - open URLs 137 - use custom values for `user`, `password`, `url`, `autotype` keys ··· 228 [33]: https://social.treehouse.systems/@psykose/109967460650885493 229 [34]: https://pkgs.alpinelinux.org/packages?name=tessen 230 [35]: https://search.nixos.org/packages?query=tessen 231 + [36]: https://timvisee.com/projects/prs/
+1 -1
config
··· 4 # configuration file for tessen 5 # place this file in $XDG_CONFIG_HOME/tessen/config 6 7 - # the default pass program to use - pass or gopass 8 # pass_backend="pass" 9 10 # the default dmenu backend program to use - rofi, fuzzel, bemenu, rofi, or dmenu
··· 4 # configuration file for tessen 5 # place this file in $XDG_CONFIG_HOME/tessen/config 6 7 + # the default pass program to use - pass, gopass or prs 8 # pass_backend="pass" 9 10 # the default dmenu backend program to use - rofi, fuzzel, bemenu, rofi, or dmenu
+15 -15
man/tessen.1.scd
··· 2 3 # NAME 4 5 - tessen - autotype and copy *pass*(1) and *gopass*(1) data on wayland 6 7 # SYNOPSIS 8 ··· 11 # DESCRIPTION 12 13 tessen is a *bash*(1) script that helps to autotype and copy data encrypted 14 - using *pass*(1) and *gopass*(1). It can also open URLs, generate HOTP and TOTP, 15 - and execute custom autotype operations. 16 17 tessen has been written for wlroots based wayland compositors like *sway*(1) 18 that support the virtual-keyboard-unstable-v1 protocol. It will NOT work on ··· 21 The options understood by tessen are: 22 23 *-p*, *--pass*, *--pass=*[pass backend] 24 - specify either *pass* or *gopass* 25 26 *-d*, *--dmenu*, *--dmenu=*[dmenu backend] 27 specify a dmenu backend - the list of recognized backends are *fuzzel*, ··· 41 42 ## DEFAULT BEHAVIOR 43 44 - If a pass backend is not specified, tessen tries to find either one of *pass*(1) 45 - or *gopass*(1) in the order mentioned here. 46 47 tessen assumes that the data organization format is the same as mentioned on 48 - the home page of password store, when using *pass*(1) and *gopass*(1) 49 50 https://www.passwordstore.org/#organization 51 ··· 67 If an action is not specified, tessen shows an additional menu with the option 68 to either autotype or copy data. 69 70 - If data is copied, it will be removed from the clipboard after 71 - *PASSWORD_STORE_CLIP_TIME* when using *pass*(1) and after *cliptimeout* when 72 - using *gopass*(1). If *PASSWORD_STORE_CLIP_TIME* is not set, a default value of 73 - 15 seconds is assumed. 74 75 A delay of 100 milliseconds will be used between successive autotype operations. 76 This can be changed using the 'delay' option in the *tessen*(5) configuration ··· 95 - *bash*(1) 96 - at least one wayland native dmenu backend - *fuzzel*(1), *tofi*(1), 97 *bemenu*(1), *wofi*(1), *rofi*(1), *dmenu* 98 - - at least one pass backend - either *pass*(1) or *gopass*(1) 99 - *wtype*(1) (if you want to autotype data) 100 - *wl-clipboard*(1) (if you want to copy and paste data) 101 - *scdoc*(1) (optional, to build this man page) ··· 117 *tessen*(5) config file. 118 119 The *otpauth://* format is supported and used if *pass-otp*(1) is installed when 120 - using *pass*(1). *gopass*(1) supports this feature natively. 121 122 A value for the 'autotype' key can be specified in password files for custom 123 autotype behavior which overrides the default behavior of autotyping the ··· 191 192 # SEE ALSO 193 194 - *tessen*(5), *pass*(1), *gopass*(1) *pass-otp*(1), *fuzzel*(1), *tofi*(1), 195 - *bemenu*(1), *wofi*(1), *rofi*(1), *wl-clipboard*(1), *wtype*(1), 196 *notify-send*(1) 197 198 # AUTHORS
··· 2 3 # NAME 4 5 + tessen - autotype and copy *pass*(1), *gopass*(1) and *prs*(1) data on wayland 6 7 # SYNOPSIS 8 ··· 11 # DESCRIPTION 12 13 tessen is a *bash*(1) script that helps to autotype and copy data encrypted 14 + using *pass*(1), *gopass*(1) and *prs*(1). It can also open URLs, generate HOTP 15 + and TOTP, and execute custom autotype operations. 16 17 tessen has been written for wlroots based wayland compositors like *sway*(1) 18 that support the virtual-keyboard-unstable-v1 protocol. It will NOT work on ··· 21 The options understood by tessen are: 22 23 *-p*, *--pass*, *--pass=*[pass backend] 24 + specify either *pass*, *gopass* or *prs* 25 26 *-d*, *--dmenu*, *--dmenu=*[dmenu backend] 27 specify a dmenu backend - the list of recognized backends are *fuzzel*, ··· 41 42 ## DEFAULT BEHAVIOR 43 44 + If a pass backend is not specified, tessen tries to find either one of 45 + *pass*(1), *gopass*(1) or *prs*(1) in the order mentioned here. 46 47 tessen assumes that the data organization format is the same as mentioned on 48 + the home page of password store, when using *pass*(1), *gopass*(1) and *prs*(1) 49 50 https://www.passwordstore.org/#organization 51 ··· 67 If an action is not specified, tessen shows an additional menu with the option 68 to either autotype or copy data. 69 70 + If data is copied, it will be removed from the clipboard after a timeout. The 71 + timeout is read from *PASSWORD_STORE_CLIP_TIME* when using *pass*(1) and from 72 + *cliptimeout* when using *gopass*(1). If no timeout is found, it falls back to a 73 + default of 15 seconds. 74 75 A delay of 100 milliseconds will be used between successive autotype operations. 76 This can be changed using the 'delay' option in the *tessen*(5) configuration ··· 95 - *bash*(1) 96 - at least one wayland native dmenu backend - *fuzzel*(1), *tofi*(1), 97 *bemenu*(1), *wofi*(1), *rofi*(1), *dmenu* 98 + - at least one pass backend - either *pass*(1), *gopass*(1) or *prs*(1) 99 - *wtype*(1) (if you want to autotype data) 100 - *wl-clipboard*(1) (if you want to copy and paste data) 101 - *scdoc*(1) (optional, to build this man page) ··· 117 *tessen*(5) config file. 118 119 The *otpauth://* format is supported and used if *pass-otp*(1) is installed when 120 + using *pass*(1). *gopass*(1) and *prs*(1) support this feature natively. 121 122 A value for the 'autotype' key can be specified in password files for custom 123 autotype behavior which overrides the default behavior of autotyping the ··· 191 192 # SEE ALSO 193 194 + *tessen*(5), *pass*(1), *gopass*(1), *prs*(1), *pass-otp*(1), *fuzzel*(1), 195 + *tofi*(1), *bemenu*(1), *wofi*(1), *rofi*(1), *wl-clipboard*(1), *wtype*(1), 196 *notify-send*(1) 197 198 # AUTHORS
+3 -3
man/tessen.5.scd
··· 35 36 *pass_backend* 37 38 - The default pass backend to use - either *pass*(1) or *gopass*(1) 39 40 *dmenu_backend* 41 ··· 134 135 # SEE ALSO 136 137 - *tessen*(5), *pass*(1), *gopass*(1) *pass-otp*(1), *fuzzel*(1), *tofi*(1), 138 - *bemenu*(1), *wofi*(1), *rofi*(1), *wl-clipboard*(1), *wtype*(1), 139 *notify-send*(1) 140 141 # AUTHORS
··· 35 36 *pass_backend* 37 38 + The default pass backend to use - either *pass*(1), *gopass*(1) or *prs*(1) 39 40 *dmenu_backend* 41 ··· 134 135 # SEE ALSO 136 137 + *tessen*(5), *pass*(1), *gopass*(1), *prs*(1), *pass-otp*(1), *fuzzel*(1), 138 + *tofi*(1), *bemenu*(1), *wofi*(1), *rofi*(1), *wl-clipboard*(1), *wtype*(1), 139 *notify-send*(1) 140 141 # AUTHORS
+16 -6
tessen
··· 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: GPL-2.0-only 3 # Copyright (C) 2021-2024 Ayush Agarwal <ayush at ayushnix dot com> 4 # 5 # tessen - a data selection interface for pass and gopass on Wayland 6 # ------------------------------------------------------------------------------ ··· 100 if [[ ${#passdata[@]} -eq 0 ]]; then 101 _die "the selected file is empty" 102 fi 103 elif [[ $_PASS_BACKEND == "gopass" ]]; then 104 # the output from gopass show -n -f that prints the first line and the 105 # newline before EOF doesn't use file descriptors but is printed only when ··· 314 315 if [[ $_PASS_BACKEND == "pass" ]]; then 316 tmp_otp="$(pass otp "$_TSN_PASSFILE")" 317 elif [[ $_PASS_BACKEND == "gopass" ]]; then 318 tmp_otp="$(gopass otp -o "$_TSN_PASSFILE")" 319 fi ··· 394 printf "%s\n" "invalid clipboard timeout value in PASSWORD_STORE_CLIP_TIME" >&2 395 return 1 396 fi 397 elif [[ $_PASS_BACKEND == "gopass" ]]; then 398 tsn_cliptime="$(gopass config core.cliptimeout)" 399 tsn_cliptime="${tsn_cliptime##*: }" ··· 430 431 validate_pass_backend() { 432 if ! is_installed "$1"; then 433 - _die "please install a valid password store backend: pass | gopass" 434 fi 435 - if [[ $1 == "pass" ]] || [[ $1 == "gopass" ]]; then 436 _PASS_BACKEND="$1" 437 else 438 - _die "please specify a valid password store backend: pass | gopass" 439 fi 440 } 441 ··· 526 } 527 528 find_pass_backend() { 529 - local -a tmp_pass_arr=('pass' 'gopass') 530 local idx 531 532 for idx in "${tmp_pass_arr[@]}"; do ··· 536 fi 537 done 538 if [[ -z $_PASS_BACKEND ]]; then 539 - _die "please install a valid password store backend: pass | gopass" 540 fi 541 542 unset -v idx tmp_pass_arr ··· 811 fi 812 813 trap '_clear' EXIT TERM INT 814 - if [[ $_PASS_BACKEND == "pass" ]]; then 815 get_pass_files 816 elif [[ $_PASS_BACKEND == "gopass" ]]; then 817 get_gopass_files
··· 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: GPL-2.0-only 3 # Copyright (C) 2021-2024 Ayush Agarwal <ayush at ayushnix dot com> 4 + # Copyright (C) 2025 JC Gr眉nhage <me at jcg dot re> 5 # 6 # tessen - a data selection interface for pass and gopass on Wayland 7 # ------------------------------------------------------------------------------ ··· 101 if [[ ${#passdata[@]} -eq 0 ]]; then 102 _die "the selected file is empty" 103 fi 104 + elif [[ $_PASS_BACKEND == "prs" ]]; then 105 + mapfile -t passdata < <(prs show --quiet "$_TSN_PASSFILE") 106 + if [[ ${#passdata[@]} -eq 0 ]]; then 107 + _die "the selected file is empty" 108 + fi 109 elif [[ $_PASS_BACKEND == "gopass" ]]; then 110 # the output from gopass show -n -f that prints the first line and the 111 # newline before EOF doesn't use file descriptors but is printed only when ··· 320 321 if [[ $_PASS_BACKEND == "pass" ]]; then 322 tmp_otp="$(pass otp "$_TSN_PASSFILE")" 323 + elif [[ $_PASS_BACKEND == "prs" ]]; then 324 + tmp_otp="$(prs otp show --quiet "$_TSN_PASSFILE")" 325 elif [[ $_PASS_BACKEND == "gopass" ]]; then 326 tmp_otp="$(gopass otp -o "$_TSN_PASSFILE")" 327 fi ··· 402 printf "%s\n" "invalid clipboard timeout value in PASSWORD_STORE_CLIP_TIME" >&2 403 return 1 404 fi 405 + elif [[ $_PASS_BACKEND == "prs" ]]; then 406 + tsn_cliptime="15" 407 elif [[ $_PASS_BACKEND == "gopass" ]]; then 408 tsn_cliptime="$(gopass config core.cliptimeout)" 409 tsn_cliptime="${tsn_cliptime##*: }" ··· 440 441 validate_pass_backend() { 442 if ! is_installed "$1"; then 443 + _die "please install a valid password store backend: pass | gopass | prs" 444 fi 445 + if [[ $1 == "pass" ]] || [[ $1 == "gopass" ]] || [[ $1 == "prs" ]]; then 446 _PASS_BACKEND="$1" 447 else 448 + _die "please specify a valid password store backend: pass | gopass | prs" 449 fi 450 } 451 ··· 536 } 537 538 find_pass_backend() { 539 + local -a tmp_pass_arr=('pass' 'gopass' 'prs') 540 local idx 541 542 for idx in "${tmp_pass_arr[@]}"; do ··· 546 fi 547 done 548 if [[ -z $_PASS_BACKEND ]]; then 549 + _die "please install a valid password store backend: pass | gopass | prs" 550 fi 551 552 unset -v idx tmp_pass_arr ··· 821 fi 822 823 trap '_clear' EXIT TERM INT 824 + if [[ $_PASS_BACKEND == "pass" ]] || [[ $_PASS_BACKEND == "prs" ]]; then 825 get_pass_files 826 elif [[ $_PASS_BACKEND == "gopass" ]]; then 827 get_gopass_files

Submissions

sign up or login to add to the discussion
jcg.re submitted #8
1 commit
expand
feat: add prs support
pull request successfully merged
jcg.re submitted #7
1 commit
expand
feat: add prs support
jcg.re submitted #6
1 commit
expand
feat: add prs support
jcg.re submitted #5
1 commit
expand
feat: add prs support
jcg.re submitted #4
1 commit
expand
feat: add prs support
jcg.re submitted #3
1 commit
expand
feat: add prs support
jcg.re submitted #2
1 commit
expand
feat: add prs support
jcg.re submitted #1
1 commit
expand
feat: add prs support
jcg.re submitted #0
1 commit
expand
add prs support