Documentation
¶
Index ¶
- func Query(delegations []delegation.Delegation, queries []CapabilityQuery) []delegation.Delegation
- type AgentData
- type CapabilityQuery
- type FsStore
- func (s *FsStore) AddDelegations(delegs ...delegation.Delegation) error
- func (s *FsStore) Delegations() ([]delegation.Delegation, error)
- func (s *FsStore) HasPrincipal() (bool, error)
- func (s *FsStore) Principal() (principal.Signer, error)
- func (s *FsStore) Query(queries ...CapabilityQuery) ([]delegation.Delegation, error)
- func (s *FsStore) Reset() error
- func (s *FsStore) SetPrincipal(principal principal.Signer) error
- type MemStore
- func (s *MemStore) AddDelegations(delegs ...delegation.Delegation) error
- func (s *MemStore) Delegations() ([]delegation.Delegation, error)
- func (s *MemStore) HasPrincipal() (bool, error)
- func (s *MemStore) Principal() (principal.Signer, error)
- func (s *MemStore) Query(queries ...CapabilityQuery) ([]delegation.Delegation, error)
- func (s *MemStore) Reset() error
- func (s *MemStore) SetPrincipal(principal principal.Signer) error
- type Store
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 (*AgentData) UnmarshalJSON ¶
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 (*FsStore) AddDelegations ¶
func (s *FsStore) AddDelegations(delegs ...delegation.Delegation) error
func (*FsStore) Delegations ¶
func (s *FsStore) Delegations() ([]delegation.Delegation, error)
func (*FsStore) HasPrincipal ¶
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.
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
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 (*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.
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)
}