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
- Variables
- func ValidateWorkflowRecord(record WorkflowRecord) error
- type AuthorizationRequest
- type Client
- func (c *Client) Authorize(ctx context.Context, intent decision.Intent) (decision.Decision, error)
- func (c *Client) AuthorizeDisclosure(ctx context.Context, intent decision.Intent, ...) (decision.Decision, error)
- func (c *Client) AuthorizeFederatedContent(ctx context.Context, intent decision.Intent, content decision.FederatedContent) (decision.Decision, error)
- func (c *Client) AuthorizeSemantic(ctx context.Context, intent decision.Intent, ...) (decision.Decision, error)
- func (c *Client) AuthorizeSemanticDisclosure(ctx context.Context, intent decision.Intent, ...) (decision.Decision, error)
- func (c *Client) AuthorizeSemanticFederatedContent(ctx context.Context, intent decision.Intent, content decision.FederatedContent, ...) (decision.Decision, error)
- func (client *Client) BeginWorkflow(ctx context.Context, envelope WorkflowBeginEnvelope) (WorkflowRecord, error)
- func (client *Client) CancelWorkflow(ctx context.Context, transactionID, reason string) (WorkflowRecord, error)
- func (client *Client) ConfigureWorkflowAgentRequestSigning(tenantID, agentID string, signer func(*http.Request, string, string) error) error
- func (client *Client) EvaluatorAttestation(ctx context.Context) (decision.EvaluatorAttestation, error)
- func (client *Client) EvaluatorOrigin() (string, error)
- func (client *Client) ExecuteWorkflow(ctx context.Context, transactionID string, intent decision.Intent) (decision.Decision, error)
- func (client *Client) ManagementWorkflowStatus(ctx context.Context, transactionID string) (WorkflowRecord, error)
- func (client *Client) ManagementWorkflows(ctx context.Context, tenantID string, limit int) ([]WorkflowRecord, error)
- func (client *Client) SubmitFederationExchange(ctx context.Context, envelope FederationExchangeRequest) (FederationExchangeResponse, error)
- func (client *Client) SubmitFederationExchangeResult(ctx context.Context, envelope FederationExchangeResultRequest) (FederationExchangeResultResponse, error)
- func (client *Client) VoteWorkflow(ctx context.Context, transactionID string, vote decision.ApprovalVote) (WorkflowRecord, error)
- func (client *Client) WorkflowStatus(ctx context.Context, transactionID string) (WorkflowRecord, error)
- type FederatedContentAuthorizationRequest
- type FederationExchangeRequest
- type FederationExchangeResponse
- type FederationExchangeResultRequest
- type FederationExchangeResultResponse
- type FederationExchangeState
- type Option
- type SemanticAuthorizationRequest
- type SemanticFederatedContentAuthorizationRequest
- type WorkflowBeginEnvelope
- type WorkflowCancelRequest
- type WorkflowExecuteEnvelope
- type WorkflowListResponse
- type WorkflowRecord
- type WorkflowVoteEnvelope
Constants ¶
const DefaultMaxResponseBytes int64 = 1 << 20
const EvaluatorAttestationPath = "/v1/evaluator-attestation"
const FederationExchangeVersion uint16 = 1
Variables ¶
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 (*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 (*Client) AuthorizeSemantic ¶
func (*Client) AuthorizeSemanticDisclosure ¶
func (*Client) AuthorizeSemanticFederatedContent ¶
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) EvaluatorOrigin ¶
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 ¶
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 WithHTTPClient ¶
func WithMaxResponseBytes ¶
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 WorkflowCancelRequest ¶
type WorkflowExecuteEnvelope ¶
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"`
}