agentstore

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0, MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(delegations []delegation.Delegation, queries []CapabilityQuery) []delegation.Delegation

Query returns delegations that match the given capability queries. If no queries are provided, returns all non-expired delegations. Delegations are filtered by:

  • Expiration: excludes expired delegations
  • NotBefore: excludes delegations that are not yet valid
  • Capability matching: if queries are provided, only returns delegations whose capabilities match at least one of the queries

Additionally, this method includes relevant session proofs (ucan/attest delegations) that attest to the returned authorizations.

Types

type AgentData

type AgentData struct {
	Principal   principal.Signer
	Delegations []delegation.Delegation
}

func (AgentData) MarshalJSON

func (ad AgentData) MarshalJSON() ([]byte, error)

func (*AgentData) UnmarshalJSON

func (ad *AgentData) UnmarshalJSON(b []byte) error

type CapabilityQuery

type CapabilityQuery struct {
	// Can is the ability to match (e.g., "store/add"). Use "*" to match all abilities.
	Can ucan.Ability
	// With is the resource to match. Use "ucan:*" to match all resources.
	With ucan.Resource
}

CapabilityQuery represents a query to filter proofs by capability.

type FsStore

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

func NewFs

func NewFs(path string) (*FsStore, error)

func (*FsStore) AddDelegations

func (s *FsStore) AddDelegations(delegs ...delegation.Delegation) error

func (*FsStore) Delegations

func (s *FsStore) Delegations() ([]delegation.Delegation, error)

func (*FsStore) HasPrincipal

func (s *FsStore) HasPrincipal() (bool, error)

func (*FsStore) Principal

func (s *FsStore) Principal() (principal.Signer, error)

func (*FsStore) Query

func (s *FsStore) Query(queries ...CapabilityQuery) ([]delegation.Delegation, error)

Query returns delegations that match the given capability queries. If no queries are provided, returns all non-expired delegations. Delegations are filtered by:

  • Expiration: excludes expired delegations
  • NotBefore: excludes delegations that are not yet valid
  • Capability matching: if queries are provided, only returns delegations whose capabilities match at least one of the queries

Additionally, this method includes relevant session proofs (ucan/attest delegations) that attest to the returned authorizations.

func (*FsStore) Reset

func (s *FsStore) Reset() error

func (*FsStore) SetPrincipal

func (s *FsStore) SetPrincipal(principal principal.Signer) error

type MemStore

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

func NewMemory

func NewMemory() (*MemStore, error)

func (*MemStore) AddDelegations

func (s *MemStore) AddDelegations(delegs ...delegation.Delegation) error

func (*MemStore) Delegations

func (s *MemStore) Delegations() ([]delegation.Delegation, error)

func (*MemStore) HasPrincipal

func (s *MemStore) HasPrincipal() (bool, error)

func (*MemStore) Principal

func (s *MemStore) Principal() (principal.Signer, error)

func (*MemStore) Query

func (s *MemStore) Query(queries ...CapabilityQuery) ([]delegation.Delegation, error)

Query returns delegations that match the given capability queries. If no queries are provided, returns all non-expired delegations. Delegations are filtered by:

  • Expiration: excludes expired delegations
  • NotBefore: excludes delegations that are not yet valid
  • Capability matching: if queries are provided, only returns delegations whose capabilities match at least one of the queries

Additionally, this method includes relevant session proofs (ucan/attest delegations) that attest to the returned authorizations.

func (*MemStore) Reset

func (s *MemStore) Reset() error

func (*MemStore) SetPrincipal

func (s *MemStore) SetPrincipal(principal principal.Signer) error

type Store

type Store interface {
	HasPrincipal() (bool, error)
	Principal() (principal.Signer, error)
	SetPrincipal(principal principal.Signer) error
	Delegations() ([]delegation.Delegation, error)
	AddDelegations(delegations ...delegation.Delegation) error
	Reset() error
	Query(queries ...CapabilityQuery) ([]delegation.Delegation, error)
}

Jump to

Keyboard shortcuts

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