func (s *Service) checkAccess(ctx context.Context, credentials *checker.Credentials, accountName string, action string) core.Result {
	if s.checker.Check(ctx, credentials, accountName, action) {
		return core.ResultSucceeded
	}
	return core.ResultDenied
}
checkAccess returns true if the client can access the account.
package standard
import (
	context "context"
	"fmt"
	"github.com/attestantio/dirk/core"
	"github.com/attestantio/dirk/services/checker"
	e2wtypes "github.com/wealdtech/go-eth2-wallet-types/v2"
)
func (s *Service) preCheck(ctx context.Context, credentials *checker.Credentials, name string, pubKey []byte, action string) (e2wtypes.Wallet, e2wtypes.Account, core.Result) {
	wallet, account, result := s.fetchAccount(ctx, credentials, name, pubKey)
	if result != core.ResultSucceeded {
		return nil, nil, result
	}
	accountName := fmt.Sprintf("%s/%s", wallet.Name(), account.Name())
	result = s.checkAccess(ctx, credentials, accountName, action)
	if result != core.ResultSucceeded {
		return nil, nil, result
	}
	return wallet, account, core.ResultSucceeded
}
func (s *Service) fetchAccount(ctx context.Context, credentials *checker.Credentials, name string, pubKey []byte) (e2wtypes.Wallet, e2wtypes.Account, core.Result) {
	if name == "" && pubKey == nil {
		log.Warn().Str("result", "denied").Msg("Neither account nor public key supplied; denied")
		return nil, nil, core.ResultDenied
	}
	var wallet e2wtypes.Wallet
	var account e2wtypes.Account
	var err error
	if pubKey == nil {
		wallet, account, err = s.fetcher.FetchAccount(ctx, name)
	} else {
		wallet, account, err = s.fetcher.FetchAccountByKey(ctx, pubKey)
	}
	if err != nil {
		log.Warn().Err(err).Str("result", "denied").Msg("Did not obtain account; denied")
		return nil, nil, core.ResultDenied
	}
	return wallet, account, core.ResultSucceeded
}