// listKey lists all keys of the given type and matching the search strings
193696
func (g *GPG) listKeys(ctx context.Context, typ string, search ...string) (gpg.KeyList, error) {
	args := []string{"--with-colons", "--with-fingerprint", "--fixed-list-mode", "--list-" + typ + "-keys"}
	args = append(args, search...)
	if e, found := g.listCache.Get(strings.Join(args, ",")); found {
		if ev, ok := e.(gpg.KeyList); ok {
			return ev, nil
		}
	}
	cmd := exec.CommandContext(ctx, g.binary, args...)
	cmd.Stderr = nil

	out.Debug(ctx, "gpg.listKeys: %s %+v\n", cmd.Path, cmd.Args)
	cmdout, err := cmd.Output()
	if err != nil {
		if bytes.Contains(cmdout, []byte("secret key not available")) {
			return gpg.KeyList{}, nil
		}
		return gpg.KeyList{}, err
	}

	kl := parseColons(bytes.NewBuffer(cmdout))
	g.listCache.Add(strings.Join(args, ","), kl)
	return kl, nil
}
130176
func (cs *CryptoService) ListKeys(role data.RoleName) []string {
	var res []string
	for _, ks := range cs.keyStores {
		for k, r := range ks.ListKeys() {
			if r.Role == role {
				res = append(res, k)
			}
		}
	}
	return res
}
568661
func (c *Collection) ModelKey(id string) string {
	if id == "" {
		return ""
	}
	// c.spec.modelKey(id) will only return an error if id was an empty string.
	// Since we already ruled that out with the check above, we can safely ignore
	// the error return value here.
	key, _ := c.spec.modelKey(id)
	return key
}
1173384
func listKeys(db keyval.ProtoBroker) {
	resp, err := db.ListKeys(phonebook.EtcdPath())
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("list keys:")
	for {
		key, _, stop := resp.GetNext()
		if stop {
			break
		}

		fmt.Printf("- %s\n", key)

	}
}
1244661
func (pdb *BrokerWatcher) ListKeys(prefix string) (keyval.BytesKeyIterator, error) {
	entries := pdb.Client.db.GetDataForPrefix(prefix)
	var keys []string
	for _, entry := range entries {
		keys = append(keys, entry.Key)
	}
	return &bytesKeyIterator{len: len(keys), keys: keys, prefix: pdb.prefix}, nil
}
1055859
func ListKeys(uName string) (KeyList, error) {
	conn, err := db.Conn()
	if err != nil {
		return nil, err
	}
	defer conn.Close()
	n, err := conn.User().FindId(uName).Count()
	if err != nil || n != 1 {
		return nil, ErrUserNotFound
	}
	var keys []Key
	err = conn.Key().Find(bson.M{"username": uName}).All(&keys)
	return KeyList(keys), err
}
1345024
func StringifyKey(key interface{}) string {
	switch key {
	// For named keys we want to handle explicitly

	default:
		// Stringify keys
		switch k := key.(type) {
		case string:
			return k
		case fmt.Stringer:
			return k.String()
		default:
			return fmt.Sprintf("%v", key)
		}
	}
}
39081
func (db *BytesConnectionEtcd) ListKeys(prefix string) (keyval.BytesKeyIterator, error) {
	return listKeysInternal(db.Logger, db.etcdClient, db.opTimeout, prefix)
}
1211710
func (e *ApiClientService) ListKeys(clientName string) (data *ApiClientKeyListResult, err error) {
	url := fmt.Sprintf("clients/%s/keys", clientName)
	err = e.client.magicRequestDecoder("GET", url, nil, &data)
	return
}
1055038
func (r *keyring) List() ([]*Key, error) {
	r.mu.Lock()
	defer r.mu.Unlock()
	if r.locked {
		// section 2.7: locked agents return empty.
		return nil, nil
	}

	var ids []*Key
	for _, k := range r.keys {
		pub := k.signer.PublicKey()
		ids = append(ids, &Key{
			Format:  pub.Type(),
			Blob:    pub.Marshal(),
			Comment: k.comment})
	}
	return ids, nil
}
157194
func (c *Client) ListKeys(keyPrefix string) (keyval.BytesKeyIterator, error) {
	boltLogger.Debugf("ListKeys: %q", keyPrefix)

	var keys []string
	err := c.db.View(func(tx *bolt.Tx) error {
		c := tx.Bucket(rootBucket).Cursor()
		prefix := []byte(keyPrefix)

		for k, _ := c.Seek(prefix); k != nil && bytes.HasPrefix(k, prefix); k, _ = c.Next() {
			boltLogger.Debugf(" listing key: %q", string(k))
			keys = append(keys, string(k))
		}

		return nil
	})

	return &bytesKeyIterator{len: len(keys), keys: keys}, err
}
155999
func (s *Service) KeyList(ctx context.Context, lr *ListRange) (KeyListResult, error) {
	var key KeyListResult
	return key, s.Get(ctx, &key, fmt.Sprintf("/account/keys"), nil, lr)
}
98741
func (cs *CryptoService) ListAllKeys() map[string]data.RoleName {
	res := make(map[string]data.RoleName)
	for _, ks := range cs.keyStores {
		for k, r := range ks.ListKeys() {
			res[k] = r.Role // keys are content addressed so don't care about overwrites
		}
	}
	return res
}
1245656
func (h *Handle) Key() []string {
	h.Lock()
	defer h.Unlock()
	return []string{h.app, h.id}
}
936117
func (mem *memNamedMapping) ListNames(field string, value string) []string {
	mem.access.RLock()
	defer mem.access.RUnlock()

	ix, found := mem.indexes[field]
	if !found {
		return nil
	}
	set, found := ix[value]

	if !found {
		return nil
	}

	return set.content()
}
563602
func (db *BytesConnectionEtcd) ListValues(key string) (keyval.BytesKeyValIterator, error) {
	return listValuesInternal(db.Logger, db.etcdClient, db.opTimeout, key)
}
951043
func Keys(featureList FeatureList) []string {
	var list []string
	for k := range featureList {
		list = append(list, string(k))
	}
	return list
}