MCPcopy
hub / github.com/smallstep/cli / GetSigner

Method GetSigner

internal/sshutil/agent.go:179–198  ·  view source on GitHub ↗

GetSigner returns a signer that has a key with the given comment.

(comment string, opts ...AgentOption)

Source from the content-addressed store, hash-verified

177
178// GetSigner returns a signer that has a key with the given comment.
179func (a *Agent) GetSigner(comment string, opts ...AgentOption) (ssh.Signer, error) {
180 key, err := a.GetKey(comment, opts...)
181 if err != nil {
182 return nil, err
183 }
184
185 signers, err := a.Signers()
186 if err != nil {
187 return nil, errors.Wrap(err, "error listing signers")
188 }
189
190 keyBytes := key.Marshal()
191 for _, sig := range signers {
192 if bytes.Equal(keyBytes, sig.PublicKey().Marshal()) {
193 return sig, nil
194 }
195 }
196
197 return nil, ErrNotFound
198}
199
200// RemoveKeys removes the keys with the given comment from the agent.
201func (a *Agent) RemoveKeys(comment string, opts ...AgentOption) (bool, error) {

Callers

nothing calls this directly

Calls 1

GetKeyMethod · 0.95

Tested by

no test coverage detected