func (t *Manifest) Verify() error {
	for _, f := range t.File {
		path := filepath.Join(t.dir, f.Path)
		sha, err := core.FileSHA256Sum(path)
		if err != nil {
			return err
		}
		if sha != f.Sha256 {
			return fmt.Errorf("Invalid SHA256 for '%s'. Local: '%s'", f.Path, sha)
		}
	}
	return nil
}
Verify will verify the files listed in the manifest locally, ensuring
that they actually exist, and that the hashes match to prevent any corrupted
uploads being inadvertently imported
package manifest
import (
	"errors"
	"fmt"
	"github.com/BurntSushi/toml"
	"github.com/getsolus/ferryd/core"
	"io/ioutil"
	"path/filepath"
	"strings"
)
const (
	Suffix = ".tram"
)
var (
	ErrInvalidHeader = errors.New("Manifest contains an invalid header")
	ErrMissingTarget = errors.New("Manifest contains no target")
	ErrMissingPayload = errors.New("Manifest does not contain a payload")
	ErrInvalidPayload = errors.New("Manifest contains an invalid payload")
	ErrIllegalUpload = errors.New("The manifest file is NOT an eopkg")
)
type Header struct {
	Version string `toml:"version"`
	Target string `toml:"target"`
}
type Manifest struct {
	Head Header `toml:"manifest"`
	File []File `toml:"file"`
	Path string  
	dir  string  
	id   string  
}
func (t *Manifest) ID() string {
	return t.id
}
func (t *Manifest) GetPaths() (ret []string) {
	for _, f := range t.File {
		ret = append(ret, filepath.Join(t.dir, f.Path))
	}
	return
}
type File struct {
	Path string `toml:"path"`
	Sha256 string `toml:"sha256"`
}
func NewManifest(path string) (mf *Manifest, err error) {
	abs, err := filepath.Abs(path)
	if err != nil {
		return
	}
	mf = &Manifest{
		Path: abs,
		dir:  filepath.Dir(abs),
		id:   filepath.Base(abs),
	}
	blob, err := ioutil.ReadFile(mf.Path)
	if err != nil {
		return
	}
	if _, err = toml.Decode(string(blob), mf); err != nil {
		return
	}
	mf.Head.Target = strings.TrimSpace(mf.Head.Target)
	mf.Head.Version = strings.TrimSpace(mf.Head.Version)
	if mf.Head.Version != "1.0" {
		err = ErrInvalidHeader
		return
	}
	if len(mf.Head.Target) == 0 {
		err = ErrMissingTarget
		return
	}
	if len(mf.File) == 0 {
		err = ErrMissingPayload
		return
	}
	for i := range mf.File {
		f := &mf.File[i]
		f.Path = strings.TrimSpace(f.Path)
		f.Sha256 = strings.TrimSpace(f.Sha256)
		if len(f.Path) == 0 || len(f.Sha256) == 0 {
			err = ErrInvalidPayload
			return
		}
		if !strings.HasSuffix(f.Path, ".eopkg") {
			err = ErrIllegalUpload
			return
		}
	}
	return
}