invocation

package
v0.4.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package invocation exposes the platform-authored context for one module request. The SDK installs a Context only after authenticating the platform transport; module code must never decode X-MS-Invocation itself.

Index

Constants

View Source
const (
	// Version is the first canonical module-invocation contract.
	Version = 1

	// CookieCapabilityLegacyLogicalRead permits the platform to present an
	// unprefixed cookie only during the fixed compatibility window.
	CookieCapabilityLegacyLogicalRead = "legacy-logical-read"
	// CookieCapabilityPhysicalNamesV1 identifies the app-and-module-scoped
	// physical cookie namespace used for all current writes.
	CookieCapabilityPhysicalNamesV1 = "physical-names-v1"

	// IdentityKindMember identifies an end-user member assertion with no app
	// operator role.
	IdentityKindMember = "member"
	// IdentityKindPlatform identifies a platform user carrying an app role.
	IdentityKindPlatform = "platform"

	// TrustSourceDirect means API Platform received the request directly.
	TrustSourceDirect = "direct"
	// TrustSourceEdge means the trusted platform edge forwarded the request.
	TrustSourceEdge = "edge"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	ID     string `json:"id"`
	Schema string `json:"schema"`
}

App is the authoritative application scope.

type Audit

type Audit struct {
	Provenance string `json:"provenance"`
}

Audit carries opaque occurrence-bound provenance. The SDK preserves it; the platform audit ingress owns signature verification.

type Context

type Context struct {
	Version  int      `json:"v"`
	App      App      `json:"app"`
	Module   Module   `json:"module"`
	Identity Identity `json:"identity"`
	Routes   Routes   `json:"routes"`
	Request  Request  `json:"request"`
	Trust    Trust    `json:"trust"`
	Cookies  Cookies  `json:"cookies"`
	Audit    Audit    `json:"audit"`
}

Context is the transport-neutral, platform-authored context for one concrete request occurrence. Slices are defensively copied when stored in or loaded from a context.Context.

func FromContext

func FromContext(ctx context.Context) (Context, bool)

FromContext returns a defensive copy of the trusted invocation, if present.

type Cookies

type Cookies struct {
	Namespace       string    `json:"namespace"`
	PhysicalPrefix  string    `json:"physicalPrefix"`
	Capabilities    []string  `json:"capabilities"`
	LegacyReadUntil time.Time `json:"legacyReadUntil"`
}

Cookies describes the platform-owned physical cookie namespace.

type Identity

type Identity struct {
	Kind            string `json:"kind,omitempty"`
	UserID          string `json:"userId,omitempty"`
	AppRole         string `json:"appRole,omitempty"`
	ActorDelegation string `json:"actorDelegation,omitempty"`
}

Identity is the verified end-user namespace and platform role. Empty fields represent an actorless request.

type Module

type Module struct {
	ID   string `json:"id"`
	Slug string `json:"slug"`
}

Module is the authoritative callee scope.

type Request

type Request struct {
	ID         string    `json:"id"`
	Method     string    `json:"method"`
	Path       string    `json:"path"`
	BodySHA256 string    `json:"bodySha256"`
	OccurredAt time.Time `json:"occurredAt"`
}

Request binds the context to one HTTP occurrence.

type Routes

type Routes struct {
	Origin       string   `json:"origin"`
	Module       string   `json:"module"`
	Public       string   `json:"public"`
	Platform     string   `json:"platform"`
	CurrentLocal string   `json:"currentLocal"`
	Redirects    []string `json:"redirects"`
}

Routes contains the canonical browser-facing routes for this installation.

type Trust

type Trust struct {
	Source   string `json:"source"`
	ClientIP string `json:"clientIp,omitempty"`
	Host     string `json:"host"`
	Scheme   string `json:"scheme"`
	Origin   string `json:"origin"`
}

Trust records connection facts derived by the platform edge.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL