bundle

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateZip

func CreateZip(path string, files []ZipFile) error

CreateZip creates a ZIP archive at the given path with the given files.

func ExtractManifestFromZip added in v0.0.15

func ExtractManifestFromZip(zipPath string) ([]byte, error)

ExtractManifestFromZip opens a bundle ZIP and extracts the encrypted manifest data. It looks for MANIFEST.age first. If not found, it falls back to extracting the manifest embedded in recover.html.

func ExtractShareFromZip added in v0.0.15

func ExtractShareFromZip(zipPath string) (*core.Share, error)

ExtractShareFromZip opens a bundle ZIP and parses the share from the README.txt inside it.

func GenerateAll

func GenerateAll(p *project.Project, cfg Config) error

GenerateAll creates bundles for all friends in the project.

func GenerateBundle

func GenerateBundle(params BundleParams) error

GenerateBundle creates a single bundle ZIP file for one friend.

func GenerateReadme

func GenerateReadme(data ReadmeData) string

GenerateReadme creates the README.txt content with all embedded information.

func VerifyBundle

func VerifyBundle(bundlePath string) error

VerifyBundle verifies the integrity of a bundle ZIP file. Returns nil if valid, or an error describing the problem.

Types

type BundleParams

type BundleParams struct {
	OutputPath       string
	ProjectName      string
	Friend           project.Friend
	Share            *core.Share
	OtherFriends     []project.Friend
	Threshold        int
	Total            int
	ManifestData     []byte
	ManifestChecksum string
	ManifestEmbedded bool // true when manifest is base64-embedded in recover.html
	RecoverHTML      string
	RecoverChecksum  string
	Version          string
	GitHubReleaseURL string
	SealedAt         time.Time
	Anonymous        bool
	RecoveryURL      string
	Language         string // Bundle language for this friend
	TlockEnabled     bool   // true when manifest uses time-lock encryption
}

BundleParams contains all parameters for generating a single bundle.

type Config

type Config struct {
	Version         string // Tool version (e.g., "v1.0.0")
	RecoveryURL     string // Optional: base URL for QR code (e.g. "https://example.com/recover.html")
	NoEmbedManifest bool   // If true, do not embed MANIFEST.age in recover.html even when small enough
	TlockEnabled    bool   // If true, bundles include tlock-js for time-lock decryption
}

Config holds configuration for bundle generation.

type ReadmeData

type ReadmeData struct {
	ProjectName      string
	Holder           string
	Share            *core.Share
	OtherFriends     []project.Friend
	Threshold        int
	Total            int
	Version          string
	GitHubReleaseURL string
	ManifestChecksum string
	RecoverChecksum  string
	Created          time.Time
	Anonymous        bool
	Language         string // Bundle language (e.g. "en", "es"); defaults to "en"
	ManifestEmbedded bool   // true when manifest is embedded in recover.html
	TlockEnabled     bool   // true when manifest uses time-lock encryption
}

ReadmeData contains all data needed to generate README.txt

type ZipFile

type ZipFile struct {
	Name    string
	Content []byte
	ModTime time.Time
}

ZipFile represents a file to be added to a ZIP archive.

Jump to

Keyboard shortcuts

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