Help us shape the future of Go! Take the 2026 Go Developer Survey

approval

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package approval stores local, operator-created approval records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	MessageID   string `json:"message_id"`
	Direction   string `json:"direction"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	BodySHA256  string `json:"body_sha256"`
}

Binding identifies the exact protocol action an operator approved.

type Pending

type Pending struct {
	MessageID    string `json:"message_id"`
	Direction    string `json:"direction"`
	Source       string `json:"source"`
	Destination  string `json:"destination"`
	Body         string `json:"body"`
	BodyExternal bool   `json:"body_external,omitempty"`
	BodySHA256   string `json:"body_sha256"`
	ReasonCode   string `json:"reason_code"`
	CreatedAt    string `json:"created_at"`
}

Pending is the exact message awaiting local review.

func (Pending) Binding

func (p Pending) Binding() Binding

Binding returns the security-relevant fields from a pending request.

type Store

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

Store holds immutable pending and approval records outside the MCP protocol.

func Open

func Open(auditDir string, create bool) (*Store, error)

Open opens the owner-only approval directory inside the state directory.

func (*Store) AliasesDirectory

func (s *Store) AliasesDirectory(candidate *os.File) (bool, error)

AliasesDirectory reports whether candidate is the approvals directory.

func (*Store) Approve

func (s *Store) Approve(binding Binding, now time.Time) error

Approve writes an immutable approval bound to one direction and peer pair.

func (*Store) Close

func (s *Store) Close() error

func (*Store) IsApproved

func (s *Store) IsApproved(binding Binding) (bool, error)

IsApproved verifies an operator approval for this exact protocol action.

func (*Store) Pending

func (s *Store) Pending(messageID string) (Pending, error)

Pending loads one exact review request for local operator display.

func (*Store) SavePending

func (s *Store) SavePending(pending Pending) error

SavePending durably stores an exact review request. Replays must match. A body that is legal under max_message_bytes can still expand past the secure-store cap once JSON escapes it. That body is spilled raw, beside the pending record, so the review can still be approved.

Jump to

Keyboard shortcuts

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