staticrypt() offers an interface to the
StatiCrypt tool for encrypting
or decrypting HTML files using a password.
Usage
staticrypt(
file,
password,
config = NULL,
directory = file.path(dirname(file), "encrypted"),
decrypt = FALSE,
recursive = FALSE,
remember = 0,
salt = NULL,
share = NULL,
share_remember = FALSE,
template = NULL,
template_button = "DECRYPT",
template_color_primary = "#4CAF50",
template_color_secondary = "#76B852",
template_instructions = "",
template_error = "Bad password!",
template_placeholder = "Password",
template_remember = "Remember me",
template_title = "Protected Page",
template_toggle_hide = "Hide password",
template_toggle_show = "Show password"
)Arguments
- file
A
characterstring indicating the path to the HTML file to be encrypted or decrypted.- password
A
characterstring specifying the password to use for encryption or decryption. For security, avoid hardcoding passwords in scripts. Useaskpass()to prompt for secure input.- config
A
characterstring specifying the path to the configuration file. IfNULL, defaults to a.staticrypt.jsonfile in the working directory (default:NULL).- directory
A
characterstring indicating the output directory for the encrypted or decrypted file (default: a subdirectory namedencryptedin the same directory asfile). Usedirname(file)to overwrite the file in place.- decrypt
A
logicalflag indicating whether to decrypt or encrypt the file (default:FALSE).- recursive
A
logicalflag indicating whether to process files in subdirectories recursively (default:FALSE).- remember
A integer number specifying the number of days to remember the password (default:
0, meaning do not remember). UseFALSEto hide the "Remember me" option in the generated HTML.- salt
A
characterstring specifying a 32-character hexadecimal salt value for encryption. IfNULL, a random salt will be generated (default:NULL).A
characterstring specifying a path to share the password securely (default:NULL, meaning do not share).A
logicalflag indicating whether to remember the shared password (default:FALSE).- template
A
characterstring specifying the path to a custom HTML template file (default:NULL, meaning use the default template).A
characterstring specifying the text for the submit button in the template (default:"DECRYPT").- template_color_primary
A
characterstring specifying the template primary color in hexadecimal format (default:"#4CAF50").- template_color_secondary
A
characterstring specifying the template secondary color in hexadecimal format (default:"#76B852").- template_instructions
A
characterstring specifying instructions to display in the template (default:"").- template_error
A
characterstring specifying the error message to display for incorrect passwords (default:"Bad password!").- template_placeholder
A
characterstring specifying the placeholder text for the password input field (default:"Password").- template_remember
A
characterstring specifying the label for the "Remember me" checkbox in the template (default:"Remember me").- template_title
A
characterstring specifying the title of the protected page in the template (default:"Protected Page").- template_toggle_hide
A
characterstring specifying the text for the "Hide password" toggle in the template (default:"Hide password").- template_toggle_show
A
characterstring specifying the text for the "Show password" toggle in the template (default:"Show password").
Value
An invisible NULL. These functions are called
for side effects only.