diff options
Diffstat (limited to 'lua/encrypt/encrypt.lua')
| -rw-r--r-- | lua/encrypt/encrypt.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lua/encrypt/encrypt.lua b/lua/encrypt/encrypt.lua index 5cdf8a9..c7efb1f 100644 --- a/lua/encrypt/encrypt.lua +++ b/lua/encrypt/encrypt.lua @@ -5,13 +5,17 @@ local helpers = require("encrypt.helpers") ---@param password string local function encrypt_lines(lines, password) return vim.fn.systemlist( - "openssl enc -aes-256-cbc -pbkdf2 -salt -in - -out - -k " .. password .. " | base64", + "openssl enc -aes-256-cbc -pbkdf2 -salt -in - -out - -k " .. vim.fn.shellescape(password) .. " | base64", lines ) end local function encrypt() local password = helpers.getPassword() + if not password then + vim.notify("Password can not be empty", vim.log.levels.ERROR) + return + end local buf_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) local encrypted_lines = encrypt_lines(buf_lines, password) |
