R/decrypt-token.R

Defines functions decrypt

#' @keywords internal
decrypt <- function(password) {
  rcrypt::decrypt('encrypted.gpg',
                  output = 'temp',
                  passphrase = password)
  if (!file.exists('encrypted.gpg')) {
    stop('No encrypted file')
  }
  if (file.exists('temp')) {
    token <- readLines('temp')
    file.remove('temp')
    return(token)
  } else {
    warning('Wrong Password')
    return(NULL)
  }
}
deeplexR/lexicoR documentation built on May 26, 2019, 2:33 a.m.