Documentation
¶
Overview ¶
Package sessionwire holds shared LIP session carrier keys and decode helpers for frontends. Security decisions stay in core; adapters only lift protocol-legal fields into lipapi.SessionRef.
Index ¶
- Constants
- func ApplyAuthoritativeHeaders(ref *lipapi.SessionRef, h http.Header)
- func ApplyAuthoritativeHeadersNamed(ref *lipapi.SessionRef, h http.Header, sessionID, resumeToken []string)
- func ApplyMetadata(ref *lipapi.SessionRef, meta map[string]string)
- func BuildSessionInput(h http.Header, meta map[string]string, opts SessionInputOptions) (largebody.SessionInput, error)
- func HTTPStatusForSessionDenial(code lipapi.SessionDenialCode) int
- func HasSessionMetadata(meta map[string]string) bool
- func ValidateMetadata(meta map[string]string) error
- func WithoutSensitiveToken(s, rawToken string) string
- func WriteResponseCarriers(w http.ResponseWriter, call *lipapi.Call)
- func WriteSessionResponseCarrier(w http.ResponseWriter, carrier largebody.SessionResponseCarrier)
- func WriteSessionResponseCarrierHeaders(h http.Header, carrier largebody.SessionResponseCarrier)
- type SessionInputOptions
Constants ¶
const ( HeaderAuthoritativeSessionID = lipsdk.HeaderSessionID HeaderResumeToken = lipsdk.HeaderResumeToken HeaderALegID = lipsdk.HeaderALegID HeaderSessionHint = lipsdk.HeaderSessionHint // Metadata keys for JSON request bodies (OpenAI-style metadata maps). MetaKeyAuthoritativeSessionID = "lip_session_id" MetaKeyResumeToken = "lip_resume_token" )
LIP-controlled HTTP carriers for secure-session resume (proxy-issued values round-tripped by clients).
Variables ¶
This section is empty.
Functions ¶
func ApplyAuthoritativeHeaders ¶
func ApplyAuthoritativeHeaders(ref *lipapi.SessionRef, h http.Header)
ApplyAuthoritativeHeaders merges LIP session headers into ref when present (trimmed). Caller supplies ref; zero fields are left unchanged when a header is absent.
func ApplyAuthoritativeHeadersNamed ¶
func ApplyAuthoritativeHeadersNamed(ref *lipapi.SessionRef, h http.Header, sessionID, resumeToken []string)
ApplyAuthoritativeHeadersNamed merges session-id and resume-token from the given header names. Empty name lists use HeaderAuthoritativeSessionID and HeaderResumeToken.
func ApplyMetadata ¶
func ApplyMetadata(ref *lipapi.SessionRef, meta map[string]string)
ApplyMetadata merges string metadata entries into ref when keys are present (trimmed). Headers should be applied after metadata if headers must win on conflict.
func BuildSessionInput ¶
func BuildSessionInput(h http.Header, meta map[string]string, opts SessionInputOptions) (largebody.SessionInput, error)
BuildSessionInput builds an exact bounded largebody.SessionInput from HTTP headers and body metadata, enforcing:
- header/body/session/resume/client-session precedence (headers win over body metadata);
- rejection of body-carried LIP session metadata when RejectBodyMetadata is true (Requirements 14.2, 17.5);
- sensitive resume token wrapping via largebody.SensitiveString (Requirements 14.1, 22);
- exact scalar bounds on all session fields under lipapi envelope caps and semantic-fact budget.
func HTTPStatusForSessionDenial ¶
func HTTPStatusForSessionDenial(code lipapi.SessionDenialCode) int
HTTPStatusForSessionDenial maps stable lipapi.SessionDenialCode values to HTTP status codes for frontend adapters (protocol-neutral transport semantics).
func HasSessionMetadata ¶
HasSessionMetadata reports whether meta contains any LIP-controlled session keys.
func ValidateMetadata ¶
ValidateMetadata checks LIP-controlled session metadata carriers before callers copy them into the canonical session reference.
func WithoutSensitiveToken ¶
WithoutSensitiveToken replaces exact rawToken substrings in s for log-safe strings.
func WriteResponseCarriers ¶
func WriteResponseCarriers(w http.ResponseWriter, call *lipapi.Call)
WriteResponseCarriers sets LIP session response headers from call.Session when fields are non-empty.
func WriteSessionResponseCarrier ¶
func WriteSessionResponseCarrier(w http.ResponseWriter, carrier largebody.SessionResponseCarrier)
WriteSessionResponseCarrier sets LIP session response headers from largebody.SessionResponseCarrier when fields are non-empty. It reveals the sensitive resume token only into the designated response header at the frontend transport boundary (Requirements 14.6, 18.2, 22.3).
func WriteSessionResponseCarrierHeaders ¶
func WriteSessionResponseCarrierHeaders(h http.Header, carrier largebody.SessionResponseCarrier)
WriteSessionResponseCarrierHeaders sets LIP session response headers on h from carrier when fields are non-empty.
Types ¶
type SessionInputOptions ¶
type SessionInputOptions struct {
HeaderAliases lipsdk.HTTPHeaders
RejectBodyMetadata bool
MaxFactBytes int64
}
SessionInputOptions parameterizes SessionInput extraction for a frontend profile.