aboutsummaryrefslogtreecommitdiff
path: root/lua/encrypt/helpers.lua
diff options
context:
space:
mode:
authorDavid Elentok <3david@gmail.com>2024-05-14 18:15:13 +0300
committerDavid Elentok <3david@gmail.com>2024-05-14 18:17:09 +0300
commita805d34f123bc8add01bd44ad28f0baf57710083 (patch)
treeb868cef404823eaf4b7c78316459cf8b2a3fd013 /lua/encrypt/helpers.lua
downloadencrypt.nvim-a805d34f123bc8add01bd44ad28f0baf57710083.tar.gz
Initial commit
Diffstat (limited to 'lua/encrypt/helpers.lua')
-rw-r--r--lua/encrypt/helpers.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/lua/encrypt/helpers.lua b/lua/encrypt/helpers.lua
new file mode 100644
index 0000000..37a96b3
--- /dev/null
+++ b/lua/encrypt/helpers.lua
@@ -0,0 +1,13 @@
+---@return string
+local function getPassword()
+ local password = vim.b["password"]
+ if password == nil then
+ password = vim.fn.inputsecret("Enter password: ")
+ vim.b["password"] = password
+ end
+ return password
+end
+
+local ENCRYPTED_PREFIX = "# <<<encrypted>>>"
+
+return { getPassword = getPassword, ENCRYPTED_PREFIX = ENCRYPTED_PREFIX }