Documentation
¶
Overview ¶
Package decrypt is the user-side half of Path A: unwrap the Data Key with the Recovery Key and restore a snapshot out of a Take-Out directory.
It is a package of its own so that the split of powers is structural rather than conventional: the admin's `takeout` binary links the parent package (extract, verify, publish) and never this one, and a test in cmd/takeout asserts that dependency graph (decisions.md #2, #15).
Exactly what that buys, stated honestly: the admin's binary contains no code that turns an envelope plus a Recovery Key into a Data Key, and none that turns a repository into files. It does still link pkg/keys, because extraction has to read an envelope's public header to record what it copied; the unwrap functions in that package are unreferenced there, which the same test file checks by reading the source.
Everything here is offline by construction — a local directory, a local kopia repository, no network client of any kind. This is the family's last resort, so it stays deliberately small: parse manifest, unwrap envelope, open repository, restore.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWrongRecoveryKey means the Recovery Key does not open this Take-Out. ErrWrongRecoveryKey = errors.New("takeout: key does not match this take-out") // ErrUnsupportedEnvelope means the envelope's format version is newer than // this tool understands. ErrUnsupportedEnvelope = errors.New("takeout: unsupported key envelope version") // ErrBadEnvelopeFile means the envelope file given in place of the // Take-Out's own is missing, unreadable or not a recovery-key envelope. ErrBadEnvelopeFile = errors.New("takeout: the envelope file is not a recovery key envelope") // ErrEnvelopeFileMismatch means the envelope file opened with the Recovery // Key but the Take-Out's repository did not open with what it held: the // file most likely belongs to another Space. ErrEnvelopeFileMismatch = errors.New("takeout: the envelope file does not belong to this take-out") )
Errors this package adds to the Take-Out set. Like those, they stay coarse on purpose: an unwrap failure must not hint at which part of the input was wrong, and no error ever carries key material.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Dir is the Take-Out directory.
Dir string
// RecoveryKey is the raw Recovery Key secret (as returned by
// keys.DecodeRecoveryKey). The caller owns and zeroizes the buffer.
RecoveryKey []byte
// OutDir receives the restored files. It is only created once the Recovery
// Key has been proven correct, so a wrong key leaves nothing behind.
OutDir string
// SnapshotID selects a snapshot; empty restores the newest one.
SnapshotID string
// WorkDir is the parent for kopia's throwaway cache. Empty uses the OS temp
// directory.
WorkDir string
// EnvelopeFile, when set, is used instead of the Take-Out's own envelope.
// It is what a member downloads from the web UI: the Space's *current*
// envelope. A Take-Out copies whatever the target held, which lags a
// Recovery Key replacement until the next backup run, and a Take-Out forced
// without an envelope holds none at all. The Data Key never changes, so
// the current envelope opens every Take-Out of the Space.
EnvelopeFile string
}
Options configures an offline restore.
type Snapshot ¶
Snapshot is one restorable snapshot inside a Take-Out.
func ListSnapshots ¶
ListSnapshots returns the snapshots inside a Take-Out, newest first. It needs the Recovery Key because snapshot metadata lives inside the encrypted repository — nothing about a backup is readable without it. OutDir and SnapshotID are ignored.