project

package
v0.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectFileName = "project.yml"
	ManifestDir     = "manifest"
	OutputDir       = "output"
	SharesDir       = "shares"
)

Variables

This section is empty.

Functions

func FindProjectDir

func FindProjectDir(startDir string) (string, error)

FindProjectDir searches up the directory tree for a project.yml file. Returns the directory containing the project, or an error if not found.

func FriendNames

func FriendNames(friends []Friend) string

FriendNames returns a comma-separated list of friend names.

func RenderManifestReadme added in v0.0.13

func RenderManifestReadme(data TemplateData) ([]byte, error)

RenderManifestReadme renders the manifest README template to bytes. Used at seal time to detect an untouched template.

func WriteManifestReadme

func WriteManifestReadme(manifestDir string, data TemplateData) error

WriteManifestReadme creates the README.md file in the manifest directory.

Types

type Friend

type Friend struct {
	Name     string `yaml:"name"`
	Contact  string `yaml:"contact,omitempty"`
	Language string `yaml:"language,omitempty"` // Bundle language override (e.g. "en", "es", "de", "fr", "sl", "pt", "zh-TW")
}

Friend represents a person who will hold a share.

type Project

type Project struct {
	Name      string   `yaml:"name"`
	Created   string   `yaml:"created"`
	Threshold int      `yaml:"threshold"`
	Anonymous bool     `yaml:"anonymous,omitempty"`
	Language  string   `yaml:"language,omitempty"` // Default bundle language (e.g. "en", "es", "de", "fr", "sl", "pt", "zh-TW")
	Friends   []Friend `yaml:"friends"`
	Sealed    *Sealed  `yaml:"sealed,omitempty"`

	// Path is the directory containing this project (not serialized)
	Path string `yaml:"-"`
}

Project represents a rememory project configuration.

func Load

func Load(dir string) (*Project, error)

Load reads a project from a directory.

func New

func New(dir, name string, threshold int, friends []Friend) (*Project, error)

New creates a new project with the given configuration.

func NewAnonymous added in v0.0.5

func NewAnonymous(dir, name string, threshold int, numShares int) (*Project, error)

NewAnonymous creates a new anonymous project (no contact info).

func NewWithOptions added in v0.0.5

func NewWithOptions(dir, name string, threshold int, friends []Friend, anonymous bool) (*Project, error)

NewWithOptions creates a new project with the given configuration.

func (*Project) ManifestAgePath

func (p *Project) ManifestAgePath() string

ManifestAgePath returns the path to the encrypted manifest.

func (*Project) ManifestPath

func (p *Project) ManifestPath() string

ManifestPath returns the path to the manifest directory.

func (*Project) OutputPath

func (p *Project) OutputPath() string

OutputPath returns the path to the output directory.

func (*Project) PagesPath added in v0.0.16

func (p *Project) PagesPath() string

PagesPath returns the path to the static pages output directory.

func (*Project) Save

func (p *Project) Save() error

Save writes the project configuration to disk.

func (*Project) SharesPath

func (p *Project) SharesPath() string

SharesPath returns the path to the shares directory.

func (*Project) Validate

func (p *Project) Validate() error

Validate checks that the project configuration is valid.

type Sealed

type Sealed struct {
	At               time.Time   `yaml:"at"`
	ManifestChecksum string      `yaml:"manifest_checksum"`
	VerificationHash string      `yaml:"verification_hash"`
	Shares           []ShareInfo `yaml:"shares"`
	TlockEnabled     bool        `yaml:"tlock_enabled,omitempty"`
	TlockRound       uint64      `yaml:"tlock_round,omitempty"`
	TlockUnlockTime  *time.Time  `yaml:"tlock_unlock_time,omitempty"`
}

SealedInfo stores information about the sealed manifest.

type ShareInfo

type ShareInfo struct {
	Friend   string `yaml:"friend"`
	File     string `yaml:"file"`
	Checksum string `yaml:"checksum"`
}

ShareInfo stores information about a generated share.

type TemplateData

type TemplateData struct {
	ProjectName string
	Friends     []Friend
	Threshold   int
}

TemplateData contains data for rendering templates.

func TemplateDataFromProject added in v0.0.13

func TemplateDataFromProject(p *Project) TemplateData

TemplateDataFromProject builds TemplateData from a Project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL