Install Age using your favorite plugin manager. For example, with
lazy.nvim:
-- ~/.config/nvim/lua/plugins/age.lua
{
'abhi-xyz/age.nvim',
cmd = { "Age" },
config = function()
local key = require('key')
require('age').setup({
encrypt_and_del = true, -- will remove the original file after encrypting.
public_key = "ageXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
private_key = key.private_key, -- defined in another lua file which is not included in git for safety
})
end
}
Age provides the :Age command with the following syntax:
:Age [action]
[action] can be one of:
encrypt,
decrypt,
genkey
Examples:
Generates an age key pair into key.txt in current working directory.
:Age genkey
Kills the current buffer and switches to a previous buffer or creates a
scratch buffer in case there is no buffer to switch, then encrypts the file
with the provided age key.
:Age encrypt
Decrypts the currently opened encrypted file, and switches to the decrypted
file.
:Age decrypt
What is age?
age is a simple, modern and secure file
encryption tool.
It features small explicit keys, no config options, and UNIX-style
composability.
Why Choose Age Over GPG?
Simplicity: Age has a straightforward syntax and intuitive design, making
it easier to use without extensive documentation.
Modern Cryptography: Age uses state-of-the-art cryptographic algorithms
like X25519, ChaCha20-Poly1305, and HMAC-SHA256, ensuring robust security.
Minimal Attack Surface: Age's codebase is minimal and easier to audit
compared to the complex and extensive GPG ecosystem.
Portable Keys: Age uses compact, user-friendly key formats, which are
easy to manage and transfer.
Focused Use Case: Age is purpose-built for encrypting files securely and
efficiently, without the additional complexity of key management and email
encryption that GPG supports.