SSH Agent Integration (#334)

Hook into an existing SSH Agent.
This allows us to pull keys already authenticated by the agent and write
to the agent ourselves.

---------

Co-authored-by: Evan Simkowitz <esimkowitz@users.noreply.github.com>
This commit is contained in:
Sylvie Crowe
2024-09-06 13:19:38 -07:00
committed by GitHub
co-authored by Evan Simkowitz
parent 566bf461ff
commit a9533b0426
4 changed files with 129 additions and 86 deletions
+28
View File
@@ -0,0 +1,28 @@
package trimquotes
import (
"strconv"
)
func TrimQuotes(s string) (string, bool) {
if len(s) > 2 && s[0] == '"' {
trimmed, err := strconv.Unquote(s)
if err != nil {
return s, false
}
return trimmed, true
}
return s, false
}
func TryTrimQuotes(s string) string {
trimmed, _ := TrimQuotes(s)
return trimmed
}
func ReplaceQuotes(s string, shouldReplace bool) string {
if shouldReplace {
return strconv.Quote(s)
}
return s
}