Documentation
¶
Overview ¶
Package kdfhelper defines the private, single-request KDF wire protocol. Linux execution uses a bounded same-binary worker before normal CLI startup.
Index ¶
Constants ¶
const ( // MaxRequestBytes bounds the complete request before parsing or allocation. MaxRequestBytes = 2048 // MaxResponseBytes bounds the complete response. MaxResponseBytes = 256 )
const PrivateArgument = "__xops_kdf_v1"
PrivateArgument selects a single-use worker before normal CLI initialization.
Variables ¶
var ( // ErrProcess hides untrusted process output while preserving exit failures. ErrProcess = errors.New("private KDF process failed") // ErrUnsupported fails closed on platforms not natively validated. ErrUnsupported = errors.New("private KDF process is unsupported") // ErrResource indicates insufficient observable memory or an enforced limit failure. ErrResource = errors.New("private KDF resource unavailable") )
var ErrProtocol = errors.New("invalid private KDF protocol frame")
ErrProtocol indicates an invalid frame without echoing potentially secret input.
Functions ¶
func ServeFiles ¶
ServeFiles is the private process entry. It accepts only bounded pipes and returns an exit code without logging, loading configuration or printing secrets.
Types ¶
type Capabilities ¶
Capabilities distinguishes Go's soft target from a kernel-enforced memory limit.
type Deriver ¶
Deriver permits deterministic session tests without doing KDF work in the host. Implementations honor ctx and transfer exclusive ownership of returned bytes, including on error; the caller may clear them immediately.
type Request ¶
Request owns its password bytes; Zero must be called when they are no longer needed.
func ParseRequest ¶
ParseRequest validates all framing and KDF parameters before copying a password. The transport must separately ensure EOF, a deadline and the same byte limit.
func (Request) MarshalBinary ¶
MarshalBinary emits the fixed approved parameters; callers must clear the frame.
type Response ¶
Response owns a key only on success. Process status must still be checked.
func ParseResponse ¶
ParseResponse rejects trailing data, unknown statuses and keys on failure frames.
func (Response) MarshalBinary ¶
MarshalBinary emits one bounded response. The caller must clear the output.
type Runner ¶
Runner launches the current binary, with a bounded process lifetime. An explicit delegated cgroup directory can enforce the provisional 128 MiB limit on Linux. Empty CgroupParent never elevates privileges and reports a soft-only capability.
func (Runner) Capabilities ¶
func (r Runner) Capabilities() Capabilities
Capabilities reports requested enforcement; Derive fails if it cannot establish it.
type Status ¶
type Status byte
Status is a fixed, non-textual response classification.
const ( // Success must also be accompanied by a successful process exit. Success Status = iota // InvalidRequest indicates malformed input. InvalidRequest // UnsupportedVersion indicates a protocol version mismatch. UnsupportedVersion // ResourceFailure indicates a reliably identified resource failure. ResourceFailure // InternalFailure indicates other helper failure. InternalFailure )