From 02ad7c9669964d72992ebff2412fe99240ac0561 Mon Sep 17 00:00:00 2001 From: Edward Cheng Date: Mon, 10 Jun 2024 23:18:02 +1000 Subject: [PATCH] adding scripts for encryption --- scripts/encript-file-by-age.sh | 12 ++++++++++++ scripts/encript-file-by-gpg.sh | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 scripts/encript-file-by-age.sh create mode 100644 scripts/encript-file-by-gpg.sh diff --git a/scripts/encript-file-by-age.sh b/scripts/encript-file-by-age.sh new file mode 100644 index 0000000..5c6bf0d --- /dev/null +++ b/scripts/encript-file-by-age.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash +set -e + +filePath=$1 + +AGE_PUB_KEY"age1d47q8mlty404pxx378q49hr93aqexca4mkeqtdm00w4gjd09xd0qhxcdcz" + +sops --age=$AGE_PUB_KEY --encrypt --encrypted-regex '^(data|stringData)$' --in-place $filePath +echo "File encrypted: $filePath." + +git add $filePath +git commit -am "Encrypt file $filePath by Age." \ No newline at end of file diff --git a/scripts/encript-file-by-gpg.sh b/scripts/encript-file-by-gpg.sh new file mode 100644 index 0000000..c46c49f --- /dev/null +++ b/scripts/encript-file-by-gpg.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +set -e + +filePath=$1 + +sops --encrypt --in-place $filePath +echo "File encrypted: $filePath." + +git add $filePath +git commit -am "Encrypt file $filePath by GPG." \ No newline at end of file