pack

package
v0.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pack produces evidence packages and signed key lists in the format defined by package evidence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assemble

func Assemble(ctx context.Context, requestID string, evidenceJSON []byte, in Input) ([]byte, error)

Assemble signs evidenceJSON, timestamps the JWS and zips the package.

func Build

func Build(ctx context.Context, ev *evidence.Evidence, in Input) ([]byte, error)

Build links ev's events, canonicalises it and assembles the package. The caller fills ev.Document from the original and final PDFs.

func Link(events []evidence.Event) error

Link sets Seq, PrevHash and Hash on events in order.

func NewManifest

func NewManifest(requestID string, files map[string][]byte) ([]byte, error)

NewManifest returns the canonical manifest for files (manifest excluded).

func SignJWS

func SignJWS(s crypto.Signer, kid string, payload []byte) ([]byte, error)

SignJWS returns a detached compact ES256 JWS over payload with header kid.

func SignKeyList

func SignKeyList(root crypto.Signer, kl evidence.KeyList) ([]byte, error)

SignKeyList signs the canonical key list with the root key as a flattened JWS JSON document carrying the root public key in its protected header.

func WriteZip

func WriteZip(files map[string][]byte) ([]byte, error)

WriteZip writes files in name order with the manifest first.

Types

type Input

type Input struct {
	// Original and Final are the PDFs stored as original.pdf and final.pdf.
	Original []byte
	Final    []byte
	// SealChain is the seal certificate followed by its intermediates.
	SealChain []*x509.Certificate
	// KeyList is the signed key list stored as keys/keys.json.
	KeyList []byte
	// Signer signs evidence.json with ES256; KeyID is the kid in the JWS
	// header and must appear in KeyList.
	Signer crypto.Signer
	KeyID  string
	// Timestamper timestamps the evidence signature.
	Timestamper Timestamper
}

Input is what a package needs besides evidence.json.

type Timestamper

type Timestamper interface {
	// Timestamp returns an RFC 3161 TimeStampToken over SHA-256(data).
	Timestamp(ctx context.Context, data []byte) ([]byte, error)
}

Timestamper obtains RFC 3161 timestamps.

Jump to

Keyboard shortcuts

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