MCPcopy Create free account
hub / github.com/Scalingo/cli / ReadPrivateKey

Function ReadPrivateKey

crypto/sshkeys/read.go:22–28  ·  view source on GitHub ↗
(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

20)
21
22func ReadPrivateKey(ctx context.Context, path string) (ssh.Signer, error) {
23 privateKeyContent, err := os.ReadFile(path)
24 if err != nil {
25 return nil, errors.Wrapf(ctx, err, "read private key file %s", path)
26 }
27 return readPrivateKeyWithContent(ctx, path, privateKeyContent)
28}
29
30func readPrivateKeyWithContent(ctx context.Context, path string, privateKeyContent []byte) (ssh.Signer, error) {
31 // We parse the private key on our own first so that we can

Callers 1

ConnectFunction · 0.92

Calls 1

Tested by

no test coverage detected