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
- type ActionKind
- type Approval
- type ApprovalRequest
- type AuditEvent
- type AuditFeedEvent
- type Decision
- type Fetch
- type FetchResult
- type Grant
- type GrantLevel
- type Group
- type GroupMember
- type Item
- type ItemKind
- type ItemVersion
- type Owner
- type OwnerKind
- type Principal
- type PrincipalKind
- type PushDevice
- type RequestStatus
- type Session
- type SubjectKind
- type UseRequest
- type UseResult
- type Workload
Constants ¶
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.
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.
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.
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 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 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 ¶
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 ¶
HoneyRevoke reports whether a honey item auto-revokes the agent on touch.
func (Item) RemoteApprove ¶
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" )
type ItemVersion ¶
ItemVersion is history metadata. The sealed blob is not here.
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 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.