Documentation
¶
Overview ¶
Package guard defines the veto a host application holds over retiring and destroying keys.
Destroying a key is irreversible, and whether it is safe depends on things keyforge cannot see: a legal hold, a retention duty, an export or snapshot in the inline mode that no registry record points at, a backup that must stay restorable. The host knows. A Guard is how it says so.
A guard is consulted before a version is retired and again before it is destroyed. It may allow, deny with a reason, or answer that an approval is still outstanding. Only an allow advances the state; anything else leaves the key usable.
Index ¶
Constants ¶
const ErrNoGuard = "no destroy guard is configured"
ErrNoGuard is the reason recorded when no guard is configured. With none, nothing is retired or destroyed: the absence of a veto is not consent.
Variables ¶
var ErrBadDecision = errors.New("guard: not a valid decision")
ErrBadDecision is returned when a guard answers with an outcome that is not one of the three.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision struct {
Outcome Outcome
// Reason is recorded in the audit trail. It must not name key material.
Reason string
}
Decision is a guard's answer and why.
func AwaitApproval ¶
AwaitApproval returns a decision that says an approval is outstanding.
type Guard ¶
Guard decides whether a retirement or destruction may proceed.
An error is not an answer: a guard that cannot decide returns it, and the action does not proceed.
func All ¶
All combines guards: every one is consulted, a denial from any refuses, and otherwise a pending answer from any is pending; the action proceeds only if all allow. An error from any guard is an error. With no guards it denies.
type Request ¶
type Request struct {
Action Action
Purpose keyforge.Purpose
KEKID envelope.ID
Version uint32
// DEKID names the data key when the request is about one, in place of a
// KEK version.
DEKID envelope.ID
// Actor is who asked, as the host named them, if anyone.
Actor string
// References is how many data keys in the registry are still wrapped under
// the version. It is zero when retirement completes; it says nothing about
// data outside the registry, which only the host knows about.
References int
// Emergency is true during an emergency rotation. The guard is consulted and
// its answer is recorded, but it cannot block the procedure.
Emergency bool
}
Request describes what the guard is asked to decide.