Documentation ¶
Index ¶
- func Archive(d Delegation) io.Reader
- func Format(dlg Delegation) (string, error)
- type Delegation
- func Delegate[C ucan.CaveatBuilder](issuer ucan.Signer, audience ucan.Principal, capabilities []ucan.Capability[C], ...) (Delegation, error)
- func Extract(b []byte) (Delegation, error)
- func NewDelegation(root ipld.Block, bs blockstore.BlockReader) (Delegation, error)
- func NewDelegationView(root ipld.Link, bs blockstore.BlockReader) (Delegation, error)
- func Parse(input string) (Delegation, error)
- type Option
- type Proof
- type Proofs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Archive ¶
func Archive(d Delegation) io.Reader
func Format ¶
func Format(dlg Delegation) (string, error)
Types ¶
type Delegation ¶
type Delegation interface { ipld.View ucan.UCAN // Data returns the UCAN view of the delegation. Data() ucan.View // Link returns the IPLD link of the root block of the delegation. Link() ucan.Link // Archive writes the delegation to a Content Addressed aRchive (CAR). Archive() io.Reader // Attach a block to the delegation DAG so it will be included in the block // iterator. You should only attach blocks that are referenced from // `Capabilities` or `Facts`. Attach(block block.Block) error }
Delagation is a materialized view of a UCAN delegation, which can be encoded into a UCAN token and used as proof for an invocation or further delegations.
func Delegate ¶
func Delegate[C ucan.CaveatBuilder](issuer ucan.Signer, audience ucan.Principal, capabilities []ucan.Capability[C], options ...Option) (Delegation, error)
Delegate creates a new signed token with a given `options.issuer`. If expiration is not set it defaults to 30 seconds from now. Returns UCAN in primary IPLD representation.
func Extract ¶
func Extract(b []byte) (Delegation, error)
func NewDelegation ¶
func NewDelegation(root ipld.Block, bs blockstore.BlockReader) (Delegation, error)
func NewDelegationView ¶
func NewDelegationView(root ipld.Link, bs blockstore.BlockReader) (Delegation, error)
func Parse ¶
func Parse(input string) (Delegation, error)
type Option ¶
type Option func(cfg *delegationConfig) error
Option is an option configuring a UCAN delegation.
func WithExpiration ¶
WithExpiration configures the expiration time in UTC seconds since Unix epoch.
func WithFacts ¶
func WithFacts(fct []ucan.FactBuilder) Option
WithFacts configures the facts for the UCAN.
func WithNoExpiration ¶
func WithNoExpiration() Option
WithNoExpiration configures the UCAN to never expire.
WARNING: this will cause the delegation to be valid FOREVER, unless revoked.
func WithNotBefore ¶
WithNotBefore configures the time in UTC seconds since Unix epoch when the UCAN will become valid.
type Proof ¶
type Proof struct {
// contains filtered or unexported fields
}
func FromDelegation ¶
func FromDelegation(delegation Delegation) Proof
func (Proof) Delegation ¶
func (p Proof) Delegation() (Delegation, bool)
type Proofs ¶
type Proofs []Proof
func NewProofsView ¶
func NewProofsView(links []ipld.Link, bs blockstore.BlockReader) Proofs
func (Proofs) WriteInto ¶
func (proofs Proofs) WriteInto(bs blockstore.BlockWriter) ([]ipld.Link, error)
WriteInto writes a set of proofs, some of which may be full delegations to a blockstore