aboutsummaryrefslogtreecommitdiff
path: root/lua/encrypt/helpers.lua
diff options
context:
space:
mode:
authorkongjun <kongjun18@outlook.com>2025-04-29 04:05:35 +0000
committerkongjun <kongjun18@outlook.com>2025-04-29 06:55:46 +0000
commite6057b3c13f004477f4963f3cdf054e5ca1bf2f4 (patch)
tree3fc89e4d9234a7f6b9b230204c27375849b97685 /lua/encrypt/helpers.lua
parent6a88d734bdb4660945923c3f4a38c14e45847c2c (diff)
downloadencrypt.nvim-e6057b3c13f004477f4963f3cdf054e5ca1bf2f4.tar.gz
feat: lock the encrypted file to read-only mode to avoid unintended corruption
Diffstat (limited to 'lua/encrypt/helpers.lua')
-rw-r--r--lua/encrypt/helpers.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/lua/encrypt/helpers.lua b/lua/encrypt/helpers.lua
index ff8baef..a2ccc51 100644
--- a/lua/encrypt/helpers.lua
+++ b/lua/encrypt/helpers.lua
@@ -15,4 +15,10 @@ end
local getPassword = getPasswordFactory()
local ENCRYPTED_PREFIX = "# <<<encrypted>>>"
-return { getPassword = getPassword, ENCRYPTED_PREFIX = ENCRYPTED_PREFIX }
+---@enum buftype
+local BUFTYPE = {
+ encrypted = 1,
+ plaintext = 2,
+}
+
+return { getPassword = getPassword, ENCRYPTED_PREFIX = ENCRYPTED_PREFIX, BUFTYPE = BUFTYPE}