data_request_access(path_data = NULL, path_user = NULL, quiet = FALSE) data_key( path_data = NULL, path_user = NULL, test = TRUE, quiet = FALSE, cache = TRUE )
Path to the data. If not given, then we look recursively down below the working directory for a ".cyphr" directory, and use that as the data directory.
Path to the directory with your user key. Usually this can be omitted. This argument is passed in as both
keypair_openssl(). Briefly, if this argument is not given we look at the environment variables
USER_KEY- if set then these must refer to path of your public and private keys. If these environment variables are not set then we fall back on
~/.ssh/id_rsa, which should work in most environments. Alternatively, provide a path to a directory where the file
id_rsacan be found.
Suppress printing of informative messages.
Test that the encryption is working? (Recommended)
Cache the key within the session. This will be useful if you are using ssh keys that have passwords, as if the key is found within the cache, then you will not have to re-enter your password. Using
cache = FALSEneither looks for the key in the cache, nor saves it.
# The workflow here does not really lend itself to an example, # please see the vignette. # Suppose that Alice has created a data directory: path_alice <- tempfile() cyphr::ssh_keygen(path_alice, password = FALSE) path_data <- tempfile() dir.create(path_data, FALSE, TRUE) cyphr::data_admin_init(path_data, path_user = path_alice) #> Generating data key #> Authorising ourselves #> Adding key c8:e0:92:d4:84:02:e1:01:99:61:f6:4d:e1:70:0f:c4:c2:0c:39:a1:de:77:af:de:25:a3:f6:11:ce:04:6a:74 #> user: root #> host: e0175ae1a84f #> date: 2023-11-19 04:38:36.023079 #> Verifying # If Bob can also write to the data directory (e.g., it is a # shared git repo, on a shared drive, etc), then he can request # access path_bob <- tempfile() cyphr::ssh_keygen(path_bob, password = FALSE) hash <- cyphr::data_request_access(path_data, path_user = path_bob) #> A request has been added #> Email someone with access to add you #> #> hash: c1:c7:bc:15:be:48:4f:7b:99:25:a8:2e:55:19:e3:03:37:18:e9:ba:8a:4a:41:55:e8:27:a8:a3:38:d7:e7:08 #> #> If you are using git, you will need to commit and push first: #> #> git add .cyphr #> git commit -m "Please add me to the dataset" #> git push # Alice can authorise Bob cyphr::data_admin_authorise(path_data, path_user = path_alice, yes = TRUE) #> There is 1 request for access #> Adding key c1:c7:bc:15:be:48:4f:7b:99:25:a8:2e:55:19:e3:03:37:18:e9:ba:8a:4a:41:55:e8:27:a8:a3:38:d7:e7:08 #> user: root #> host: e0175ae1a84f #> date: 2023-11-19 04:38:36.36195 #> Added 1 key #> If you are using git, you will need to commit and push: #> #> git add .cyphr #> git commit -m "Authorised root" #> git push # After which Bob can get the data key cyphr::data_key(path_data, path_user = path_bob) #> <cyphr_key: sodium> # See the vignette for more details. This is not the best medium # to explore this. # Cleanup unlink(path_alice, recursive = TRUE) unlink(path_bob, recursive = TRUE) unlink(path_data, recursive = TRUE)