mirror of
https://github.com/octoleo/Purse.git
synced 2024-12-29 12:32:39 +00:00
commit
bb75af004b
@ -66,7 +66,7 @@ tar xvf purse*tar
|
|||||||
|
|
||||||
Several customizable options and features are also available, and can be configured with environment variables, for example in the [shell rc](https://github.com/drduh/config/blob/master/zshrc) file:
|
Several customizable options and features are also available, and can be configured with environment variables, for example in the [shell rc](https://github.com/drduh/config/blob/master/zshrc) file:
|
||||||
|
|
||||||
Variable | Description | Default | Values
|
Variable | Description | Default | Available options
|
||||||
-|-|-|-
|
-|-|-|-
|
||||||
`PURSE_CLIP` | clipboard to use | `xclip` | `pbcopy` on macOS
|
`PURSE_CLIP` | clipboard to use | `xclip` | `pbcopy` on macOS
|
||||||
`PURSE_CLIP_ARGS` | arguments to pass to clipboard command | unset (disabled) | `-i -selection clipboard` to use primary (control-v) clipboard with xclip
|
`PURSE_CLIP_ARGS` | arguments to pass to clipboard command | unset (disabled) | `-i -selection clipboard` to use primary (control-v) clipboard with xclip
|
||||||
|
9
purse.sh
9
purse.sh
@ -133,7 +133,7 @@ read_pass () {
|
|||||||
fail "Secret not available" ; fi
|
fail "Secret not available" ; fi
|
||||||
|
|
||||||
prompt_key "password"
|
prompt_key "password"
|
||||||
clip <(decrypt "${spath}" | head -1) || \
|
emit_pass <(decrypt "${spath}" | head -1) || \
|
||||||
fail "Failed to decrypt ${spath}"
|
fail "Failed to decrypt ${spath}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,8 @@ generate_pass () {
|
|||||||
else length="${3}" ; fi
|
else length="${3}" ; fi
|
||||||
|
|
||||||
if [[ "${length}" =~ ^[0-9]+$ ]] ; then
|
if [[ "${length}" =~ ^[0-9]+$ ]] ; then
|
||||||
pass_len="${length}" ; fi
|
pass_len="${length}"
|
||||||
|
fi
|
||||||
|
|
||||||
tr -dc "${pass_chars}" < /dev/urandom | \
|
tr -dc "${pass_chars}" < /dev/urandom | \
|
||||||
fold -w "${pass_len}" | head -1
|
fold -w "${pass_len}" | head -1
|
||||||
@ -175,7 +176,7 @@ write_pass () {
|
|||||||
fold -w10 | head -1)"
|
fold -w10 | head -1)"
|
||||||
|
|
||||||
if [[ -n "${pass_copy}" ]] ; then
|
if [[ -n "${pass_copy}" ]] ; then
|
||||||
clip <(printf '%s' "${userpass}") ; fi
|
emit_pass <(printf '%s' "${userpass}") ; fi
|
||||||
|
|
||||||
printf '%s\n' "${userpass}" | encrypt "${spath}" - || \
|
printf '%s\n' "${userpass}" | encrypt "${spath}" - || \
|
||||||
fail "Failed saving ${spath}"
|
fail "Failed saving ${spath}"
|
||||||
@ -220,7 +221,7 @@ backup () {
|
|||||||
else warn "${safe_backup} exists, skipping archive" ; fi
|
else warn "${safe_backup} exists, skipping archive" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
clip () {
|
emit_pass () {
|
||||||
# Use clipboard or stdout and clear after timeout.
|
# Use clipboard or stdout and clear after timeout.
|
||||||
|
|
||||||
if [[ "${clip_dest}" = "screen" ]] ; then
|
if [[ "${clip_dest}" = "screen" ]] ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user