approval

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 8 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"`
	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.

Jump to

Keyboard shortcuts

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