-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in match.call: ... used in a situation where it does not exist #42
Comments
Use the |
Thanks - relying on undocumented/internal functions such as I ended up using save_enc_rds <- function(object, file) {
cyphr::encrypt(saveRDS(object, file), key)
} which is enough for my use case. I'll have to add additional arguments as needed, but that API is probably stable enough. |
The One possible way of using them would be to do: save_enc_rds <- function(...) {
## The 'rlang' package provides other ways of doing this
envir <- parent.frame()
call <- sys.call()
call[[1L]] <- quote(saveRDS)
## Following your example, with 'key' found in the global
## environment; I'd recommend doing something more robust here
## personally.
cyphr::encrypt_(call, key, envir = envir)
} then use as: key <- cyphr::key_sodium(sodium::keygen())
obj <- runif(10)
path <- tempfile(fileext = ".rds")
save_enc_rds(obj, path, compress = FALSE, version = 3) # note extra args
cyphr::decrypt(readRDS(path), key) However, much simpler would be to use path <- tempfile(fileext = ".rds")
cyphr::encrypt_object(obj, key, path)
cyphr::decrypt_object(path, key) |
Ah, I see. I was under that false impression due the similarity with Python's So that looks very useful then, thanks! |
For convenience, I am trying to do
However, this fails with
I feel this may due to the use of
substitute
here (but this may be wrong):cyphr/R/encrypt_wrapper.R
Lines 57 to 59 in b718ca5
How can I get the kind of function wrapper I am looking for?
The text was updated successfully, but these errors were encountered: