backupcustody

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package backupcustody owns the local Kopia repository passphrase without adding it to the Basement runtime-custody inventory.

Index

Constants

View Source
const (
	// APIVersion identifies the on-disk, owner-bound backup custody contract.
	APIVersion = "stackkit.local-backup-passphrase-custody/v1"
)

Variables

View Source
var ErrMissing = errors.New("backupcustody: no local backup passphrase custody")

ErrMissing reports that no local backup passphrase custody exists.

Functions

func Clear

func Clear(secret []byte)

Clear overwrites one caller-owned secret copy.

func EstablishS3Target

func EstablishS3Target(workspace string, authority S3TargetAuthority, material S3TargetMaterial) error

EstablishS3Target binds one immutable target to an exact owner-approved Plan. Validation uses the native engine boundary without executing an operation.

func ProtectPrivatePath

func ProtectPrivatePath(path string, directory bool) error

func RebindS3Target

func RebindS3Target(workspace string, authority S3TargetAuthority, material S3TargetMaterial) error

RebindS3Target renews source/Plan authority while preserving identical target and credentials. The caller must hold the owner-authorized lifecycle mutation.

func RequirePrivatePath

func RequirePrivatePath(path string, directory bool) error

func S3TargetReferences

func S3TargetReferences(workspace string, material S3TargetMaterial) (targetRef, custodyRef string, err error)

S3TargetReferences commits actual consumer bytes with the owner's existing private wrapping key. Public references cannot be dictionary-tested for endpoints.

func VerifyS3RebindMaterial

func VerifyS3RebindMaterial(workspace string, material S3TargetMaterial) error

VerifyS3RebindMaterial checks unchanged target material before Inventory mutation.

Types

type Custody

type Custody struct {
	APIVersion    string                                  `json:"apiVersion"`
	Kind          string                                  `json:"kind"`
	OwnerRef      string                                  `json:"ownerRef"`
	KeyID         string                                  `json:"keyId"`
	EstablishedAt time.Time                               `json:"establishedAt"`
	SecretDigest  string                                  `json:"secretDigest"`
	Signature     localevidence.OwnerPolicyStateSignature `json:"signature"`
}

Custody is the secret-free, owner-signed index for one local Kopia passphrase. SecretDigest binds the separate private file without placing the high-entropy passphrase in JSON. It is an integrity commitment, not a password verifier.

func Establish

func Establish(workspaceRoot string) (Custody, []byte, error)

Establish creates one random local Kopia passphrase exactly once. The returned bytes are a short-lived copy owned by the caller; call Clear as soon as the Kopia invocation has consumed them.

func Load

func Load(workspaceRoot string) (Custody, []byte, error)

Load verifies the current owner binding, owner signature, private-file mode, and passphrase digest before returning a fresh caller-owned byte slice.

type S3TargetAuthority

type S3TargetAuthority struct {
	Binding      generationartifact.ApplyBackupTargetBindingRequirement `json:"binding"`
	SourceDigest string                                                 `json:"sourceDigest"`
}

S3TargetAuthority is projected from the verified Plan, never from secret input.

func StoredS3TargetAuthority

func StoredS3TargetAuthority(workspace string) (S3TargetAuthority, error)

StoredS3TargetAuthority verifies owner custody without treating an expired binding as current authority. Only explicit rebind uses this historical value.

type S3TargetMaterial

type S3TargetMaterial struct {
	Endpoint        string `json:"endpoint"`
	Bucket          string `json:"bucket"`
	Prefix          string `json:"prefix"`
	Region          string `json:"region"`
	AccessKeyID     string `json:"accessKeyId"`
	SecretAccessKey string `json:"secretAccessKey"`
	Passphrase      []byte `json:"passphrase"`
}

S3TargetMaterial stays encrypted in local owner custody. It never enters a Plan.

func LoadS3Target

func LoadS3Target(workspace string, authority S3TargetAuthority) (S3TargetMaterial, error)

LoadS3Target verifies owner, exact target/source binding and ciphertext before decryption.

Jump to

Keyboard shortcuts

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