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

Function generateKeys

coderd/gitsshkey/gitsshkey.go:132–144  ·  view source on GitHub ↗
(block pem.Block, cp crypto.Signer)

Source from the content-addressed store, hash-verified

130}
131
132func generateKeys(block pem.Block, cp crypto.Signer) (privateKey string, publicKey string, err error) {
133 pkBytes := pem.EncodeToMemory(&block)
134 privateKey = string(pkBytes)
135
136 publicKeyRaw := cp.Public()
137 p, err := ssh.NewPublicKey(publicKeyRaw)
138 if err != nil {
139 return "", "", err
140 }
141 publicKey = string(ssh.MarshalAuthorizedKey(p))
142
143 return privateKey, publicKey, nil
144}

Callers 3

ed25519KeyGenFunction · 0.85
ecdsaKeyGenFunction · 0.85
rsa4096KeyGenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected