protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 3 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 protocol is the one API every surface speaks: CLI, MCP, SDK, proxy.

Agents never receive a Secret. They Resolve metadata, Use an action, and wait on Approve for level-1 grants. Injection happens inside the broker.

Index

Constants

View Source
const LocalOrgID = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa"

LocalOrgID is the one VeilNYC organization. Same value in the vault, Kratos organization_id, and the Keto object. A second company is a new UUID when a second tenant exists. Not this slice.

View Source
const TagHoneyRevoke = "veil:honey-revoke"

TagHoneyRevoke marks a honey tripwire item that immediately revokes the offending agent (and cancels its pending approval requests) on first touch.

View Source
const TagNeverFill = "veil:never-fill"

TagNeverFill is the one reserved tag: the origin strips a tagged item from every device sync, so no laptop, phone, or extension replica ever holds its material — origin use only.

View Source
const TagRemoteApprove = "veil:remote-approve"

TagRemoteApprove marks an item whose fills require an approval from another device — the 1Password "approve sign-in elsewhere" posture.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionKind

type ActionKind string
const (
	ActionFetch  ActionKind = "fetch"
	ActionEnv    ActionKind = "env"
	ActionRevoke ActionKind = "revoke"
	// Audit actions for the approval-request lifecycle. Never grant actions —
	// actionAllowed only passes fetch/env and Use only accepts fetch.
	ActionRequestFiled     ActionKind = "request_filed"
	ActionRequestApproved  ActionKind = "request_approved"
	ActionRequestDenied    ActionKind = "request_denied"
	ActionRequestExpired   ActionKind = "request_expired"
	ActionRequestCancelled ActionKind = "request_cancelled"
	// Billing plane: the Vortex webhook receiver flips org plan state.
	ActionBillingPlanChanged ActionKind = "billing_plan_changed"

	// Administration plane (VEIL-86): vault configuration writes. AgentID
	// carries the acting principal — a human id or a system name — and the
	// target rides ItemID or a `key=value` Reason. These commit atomically
	// with the write they describe.
	ActionItemCreated    ActionKind = "item_created"
	ActionItemUpdated    ActionKind = "item_updated"
	ActionItemRotated    ActionKind = "item_rotated"
	ActionItemArchived   ActionKind = "item_archived"
	ActionItemDeleted    ActionKind = "item_deleted"
	ActionAgentCreated   ActionKind = "agent_created"
	ActionGrantGranted   ActionKind = "grant_granted"
	ActionSessionCreated ActionKind = "session_created"
	ActionSessionRevoked ActionKind = "session_revoked"
	ActionSessionRenewed ActionKind = "session_renewed"
	ActionWorkloadBound  ActionKind = "workload_bound"

	// Human read plane (VEIL-86): credential disclosures. The audit row is
	// appended before the secret leaves, so a failed write denies the reveal.
	ActionFill          ActionKind = "fill"
	ActionTOTPMint      ActionKind = "totp_mint"
	ActionPasskeyAssert ActionKind = "passkey_assert"
	ActionFillSync      ActionKind = "fill_sync"
	ActionFileWrite     ActionKind = "file_write"

	// Org plane (VEIL-86): Keto/identity-side membership changes. These
	// commit after the external write — the external system owns the tx.
	ActionMemberInvited    ActionKind = "member_invited"
	ActionMemberRemoved    ActionKind = "member_removed"
	ActionOwnerPromoted    ActionKind = "owner_promoted"
	ActionOwnerDemoted     ActionKind = "owner_demoted"
	ActionHumanDeleted     ActionKind = "human_deleted"
	ActionOrgDeleted       ActionKind = "org_deleted"
	ActionHumanProvisioned ActionKind = "human_provisioned"
	// Group administration (VEIL-20): vault-plane group lifecycle and
	// membership edges. Groups are vault data, not Keto tuples.
	ActionGroupCreated       ActionKind = "group_created"
	ActionGroupMemberAdded   ActionKind = "group_member_added"
	ActionGroupMemberRemoved ActionKind = "group_member_removed"
	// billing_provision_failed — Vortex customer upsert failed during
	// provision; signup succeeded anyway. Reconcile target.
	ActionBillingProvisionFailed ActionKind = "billing_provision_failed"
)

type Approval

type Approval struct {
	ID        string
	GrantID   string
	HumanID   string
	ExpiresAt time.Time
}

type ApprovalRequest

type ApprovalRequest struct {
	ID         string
	OrgID      string
	AgentID    string
	ItemID     string
	GrantID    string
	Action     ActionKind
	Status     RequestStatus
	CreatedAt  time.Time
	ExpiresAt  time.Time
	ResolvedAt *time.Time
	ResolvedBy string
	ApprovalID string
}

ApprovalRequest is a filed ask: this grant wants this action and a human must answer. One open row per (grant, action) — re-filing reuses it.

type AuditEvent

type AuditEvent struct {
	Time       time.Time  `json:"time"`
	OrgID      string     `json:"org_id"`
	AgentID    string     `json:"agent_id"`
	ItemID     string     `json:"item_id"`
	Action     ActionKind `json:"action"`
	Decision   Decision   `json:"decision"`
	Reason     string     `json:"reason,omitempty"`
	ApprovalID string     `json:"approval_id,omitempty"`
}

type AuditFeedEvent

type AuditFeedEvent struct {
	ID         int64      `json:"id"`
	Time       time.Time  `json:"time"`
	OrgID      string     `json:"org_id"`
	AgentID    string     `json:"agent_id"`
	ItemID     string     `json:"item_id"`
	Action     ActionKind `json:"action"`
	Decision   Decision   `json:"decision"`
	Reason     string     `json:"reason,omitempty"`
	ApprovalID string     `json:"approval_id,omitempty"`
}

AuditFeedEvent is one committed audit row on the per-org SIEM feed — the event plus its monotonically increasing row id, which doubles as the feed's resume cursor (`?after=`).

type Decision

type Decision string
const (
	DecisionAllow        Decision = "allow"
	DecisionDeny         Decision = "deny"
	DecisionNeedApproval Decision = "need_approval"
)

type Fetch

type Fetch struct {
	Method string
	URL    string
	Header http.Header
	Body   []byte
}

type FetchResult

type FetchResult struct {
	Status int
	Header http.Header
	Body   []byte
}

type Grant

type Grant struct {
	ID    string
	OrgID string
	// AgentID is the subject id — the agent/human principal id for direct
	// grants, the group id for SubjectGroup grants. The column name stays
	// agent_id in the stores.
	AgentID     string
	SubjectKind SubjectKind
	ItemID      string
	Level       GrantLevel
	Actions     []ActionKind
	ExpiresAt   *time.Time
}

func (Grant) Subject

func (g Grant) Subject() SubjectKind

Subject normalizes the grant's kind: empty reads as agent so rows written before VEIL-20 and zero-value literals in tests keep their meaning.

type GrantLevel

type GrantLevel string
const (
	// Level1: agent may prepare; a human must approve the last step.
	Level1 GrantLevel = "level1"
	// Level2: this identity was donated to agents. No human in the loop.
	Level2 GrantLevel = "level2"
	// LevelDeny is an explicit block — an exception that overrides any
	// inherited allow (a member denied on a group-granted item). Deny
	// beats allow; a direct deny shadows every group grant on the item.
	LevelDeny GrantLevel = "deny"
)

type Group

type Group struct {
	ID    string `json:"id"`
	OrgID string `json:"org_id"`
	Name  string `json:"name"`
}

Group is an org-scoped set of principals — vault data like items and agents, not a Keto tuple. A grant to a group is the shared-vault shape: every member inherits the item at the grant's level.

type GroupMember

type GroupMember struct {
	GroupID    string        `json:"group_id"`
	MemberKind PrincipalKind `json:"member_kind"`
	MemberID   string        `json:"member_id"`
}

GroupMember is one membership edge: the principal (agent or human) named by MemberKind/MemberID is in the group. An agent also inherits the groups of its user owner — a laptop agent shares its human's team grants.

type Item

type Item struct {
	ID    string   `json:"id"`
	OrgID string   `json:"org_id"`
	Name  string   `json:"name"`
	Kind  ItemKind `json:"kind"`
	Owner Owner    `json:"owner"`
	// URIs are the hosts this item may be used against (Infisical "service").
	URIs []string `json:"uris"`
	// Tags are owner labels. Not ACL. Grants are ACL.
	Tags []string `json:"tags,omitempty"`
	// Archived items are hidden from Use, list, fill. History stays.
	Archived bool `json:"archived,omitempty"`
	// HasTOTP is metadata. The seed is not on this struct.
	HasTOTP bool `json:"has_totp,omitempty"`
	// HasFile is metadata. Bytes are not on this struct.
	HasFile bool `json:"has_file,omitempty"`
	// Login is the fill username. Metadata. Not a secret. Empty is honest.
	Login string `json:"login,omitempty"`
	// Passkey identity fields — populated on list for human principals so
	// credential-provider extensions (iOS/Android AutoFill) can register
	// ASPasskeyCredentialIdentity and match RPs. Identifiers, not secrets:
	// the private key never leaves the sealed material.
	CredID     string `json:"cred_id,omitempty"`
	RpID       string `json:"rp_id,omitempty"`
	UserHandle string `json:"user_handle,omitempty"`
}

func (Item) HoneyRevoke

func (i Item) HoneyRevoke() bool

HoneyRevoke reports whether a honey item auto-revokes the agent on touch.

func (Item) NeverFill

func (i Item) NeverFill() bool

NeverFill reports whether the item carries the reserved never-fill tag.

func (Item) RemoteApprove

func (i Item) RemoteApprove() bool

RemoteApprove reports whether the item carries the remote-approve tag.

type ItemKind

type ItemKind string
const (
	ItemAPIKey   ItemKind = "api_key"
	ItemOAuth    ItemKind = "oauth"
	ItemSSH      ItemKind = "ssh"
	ItemFile     ItemKind = "file"
	ItemPasskey  ItemKind = "passkey"
	ItemCard     ItemKind = "card"
	ItemIdentity ItemKind = "identity"
	// ItemHoney is a tripwire. Any Use is deny + alert; material is a decoy
	// or empty. Never injected, never filled.
	ItemHoney ItemKind = "honey"
)

func (ItemKind) Fillable

func (k ItemKind) Fillable() bool

Fillable is whether the fill host / OS provider may write this kind.

func (ItemKind) Injects

func (k ItemKind) Injects() bool

Injects is whether Use / child env may touch this kind. SSH stays on the agent socket. Files are owner write. Passkeys, cards, and identities are fill-host only. PAN/CVV never enter a child env.

type ItemVersion

type ItemVersion struct {
	ID     int64
	ItemID string
	Time   time.Time
}

ItemVersion is history metadata. The sealed blob is not here.

type Owner

type Owner struct {
	Kind OwnerKind `json:"kind"`
	ID   string    `json:"id"`
}

type OwnerKind

type OwnerKind string
const (
	OwnerUser OwnerKind = "user"
	OwnerOrg  OwnerKind = "org"
)

type Principal

type Principal struct {
	Kind  PrincipalKind `json:"kind"`
	ID    string        `json:"id"`
	OrgID string        `json:"org_id"`
	// Owner is who may create grants for this agent. Humans leave it empty.
	Owner Owner `json:"owner,omitempty"`
	// RevokedAt is set when an agent's grants and sessions are killed.
	// It is a timestamp, not a secret, and is included in agent lists.
	RevokedAt *time.Time `json:"revoked_at,omitempty"`
}

func (Principal) MemberKeys

func (p Principal) MemberKeys() []GroupMember

MemberKeys is the membership lookup set for a principal: itself, plus — for a user-owned agent — the owning human.

type PrincipalKind

type PrincipalKind string
const (
	PrincipalHuman PrincipalKind = "human"
	PrincipalAgent PrincipalKind = "agent"
)

type PushDevice

type PushDevice struct {
	OrgID     string    `json:"org_id"`
	Platform  string    `json:"platform"` // "apns" | "fcm"
	Token     string    `json:"token"`
	Label     string    `json:"label"`
	UpdatedAt time.Time `json:"updated_at"`
}

PushDevice is a phone's push endpoint: the OS hands the app a token, the app registers it here, and the origin pushes approval wake-ups and ops pages over APNs/FCM. The token is a routing handle, not a credential — it authorizes nothing.

type RequestStatus

type RequestStatus string

RequestStatus is the approval-request lifecycle. Open is the only state a resolve may leave; every other state is terminal.

const (
	RequestOpen      RequestStatus = "open"
	RequestApproved  RequestStatus = "approved"
	RequestDenied    RequestStatus = "denied"
	RequestExpired   RequestStatus = "expired"
	RequestCancelled RequestStatus = "cancelled"
)

type Session

type Session struct {
	ID        string     `json:"id"`
	OrgID     string     `json:"org_id"`
	AgentID   string     `json:"agent_id"`
	ExpiresAt time.Time  `json:"expires_at"`
	CreatedAt time.Time  `json:"created_at"`
	RevokedAt *time.Time `json:"revoked_at,omitempty"`
	RenewedAt *time.Time `json:"renewed_at,omitempty"`
	TTL       int64      `json:"ttl"`      // seconds
	MaxTTL    int64      `json:"max_ttl"`  // seconds
	MaxUses   int        `json:"max_uses"` // 0 = unlimited
	Uses      int        `json:"uses"`     // Use calls that passed authorization and reached upstream consumption
}

Session is a short-lived Use lease onto an existing agent. The token is never on this type. Owner mint only. Not MCP. Not list.

type SubjectKind

type SubjectKind string

SubjectKind is who a grant names. Existing rows migrate as agent — the human kind is stamped on new grants; group is the VEIL-20 shared-vault subject. Grants carry the subject id in AgentID for all kinds.

const (
	SubjectAgent SubjectKind = "agent"
	SubjectHuman SubjectKind = "human"
	SubjectGroup SubjectKind = "group"
)

type UseRequest

type UseRequest struct {
	ItemID string
	Action ActionKind
	Fetch  *Fetch
	// Dry evaluates the decision (and files the ask on need_approval) but
	// never claims a use or touches the secret — the agent's pre-flight.
	Dry bool
}

type UseResult

type UseResult struct {
	Decision   Decision
	Reason     string
	ApprovalID string
	// RequestID and RequestExpiresAt carry the approval request filed on a
	// need_approval denial — the agent retries Use; the human resolves the ask.
	RequestID        string
	RequestExpiresAt *time.Time
	Fetch            *FetchResult
}

type Workload

type Workload struct {
	AgentID  string              `json:"agent_id"`
	OrgID    string              `json:"org_id,omitempty"`
	Issuer   string              `json:"issuer"`
	Subject  string              `json:"subject"`
	Audience string              `json:"audience"`
	Claims   map[string][]string `json:"claims,omitempty"`
}

Workload is an Entra-style federation binding. We verify an OIDC ID token from someone else's issuer and map (issuer, subject) to an existing agent. We do not issue tokens.

Jump to

Keyboard shortcuts

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