func (c *nativeStore) storeCredentialsInStore(config types.AuthConfig) error {
	creds := &credentials.Credentials{
		ServerURL: config.ServerAddress,
		Username:  config.Username,
		Secret:    config.Password,
	}
	if config.IdentityToken != "" {
		creds.Username = tokenUsername
		creds.Secret = config.IdentityToken
	}
	return client.Store(c.programFunc, creds)
}
storeCredentialsInStore executes the command to store the credentials in the native store.
package credentials
import (
	"github.com/docker/docker-credential-helpers/client"
	"github.com/docker/docker-credential-helpers/credentials"
	"github.com/docker/docker/api/types"
)
const (
	remoteCredentialsPrefix = "docker-credential-"
	tokenUsername           = "<token>"
)
type nativeStore struct {
	programFunc client.ProgramFunc
	fileStore   Store
}
func NewNativeStore(file store, helperSuffix string) Store {
	name := remoteCredentialsPrefix + helperSuffix
	return &nativeStore{
		programFunc: client.NewShellProgramFunc(name),
		fileStore:   NewFileStore(file),
	}
}
func (c *nativeStore) Erase(serverAddress string) error {
	if err := client.Erase(c.programFunc, serverAddress); err != nil {
		return err
	}
	return c.fileStore.Erase(serverAddress)
}
func (c *nativeStore) Get(serverAddress string) (types.AuthConfig, error) {
	auth, _ := c.fileStore.Get(serverAddress)
	creds, err := c.getCredentialsFromStore(serverAddress)
	if err != nil {
		return auth, err
	}
	auth.Username = creds.Username
	auth.IdentityToken = creds.IdentityToken
	auth.Password = creds.Password
	return auth, nil
}
func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) {
	auths, err := c.listCredentialsInStore()
	if err != nil {
		return nil, err
	}
	fileConfigs, _ := c.fileStore.GetAll()
	authConfigs := make(map[string]types.AuthConfig)
	for registry := range auths {
		creds, err := c.getCredentialsFromStore(registry)
		if err != nil {
			return nil, err
		}
		ac := fileConfigs[registry]  
		ac.Username = creds.Username
		ac.Password = creds.Password
		ac.IdentityToken = creds.IdentityToken
		authConfigs[registry] = ac
	}
	return authConfigs, nil
}
func (c *nativeStore) Store(authConfig types.AuthConfig) error {
	if err := c.storeCredentialsInStore(authConfig); err != nil {
		return err
	}
	authConfig.Username = ""
	authConfig.Password = ""
	authConfig.IdentityToken = ""
	return c.fileStore.Store(authConfig)
}