diff options
| author | David Elentok <3david@gmail.com> | 2025-05-06 22:04:23 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-06 22:04:23 +0300 |
| commit | 363e1d924c6235ae4e9170b1e2ebab50a2e26c07 (patch) | |
| tree | bf21093fa70c8ed8014e70f4841714d622ec651e /lua/encrypt/encrypt.lua | |
| parent | 09d7f6ee9ee1d728449131dff4e750e5339f7968 (diff) | |
| parent | a9e7d700eb546800e3d341bc53667964ac821a38 (diff) | |
| download | encrypt.nvim-363e1d924c6235ae4e9170b1e2ebab50a2e26c07.tar.gz | |
Merge pull request #2 from kongjun18/main
Some Improvement
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) |
