Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dewittpe committed Sep 19, 2024
1 parent 0e38a5c commit 3994769
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/keyring.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ REDCapExporter_keyring_check <- function(keyring = "REDCapExporter", password =
} else {
message(sprintf("File based keyring %s exists", keyring))
}

invisible(TRUE)

}

#' @rdname REDCapExporter_keyring
Expand Down Expand Up @@ -82,7 +84,9 @@ REDCapExporter_add_api_token <- function(project, keyring = "REDCapExporter", us

# lock the keyring
kr$keyring_lock(keyring = keyring)

invisible(TRUE)

}

#' @rdname REDCapExporter_keyring
Expand All @@ -95,7 +99,9 @@ REDCapExporter_get_api_token <- function(project, keyring = "REDCapExporter", us
kr <- keyring::backend_file$new()
kr$keyring_unlock(keyring = keyring, password = password)
token <- kr$get(service = project, username = user, keyring = keyring)
kr$keyring_unlock(keyring = keyring, password = password)
kr$keyring_lock(keyring = keyring)

invisible(token)

}

Binary file modified data/avs_raw_core.rda
Binary file not shown.
Binary file modified data/avs_raw_core_json.rda
Binary file not shown.
Binary file modified data/avs_raw_metadata.rda
Binary file not shown.
Binary file modified data/avs_raw_metadata_json.rda
Binary file not shown.
Binary file modified data/avs_raw_project.rda
Binary file not shown.
Binary file modified data/avs_raw_project_json.rda
Binary file not shown.
Binary file modified data/avs_raw_record.rda
Binary file not shown.
Binary file modified data/avs_raw_record_json.rda
Binary file not shown.
Binary file modified data/avs_raw_user.rda
Binary file not shown.
Binary file modified data/avs_raw_user_json.rda
Binary file not shown.
1 change: 1 addition & 0 deletions tests/test-keyring.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ x <- tryCatch(REDCapExporter_keyring_check("testingring"), message = function(m)
stopifnot(identical(x$message, "File based keyring testingring has been created\n"))
x <- tryCatch(REDCapExporter_keyring_check("testingring"), message = function(m) {m})
stopifnot(identical(x$message, "File based keyring testingring exists\n"))
stopifnot(isTRUE(REDCapExporter_keyring_check("testingring")))

# Expect that this will error because we are not interactive and a password
# prompt cannot be filled in
Expand Down

0 comments on commit 3994769

Please sign in to comment.