Documentation
¶
Overview ¶
Package recipe strictly parses, applies, and generates bounded DKIM2 message reconstruction recipes for draft-ietf-dkim-dkim2-spec-09.
The package owns the decoded RFC 8259 schema, immutable recipe plans, reconstruction state, resource accounting, transactional application, and deterministic inverse generation from a current source state to a previous target state. Generated compact decoded JSON is conservative and reproducible but not required to be minimal. Copy-only disclosure and unavailable-body behavior are explicit closed policies, and every recipe success passes the package's strict parse, apply, and semantic reconstruction proof first.
Message-Instance base64 remains owned by instance, RFC 5322 bytes remain owned by rawmsg, and signed-header relevance and canonical hashes remain owned by canonical. Authenticated history remains owned by verify. Hash-gated revision decisions, Message-Instance formatting, and signing are outside this package.
Index ¶
- func IsErrorCode(err error, code ErrorCode) bool
- func IsJSONSyntaxError(err error) bool
- type Applier
- type BodyAvailability
- type BodyGenerationOutcome
- type BodyMode
- type BodyUnavailablePolicy
- type BodyUnavailableReason
- type ChangeClass
- type Descriptor
- func (d Descriptor) AffectedHeaderCount() int
- func (d Descriptor) AffectedHeaders() []string
- func (d Descriptor) BodyMode() BodyMode
- func (d Descriptor) ChangeClasses() []ChangeClass
- func (d Descriptor) ChangeCount() int
- func (d Descriptor) Digest() [sha256.Size]byte
- func (Descriptor) Format(state fmt.State, _ rune)
- func (Descriptor) GoString() string
- func (d Descriptor) HasHeaderChanges() bool
- func (Descriptor) String() string
- func (d Descriptor) Valid() bool
- type Dimension
- type Error
- type ErrorClass
- type ErrorCode
- type ErrorDetails
- type ErrorLocation
- type Generation
- type GenerationLimits
- type GenerationOutcome
- type GenerationRequest
- type GenerationUsage
- func (u GenerationUsage) CandidateKeyBytes() int
- func (u GenerationUsage) Candidates() int
- func (u GenerationUsage) Comparisons() int
- func (u GenerationUsage) GeneratedLiterals() int
- func (u GenerationUsage) GeneratedSteps() int
- func (u GenerationUsage) InputBytes() int
- func (u GenerationUsage) InputItems() int
- func (u GenerationUsage) JSONBytes() int
- func (u GenerationUsage) LiteralBytes() int
- func (u GenerationUsage) ProofWorkUnits() int
- func (u GenerationUsage) Valid() bool
- func (u GenerationUsage) WorkUnits() int
- type Generator
- type HeaderRelevance
- type Limits
- type LiteralDisclosurePolicy
- type Parser
- type Recipe
- type State
- type StepKind
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrorCode ¶
IsErrorCode reports whether err contains a recipe Error with code.
func IsJSONSyntaxError ¶
IsJSONSyntaxError reports whether err is a recipe failure of the JSON text itself: malformed RFC 8259 syntax, a repeated member name, or a root that is not a JSON object. Draft-09 Section 14.2 reports these as "contains invalid JSON"; every schema, step, range, literal, or application failure of otherwise valid JSON is instead "Recipe <value> is invalid".
Types ¶
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
Applier owns immutable recipe application limits and reconstruction policy.
func NewApplier ¶
NewApplier constructs one fail-closed recipe applier.
func (Applier) Apply ¶
Apply transactionally reconstructs both recipe dimensions under one operation budget.
func (Applier) ApplyHistorical ¶
ApplyHistorical strictly applies reconstructable dimensions after an explicit body-unavailable boundary.
type BodyAvailability ¶
type BodyAvailability string
BodyAvailability identifies whether reconstructed body bytes exist.
const ( // BodyAvailabilityKnown reports validated body bytes and indexing. BodyAvailabilityKnown BodyAvailability = "known" BodyAvailabilityUnavailable BodyAvailability = "unavailable" )
func (BodyAvailability) Known ¶
func (a BodyAvailability) Known() bool
Known reports whether availability belongs to the closed recipe vocabulary.
type BodyGenerationOutcome ¶
type BodyGenerationOutcome string
BodyGenerationOutcome identifies the generated recipe's body dimension.
const ( // BodyGenerationUnchanged reports that the body member is omitted. BodyGenerationUnchanged BodyGenerationOutcome = "unchanged" // BodyGenerationGenerated reports that body steps reconstruct the previous body. BodyGenerationGenerated BodyGenerationOutcome = "generated" BodyGenerationUnavailable BodyGenerationOutcome = "unavailable" )
func (BodyGenerationOutcome) Known ¶
func (o BodyGenerationOutcome) Known() bool
Known reports whether outcome belongs to the closed body-generation vocabulary.
type BodyUnavailablePolicy ¶
type BodyUnavailablePolicy uint8
BodyUnavailablePolicy controls whether an unrepresentable previous body may become b:null.
const ( RejectUnavailableBody BodyUnavailablePolicy = iota // outcome (Draft-09 Section 12.1 MAY). The resulting history is never // Fully Verified (Sections 13 and 14.2), so later verifiers report // PERMERROR body_history_unavailable and later signers refuse it. AllowUnavailableBody )
func (BodyUnavailablePolicy) Known ¶
func (p BodyUnavailablePolicy) Known() bool
Known reports whether policy belongs to the closed unavailable-body vocabulary.
type BodyUnavailableReason ¶
type BodyUnavailableReason string
BodyUnavailableReason identifies a non-sensitive reason for an authorized b:null result.
const ( BodyUnavailableReasonUnrepresentable BodyUnavailableReason = "unrepresentable" BodyUnavailableReasonLiteralRequired BodyUnavailableReason = "literal_required" )
func (BodyUnavailableReason) Known ¶
func (r BodyUnavailableReason) Known() bool
Known reports whether reason belongs to the closed unavailable-body vocabulary.
type ChangeClass ¶
type ChangeClass string
ChangeClass identifies one conservative normalized Recipe change dimension.
const ( // ChangeClassBodyRewrite reports an authenticated body reconstruction recipe. ChangeClassBodyRewrite ChangeClass = "body.rewrite" // ChangeClassHeaderRewrite reports one or more authenticated header reconstruction recipes. ChangeClassHeaderRewrite ChangeClass = "header.rewrite" )
func (ChangeClass) Known ¶
func (c ChangeClass) Known() bool
Known reports whether the change class belongs to the closed descriptor vocabulary.
type Descriptor ¶
type Descriptor struct {
// contains filtered or unexported fields
}
Descriptor stores a privacy-minimized immutable Recipe projection.
func UnchangedDescriptor ¶
func UnchangedDescriptor() Descriptor
UnchangedDescriptor returns the canonical descriptor for an absent Recipe.
func (Descriptor) AffectedHeaderCount ¶
func (d Descriptor) AffectedHeaderCount() int
AffectedHeaderCount returns the coherence count for AffectedHeaders.
func (Descriptor) AffectedHeaders ¶
func (d Descriptor) AffectedHeaders() []string
AffectedHeaders returns sorted unique canonical lower-case header names.
func (Descriptor) BodyMode ¶
func (d Descriptor) BodyMode() BodyMode
BodyMode returns the exact Draft-09 body member form.
func (Descriptor) ChangeClasses ¶
func (d Descriptor) ChangeClasses() []ChangeClass
ChangeClasses returns the sorted closed conservative change dimensions.
func (Descriptor) ChangeCount ¶
func (d Descriptor) ChangeCount() int
ChangeCount returns the number of normalized change dimensions.
func (Descriptor) Digest ¶
func (d Descriptor) Digest() [sha256.Size]byte
Digest returns the SHA-256 binding of the normalized descriptor.
func (Descriptor) Format ¶
func (Descriptor) Format(state fmt.State, _ rune)
Format prevents formatting verbs from exposing message-derived descriptor facts.
func (Descriptor) GoString ¶
func (Descriptor) GoString() string
GoString returns a constant representation without message-derived names or counts.
func (Descriptor) HasHeaderChanges ¶
func (d Descriptor) HasHeaderChanges() bool
HasHeaderChanges reports whether h= contains at least one header dimension.
func (Descriptor) String ¶
func (Descriptor) String() string
String returns a constant representation without message-derived names or counts.
func (Descriptor) Valid ¶
func (d Descriptor) Valid() bool
Valid reports whether the descriptor is a coherent closed projection.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a typed recipe failure that never retains input-derived causes.
func (*Error) Class ¶
func (e *Error) Class() ErrorClass
Class returns the closed recipe error class.
func (*Error) Dimension ¶
Dimension returns the closed recipe dimension associated with the failure.
func (*Error) Location ¶
func (e *Error) Location() ErrorLocation
Location returns bounded structural coordinates.
type ErrorClass ¶
type ErrorClass string
ErrorClass groups recipe failures without retaining input.
const ( // ErrorClassOptions identifies constructor configuration failures. ErrorClassOptions ErrorClass = "options" // ErrorClassState identifies invalid domain states. ErrorClassState ErrorClass = "state" // ErrorClassLimit identifies resource-limit failures. ErrorClassLimit ErrorClass = "limit" // ErrorClassSyntax identifies malformed JSON text. ErrorClassSyntax ErrorClass = "syntax" // ErrorClassSchema identifies recipe-v1 shape failures. ErrorClassSchema ErrorClass = "schema" // ErrorClassRange identifies invalid copy coordinates. ErrorClassRange ErrorClass = "range" // ErrorClassSource identifies unavailable reconstruction input. ErrorClassSource ErrorClass = "source" // ErrorClassRequest identifies invalid generation requests. ErrorClassRequest ErrorClass = "request" // ErrorClassPolicy identifies invalid closed generation policy values. ErrorClassPolicy ErrorClass = "policy" // ErrorClassRepresentation identifies content that recipes cannot represent. ErrorClassRepresentation ErrorClass = "representation" // ErrorClassSerialization identifies deterministic output encoding failures. ErrorClassSerialization ErrorClass = "serialization" // ErrorClassInvariant identifies internal dependency or proof disagreement. ErrorClassInvariant ErrorClass = "invariant" )
func (ErrorClass) Known ¶
func (c ErrorClass) Known() bool
Known reports whether class belongs to the closed recipe vocabulary.
type ErrorCode ¶
type ErrorCode string
ErrorCode identifies one closed recipe failure.
const ( // ErrorCodeInvalidOptions reports unsafe or incoherent recipe limits. ErrorCodeInvalidOptions ErrorCode = "invalid_options" // ErrorCodeInvalidState reports a zero or incoherent recipe domain value. ErrorCodeInvalidState ErrorCode = "invalid_state" // ErrorCodeLimitExceeded reports a bounded resource limit failure. ErrorCodeLimitExceeded ErrorCode = "limit_exceeded" // ErrorCodeInvalidJSON reports malformed RFC 8259 syntax. ErrorCodeInvalidJSON ErrorCode = "invalid_json" // ErrorCodeDuplicateMember reports repeated JSON object names. ErrorCodeDuplicateMember ErrorCode = "duplicate_member" // ErrorCodeInvalidTopLevel reports a non-object recipe root. ErrorCodeInvalidTopLevel ErrorCode = "invalid_top_level" // ErrorCodeMissingRecipeDimension reports a root without h or b. ErrorCodeMissingRecipeDimension ErrorCode = "missing_recipe_dimension" // ErrorCodeInvalidHeaderName reports a non-RFC 5322 recipe key. ErrorCodeInvalidHeaderName ErrorCode = "invalid_header_name" // ErrorCodeNonLowercaseHeaderName reports a decoded recipe key that is not lowercase. ErrorCodeNonLowercaseHeaderName ErrorCode = "non_lowercase_header_name" // ErrorCodeNonLowercaseKey reports a decoded JSON object key that is not lowercase. ErrorCodeNonLowercaseKey ErrorCode = "non_lowercase_key" // ErrorCodeUnsignedHeaderRecipe reports a header recipe for a field that is never signed. ErrorCodeUnsignedHeaderRecipe ErrorCode = "unsigned_header_recipe" // ErrorCodeHeaderNameCollision reports ASCII case-folded key duplication. ErrorCodeHeaderNameCollision ErrorCode = "header_name_collision" // ErrorCodeInvalidHeaderRecipe reports an invalid h member shape. ErrorCodeInvalidHeaderRecipe ErrorCode = "invalid_header_recipe" // ErrorCodeInvalidBodyRecipe reports an invalid b member shape. ErrorCodeInvalidBodyRecipe ErrorCode = "invalid_body_recipe" // ErrorCodeInvalidStep reports an unknown or mixed recipe step. ErrorCodeInvalidStep ErrorCode = "invalid_step" // ErrorCodeInvalidCopyRange reports invalid inclusive copy coordinates. ErrorCodeInvalidCopyRange ErrorCode = "invalid_copy_range" // ErrorCodeCopyRangeOrder reports overlapping or descending copy ranges. ErrorCodeCopyRangeOrder ErrorCode = "copy_range_order" // ErrorCodeCopyRangeOutOfBounds reports a range outside its source. ErrorCodeCopyRangeOutOfBounds ErrorCode = "copy_range_out_of_bounds" // ErrorCodeInvalidLiteral reports invalid UTF-8, invalid base64, or line-breaking data. ErrorCodeInvalidLiteral ErrorCode = "invalid_literal" ErrorCodeSourceUnavailable ErrorCode = "source_unavailable" // ErrorCodeInvalidGenerator reports a zero or invalid generation dependency set. ErrorCodeInvalidGenerator ErrorCode = "invalid_generator" // ErrorCodeInvalidRequest reports an invalid generation request or unknown body state. ErrorCodeInvalidRequest ErrorCode = "invalid_request" // ErrorCodeInvalidPolicy reports a value outside a closed generation policy. ErrorCodeInvalidPolicy ErrorCode = "invalid_policy" // ErrorCodeHeaderRelevance reports invalid, failing, or inconsistent relevance classification. ErrorCodeHeaderRelevance ErrorCode = "header_relevance" // ErrorCodeHeaderUnrepresentable reports a relevant header state that cannot be reconstructed. ErrorCodeHeaderUnrepresentable ErrorCode = "header_unrepresentable" // ErrorCodeBodyUnrepresentable reports a body state rejected by unavailable-body policy. ErrorCodeBodyUnrepresentable ErrorCode = "body_unrepresentable" // ErrorCodeSerializationFailure reports deterministic decoded-JSON serialization failure. ErrorCodeSerializationFailure ErrorCode = "serialization_failure" // ErrorCodeGeneratedOutputInvariant reports an internal generated parse or apply proof failure. ErrorCodeGeneratedOutputInvariant ErrorCode = "generated_output_invariant" // ErrorCodeReconstructionMismatch reports generated output that does not reconstruct the target. ErrorCodeReconstructionMismatch ErrorCode = "reconstruction_mismatch" )
type ErrorDetails ¶
type ErrorDetails struct {
Class ErrorClass
LimitName string
Expected int
Actual int
Dimension Dimension
StepKind StepKind
}
ErrorDetails carries bounded closed recipe diagnostics.
type ErrorLocation ¶
type ErrorLocation struct {
Offset int
StepIndex int
MemberIndex int
HeaderOrdinal int
BodyLine int
}
ErrorLocation carries bounded structural coordinates only.
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation stores one immutable closed generation success.
func (Generation) BodyOutcome ¶
func (g Generation) BodyOutcome() BodyGenerationOutcome
BodyOutcome returns the closed body generation outcome.
func (Generation) BodyUnavailableReason ¶
func (g Generation) BodyUnavailableReason() BodyUnavailableReason
BodyUnavailableReason returns the reason only for an unavailable-body result.
func (Generation) DecodedJSON ¶
func (g Generation) DecodedJSON() []byte
DecodedJSON returns a detached copy of protected decoded recipe JSON.
func (Generation) Outcome ¶
func (g Generation) Outcome() GenerationOutcome
Outcome returns the closed top-level generation outcome.
func (Generation) Recipe ¶
func (g Generation) Recipe() (Recipe, bool)
Recipe returns a detached immutable recipe for recipe success.
func (Generation) Valid ¶
func (g Generation) Valid() bool
Valid reports whether generation is a coherent unchanged or recipe success.
type GenerationLimits ¶
type GenerationLimits struct {
// RecipeLimits bounds generated recipe syntax and internal parse/apply proof.
RecipeLimits Limits
// MaxInputBytes bounds previous and current state bytes examined.
MaxInputBytes int
// MaxInputItems bounds previous and current header fields and body lines examined.
MaxInputItems int
// MaxCandidateEntries bounds retained current-source occurrences.
MaxCandidateEntries int
// MaxCandidateKeyBytes bounds protected exact-match keys retained from the source.
MaxCandidateKeyBytes int
// MaxComparisons bounds target lookups and monotone candidate advances.
MaxComparisons int
// MaxGenerationWorkUnits bounds aggregate scans, plans, output, and proof work.
MaxGenerationWorkUnits int
}
GenerationLimits bounds one deterministic generation operation and its proof.
func DefaultGenerationLimits ¶
func DefaultGenerationLimits() GenerationLimits
DefaultGenerationLimits returns the exact closed generation hard ceilings.
func (GenerationLimits) Validate ¶
func (l GenerationLimits) Validate() error
Validate rejects negative, widening, overflowing, or incoherent generation limits.
type GenerationOutcome ¶
type GenerationOutcome string
GenerationOutcome identifies one closed top-level generation success.
const ( // GenerationOutcomeUnchanged reports that no recipe-semantic relevant change exists. GenerationOutcomeUnchanged GenerationOutcome = "unchanged" // GenerationOutcomeRecipe reports one initialized recipe result. GenerationOutcomeRecipe GenerationOutcome = "recipe" )
func (GenerationOutcome) Known ¶
func (o GenerationOutcome) Known() bool
Known reports whether outcome belongs to the closed generation vocabulary.
type GenerationRequest ¶
type GenerationRequest struct {
// contains filtered or unexported fields
}
GenerationRequest stores one immutable inverse-generation request.
func NewGenerationRequest ¶
func NewGenerationRequest(previous, current State, bodyPolicy BodyUnavailablePolicy, literalPolicy LiteralDisclosurePolicy) (GenerationRequest, error)
NewGenerationRequest constructs a request from known initialized states and closed policies.
func (GenerationRequest) BodyUnavailablePolicy ¶
func (r GenerationRequest) BodyUnavailablePolicy() BodyUnavailablePolicy
BodyUnavailablePolicy returns the closed body-unavailable policy.
func (GenerationRequest) Current ¶
func (r GenerationRequest) Current() State
Current returns the immutable current source state.
func (GenerationRequest) LiteralPolicy ¶
func (r GenerationRequest) LiteralPolicy() LiteralDisclosurePolicy
LiteralPolicy returns the closed literal-disclosure policy.
func (GenerationRequest) Previous ¶
func (r GenerationRequest) Previous() State
Previous returns the immutable previous target state.
func (GenerationRequest) Valid ¶
func (r GenerationRequest) Valid() bool
Valid reports whether the request contains two known states and closed policies.
type GenerationUsage ¶
type GenerationUsage struct {
// contains filtered or unexported fields
}
GenerationUsage stores bounded numeric accounting for one generation attempt.
func (GenerationUsage) CandidateKeyBytes ¶
func (u GenerationUsage) CandidateKeyBytes() int
CandidateKeyBytes returns protected key bytes retained during matching.
func (GenerationUsage) Candidates ¶
func (u GenerationUsage) Candidates() int
Candidates returns retained source occurrence entries.
func (GenerationUsage) Comparisons ¶
func (u GenerationUsage) Comparisons() int
Comparisons returns exact target lookup and candidate advance operations.
func (GenerationUsage) GeneratedLiterals ¶
func (u GenerationUsage) GeneratedLiterals() int
GeneratedLiterals returns planned data-string count.
func (GenerationUsage) GeneratedSteps ¶
func (u GenerationUsage) GeneratedSteps() int
GeneratedSteps returns planned recipe steps.
func (GenerationUsage) InputBytes ¶
func (u GenerationUsage) InputBytes() int
InputBytes returns source and target bytes examined.
func (GenerationUsage) InputItems ¶
func (u GenerationUsage) InputItems() int
InputItems returns source and target items examined.
func (GenerationUsage) JSONBytes ¶
func (u GenerationUsage) JSONBytes() int
JSONBytes returns generated decoded recipe bytes.
func (GenerationUsage) LiteralBytes ¶
func (u GenerationUsage) LiteralBytes() int
LiteralBytes returns previous content bytes authorized for disclosure.
func (GenerationUsage) ProofWorkUnits ¶
func (u GenerationUsage) ProofWorkUnits() int
ProofWorkUnits returns parse, application, and semantic reconstruction proof work.
func (GenerationUsage) Valid ¶
func (u GenerationUsage) Valid() bool
Valid reports whether usage contains only initialized nonnegative counters.
func (GenerationUsage) WorkUnits ¶
func (u GenerationUsage) WorkUnits() int
WorkUnits returns aggregate generation work.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator stores immutable validated generation dependencies and limits.
func NewGenerator ¶
func NewGenerator(limits GenerationLimits, relevance HeaderRelevance) (Generator, error)
NewGenerator constructs an immutable fail-closed recipe generator.
func (Generator) Generate ¶
func (g Generator) Generate(request GenerationRequest) (Generation, GenerationUsage, error)
Generate deterministically plans and returns a recipe only after strict parse, apply, and semantic proof.
func (Generator) Limits ¶
func (g Generator) Limits() GenerationLimits
Limits returns the immutable normalized generation limits.
type HeaderRelevance ¶
type HeaderRelevance interface {
Validate() error
IsRelevantHeader(nameLower string) (bool, error)
}
HeaderRelevance classifies validated canonical lowercase header names. Implementations must be immutable, deterministic, concurrent-safe, and must return errors that do not retain or expose header names or message content.
type Limits ¶
type Limits struct {
// MaxDecodedRecipeBytes bounds one decoded r= JSON payload.
MaxDecodedRecipeBytes int
// MaxJSONDepth bounds nested unknown extension traversal.
MaxJSONDepth int
// MaxJSONMembers bounds all object members scanned.
MaxJSONMembers int
// MaxJSONTokens bounds total JSON tokenization work.
MaxJSONTokens int
// MaxHeaderNames bounds distinct recipe and state header groups.
MaxHeaderNames int
// MaxHeaderNameBytes bounds one RFC 5322 header field name.
MaxHeaderNameBytes int
// MaxTotalHeaderNameBytes bounds retained recipe-key storage.
MaxTotalHeaderNameBytes int
// MaxStepsPerHeader bounds one header-name instruction array.
MaxStepsPerHeader int
// MaxBodySteps bounds the body instruction array.
MaxBodySteps int
// MaxTotalSteps bounds all retained recipe steps.
MaxTotalSteps int
// MaxCopyRanges bounds copy-range metadata.
MaxCopyRanges int
// MaxCopiedItemsPerRange bounds one inclusive copy expansion.
MaxCopiedItemsPerRange int
// MaxTotalCopiedItems bounds all copied fields or lines per apply.
MaxTotalCopiedItems int
// MaxDataStrings bounds retained literal strings.
MaxDataStrings int
// MaxDataStringBytes bounds one decoded literal before dimension checks.
MaxDataStringBytes int
// MaxTotalLiteralBytes bounds all retained decoded literal bytes.
MaxTotalLiteralBytes int
// MaxHeaderFields bounds reconstructed header occurrence count.
MaxHeaderFields int
// MaxHeaderFieldBytes bounds one reconstructed logical field.
MaxHeaderFieldBytes int
// MaxHeaderLineBytes bounds one reconstructed physical header line.
MaxHeaderLineBytes int
// MaxHeaderBytes bounds the reconstructed header block.
MaxHeaderBytes int
// MaxBodyLines bounds reconstructed body line indexing.
MaxBodyLines int
// MaxBodyLineBytes bounds one reconstructed body line.
MaxBodyLineBytes int
// MaxStateBytes bounds one reconstructed raw message state.
MaxStateBytes int
// MaxOperationWorkUnits bounds aggregate parsing or application work.
MaxOperationWorkUnits int
}
Limits bounds one recipe parse or apply operation.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns the closed hard ceilings for one recipe operation.
type LiteralDisclosurePolicy ¶
type LiteralDisclosurePolicy uint8
LiteralDisclosurePolicy controls whether generated recipes may embed previous content.
const ( // CopyOnly forbids embedding previous header or body content. CopyOnly LiteralDisclosurePolicy = iota // AllowLiterals permits bounded literal disclosure in generated recipes. AllowLiterals )
func (LiteralDisclosurePolicy) Known ¶
func (p LiteralDisclosurePolicy) Known() bool
Known reports whether policy belongs to the closed disclosure vocabulary.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser converts decoded Draft-09 recipe JSON into immutable plans.
func NewParser ¶
func NewParser(limits Limits, relevance HeaderRelevance) (Parser, error)
NewParser constructs a strict recipe parser with resolved restrictive limits. The header relevance classifier is mandatory because Draft-09 Section 5.1 forbids recipes for header fields that are not signed; the parser rejects such recipes instead of leaving the rule to each caller.
type Recipe ¶
type Recipe struct {
// contains filtered or unexported fields
}
Recipe stores one immutable parsed Draft-09 reconstruction plan.
func (Recipe) CanonicalHeaderNames ¶
CanonicalHeaderNames returns the lowercase canonical names of every header plan, the names whose fields the applier regroups when the recipe is applied.
func (Recipe) Descriptor ¶
func (r Recipe) Descriptor() Descriptor
Descriptor returns a privacy-minimized immutable view of this Recipe.
func (Recipe) HasHeaderRecipe ¶
HasHeaderRecipe reports whether h was present.
func (Recipe) HeaderNames ¶
HeaderNames returns deterministic retained key spellings only.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State stores one immutable controlled reconstruction state.
func NewHeadersOnlyState ¶
func NewHeadersOnlyState(headers rawmsg.HeaderBlock) (State, error)
NewHeadersOnlyState constructs a header-known state whose body is truthfully unavailable, such as the text/rfc822-headers original of a delivery-status report. Application and generation semantics are unchanged: the state behaves exactly like the body-unavailable state produced by a null recipe.
func (State) BodyState ¶
func (s State) BodyState() BodyAvailability
BodyState returns the closed body availability.
func (State) Framing ¶
func (s State) Framing() rawmsg.MessageFraming
Framing returns the validated header/body separator form of the state, or the empty value for an invalid state. A body-unavailable state always reports delimited framing because its body is unknown rather than empty.
func (State) Headers ¶
func (s State) Headers() rawmsg.HeaderBlock
Headers returns an immutable cloned header block.
func (State) Materialize ¶
Materialize returns exact raw framing when both dimensions are known.
type StepKind ¶
type StepKind string
StepKind identifies one closed recipe operation.
const ( // StepKindCopy identifies an inclusive source-range copy. StepKindCopy StepKind = "copy" // StepKindData identifies UTF-8 literal data emission ("d"). StepKindData StepKind = "data" // StepKindBinaryData identifies base64-carried literal emission ("u") for // lines or values that are not valid UTF-8 (Draft-09 Section 5). StepKindBinaryData StepKind = "binary_data" )
type Usage ¶
type Usage struct {
// contains filtered or unexported fields
}
Usage records bounded work performed by one parse or apply operation.
func (Usage) DecodedBytes ¶
DecodedBytes returns charged decoded recipe bytes.
func (Usage) EmittedBytes ¶
EmittedBytes returns charged reconstructed output bytes.
Source Files
¶
- applier.go
- apply_body.go
- apply_header.go
- base64line.go
- descriptor.go
- doc.go
- errors.go
- generation_body.go
- generation_header.go
- generation_limits.go
- generation_plan.go
- generation_proof.go
- generation_serializer.go
- generation_types.go
- generation_usage_counter.go
- generator.go
- limit_names.go
- limits.go
- parser.go
- plan_budgets.go
- state.go
- types.go
- usage.go