From c7a16c626a0379d9304e0337348affb4bde9ba4e Mon Sep 17 00:00:00 2001 From: kongjun Date: Tue, 6 May 2025 10:10:59 +0000 Subject: feat: support password with special characters --- lua/encrypt/encrypt.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/encrypt/encrypt.lua') diff --git a/lua/encrypt/encrypt.lua b/lua/encrypt/encrypt.lua index 5cdf8a9..93d2b78 100644 --- a/lua/encrypt/encrypt.lua +++ b/lua/encrypt/encrypt.lua @@ -5,7 +5,7 @@ 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 -- cgit v1.2.3 From a9e7d700eb546800e3d341bc53667964ac821a38 Mon Sep 17 00:00:00 2001 From: kongjun Date: Tue, 6 May 2025 10:14:39 +0000 Subject: feat: handle the case where the inputsecret() is cancelled --- lua/encrypt/encrypt.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/encrypt/encrypt.lua') diff --git a/lua/encrypt/encrypt.lua b/lua/encrypt/encrypt.lua index 93d2b78..c7efb1f 100644 --- a/lua/encrypt/encrypt.lua +++ b/lua/encrypt/encrypt.lua @@ -12,6 +12,10 @@ 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) -- cgit v1.2.3