// Wallets implements accounts.Backend, returning all single-key wallets from the
// keystore directory.
182647
func (ks *KeyStore) Wallets() []accounts.Wallet {
	// Make sure the list of wallets is in sync with the account cache
	ks.refreshWallets()

	ks.mu.RLock()
	defer ks.mu.RUnlock()

	cpy := make([]accounts.Wallet, len(ks.wallets))
	copy(cpy, ks.wallets)
	return cpy
}
403680
func (w *keystoreWallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error) {
	return accounts.Account{}, accounts.ErrNotSupported
}
771946
func (l *LocalStore) Folders(ctx context.Context, csq cloudstorage.Query) ([]string, error) {
	spath := path.Join(l.storepath, csq.Prefix)
	if !cloudstorage.Exists(spath) {
		return nil, fmt.Errorf("That folder %q does not exist", spath)
	}
	select {
	case <-ctx.Done():
		return nil, ctx.Err()
	default:
	}

	folders := make([]string, 0)
	files, _ := ioutil.ReadDir(spath)
	for _, f := range files {
		if f.IsDir() {
			folders = append(folders, fmt.Sprintf("%s/", path.Join(csq.Prefix, f.Name())))
		}
	}
	return folders, nil
}
977669
func (r *Store) Crypto(ctx context.Context, name string) backend.Crypto {
	_, sub, _ := r.getStore(ctx, name)
	if !sub.Valid() {
		out.Debug(ctx, "Sub-Store not found for %s. Returning nil crypto backend", name)
		return nil
	}
	return sub.Crypto()
}
88990
func (k *ArrayKeyring) Keys() ([]string, error) {
	var keys = []string{}
	for key := range k.items {
		keys = append(keys, key)
	}
	return keys, nil
}
1353569
func (rpc *EthRPC) EthAccounts() ([]string, error) {
	accounts := []string{}

	err := rpc.call("eth_accounts", &accounts)
	return accounts, err
}
439269
func (c *Client) Datastores(ctx context.Context) ([]*mo.Datastore, error) {
	_, datacenter, err := c.finder(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	folders, err := datacenter.Folders(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}

	es, err := c.lister(folders.DatastoreFolder.Reference()).List(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var datastores []*mo.Datastore
	for _, e := range es {
		switch o := e.Object.(type) {
		case mo.Datastore:
			datastores = append(datastores, &o)
		}
	}
	return datastores, nil
}
276490
func cacheKeys(caches ...map[string]interface{}) map[string]bool {
	keys := make(map[string]bool)
	for _, cache := range caches {
		for key := range cache {
			keys[key] = true
		}
	}
	return keys
}
438737
func BackupWallet() (string, error) {
	type walletBackupResponse struct {
		Seed         string             `json:"wallet-seed"`
		Addresses    []*addressResponse `json:"addresses"`
		IdentityKeys []*addressResponse `json:"identity-keys"`
	}

	req := NewJSON2Request("wallet-backup", APICounter(), nil)
	resp, err := walletRequest(req)
	if err != nil {
		return "", err
	}
	if resp.Error != nil {
		return "", resp.Error
	}

	w := new(walletBackupResponse)
	if err := json.Unmarshal(resp.JSONResult(), w); err != nil {
		return "", err
	}

	s := fmt.Sprintln(w.Seed)
	s += fmt.Sprintln()
	for _, adr := range w.Addresses {
		s += fmt.Sprintln(adr.Public)
		s += fmt.Sprintln(adr.Secret)
		s += fmt.Sprintln()
	}
	for _, k := range w.IdentityKeys {
		s += fmt.Sprintln(k.Public)
		s += fmt.Sprintln(k.Secret)
		s += fmt.Sprintln()
	}
	return s, nil
}
143874
func (s *Section) Keys() []string {
	keys := make([]string, len(s.keys))
	for i, k := range s.keys {
		keys[i] = s.file.KeyManipFunc(k)
	}

	return keys
}
691101
func (s *GlobalStore) NodeKeys(addr common.Address, startKey []byte, limit int) (keys mock.Keys, err error) {
	err = s.client.Call(&keys, "mockStore_nodeKeys", addr, startKey, limit)
	return keys, err
}
173967
func (s *GlobalStore) NodeKeys(addr common.Address, startKey []byte, limit int) (keys mock.Keys, err error) {
	s.mu.RLock()
	defer s.mu.RUnlock()

	var i int
	if startKey != nil {
		i, _ = s.nodeKeyIndex(addr, startKey)
	}
	total := len(s.nodeKeys[addr])
	max := maxIndex(i, limit, total)
	keys.Keys = make([][]byte, 0, max-i)
	for ; i < max; i++ {
		keys.Keys = append(keys.Keys, append([]byte(nil), s.nodeKeys[addr][i]...))
	}
	if total > max {
		keys.Next = s.nodeKeys[addr][max]
	}
	return keys, nil
}
625643
func (l *Loader) WalletExists() (bool, error) {
	dbPath := filepath.Join(l.dbDirPath, walletDbName)
	return fileExists(dbPath)
}
985138
func WalletAccount(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.WalletAccountLocal, error) {
	bundle, err := remote.FetchSecretlessBundle(mctx)
	if err != nil {
		return stellar1.WalletAccountLocal{}, err
	}
	entry, err := bundle.Lookup(accountID)
	if err != nil {
		return stellar1.WalletAccountLocal{}, err
	}

	return accountLocal(mctx, remoter, entry)
}
417994
func (api *API) WalletBalances() (wallet WalletBalances, err error) {
	request := struct {
		URL   string `json:"request"`
		Nonce string `json:"nonce"`
	}{
		"/v1/balances",
		strconv.FormatInt(time.Now().UnixNano(), 10),
	}

	body, err := api.post(request.URL, request)
	if err != nil {
		return
	}

	tmpBalances := []WalletBalance{}
	err = json.Unmarshal(body, &tmpBalances)
	if err != nil { // Failed to unmarshal expected message
		// Attempt to unmarshal the error message
		errorMessage := ErrorMessage{}
		err = json.Unmarshal(body, &errorMessage)
		if err != nil { // Not expected message and not expected error, bailing...
			return
		}

		return nil, errors.New("API: " + errorMessage.Message)
	}

	wallet = make(WalletBalances)
	for _, w := range tmpBalances {
		wallet[WalletKey{w.Type, w.Currency}] = w
	}

	return
}
1016806
func (s *GlobalStore) Keys(startKey []byte, limit int) (keys mock.Keys, err error) {
	return s.keys(nil, startKey, limit)
}
466764
func (a *AccountState) Balances(ctx context.Context) ([]stellar1.Balance, error) {
	a.RLock()
	defer a.RUnlock()
	a.enqueueRefreshReq()
	return a.balances, nil
}