aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rwxr-xr-xdecrypt.sh15
2 files changed, 18 insertions, 1 deletions
diff --git a/README.md b/README.md
index 4901095..ece988b 100644
--- a/README.md
+++ b/README.md
@@ -29,11 +29,13 @@ To decrypt a file that was encrypted using `decrypt.nvim` without the plugin
just run:
```
-cat encrypted.txt \
+tail -n +2 encrypted.txt \
| base64 --decode \
| openssl enc -d -aes-256-cbc -pbkdf2 -salt -in - -out - -k {PASSWORD}
```
+Or use the provided [decrypt.sh](decrypt.sh)
+
## TODO
- [ ] Store the password in a local scope in the plugin instead of as a buffer
diff --git a/decrypt.sh b/decrypt.sh
new file mode 100755
index 0000000..914be88
--- /dev/null
+++ b/decrypt.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+if [ $# -lt 2 ]; then
+ echo "Usage: decrypt.sh <encrypted.txt> <password>"
+ exit 1
+fi
+
+filename="$1"
+password="$2"
+
+tail -n +2 "$filename" \
+ | base64 --decode \
+ | openssl enc -d -aes-256-cbc -pbkdf2 -salt -in - -out - -k "$password"