Compare commits

...

4 Commits

Author SHA1 Message Date
Zeke Dou 4a3eae3a50
Merge 2c9abfec86 into 24a7ea3905 2024-04-26 15:00:16 +02:00
Ryan Mulligan 24a7ea3905
Merge pull request #256 from spectre256/main
fix: allow for newlines in keys
2024-04-26 05:59:12 -07:00
Ellis Gibbons 2c1d1fb134
fix: allow for newlines in keys 2024-04-12 17:50:07 -04:00
c4710n 2c9abfec86
Improve keys function for keys with extra newlines 2024-03-15 11:55:12 +08:00
2 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@
stdenv,
age,
jq,
gnused,
nix,
mktemp,
diffutils,
@ -18,6 +19,7 @@ in
src = substituteAll {
inherit ageBin version;
jqBin = "${jq}/bin/jq";
sedBin = "${gnused}/bin/sed";
nixInstantiate = "${nix}/bin/nix-instantiate";
mktempBin = "${mktemp}/bin/mktemp";
diffBin = "${diffutils}/bin/diff";

View File

@ -115,7 +115,7 @@ function cleanup {
trap "cleanup" 0 2 3 15
function keys {
(@nixInstantiate@ --json --eval --strict -E "(let rules = import $RULES; in rules.\"$1\".publicKeys)" | @jqBin@ -r .[]) || exit 1
(@nixInstantiate@ --json --eval --strict -E "(let rules = import $RULES; in rules.\"$1\".publicKeys)" | @jqBin@ -r .[] | @sedBin@ '/^$/d') || exit 1
}
function decrypt {
@ -171,7 +171,9 @@ function edit {
ENCRYPT=()
while IFS= read -r key
do
ENCRYPT+=(--recipient "$key")
if [ -n "$key" ]; then
ENCRYPT+=(--recipient "$key")
fi
done <<< "$KEYS"
REENCRYPTED_DIR=$(@mktempBin@ -d)