decisionhttp

package
v1.13.10 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package decisionhttp implements the managed/self-hosted HTTP transport for decision.Authorizer. Signature and policy verification remain at the local enforcement point.

Index

Constants

View Source
const DefaultMaxResponseBytes int64 = 1 << 20
View Source
const EvaluatorAttestationPath = "/v1/evaluator-attestation"
View Source
const FederationExchangeVersion uint16 = 1

Variables

View Source
var ErrWorkflowConflict = errors.New("decisionhttp: approval workflow conflict")

Functions

func ValidateWorkflowRecord

func ValidateWorkflowRecord(record WorkflowRecord) error

Types

type AuthorizationRequest

type AuthorizationRequest struct {
	Intent     decision.Intent             `json:"intent"`
	Disclosure *decision.DisclosureBinding `json:"disclosure,omitempty"`
}

AuthorizationRequest is the additive authorization wire envelope for a disclosure-bound V1 Intent. Plain V1 clients continue posting an Intent directly, preserving their signed bytes and endpoint compatibility.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(endpoint string, options ...Option) (*Client, error)

func (*Client) Authorize

func (c *Client) Authorize(ctx context.Context, intent decision.Intent) (decision.Decision, error)

func (*Client) AuthorizeDisclosure

func (c *Client) AuthorizeDisclosure(ctx context.Context, intent decision.Intent, disclosure decision.DisclosureBinding) (decision.Decision, error)

AuthorizeDisclosure submits typed metadata alongside an Intent that already binds its canonical hash. Authorities whose evaluator cannot inspect disclosure metadata fail closed.

func (*Client) AuthorizeFederatedContent

func (c *Client) AuthorizeFederatedContent(ctx context.Context, intent decision.Intent, content decision.FederatedContent) (decision.Decision, error)

func (*Client) AuthorizeSemantic

func (c *Client) AuthorizeSemantic(ctx context.Context, intent decision.Intent, policy decision.SemanticPolicyContext) (decision.Decision, error)

func (*Client) AuthorizeSemanticDisclosure

func (c *Client) AuthorizeSemanticDisclosure(ctx context.Context, intent decision.Intent, disclosure decision.DisclosureBinding, policy decision.SemanticPolicyContext) (decision.Decision, error)

func (*Client) AuthorizeSemanticFederatedContent

func (c *Client) AuthorizeSemanticFederatedContent(ctx context.Context, intent decision.Intent, content decision.FederatedContent, policy decision.SemanticPolicyContext) (decision.Decision, error)

func (*Client) BeginWorkflow

func (client *Client) BeginWorkflow(ctx context.Context, envelope WorkflowBeginEnvelope) (WorkflowRecord, error)

BeginWorkflow creates or retrieves the deterministic approval transaction bound to an already-issued approval_required decision.

func (*Client) CancelWorkflow

func (client *Client) CancelWorkflow(ctx context.Context, transactionID, reason string) (WorkflowRecord, error)

CancelWorkflow requests an authority-signed terminal cancellation through the separately protected management route. It binds retries to the exact transaction and reason, so a retry cannot accidentally mutate a different management action.

func (*Client) ConfigureWorkflowAgentRequestSigning

func (client *Client) ConfigureWorkflowAgentRequestSigning(tenantID, agentID string, signer func(*http.Request, string, string) error) error

ConfigureWorkflowAgentRequestSigning authenticates participant status reads without changing the already signed workflow mutation envelopes. Configure the client before concurrent use.

func (*Client) EvaluatorAttestation

func (client *Client) EvaluatorAttestation(ctx context.Context) (decision.EvaluatorAttestation, error)

func (*Client) EvaluatorOrigin

func (client *Client) EvaluatorOrigin() (string, error)

func (*Client) ExecuteWorkflow

func (client *Client) ExecuteWorkflow(ctx context.Context, transactionID string, intent decision.Intent) (decision.Decision, error)

ExecuteWorkflow submits a new workload-signed execution intent and returns the one canonical decision consumed for that approval transaction. Callers must still locally verify this signed decision before performing a side effect.

func (*Client) ManagementWorkflowStatus

func (client *Client) ManagementWorkflowStatus(ctx context.Context, transactionID string) (WorkflowRecord, error)

ManagementWorkflowStatus returns a workflow record through the separately protected operator route. It is intended for a client configured with the authority's management mTLS identity; it does not grant an uncredentialed caller any management authority itself.

func (*Client) ManagementWorkflows

func (client *Client) ManagementWorkflows(ctx context.Context, tenantID string, limit int) ([]WorkflowRecord, error)

ManagementWorkflows retrieves a bounded tenant-scoped list through the separately protected operator route. The caller supplies management mTLS; this method validates each returned workflow before exposing it to a UI or CLI.

func (*Client) SubmitFederationExchange

func (client *Client) SubmitFederationExchange(ctx context.Context, envelope FederationExchangeRequest) (FederationExchangeResponse, error)

func (*Client) SubmitFederationExchangeResult

func (client *Client) SubmitFederationExchangeResult(ctx context.Context, envelope FederationExchangeResultRequest) (FederationExchangeResultResponse, error)

func (*Client) VoteWorkflow

func (client *Client) VoteWorkflow(ctx context.Context, transactionID string, vote decision.ApprovalVote) (WorkflowRecord, error)

VoteWorkflow submits one signed vote. Replaying the same vote returns the durable record; a different vote from the same key is rejected by the authority.

func (*Client) WorkflowStatus

func (client *Client) WorkflowStatus(ctx context.Context, transactionID string) (WorkflowRecord, error)

type FederatedContentAuthorizationRequest

type FederatedContentAuthorizationRequest struct {
	Intent  decision.Intent           `json:"intent"`
	Content decision.FederatedContent `json:"federated_content"`
}

FederatedContentAuthorizationRequest is used only between Pilot's hosted authority and its hosted semantic runtime. It is never accepted by the workload /v1/authorize handler.

type FederationExchangeRequest

type FederationExchangeRequest struct {
	Version uint16                    `json:"version"`
	Intent  decision.Intent           `json:"intent"`
	Content decision.FederatedContent `json:"content"`
}

type FederationExchangeResponse

type FederationExchangeResponse struct {
	Version               uint16                  `json:"version"`
	ExchangeID            string                  `json:"exchange_id"`
	AccountSlug           string                  `json:"account_slug"`
	State                 FederationExchangeState `json:"state"`
	Decision              decision.Decision       `json:"decision"`
	ApprovalTransactionID string                  `json:"approval_transaction_id,omitempty"`
	ApprovalExpiresAt     int64                   `json:"approval_expires_at,omitempty"`
	RetentionUntil        int64                   `json:"retention_until"`
}

type FederationExchangeResultRequest

type FederationExchangeResultRequest struct {
	Version         uint16                     `json:"version"`
	ExecutionIntent decision.Intent            `json:"execution_intent"`
	Decision        decision.Decision          `json:"decision"`
	Result          decision.FederationResult  `json:"result"`
	Content         *decision.FederatedContent `json:"content,omitempty"`
}

type FederationExchangeResultResponse

type FederationExchangeResultResponse struct {
	Version    uint16                  `json:"version"`
	ExchangeID string                  `json:"exchange_id"`
	State      FederationExchangeState `json:"state"`
	UpdatedAt  int64                   `json:"updated_at"`
}

type FederationExchangeState

type FederationExchangeState string
const (
	FederationExchangeDenied          FederationExchangeState = "denied"
	FederationExchangeApprovalPending FederationExchangeState = "approval_pending"
	FederationExchangeAuthorized      FederationExchangeState = "authorized"
	FederationExchangeCompleted       FederationExchangeState = "completed"
	FederationExchangeFailed          FederationExchangeState = "failed"
)

type Option

type Option func(*Client)

func WithBearerToken

func WithBearerToken(token string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithMaxResponseBytes

func WithMaxResponseBytes(limit int64) Option

type SemanticAuthorizationRequest

type SemanticAuthorizationRequest struct {
	Intent     decision.Intent                `json:"intent"`
	Disclosure *decision.DisclosureBinding    `json:"disclosure,omitempty"`
	Policy     decision.SemanticPolicyContext `json:"semantic_policy"`
}

SemanticAuthorizationRequest is sent only to a configured semantic evaluator. The primary workload authorization handler deliberately rejects this envelope so a workload cannot choose or replace its active policy.

type SemanticFederatedContentAuthorizationRequest

type SemanticFederatedContentAuthorizationRequest struct {
	Intent  decision.Intent                `json:"intent"`
	Content decision.FederatedContent      `json:"federated_content"`
	Policy  decision.SemanticPolicyContext `json:"semantic_policy"`
}

SemanticFederatedContentAuthorizationRequest additionally carries the reviewed policy clauses selected by the authority. A workload cannot choose or replace this context.

type WorkflowBeginEnvelope

type WorkflowBeginEnvelope struct {
	Intent     decision.Intent             `json:"intent"`
	Initial    decision.Decision           `json:"initial_decision"`
	Disclosure *decision.DisclosureBinding `json:"disclosure,omitempty"`
}

type WorkflowCancelRequest

type WorkflowCancelRequest struct {
	TransactionID string `json:"transaction_id"`
	Reason        string `json:"reason"`
}

type WorkflowExecuteEnvelope

type WorkflowExecuteEnvelope struct {
	TransactionID string          `json:"transaction_id"`
	Intent        decision.Intent `json:"intent"`
}

type WorkflowListResponse

type WorkflowListResponse struct {
	Workflows []WorkflowRecord `json:"workflows"`
}

type WorkflowRecord

type WorkflowRecord struct {
	Transaction      decision.ApprovalTransaction   `json:"transaction"`
	Votes            []decision.ApprovalVote        `json:"votes,omitempty"`
	Certificate      *decision.ApprovalCertificate  `json:"certificate,omitempty"`
	Cancellation     *decision.ApprovalCancellation `json:"cancellation,omitempty"`
	ConsumedIntentID string                         `json:"consumed_intent_hash,omitempty"`
	ConsumedDecision *decision.Decision             `json:"consumed_decision,omitempty"`
}

type WorkflowVoteEnvelope

type WorkflowVoteEnvelope struct {
	TransactionID string                `json:"transaction_id"`
	Vote          decision.ApprovalVote `json:"vote"`
}

Jump to

Keyboard shortcuts

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