Decrypt an age-encrypted file

Description

Decrypts a file that was encrypted with age. Can decrypt using a private key file (for key-based decryption) or with a passphrase (when no private key provided). If no private key is specified, will prompt for a passphrase interactively.

Usage

file_decrypt(input = NULL, output = NULL, private = NULL)

Arguments

input Character string, path to the age-encrypted file to decrypt
output Character string, path for the decrypted output file. If NULL, returns content as string.
private Character string, path to the private age key file. If NULL, will use passphrase decryption and prompt for password.

Value

If output is provided, returns invisible path to the output file. If output is NULL, returns decrypted content as string.

Examples

library("lockbox")

# Decrypt to file with private key
file_decrypt("secret.txt.age", "secret.txt", private = "identity.key")

# Decrypt to file with passphrase (will prompt)
file_decrypt("secret.txt.age", "secret.txt")

# Decrypt to string (no file output)
content <- file_decrypt("secret.txt.age", output = NULL, private = "identity.key")
content <- file_decrypt("secret.txt.age", output = NULL) # will prompt for passphrase