loading...

Call these functions every time you need to get environment variables set, like the URL, user and password of the MongoDB database used by the course.

config(
  url,
  password,
  cache = file.path(tempdir(), ".learnitdown_config"),
  debug = Sys.getenv("LEARNITDOWN_DEBUG", 0) != 0
)

sign_in(
  data,
  password,
  cipher = "aes-256-cbc",
  iv = NULL,
  cache = file.path(tempdir(), ".learnitdown_user"),
  debug = Sys.getenv("LEARNITDOWN_DEBUG", 0) != 0
)

sign_out(
  title = "Signing out",
  message = "Do you really want to sign out with learnitdown?",
  cache = file.path(tempdir(), ".learnitdown_user"),
  debug = Sys.getenv("LEARNITDOWN_DEBUG", 0) != 0
)

encrypt(
  object,
  password,
  cipher = "aes-256-cbc",
  iv = NULL,
  serialize = TRUE,
  base64 = FALSE,
  url.encode = FALSE
)

decrypt(
  object,
  password,
  cipher = "aes-256-cbc",
  iv = NULL,
  unserialize = TRUE,
  base64 = FALSE,
  url.decode = FALSE
)

lock(
  object,
  password,
  key = "",
  message = "Password for learnitdown:",
  reset = FALSE,
  ref1 = NULL,
  ref2 = NULL
)

unlock(
  object,
  password,
  key = "",
  message = "Password for learnitdown:",
  reset = FALSE,
  ref1 = NULL,
  ref2 = NULL
)

Arguments

url

The URL of the encrypted file that contains the configuration information.

password

The password to crypt, decrypt, lock or unlock the data.

cache

The path to the file to use to store a cached version of these data. Access to the database will be checked, and if it fails, the configuration data are refreshed from the URL.

debug

Do we issue debugging messages? By default, it is set according to the LEARNITDOWN_DEBUG environment variable (yes, if this variable is not 0).

data

The fingerprint data in clear or ciphered form (in this case, the string must start with "fingerprint=").

cipher

The cryptography algorithm to use.

iv

The initialization vector for the cipher.

title

The title of the dialog box prompting to sign out.

message

The message of the dialog box prompting to sign out, or asking for a password.

object

An object to be encrypted, decrypted, locked or unlocked.

serialize

Do we serialize object before ciphering it (TRUE by default)?

base64

Do we encode/decode base64 the object (FALSE by default)?

url.encode

Do we encode for URL (query) use (FALSE by default) ?

unserialize

Do we unserialize the resulting object after deciphering it (TRUE by default)?

url.decode

Do we decode URL before deciphering it (FALSE by default)?

key

The key that stores the password. It is advised to use something like course_year, so that you can manage different passwords for the same course given at different academic years. Using a key, the course password must be entered only once. If not provided, the password is not stored. Note also that the name of an environment variable could be used too for the key. This is convenient on a server like RStudio Connect, for instance.

reset

Should we reset the password (FALSE by default)?

ref1

Code to check the validity of the password

ref2

Second code to check password validity.

Value

Invisibly returns TRUE if success, or FALSE otherwise for config(). The encrypted/decrypted object for encrypt() and decrypt(), or the locked/unlocked object for lock() and unlock(). The user information for sign_in().