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

Method RemoveAllKeys

internal/sshutil/agent.go:224–242  ·  view source on GitHub ↗

RemoveAllKeys removes from the agent all the keys matching the given options.

(opts ...AgentOption)

Source from the content-addressed store, hash-verified

222
223// RemoveAllKeys removes from the agent all the keys matching the given options.
224func (a *Agent) RemoveAllKeys(opts ...AgentOption) (bool, error) {
225 o := newOptions(opts)
226 keys, err := a.List()
227 if err != nil {
228 return false, errors.Wrap(err, "error listing keys")
229 }
230
231 var removed bool
232 for _, key := range keys {
233 if o.filterBySignatureKey == nil || o.filterBySignatureKey(key) {
234 if err := a.Remove(key); err != nil {
235 return false, errors.Wrap(err, "error removing key")
236 }
237 removed = true
238 }
239 }
240
241 return removed, nil
242}
243
244// AddCertificate adds the given certificate to the agent.
245func (a *Agent) AddCertificate(subject string, cert *ssh.Certificate, priv interface{}) error {

Callers 1

removeSSHKeysFunction · 0.80

Calls 1

newOptionsFunction · 0.85

Tested by

no test coverage detected