logo

secret

Replacement to pass(1) based on reop(1)git clone https://hacktivis.me/git/secret.git
commit: c7c9537232dc11f7c60725f9a29a8e1d877c574b
parent 9c41e075519308fcc5448489c09e1e74c6e64ba8
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 24 May 2020 17:29:11 +0200

secret: Use our own set of keys

Diffstat:

Msecret19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/secret b/secret @@ -2,12 +2,12 @@ # secret: Replacement to pass(1) based on reop(1) # Copyright 2020 Haelwenn (lanodan) Monnier <contact+secret@hacktivis.me> # SPDX-License-Identifier: ISC -workdir="$HOME/.secret-storage" +basepath="$HOME/.secret-storage" set -e secret_list() { - ( cd "$workdir" && find . -type f -name '*.reop' "$@" | sed -e 's;^./;;' -e 's;.reop$;;') | sort | column + ( cd "$basepath" && find . -type f -name '*.reop' "$@" | sed -e 's;^./;;' -e 's;.reop$;;') | sort | column } secret_list_oath() { @@ -22,22 +22,27 @@ secret_read() { entry="$*" target="${SECRET_FILE:--}" - reop -D -m "$target" -x "${workdir}/${entry}.reop" + reop -D -p "${basepath}.pub" -s "${basepath}.priv" -m "$target" -x "${basepath}/${entry}.reop" } secret_write() { entry="$*" target="${SECRET_FILE:--}" - reop -E -m "$target" -x "${workdir}/${entry}.reop" + reop -E -p "${basepath}.pub" -s "${basepath}.priv" -m "$target" -x "${basepath}/${entry}.reop" - if test -f "${workdir}/.git/HEAD" + if test -f "${basepath}/.git/HEAD" then - git add "${workdir}/${entry}.reop" + oldpwd="$PWD" + cd "${basepath}" + + git add "${entry}.reop" git commit -m "${entry}: encrypt auto-update" if [ "$(git remote show -n)" != "" ]; then git push; fi + + cd "${oldpwd}" else - echo "No git repository in ‘$workdir’, consider creating one" + echo "No git repository in ‘$basepath’, consider creating one" fi }