Type: | Package |
Title: | Save and Retrieve Name-Value Pairs to and from a File |
Version: | 1.0.0 |
Date: | 2025-03-07 |
Maintainer: | Koen Greuell <vlic@lifewatch.eu> |
Description: | Facilitates secret management by storing credentials in a dedicated file, keeping them out of your code base. The secrets are stored without encryption. This package is compatible with secrets stored by the 'SecretsProvider' 'Python' package https://pypi.org/project/SecretsProvider/. |
License: | Apache License (== 2.0) |
Suggests: | testthat (≥ 3.0.0), getPass |
RoxygenNote: | 7.3.2 |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2025-04-01 12:15:59 UTC; koen-greuell |
Author: | Koen Greuell [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-04-02 17:20:05 UTC |
Save and Retrieve Name-Value Pairs to and from a File
Description
Facilitates secret management by storing credentials in a dedicated file, keeping them out of your code base. The secrets are stored without encryption. This package is compatible with secrets stored by the 'SecretsProvider' 'Python' package <https://pypi.org/project/SecretsProvider/>.
Details
Arguments:
secret_file_path Path to the file where secrets are stored. Defaults to ".env".
input_func Function to get input from the user. Defaults to getPass::getPass
Methods:
set_secret(secret_name): Retrieves Saves a secret If there is already a secret with the name given. Entering a new value will overwrite the existing secret.
get_secret(secret_name): Retrieves secret If this secret does not exist, it prompts the user to enter a secret and stores that.
remove_secret(secret_name): Remove a secret
Author(s)
Koen Greuell
Maintainer: Koen Greuell
Examples
# Create a SecretsProvider object
secretsProvider <- SecretsProvider(secret_file_path = tempfile(),
input_func = function(prompt) { "mock_input"})
# Set a secret
secretsProvider$set_secret("Data_source_API_key")
# Get a secret
api_key <- secretsProvider$get_secret("Data_source_API_key")
# Remove a secret
secretsProvider$remove_secret("Data_source_API_key")