func Init(cwlPath string) {
	if _, err := os.Stat(cwlPath); err != nil {
		err := os.MkdirAll(cwlPath, os.ModePerm)
		if err != nil {
			log.Panicf("Failed to create cwlPath %s: %s\n", cwlPath, err)
		}
	}
	cwlFilePath = cwlPath + "/" + cwlFileName
	initContainerWhiteList()
	initialized = true
}
Init sets the environments for securemgr
package verifier
import (
	"errors"
	"io/ioutil"
	"os"
	"strings"
	"github.com/lf-edge/edge-home-orchestration-go/internal/common/logmgr"
)
const (
	cwlFileName = "containerwhitelist.txt"
	ErrorNone         = "ERROR_NONE"
	InvalidParameter  = "INVALID_PARAMETER"
	SecureMgrError    = "INTERNAL_SECUREMGR_ERROR"
	NotAllowedCommand = "NOT_ALLOWED_COMMAND"
)
type VerificationImpl struct{}
var (
	containerWhiteList []string
	logPrefix          = "[securemgr: verifier]"
	log                = logmgr.GetInstance()
	verifierIns        *VerificationImpl
	initialized        = false
	cwlFilePath        = ""
)
type RequestDescInfo struct {
	ContainerHash string
}
type RequestVerifierConf struct {
	SecureInsName string
	CmdType       string
	Desc          []RequestDescInfo
}
type ResponseVerifierConf struct {
	Message       string
	SecureCmpName string
}
type Conf interface {
	RequestVerifierConf(containerInfo RequestVerifierConf) ResponseVerifierConf
}
func init() {
	verifierIns = new(VerificationImpl)
}
func initContainerWhiteList() error {
	fileContent, err := ioutil.ReadFile(cwlFilePath)
	if err != nil {
		containerWhiteList = nil
		err = ioutil.WriteFile(cwlFilePath, []byte(""), 0666)
		if err != nil {
			log.Println(logPrefix, "cannot create "+cwlFileName+": ", err)
		}
	} else {
		containerWhiteList = strings.Split(string(fileContent), "\n")
		if len(containerWhiteList) > 0 {
			containerWhiteList = containerWhiteList[:len(containerWhiteList)-1]
		}
	}
	return err
}
func GetInstance() *VerificationImpl {
	return verifierIns
}
func containerHashIsInWhiteList(hash string) error {
	for _, whitelistItem := range containerWhiteList {
		if hash == whitelistItem {
			return nil
		}
	}
	return errors.New("container's hash: " + hash + " is not in container white list")
}
func getIndexHashInContainerName(containerName string) (int, error) {
	digestIndex := strings.Index(containerName, "@sha256:")
	if digestIndex == -1 {
		return -1, errors.New("container name does not contain a digest")
	}
	digestIndex = digestIndex + len("@sha256:")
	return digestIndex, nil
}