From 984d38920387e0ae9b52c2295abf6febc8446e4b Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sat, 5 Nov 2022 21:45:54 +0000 Subject: [PATCH 01/15] Allow id_ed25519 keypair name --- DESCRIPTION | 4 ++-- R/openssl.R | 11 ++++++----- R/util.R | 20 ++++++++++++++++++++ man/keypair_openssl.Rd | 4 ++-- tests/testthat/test-openssl.R | 4 ++-- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 634b33c..956768a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cyphr Title: High Level Encryption Wrappers -Version: 1.1.4 +Version: 1.1.5 Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), email = "rich.fitzjohn@gmail.com"), person("Jai", "Ranganathan", role = "ctb")) @@ -22,7 +22,7 @@ Suggests: knitr, rmarkdown, testthat -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.1 Roxygen: list(markdown = TRUE) VignetteBuilder: rmarkdown, knitr diff --git a/R/openssl.R b/R/openssl.R index 6f9589d..6224696 100644 --- a/R/openssl.R +++ b/R/openssl.R @@ -3,8 +3,8 @@ ##' @title Asymmetric encryption with openssl ##' ##' @param pub An openssl public key. Usually this will be the path -##' to the key, in which case it may either the path to a public key -##' or be the path to a directory containing a file +##' to the key, in which case it may be either the path to a public key +##' or the path to a directory containing a file such as ##' `id_rsa.pub`. If `NULL`, then your public key will be ##' used (found via the environment variable `USER_PUBKEY`, ##' then `~/.ssh/id_rsa.pub`). However, it is not that common @@ -193,7 +193,7 @@ openssl_find_pubkey <- function(path) { ## NOTE: almost same logic as the openssl package (but without the ## automatic derivation bit because that would require loading the ## private key which would trigger a password request). - path <- Sys.getenv("USER_PUBKEY", "~/.ssh/id_rsa.pub") + path <- Sys.getenv("USER_PUBKEY", guess_key_filename()) if (!file.exists(path)) { openssl_key_error(path, "public") } @@ -202,9 +202,10 @@ openssl_find_pubkey <- function(path) { stop("Public key does not exist at ", path) } if (is_directory(path)) { - path <- file.path(path, "id_rsa.pub") + path <- guess_key_filename(path) if (!file.exists(path)) { - stop("did not find id_rsa.pub within path") + stop(sprintf("did not find %s within path", + guess_key_options(error = TRUE))) } } path diff --git a/R/util.R b/R/util.R index a63161e..941bbf7 100644 --- a/R/util.R +++ b/R/util.R @@ -146,3 +146,23 @@ cyphr_file <- function(...) { file_copy <- function(...) { stopifnot(file.copy(...)) } + +guess_key_options <- function(error = FALSE) { + if (error) { + "id_rsa or id_ed25519" + } else { + c("id_rsa", "id_ed25519") + } +} + +guess_key_filename <- function(path = "~/.ssh/") { + for (guess in guess_key_options()) { + keyfile <- sprintf("%s/%s", path, guess) + pubkeyfile <- sprintf("%s/%s.pub", path, guess) + if (file.exists(keyfile) && file.exists(pubkeyfile)) { + return(keyfile) + } + } + + NULL +} diff --git a/man/keypair_openssl.Rd b/man/keypair_openssl.Rd index 5a344a7..791c74d 100644 --- a/man/keypair_openssl.Rd +++ b/man/keypair_openssl.Rd @@ -14,8 +14,8 @@ keypair_openssl( } \arguments{ \item{pub}{An openssl public key. Usually this will be the path -to the key, in which case it may either the path to a public key -or be the path to a directory containing a file +to the key, in which case it may be either the path to a public key +or the path to a directory containing a file such as \code{id_rsa.pub}. If \code{NULL}, then your public key will be used (found via the environment variable \code{USER_PUBKEY}, then \verb{~/.ssh/id_rsa.pub}). However, it is not that common diff --git a/tests/testthat/test-openssl.R b/tests/testthat/test-openssl.R index 8de1014..98a4120 100644 --- a/tests/testthat/test-openssl.R +++ b/tests/testthat/test-openssl.R @@ -141,8 +141,8 @@ test_that("find key", { expect_error(openssl_find_key(path), "Private key does not exist") expect_error(openssl_find_pubkey(path), "Public key does not exist") dir.create(path) - expect_error(openssl_find_key(path), "did not find id_rsa within") - expect_error(openssl_find_pubkey(path), "did not find id_rsa.pub within") + expect_error(openssl_find_key(path), "did not find (.*) within") + expect_error(openssl_find_pubkey(path), "did not find (.*).pub within") }) test_that("default key", { From 19a60be6e69343ab0ffa6d6aa500d7fa556ff656 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sat, 5 Nov 2022 22:01:27 +0000 Subject: [PATCH 02/15] Handle both public and private --- R/openssl.R | 14 ++++++++------ R/util.R | 15 ++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/R/openssl.R b/R/openssl.R index 6224696..04d4243 100644 --- a/R/openssl.R +++ b/R/openssl.R @@ -170,7 +170,7 @@ openssl_load_pubkey <- function(path) { openssl_find_key <- function(path) { if (is.null(path)) { ## NOTE: same logic as the openssl package - path <- Sys.getenv("USER_KEY", "~/.ssh/id_rsa") + path <- Sys.getenv("USER_KEY", guess_key_filename(pub = FALSE)) if (!file.exists(path)) { openssl_key_error(path, "private") } @@ -179,9 +179,11 @@ openssl_find_key <- function(path) { stop("Private key does not exist at ", path) } if (is_directory(path)) { - path <- file.path(path, "id_rsa") + path <- guess_key_filename(path = path, pub = FALSE) if (!file.exists(path)) { - stop("did not find id_rsa within path") + stop(sprintf("did not find %s within path", + guess_key_options(pub = FALSE, error = TRUE))) + } } path @@ -193,7 +195,7 @@ openssl_find_pubkey <- function(path) { ## NOTE: almost same logic as the openssl package (but without the ## automatic derivation bit because that would require loading the ## private key which would trigger a password request). - path <- Sys.getenv("USER_PUBKEY", guess_key_filename()) + path <- Sys.getenv("USER_PUBKEY", guess_key_filename(pub = TRUE)) if (!file.exists(path)) { openssl_key_error(path, "public") } @@ -202,10 +204,10 @@ openssl_find_pubkey <- function(path) { stop("Public key does not exist at ", path) } if (is_directory(path)) { - path <- guess_key_filename(path) + path <- guess_key_filename(path, pub = TRUE) if (!file.exists(path)) { stop(sprintf("did not find %s within path", - guess_key_options(error = TRUE))) + guess_key_options(pub = TRUE, error = TRUE))) } } path diff --git a/R/util.R b/R/util.R index 941bbf7..6d514ee 100644 --- a/R/util.R +++ b/R/util.R @@ -147,19 +147,20 @@ file_copy <- function(...) { stopifnot(file.copy(...)) } -guess_key_options <- function(error = FALSE) { +guess_key_options <- function(pub, error = FALSE) { + ext <- if (pub) ".pub" else "" if (error) { - "id_rsa or id_ed25519" + sprintf("id_rsa%s or id_ed25519%s", ext) } else { - c("id_rsa", "id_ed25519") + c(sprintf("id_rsa%s", ext), + sprintf("id_ed25519%s", ext)) } } -guess_key_filename <- function(path = "~/.ssh/") { - for (guess in guess_key_options()) { +guess_key_filename <- function(pub, path = "~/.ssh/") { + for (guess in guess_key_options(pub)) { keyfile <- sprintf("%s/%s", path, guess) - pubkeyfile <- sprintf("%s/%s.pub", path, guess) - if (file.exists(keyfile) && file.exists(pubkeyfile)) { + if (file.exists(keyfile)) { return(keyfile) } } From 15dbf53e44a32c9ec1d0a793b12c3830972f4ee0 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sat, 5 Nov 2022 22:02:51 +0000 Subject: [PATCH 03/15] Better arg order --- R/openssl.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/openssl.R b/R/openssl.R index 04d4243..c860495 100644 --- a/R/openssl.R +++ b/R/openssl.R @@ -179,7 +179,7 @@ openssl_find_key <- function(path) { stop("Private key does not exist at ", path) } if (is_directory(path)) { - path <- guess_key_filename(path = path, pub = FALSE) + path <- guess_key_filename(pub = FALSE, path = path) if (!file.exists(path)) { stop(sprintf("did not find %s within path", guess_key_options(pub = FALSE, error = TRUE))) @@ -204,7 +204,7 @@ openssl_find_pubkey <- function(path) { stop("Public key does not exist at ", path) } if (is_directory(path)) { - path <- guess_key_filename(path, pub = TRUE) + path <- guess_key_filename(pub = TRUE, path = path) if (!file.exists(path)) { stop(sprintf("did not find %s within path", guess_key_options(pub = TRUE, error = TRUE))) From 9d07623f6ce995ef75971c7bfeaaa57333574542 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sat, 5 Nov 2022 22:04:26 +0000 Subject: [PATCH 04/15] Fix sprintfs --- R/util.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/util.R b/R/util.R index 6d514ee..29914af 100644 --- a/R/util.R +++ b/R/util.R @@ -150,7 +150,10 @@ file_copy <- function(...) { guess_key_options <- function(pub, error = FALSE) { ext <- if (pub) ".pub" else "" if (error) { - sprintf("id_rsa%s or id_ed25519%s", ext) + paste0( + sprintf("id_rsa%s or ", ext), + sprintf("id_ed25519%s", ext) + ) } else { c(sprintf("id_rsa%s", ext), sprintf("id_ed25519%s", ext)) From 137cc9ae08de37b55cde9340fe83a6a71e3b220b Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sun, 6 Nov 2022 17:36:09 +0000 Subject: [PATCH 05/15] Prevent mismatch (eg id_rsa and id_ed25519.pub) --- R/openssl.R | 4 ++-- R/util.R | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/R/openssl.R b/R/openssl.R index c860495..a9103ba 100644 --- a/R/openssl.R +++ b/R/openssl.R @@ -180,7 +180,7 @@ openssl_find_key <- function(path) { } if (is_directory(path)) { path <- guess_key_filename(pub = FALSE, path = path) - if (!file.exists(path)) { + if ((is.null(path)) || (!file.exists(path))) { stop(sprintf("did not find %s within path", guess_key_options(pub = FALSE, error = TRUE))) @@ -205,7 +205,7 @@ openssl_find_pubkey <- function(path) { } if (is_directory(path)) { path <- guess_key_filename(pub = TRUE, path = path) - if (!file.exists(path)) { + if ((is.null(path)) || (!file.exists(path))) { stop(sprintf("did not find %s within path", guess_key_options(pub = TRUE, error = TRUE))) } diff --git a/R/util.R b/R/util.R index 29914af..eacd9c4 100644 --- a/R/util.R +++ b/R/util.R @@ -151,8 +151,8 @@ guess_key_options <- function(pub, error = FALSE) { ext <- if (pub) ".pub" else "" if (error) { paste0( - sprintf("id_rsa%s or ", ext), - sprintf("id_ed25519%s", ext) + sprintf("id_rsa[.pub] pair or "), + sprintf("id_ed25519[.pub] pair") ) } else { c(sprintf("id_rsa%s", ext), @@ -161,10 +161,19 @@ guess_key_options <- function(pub, error = FALSE) { } guess_key_filename <- function(pub, path = "~/.ssh/") { - for (guess in guess_key_options(pub)) { + for (guess in guess_key_options(pub = FALSE)) { keyfile <- sprintf("%s/%s", path, guess) - if (file.exists(keyfile)) { - return(keyfile) + pubkeyfile <- sprintf("%s/%s.pub", path, guess) + + # Ensure both private and public key exist, + # in order to return either. + + if (file.exists(keyfile) && file.exists(pubkeyfile)) { + if (pub) { + return(pubkeyfile) + } else { + return(keyfile) + } } } From b76793c9219a4642ee663b5e25d6203539bb6429 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sun, 6 Nov 2022 17:38:57 +0000 Subject: [PATCH 06/15] Fix test text --- tests/testthat/test-openssl.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-openssl.R b/tests/testthat/test-openssl.R index 98a4120..e295271 100644 --- a/tests/testthat/test-openssl.R +++ b/tests/testthat/test-openssl.R @@ -142,7 +142,7 @@ test_that("find key", { expect_error(openssl_find_pubkey(path), "Public key does not exist") dir.create(path) expect_error(openssl_find_key(path), "did not find (.*) within") - expect_error(openssl_find_pubkey(path), "did not find (.*).pub within") + expect_error(openssl_find_pubkey(path), "did not find (.*) within") }) test_that("default key", { From 294751041508eaaaf7b275d928634186d9dcd27d Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sun, 6 Nov 2022 18:04:55 +0000 Subject: [PATCH 07/15] Return '' instead of null for no key --- R/util.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/util.R b/R/util.R index eacd9c4..c6097b6 100644 --- a/R/util.R +++ b/R/util.R @@ -177,5 +177,5 @@ guess_key_filename <- function(pub, path = "~/.ssh/") { } } - NULL + "" } From 657a87d03a2683600cee38b73e42b432311788d4 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sun, 6 Nov 2022 18:17:59 +0000 Subject: [PATCH 08/15] Simplify unneeded pub arg --- R/openssl.R | 4 ++-- R/util.R | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/R/openssl.R b/R/openssl.R index a9103ba..c336a66 100644 --- a/R/openssl.R +++ b/R/openssl.R @@ -182,7 +182,7 @@ openssl_find_key <- function(path) { path <- guess_key_filename(pub = FALSE, path = path) if ((is.null(path)) || (!file.exists(path))) { stop(sprintf("did not find %s within path", - guess_key_options(pub = FALSE, error = TRUE))) + guess_key_options(error = TRUE))) } } @@ -207,7 +207,7 @@ openssl_find_pubkey <- function(path) { path <- guess_key_filename(pub = TRUE, path = path) if ((is.null(path)) || (!file.exists(path))) { stop(sprintf("did not find %s within path", - guess_key_options(pub = TRUE, error = TRUE))) + guess_key_options(error = TRUE))) } } path diff --git a/R/util.R b/R/util.R index c6097b6..d7a0b20 100644 --- a/R/util.R +++ b/R/util.R @@ -147,21 +147,20 @@ file_copy <- function(...) { stopifnot(file.copy(...)) } -guess_key_options <- function(pub, error = FALSE) { - ext <- if (pub) ".pub" else "" +guess_key_options <- function(error = FALSE) { if (error) { paste0( sprintf("id_rsa[.pub] pair or "), sprintf("id_ed25519[.pub] pair") ) } else { - c(sprintf("id_rsa%s", ext), - sprintf("id_ed25519%s", ext)) + c("id_rsa", + "id_ed25519%s") } } guess_key_filename <- function(pub, path = "~/.ssh/") { - for (guess in guess_key_options(pub = FALSE)) { + for (guess in guess_key_options()) { keyfile <- sprintf("%s/%s", path, guess) pubkeyfile <- sprintf("%s/%s.pub", path, guess) From 320d7f6b8677560c58652233047765437293aace Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sun, 6 Nov 2022 18:19:34 +0000 Subject: [PATCH 09/15] Typo --- R/util.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/util.R b/R/util.R index d7a0b20..754436f 100644 --- a/R/util.R +++ b/R/util.R @@ -155,7 +155,7 @@ guess_key_options <- function(error = FALSE) { ) } else { c("id_rsa", - "id_ed25519%s") + "id_ed25519") } } From 2e92e7839a61fd4ab1ce6f6065891fba26867251 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Sun, 6 Nov 2022 18:20:28 +0000 Subject: [PATCH 10/15] Remove unneeded sprintf --- R/util.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/util.R b/R/util.R index 754436f..23c3a21 100644 --- a/R/util.R +++ b/R/util.R @@ -149,10 +149,8 @@ file_copy <- function(...) { guess_key_options <- function(error = FALSE) { if (error) { - paste0( - sprintf("id_rsa[.pub] pair or "), - sprintf("id_ed25519[.pub] pair") - ) + paste0("id_rsa[.pub] pair or ", + "id_ed25519[.pub] pair") } else { c("id_rsa", "id_ed25519") From 93ed1c6a1db872608587342fb0bc5c54dc8170a3 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Mon, 7 Nov 2022 18:41:38 +0000 Subject: [PATCH 11/15] Separate candidate filenames / error message --- R/openssl.R | 7 ++----- R/util.R | 20 +++++++++++--------- tests/testthat/test-openssl.R | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/R/openssl.R b/R/openssl.R index c336a66..ca73c01 100644 --- a/R/openssl.R +++ b/R/openssl.R @@ -181,9 +181,7 @@ openssl_find_key <- function(path) { if (is_directory(path)) { path <- guess_key_filename(pub = FALSE, path = path) if ((is.null(path)) || (!file.exists(path))) { - stop(sprintf("did not find %s within path", - guess_key_options(error = TRUE))) - + stop(guess_key_error()) } } path @@ -206,8 +204,7 @@ openssl_find_pubkey <- function(path) { if (is_directory(path)) { path <- guess_key_filename(pub = TRUE, path = path) if ((is.null(path)) || (!file.exists(path))) { - stop(sprintf("did not find %s within path", - guess_key_options(error = TRUE))) + stop(guess_key_error()) } } path diff --git a/R/util.R b/R/util.R index 23c3a21..b7e7cb7 100644 --- a/R/util.R +++ b/R/util.R @@ -147,18 +147,20 @@ file_copy <- function(...) { stopifnot(file.copy(...)) } -guess_key_options <- function(error = FALSE) { - if (error) { - paste0("id_rsa[.pub] pair or ", - "id_ed25519[.pub] pair") - } else { - c("id_rsa", - "id_ed25519") - } +acceptable_key_filenames <- function() { + c("id_rsa", + "id_ed25519") +} + +guess_key_error <- function() { + paste0("Could not find a pair of ", + paste0(acceptable_key_filenames(), + collapse = "[.pub], "), + "[.pub]. (Consider setting USER_KEY and USER_PUBKEY)") } guess_key_filename <- function(pub, path = "~/.ssh/") { - for (guess in guess_key_options()) { + for (guess in acceptable_key_filenames()) { keyfile <- sprintf("%s/%s", path, guess) pubkeyfile <- sprintf("%s/%s.pub", path, guess) diff --git a/tests/testthat/test-openssl.R b/tests/testthat/test-openssl.R index e295271..a302ecd 100644 --- a/tests/testthat/test-openssl.R +++ b/tests/testthat/test-openssl.R @@ -141,8 +141,8 @@ test_that("find key", { expect_error(openssl_find_key(path), "Private key does not exist") expect_error(openssl_find_pubkey(path), "Public key does not exist") dir.create(path) - expect_error(openssl_find_key(path), "did not find (.*) within") - expect_error(openssl_find_pubkey(path), "did not find (.*) within") + expect_error(openssl_find_key(path), "Could not find a pair of (.*)") + expect_error(openssl_find_pubkey(path), "Could not find a pair of (.*)") }) test_that("default key", { From cf25c2afb78e85350bfa8e78f6998179400a6083 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Mon, 7 Nov 2022 18:44:45 +0000 Subject: [PATCH 12/15] Update news --- NEWS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS.md b/NEWS.md index 308af4e..86dcf7d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# cyphr 1.1.5 + +* Recognise default keypairs named either `id_rsa`, or `id_ed25519` (Issue #53) + # cyphr 1.0.6 * Added wrappers for `readxl::read_excel` and `writexl::write_xlsx` (reside-109) @@ -14,3 +18,4 @@ # cyphr 0.1.0 * Initial prototype, as sent to rOpenSci onboarding for review +15 \ No newline at end of file From 09d233d9971f3bb70c7d288c41af02a807f5633d Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Mon, 7 Nov 2022 18:47:46 +0000 Subject: [PATCH 13/15] Better error --- R/util.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/util.R b/R/util.R index b7e7cb7..309a9a2 100644 --- a/R/util.R +++ b/R/util.R @@ -156,7 +156,7 @@ guess_key_error <- function() { paste0("Could not find a pair of ", paste0(acceptable_key_filenames(), collapse = "[.pub], "), - "[.pub]. (Consider setting USER_KEY and USER_PUBKEY)") + "[.pub]. (See ssl_keygen, or set USER_KEY and USER_PUBKEY)") } guess_key_filename <- function(pub, path = "~/.ssh/") { From f002978683f56ba407d78aedc52a213653e4c52f Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 8 Nov 2022 10:39:24 +0000 Subject: [PATCH 14/15] Refresh cyphr.Rmd vignette --- vignettes/cyphr.Rmd | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vignettes/cyphr.Rmd b/vignettes/cyphr.Rmd index 3ec4f0f..2f72eba 100644 --- a/vignettes/cyphr.Rmd +++ b/vignettes/cyphr.Rmd @@ -172,8 +172,8 @@ path_key_alice <- cyphr::ssh_keygen(password = FALSE) path_key_bob <- cyphr::ssh_keygen(password = FALSE) ``` -Note that each directory contains a public key (`id_rsa.pub`) and a -private key (`id_rsa`). +Note that ssh_keygen writes a public key (`id_rsa.pub`) and a +private key (`id_rsa`) in each directory. ``` {r } dir(path_key_alice) dir(path_key_bob) @@ -307,8 +307,8 @@ this is appropriate and consider generating a new keypair with the private key encrypted. If you don't then anyone who can read your private key can decrypt any message intended for you. -3. you get an error like `Did not find default ssh public key at -~/.ssh/id_rsa.pub`. You need to create a keypair. +3. you get an error like `Could not find a pair of id_rsa[.pub] ...` +You need to create a keypair, or specify an existing one. To create a keypair, you can use the `cyphr::ssh_keygen()` function as @@ -322,6 +322,11 @@ by default. See `?ssh_keygen` for more information. (On Linux and macOS you might use the `ssh-keygen` command line utility. On windows, PuTTY` has a utility for creating keys.) +To use an existing keypair, set the `USER_KEY` and `USER_PUBKEY` +environment variables. You can either directly specify the path +of each, or you can specify a directory, and cyphr will search +for a key-pair starting with `id_rsa` or `id_ed25519`. + ### `sodium` With `sodium`, things are largely the same with the exception that From f22f43274883912f24ecaaa28707af08b57cf66c Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 8 Nov 2022 10:41:48 +0000 Subject: [PATCH 15/15] Prefer new keytype if both exist --- R/util.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/util.R b/R/util.R index 309a9a2..db91489 100644 --- a/R/util.R +++ b/R/util.R @@ -148,8 +148,9 @@ file_copy <- function(...) { } acceptable_key_filenames <- function() { - c("id_rsa", - "id_ed25519") + c("id_ed25519", + "id_rsa" + ) } guess_key_error <- function() {