Implement libsecret password backend

This commit is contained in:
Kevin Velghe 2016-04-01 22:37:49 +02:00
parent 3b24e70db1
commit 35fa7b3989

View File

@ -273,6 +273,28 @@ pass_backend() {
}
# =======================================================
# =======================================================
# backend: secret
secret_backend() {
init() {
return
}
query_entries() {
local domain="$1"
while read -r line ; do
if [[ "$line" =~ "attribute.username = " ]] ; then
files+=("$domain ${line#${BASH_REMATCH[0]}}")
fi
done < <( secret-tool search --unlock --all domain "$domain" 2>&1 )
}
open_entry() {
local domain="${1%% *}"
username="${1#* }"
password=$(secret-tool lookup domain "$domain" username "$username")
}
}
# =======================================================
# load some sane default backend
reset_backend
pass_backend