Skip to content

Commit

Permalink
fix: exit if file is empty or decryption fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush Agarwal committed Nov 15, 2021
1 parent 8704837 commit a1b59dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ which you probably should.
### Stable Release

```
wget https://github.com/ayushnix/tessen/releases/download/v1.2.1/tessen-1.2.1.tar.gz
tar xvzf tessen-1.2.1.tar.gz
cd tessen-1.2.1
wget https://github.com/ayushnix/tessen/releases/download/v1.2.2/tessen-1.2.2.tar.gz
tar xvzf tessen-1.2.2.tar.gz
cd tessen-1.2.2
sudo make install
```

Expand Down
8 changes: 6 additions & 2 deletions tessen
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set +x

# GLOBAL VARIABLES
# variables which won't be changed and can be made readonly
readonly tsn_version="1.2.1"
readonly tsn_version="1.2.2"
readonly tsn_prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
readonly tsn_cliptime="${PASSWORD_STORE_CLIP_TIME:-15}"
readonly tsn_delay="${TESSEN_DELAY:-200}"
Expand Down Expand Up @@ -54,7 +54,11 @@ get_pass_data() {
local -a passdata
local keyval_regex otp_regex idx key val

mapfile -t passdata < <(pass "$tsn_passfile")
mapfile -t passdata < <(pass "$tsn_passfile" 2> /dev/null)
if [[ "${#passdata[@]}" -eq 0 ]]; then
_die "$tsn_passfile is empty"
fi

# the key can contain
# alphanumerics, spaces, hyphen, underscore, plus, at, and hash
# the value can contain
Expand Down

0 comments on commit a1b59dd

Please sign in to comment.