MCPcopy Create free account
hub / github.com/coder/envbuilder / DecodeBase64PrivateKey

Function DecodeBase64PrivateKey

git/git.go:194–206  ·  view source on GitHub ↗

DecodeBase64PrivateKey attempts to decode a base64 encoded private key and returns an ssh.Signer

(key string)

Source from the content-addressed store, hash-verified

192// DecodeBase64PrivateKey attempts to decode a base64 encoded private
193// key and returns an ssh.Signer
194func DecodeBase64PrivateKey(key string) (gossh.Signer, error) {
195 bs, err := base64.StdEncoding.DecodeString(key)
196 if err != nil {
197 return nil, fmt.Errorf("decode base64: %w", err)
198 }
199
200 k, err := gossh.ParsePrivateKey(bs)
201 if err != nil {
202 return nil, fmt.Errorf("parse private key: %w", err)
203 }
204
205 return k, nil
206}
207
208// LogHostKeyCallback is a HostKeyCallback that just logs host keys
209// and does nothing else.

Callers 1

SetupRepoAuthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected