MCPcopy Index your code
hub / github.com/coder/coder / writePrivateKeyToFile

Function writePrivateKeyToFile

cli/gitssh_test.go:100–112  ·  view source on GitHub ↗
(t *testing.T, name string, key *ecdsa.PrivateKey)

Source from the content-addressed store, hash-verified

98}
99
100func writePrivateKeyToFile(t *testing.T, name string, key *ecdsa.PrivateKey) {
101 t.Helper()
102
103 b, err := x509.MarshalPKCS8PrivateKey(key)
104 require.NoError(t, err)
105 b = pem.EncodeToMemory(&pem.Block{
106 Type: "PRIVATE KEY",
107 Bytes: b,
108 })
109
110 err = os.WriteFile(name, b, 0o600)
111 require.NoError(t, err)
112}
113
114func TestGitSSH(t *testing.T) {
115 t.Parallel()

Callers 1

TestGitSSHFunction · 0.85

Calls 2

HelperMethod · 0.65
WriteFileMethod · 0.65

Tested by

no test coverage detected