Skip to content

Commit

Permalink
Fix R CMD check errors/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mdenwood committed Dec 14, 2023
1 parent b260b67 commit f20d743
Show file tree
Hide file tree
Showing 25 changed files with 156 additions and 60 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
^LICENSE\.md$
notebooks
reports
releases
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ Imports:
keyring,
getPass,
sodium (>= 1.1),
Rcpp (>= 1.0.8),
qs (>= 0.25),
cyphr,
stringr,
dplyr,
rlang,
tibble,
magrittr,
shiny,
shinydashboard,
shinythemes,
htmltools,
markdown
Depends:
R (>= 4.1.0),
Expand Down
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@ export(gy_unzip)
export(gy_users)
export(gy_zip)
export(run_app)
import(magrittr)
import(shiny)
import(shinydashboard)
importFrom(base64enc,base64decode)
importFrom(base64enc,base64encode)
importFrom(dplyr,arrange)
importFrom(dplyr,mutate)
importFrom(getPass,getPass)
importFrom(htmltools,includeMarkdown)
importFrom(keyring,key_delete)
importFrom(keyring,key_get)
importFrom(keyring,key_list)
importFrom(keyring,key_set_with_value)
importFrom(markdown,mark)
importFrom(qs,qdeserialize)
importFrom(qs,qserialize)
importFrom(rlang,.data)
importFrom(rstudioapi,isAvailable)
importFrom(rstudioapi,selectDirectory)
importFrom(shinythemes,shinytheme)
importFrom(sodium,auth_decrypt)
importFrom(sodium,auth_encrypt)
importFrom(sodium,data_decrypt)
Expand All @@ -49,8 +56,12 @@ importFrom(sodium,sig_verify)
importFrom(sodium,simple_decrypt)
importFrom(sodium,simple_encrypt)
importFrom(stringr,str_c)
importFrom(stringr,str_detect)
importFrom(stringr,str_glue)
importFrom(stringr,str_remove)
importFrom(stringr,str_split)
importFrom(tibble,as_tibble)
importFrom(utils,download.file)
importFrom(zip,unzip)
importFrom(zip,zip)
importFrom(zip,zip_list)
5 changes: 5 additions & 0 deletions R/get_localuser.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#' @importFrom utils download.file
#' @importFrom stringr str_detect str_split
#' @importFrom tibble as_tibble
#' @importFrom dplyr mutate arrange

get_localuser <- function(){
if(is.null(package_env$currentlocal)) gy_profile()

Expand Down
3 changes: 3 additions & 0 deletions R/goldeneye-package.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#' @importFrom shinythemes shinytheme
#' @importFrom htmltools includeMarkdown
#' @importFrom markdown mark
#' @keywords internal
"_PACKAGE"

Expand Down
10 changes: 6 additions & 4 deletions R/gy_check.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#' @param path path to goldeneye profile
#' @param silent option to suppress output to screen
#'
#' @importFrom rlang .data
#' @import magrittr

#' @rdname gy_profile
#' @export
Expand Down Expand Up @@ -62,8 +64,8 @@ gy_info <- function(silent=FALSE){
c(unlist(x[c("user","name","email")]), member_since=as.character(x$member_since))
}, character(4))) %>%
as_tibble() %>%
mutate(member_since=as.Date(member_since)) %>%
arrange(member_since)
mutate(member_since=as.Date(.data$member_since)) %>%
arrange(.data$member_since)
if(redact) usrs$email <- "**@**.**"
print(usrs)
}
Expand Down Expand Up @@ -94,8 +96,8 @@ gy_info <- function(silent=FALSE){
c(unlist(x[c("user","name","email")]), member_since=as.character(x$member_since))
}, character(4))) %>%
as_tibble() %>%
mutate(member_since=as.Date(member_since)) %>%
arrange(member_since)
mutate(member_since=as.Date(.data$member_since)) %>%
arrange(.data$member_since)
if(redact) usrs$email <- "**@**.**"
print(usrs)
}
Expand Down
7 changes: 4 additions & 3 deletions R/gy_create_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gy_create_group <- function(group, weblink, password){


weblink <- readRDS(getOption("goldeneye_path"))$groups$goldfinger$weblink
webinfo <- goldeneye:::refresh_users(weblink)
webinfo <- refresh_users(weblink)
user_info <- webinfo$users
names(user_info)

Expand Down Expand Up @@ -47,18 +47,19 @@ gy_create_group <- function(group, weblink, password){

users <- list(usernames=usernames, user_info=sodium::data_encrypt(serialize(user_info, NULL), sodium::hash(charToRaw(webpwd))), message=sodium::data_encrypt(serialize(msg, NULL), sodium::hash(charToRaw(webpwd))), public_curve=public_curve, public_ed=public_ed)

verification <- goldeneye:::gy_sign(users)
verification <- gy_sign(users)

versions <- attr(verification, "versions")
versions["type"] <- "generic"
versions["minimum"] <- "0.5.0-1"
attr(verification, "versions") <- versions
stopifnot(goldeneye:::gy_verify(users, verification, silent=TRUE))
stopifnot(gy_verify(users, verification, silent=TRUE))
attr(verification, "user") <- NULL

keys <- list(group="demo22", users=users, verification=verification)
saveRDS(keys, "demo22.gyg", compress=FALSE)

webpwd <- NULL
weblink <- str_c("https://www.costmodds.org/rsc/goldeneye/demo22.gyg#",webpwd,"#md")


Expand Down
2 changes: 2 additions & 0 deletions R/gy_encrypt.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#' @param local_user should the current user also be able to decrypt thw file?
#' @param comment an optional comment that will be sent (unencrypted) along with the file
#' @param funs optional additional encryption steps: this must be the output of a call to \code{\link{gy_key_funs}}
#' @param run_custom should any custom decryption functions be run automatically?
#' @param type the type of public key to return ("curve" or "ed")
#'
#' @rdname gy_encrypt
#' @export
Expand Down
7 changes: 4 additions & 3 deletions R/gy_join_group.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#' @name gy_join_group
#' @title Join an existing goldeneye user group via a weblink
#'
#'
#' @param weblink the weblink as provided by the group administrator
#' @param user the username that you want to use for this group
#' @param make_default should this become the default group?
#' @param group the name of the group to set
#' @param silent option to silence output
#'
#' @importFrom stringr str_glue
#'
Expand Down Expand Up @@ -44,7 +45,7 @@ gy_join_group <- function(weblink=NULL, user=NULL, make_default=FALSE){
}else if(!is.null(local$user)){
tuser <- local$user
}else if(!is.na(local$groups$default_group)){
if(!default_group %in% names(local$group)){
if(!"default_group" %in% names(local$group)){
stop("An unexpected error occured with the groups element of your user profile: please contact the package maintaner with this error message for help")
}
tuser <- local$groups[[local$groups$default_group]][["user"]]
Expand Down
7 changes: 2 additions & 5 deletions R/gy_key_funs.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#' Title
#' Obtain key functions
#'
#' @param type
#' @param type type of key function (only "identity" is currently supported)
#'
#' @return
#' @export
#'
#' @examples
gy_key_funs <- function(type){

stopifnot(type=="identity")
Expand Down
6 changes: 3 additions & 3 deletions R/gy_public_file.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Title
#' Extract the public key file
#'
#' @param file
#' @param silent
#' @param file filename to write to
#' @param silent do this quietly?
#'
#' @export
gy_public_file <- function(file="goldeneye_public.gyu", silent=FALSE){
Expand Down
19 changes: 11 additions & 8 deletions R/gy_saveRDS.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#' @name gf_saveRDS
#' @title Save and read encrypted RDS
#' @param object
#' @param file
#' @param user
#' @param local_user
#' @param ascii
#' @param version
#' @param compress
#' @param overwrite
#'
#' @param object the object to encrypt
#' @param file the filename to which the encrypted object will be saved
#' @param users one or more users who will be authorised to decrypt the file
#' @param local_user should the local user be able to decrypt the file?
#' @param comment a comment to include
#' @param overwrite should the file be overwritten, if it exists?
#' @param ascii argument passed to saveRDS
#' @param funs argument passed to saveRDS
#' @param ... arguments passed to gy_serialise
#' @param run_custom should any custom decryption functions be run automatically?
#'
#' @rdname gy_saveRDS
#' @export
Expand Down
12 changes: 4 additions & 8 deletions R/gy_serialise.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#' @name gy_serialise
#' @title Serialise and deserialise a list of objects/files
#' @param object
#' @param file
#' @param user
#' @param local_user
#' @param ascii
#' @param version
#' @param compress
#' @param overwrite
#' @param object the object to encrypt
#' @param files external files to serialise (not yet implemented)
#' @param method the serialisation method to use (base, qs, or custom)
#' @param ... arguments passed to the underlying serialisation method
#'
#' @importFrom qs qserialize qdeserialize
#'
Expand Down
9 changes: 8 additions & 1 deletion R/gy_setup.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#' Title
#' Setup a new goldeyene encryption profile
#'
#' @param name your full name
#' @param email your email address
#' @param filename the filename to which the profile will be saved
#' @param path the path in which to save the profile
#' @param append_Rprofile should the R profile file be appended to automatically load this profile when R is restarted?
#' @param silent option to suppress output
#'
#' @importFrom stringr str_remove str_c
#' @importFrom getPass getPass
Expand Down
13 changes: 5 additions & 8 deletions R/gy_users.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#' Title
#' Obtain a list of users for a given group
#'
#' @param group
#' @param refresh
#' @param group the group for which to return users (defaults to the active group)
#' @param refresh should the list be refreshed from the remote/online location?
#'
#' @return
#' @export
#'
#' @examples
gy_users <- function(group=NULL, refresh=FALSE){

if(is.null(package_env$currentlocal)) gy_profile(silent=TRUE)
Expand All @@ -27,8 +24,8 @@ gy_users <- function(group=NULL, refresh=FALSE){
c(unlist(x[c("user","name","email")]), member_since=as.character(x$member_since))
}, character(4))) %>%
as_tibble() %>%
mutate(member_since=as.Date(member_since)) %>%
arrange(member_since)
mutate(member_since=as.Date(.data$member_since)) %>%
arrange(.data$member_since)

if(redact) usrs$email <- "**@**.**"

Expand Down
7 changes: 6 additions & 1 deletion R/gy_zip.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#' @name gy_zip
#' @title Zip and encrypt external files using goldeneye
#' @param files one or more files to add to the zip archive
#' @param input_files one or more files to add to the zip archive
#' @param file the filename to which the encrypted object will be saved
#' @param compression_level compression level to use on a scale of 1-9 (passed to \code{\link[zip]{zip}})
#' @param users a character vector of (other) users within your current user group for whom the encrypted file will be decryptable. Alternatively, this can be a vector of paths/urls to public keys, or a mixture of the two.
#' @param local_user should the current user also be able to decrypt thw file?
#' @param comment an optional comment that will be sent (unencrypted) along with the file
#' @param funs optional additional encryption steps: this must be the output of a call to \code{\link{gy_key_funs}}
#' @param directory the directory to which the decrypted/unzipped files will be saved
#' @param unzip should the decrypted files also be unzipped?
#' @param overwrite should the file be overwritten, if it exists?
#' @param run_custom should any custom decryption functions be run automatically?
#'
#' @importFrom zip zip unzip zip_list
#' @importFrom base64enc base64encode base64decode
Expand Down
4 changes: 4 additions & 0 deletions man/gy_encrypt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/gy_join_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/gy_key_funs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/gy_public_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion man/gy_saveRDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f20d743

Please sign in to comment.