diff --git a/.Rbuildignore b/.Rbuildignore index e4952c6..ffc6fc4 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,4 @@ ^LICENSE\.md$ notebooks reports +releases diff --git a/DESCRIPTION b/DESCRIPTION index a3c18ec..4bb7c21 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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), diff --git a/NAMESPACE b/NAMESPACE index 5b4de96..e7cde96 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) @@ -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) diff --git a/R/get_localuser.R b/R/get_localuser.R index fd1af7d..35aa4d5 100644 --- a/R/get_localuser.R +++ b/R/get_localuser.R @@ -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() diff --git a/R/goldeneye-package.R b/R/goldeneye-package.R index a65cf64..ea03dd1 100644 --- a/R/goldeneye-package.R +++ b/R/goldeneye-package.R @@ -1,3 +1,6 @@ +#' @importFrom shinythemes shinytheme +#' @importFrom htmltools includeMarkdown +#' @importFrom markdown mark #' @keywords internal "_PACKAGE" diff --git a/R/gy_check.R b/R/gy_check.R index 34d44cc..e431b56 100644 --- a/R/gy_check.R +++ b/R/gy_check.R @@ -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 @@ -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) } @@ -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) } diff --git a/R/gy_create_group.R b/R/gy_create_group.R index 2b37c6b..a3feab4 100644 --- a/R/gy_create_group.R +++ b/R/gy_create_group.R @@ -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) @@ -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") diff --git a/R/gy_encrypt.R b/R/gy_encrypt.R index 924b638..b06dde8 100644 --- a/R/gy_encrypt.R +++ b/R/gy_encrypt.R @@ -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 diff --git a/R/gy_join_group.R b/R/gy_join_group.R index e3413c9..70b2bbc 100644 --- a/R/gy_join_group.R +++ b/R/gy_join_group.R @@ -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 #' @@ -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"]] diff --git a/R/gy_key_funs.R b/R/gy_key_funs.R index a4882f6..ea27102 100644 --- a/R/gy_key_funs.R +++ b/R/gy_key_funs.R @@ -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") diff --git a/R/gy_public_file.R b/R/gy_public_file.R index cfc8f95..4000560 100644 --- a/R/gy_public_file.R +++ b/R/gy_public_file.R @@ -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){ diff --git a/R/gy_saveRDS.R b/R/gy_saveRDS.R index acfea6e..ec7ee09 100644 --- a/R/gy_saveRDS.R +++ b/R/gy_saveRDS.R @@ -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 diff --git a/R/gy_serialise.R b/R/gy_serialise.R index 522dd61..dcdcbc3 100644 --- a/R/gy_serialise.R +++ b/R/gy_serialise.R @@ -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 #' diff --git a/R/gy_setup.R b/R/gy_setup.R index bb7fba7..623c274 100644 --- a/R/gy_setup.R +++ b/R/gy_setup.R @@ -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 diff --git a/R/gy_users.R b/R/gy_users.R index c36829f..1c29304 100644 --- a/R/gy_users.R +++ b/R/gy_users.R @@ -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) @@ -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 <- "**@**.**" diff --git a/R/gy_zip.R b/R/gy_zip.R index d860c0c..56e89a8 100644 --- a/R/gy_zip.R +++ b/R/gy_zip.R @@ -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 diff --git a/man/gy_encrypt.Rd b/man/gy_encrypt.Rd index 56bda7c..ae3222d 100644 --- a/man/gy_encrypt.Rd +++ b/man/gy_encrypt.Rd @@ -28,6 +28,10 @@ get_public_keys(users, type = "curve") \item{comment}{an optional comment that will be sent (unencrypted) along with the file} \item{funs}{optional additional encryption steps: this must be the output of a call to \code{\link{gy_key_funs}}} + +\item{run_custom}{should any custom decryption functions be run automatically?} + +\item{type}{the type of public key to return ("curve" or "ed")} } \description{ Encrypt and decrypt a pre-serialised object using goldeneye diff --git a/man/gy_join_group.Rd b/man/gy_join_group.Rd index f98d9e7..f6c6b4f 100644 --- a/man/gy_join_group.Rd +++ b/man/gy_join_group.Rd @@ -13,6 +13,12 @@ gy_set_group(group, make_default = FALSE, silent = FALSE) \item{weblink}{the weblink as provided by the group administrator} \item{user}{the username that you want to use for this group} + +\item{make_default}{should this become the default group?} + +\item{group}{the name of the group to set} + +\item{silent}{option to silence output} } \description{ Join an existing goldeneye user group via a weblink diff --git a/man/gy_key_funs.Rd b/man/gy_key_funs.Rd index b9f5598..454bff6 100644 --- a/man/gy_key_funs.Rd +++ b/man/gy_key_funs.Rd @@ -2,13 +2,13 @@ % Please edit documentation in R/gy_key_funs.R \name{gy_key_funs} \alias{gy_key_funs} -\title{Title} +\title{Obtain key functions} \usage{ gy_key_funs(type) } \arguments{ -\item{type}{} +\item{type}{type of key function (only "identity" is currently supported)} } \description{ -Title +Obtain key functions } diff --git a/man/gy_public_file.Rd b/man/gy_public_file.Rd index 7780512..e30c10c 100644 --- a/man/gy_public_file.Rd +++ b/man/gy_public_file.Rd @@ -2,13 +2,15 @@ % Please edit documentation in R/gy_public_file.R \name{gy_public_file} \alias{gy_public_file} -\title{Title} +\title{Extract the public key file} \usage{ gy_public_file(file = "goldeneye_public.gyu", silent = FALSE) } \arguments{ -\item{silent}{} +\item{file}{filename to write to} + +\item{silent}{do this quietly?} } \description{ -Title +Extract the public key file } diff --git a/man/gy_saveRDS.Rd b/man/gy_saveRDS.Rd index fde12a5..10dff55 100644 --- a/man/gy_saveRDS.Rd +++ b/man/gy_saveRDS.Rd @@ -24,7 +24,25 @@ gy_readRDS( ) } \arguments{ -\item{overwrite}{} +\item{object}{the object to encrypt} + +\item{file}{the filename to which the encrypted object will be saved} + +\item{users}{one or more users who will be authorised to decrypt the file} + +\item{local_user}{should the local user be able to decrypt the file?} + +\item{comment}{a comment to include} + +\item{overwrite}{should the file be overwritten, if it exists?} + +\item{ascii}{argument passed to saveRDS} + +\item{funs}{argument passed to saveRDS} + +\item{...}{arguments passed to gy_serialise} + +\item{run_custom}{should any custom decryption functions be run automatically?} } \description{ Save and read encrypted RDS diff --git a/man/gy_serialise.Rd b/man/gy_serialise.Rd index c67942d..3325db7 100644 --- a/man/gy_serialise.Rd +++ b/man/gy_serialise.Rd @@ -16,7 +16,13 @@ gy_serialize(object, files = character(0), method = "qs", ...) gy_deserialize(object, files = TRUE, ...) } \arguments{ -\item{overwrite}{} +\item{object}{the object to encrypt} + +\item{files}{external files to serialise (not yet implemented)} + +\item{method}{the serialisation method to use (base, qs, or custom)} + +\item{...}{arguments passed to the underlying serialisation method} } \description{ Serialise and deserialise a list of objects/files diff --git a/man/gy_setup.Rd b/man/gy_setup.Rd index 3385fc2..e5addc7 100644 --- a/man/gy_setup.Rd +++ b/man/gy_setup.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/gy_setup.R \name{gy_setup} \alias{gy_setup} -\title{Title} +\title{Setup a new goldeyene encryption profile} \usage{ gy_setup( name = NULL, @@ -13,6 +13,19 @@ gy_setup( silent = FALSE ) } +\arguments{ +\item{name}{your full name} + +\item{email}{your email address} + +\item{filename}{the filename to which the profile will be saved} + +\item{path}{the path in which to save the profile} + +\item{append_Rprofile}{should the R profile file be appended to automatically load this profile when R is restarted?} + +\item{silent}{option to suppress output} +} \description{ -Title +Setup a new goldeyene encryption profile } diff --git a/man/gy_users.Rd b/man/gy_users.Rd index 1daccf2..a865102 100644 --- a/man/gy_users.Rd +++ b/man/gy_users.Rd @@ -2,13 +2,15 @@ % Please edit documentation in R/gy_users.R \name{gy_users} \alias{gy_users} -\title{Title} +\title{Obtain a list of users for a given group} \usage{ gy_users(group = NULL, refresh = FALSE) } \arguments{ -\item{refresh}{} +\item{group}{the group for which to return users (defaults to the active group)} + +\item{refresh}{should the list be refreshed from the remote/online location?} } \description{ -Title +Obtain a list of users for a given group } diff --git a/man/gy_zip.Rd b/man/gy_zip.Rd index 51df1c4..2e10ac5 100644 --- a/man/gy_zip.Rd +++ b/man/gy_zip.Rd @@ -24,6 +24,10 @@ gy_unzip( ) } \arguments{ +\item{input_files}{one or more files to add to the zip archive} + +\item{file}{the filename to which the encrypted object will be saved} + \item{compression_level}{compression level to use on a scale of 1-9 (passed to \code{\link[zip]{zip}})} \item{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.} @@ -34,7 +38,13 @@ gy_unzip( \item{funs}{optional additional encryption steps: this must be the output of a call to \code{\link{gy_key_funs}}} -\item{files}{one or more files to add to the zip archive} +\item{directory}{the directory to which the decrypted/unzipped files will be saved} + +\item{unzip}{should the decrypted files also be unzipped?} + +\item{overwrite}{should the file be overwritten, if it exists?} + +\item{run_custom}{should any custom decryption functions be run automatically?} } \description{ Zip and encrypt external files using goldeneye