Encrypt a file using age

Description

Encrypts a file using the age encryption tool. Can encrypt with public keys (for key-based encryption) or with a passphrase (when no public keys provided). If no public keys are specified, will prompt for a passphrase interactively.

Usage

file_encrypt(
  input = NULL,
  output = if (!is.null(input)) paste0(input, ".age") else NULL,
  public = NULL,
  armor = FALSE
)

Arguments

input Character string, path to the file to encrypt
output Character string, path for the encrypted output file. Defaults to input + ".age" extension
public Character vector of age public keys (recipients). If NULL, will use passphrase encryption and prompt for password.
armor Logical, whether to use ASCII armor format (only applies to public key encryption)

Value

Invisible NULL

Examples

library("lockbox")

# Encrypt with public key
file_encrypt("secret.txt", public = "age1xyz...")

# Encrypt with passphrase (will prompt)
file_encrypt("secret.txt")

# Encrypt with custom output path and armor
file_encrypt("secret.txt", "encrypted.age",
  public = "age1xyz...", armor = TRUE)