Documentation
¶
Overview ¶
Package approval models tool approval decisions and permission prompts.
Index ¶
- func GenerateReplayPreventionNonce() (string, error)
- func GenerateToken() (string, error)
- type Audit
- type DelegationHop
- type Error
- type Grant
- type GrantOptions
- type Ledger
- type Scope
- type Status
- type Store
- func (s Store) Approve(token string, opts GrantOptions) (Grant, error)
- func (s Store) Consume(token string, scope Scope, executingActor string, now time.Time) (Audit, error)
- func (s Store) Grant(opts GrantOptions) (Grant, error)
- func (s Store) List() (Ledger, error)
- func (s Store) Revoke(token string, now time.Time) (Audit, error)
- func (s Store) Verify(token string, scope Scope, executingActor string, now time.Time) (Audit, error)
- type UsageState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
Types ¶
type Audit ¶
type Audit struct {
Kind string `json:"kind"`
Token string `json:"token"`
ReplayPreventionNonce string `json:"replay_prevention_nonce"`
Scope Scope `json:"scope"`
ApprovingActor string `json:"approving_actor"`
RequestingActor string `json:"requesting_actor"`
ExecutingActor string `json:"executing_actor"`
ExecutionMode string `json:"execution_mode"`
Status Status `json:"status"`
DelegatedExecution bool `json:"delegated_execution"`
DelegationChain []DelegationHop `json:"delegation_chain"`
Uses int `json:"uses"`
MaxUses int `json:"max_uses"`
VerifiedAt time.Time `json:"verified_at"`
}
type DelegationHop ¶
type Error ¶
type Grant ¶
type Grant struct {
Token string `json:"token"`
ReplayPreventionNonce string `json:"replay_prevention_nonce"`
Scope Scope `json:"scope"`
ApprovingActor string `json:"approving_actor"`
RequestingActor string `json:"requesting_actor"`
ApprovedExecutor string `json:"approved_executor"`
Status Status `json:"status"`
State UsageState `json:"state"`
Usable bool `json:"usable"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
MaxUses int `json:"max_uses"`
Uses int `json:"uses"`
RemainingUses int `json:"remaining_uses"`
DelegationChain []DelegationHop `json:"delegation_chain,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastAuditErrorKind string `json:"last_audit_error_kind,omitempty"`
}
type GrantOptions ¶
type Store ¶
type Store struct {
ConfigHome string
}
func (Store) Approve ¶
func (s Store) Approve(token string, opts GrantOptions) (Grant, error)
Approve transitions an existing pending token into a granted approval.
type UsageState ¶
type UsageState string
UsageState summarizes whether an approval token can still authorize work.
const ( // UsagePending means the token exists but is not owner-approved yet. UsagePending UsageState = "pending" // UsageUnused means the token is granted and has all uses available. UsageUnused UsageState = "unused" // UsagePartiallyConsumed means the token is granted and has some remaining uses. UsagePartiallyConsumed UsageState = "partially_consumed" // UsageConsumed means the token exhausted its allowed uses. UsageConsumed UsageState = "consumed" // UsageExpired means the token's time window has elapsed. UsageExpired UsageState = "expired" // UsageRevoked means the token was explicitly revoked. UsageRevoked UsageState = "revoked" )
Click to show internal directories.
Click to hide internal directories.