func (s *Store) idFiles(ctx context.Context) []string {
	if s.crypto == nil {
		return nil
	}
	files, err := s.Storage().List(ctx, "")
	if err != nil {
		return nil
	}
	fileSet := make(map[string]struct{}, len(files))
	for _, file := range files {
		if strings.HasPrefix(filepath.Base(file), ".") {
			continue
		}
		idf := s.idFile(ctx, file)
		if s.storage.Exists(ctx, idf) {
			fileSet[idf] = struct{}{}
		}
	}
	out := make([]string, 0, len(fileSet))
	for file := range fileSet {
		out = append(out, file)
	}
	sort.Strings(out)
	return out
}
idFiles returns the path to all id files in this store.
package leaf
import (
	"context"
	"fmt"
	"path/filepath"
	"sort"
	"strings"
	"github.com/gopasspw/gopass/internal/backend"
	"github.com/gopasspw/gopass/pkg/debug"
)
type Store struct {
	alias   string
	path    string
	crypto  backend.Crypto
	storage backend.Storage
}
func Init(ctx context.Context, alias, path string) (*Store, error) {
	debug.Log("Initializing %s at %s", alias, path)
	s := &Store{
		alias: alias,
		path:  path,
	}
	st, err := backend.InitStorage(ctx, backend.GetStorageBackend(ctx), path)
	if err != nil {
		return nil, err
	}
	s.storage = st
	debug.Log("Storage initialized")
	crypto, err := backend.NewCrypto(ctx, backend.GetCryptoBackend(ctx))
	if err != nil {
		return nil, err
	}
	s.crypto = crypto
	debug.Log("Crypto initialized")
	return s, nil
}
func New(ctx context.Context, alias, path string) (*Store, error) {
	debug.Log("Instantiating %s at %s", alias, path)
	s := &Store{
		alias: alias,
		path:  path,
	}
	if err := s.initStorageBackend(ctx); err != nil {
		return nil, fmt.Errorf("failed to init storage backend: %w", err)
	}
	debug.Log("Storage initialized")
	if err := s.initCryptoBackend(ctx); err != nil {
		return nil, fmt.Errorf("failed to init crypto backend: %w", err)
	}
	debug.Log("Crypto initialized")
	debug.Log("Instantiated %s at %s - storage: %+#v - crypto: %+#v", alias, path, s.storage, s.crypto)
	return s, nil
}
func (s *Store) idFile(ctx context.Context, name string) string {
	if s.crypto == nil {
		return ""
	}
	fn := name
	var cnt uint8
	for {
		cnt++
		if cnt > 100 {
			break
		}
		if fn == "" || fn == Sep {
			break
		}
		gfn := filepath.Join(fn, s.crypto.IDFile())
		if s.storage.Exists(ctx, gfn) {
			return gfn
		}
		fn = filepath.Dir(fn)
	}
	return s.crypto.IDFile()
}