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

Method RemoveKeys

internal/sshutil/agent.go:201–221  ·  view source on GitHub ↗

RemoveKeys removes the keys with the given comment from the agent.

(comment string, opts ...AgentOption)

Source from the content-addressed store, hash-verified

199
200// RemoveKeys removes the keys with the given comment from the agent.
201func (a *Agent) RemoveKeys(comment string, opts ...AgentOption) (bool, error) {
202 o := newOptions(opts)
203 keys, err := a.List()
204 if err != nil {
205 return false, errors.Wrap(err, "error listing keys")
206 }
207
208 var removed bool
209 for _, key := range keys {
210 if key.Comment == comment {
211 if o.filterBySignatureKey == nil || o.filterBySignatureKey(key) {
212 if err := a.Remove(key); err != nil {
213 return false, errors.Wrap(err, "error removing key")
214 }
215 removed = true
216 }
217 }
218 }
219
220 return removed, nil
221}
222
223// RemoveAllKeys removes from the agent all the keys matching the given options.
224func (a *Agent) RemoveAllKeys(opts ...AgentOption) (bool, error) {

Callers 1

removeSSHKeysFunction · 0.80

Calls 1

newOptionsFunction · 0.85

Tested by

no test coverage detected