Documentation
¶
Index ¶
Constants ¶
const ( InvalidAccessConfirmSubjectErrorName = "InvalidAccessConfirmSubject" InvalidAccessConfirmIssuerErrorName = "InvalidAccessConfirmIssuer" )
const ( DelegationNotFoundErrorName = "DelegationNotFound" InsufficientStorageErrorName = "InsufficientStorage" )
const ( UnknownAbilityErrorName = "UnknownAbility" MissingCapabilityErrorName = "MissingCapability" UnknownCauseErrorName = "UnknownCause" MissingCauseErrorName = "MissingCause" InvalidCauseErrorName = "InvalidCause" )
const ( InvalidAuthorizationAccountErrorName = "InvalidAuthorizationAccount" InvalidAuthorizationAudienceErrorName = "InvalidAuthorizationAudience" )
const ConfirmMetaKey = "accessConfirm"
ConfirmMetaKey is the key in metadata in any delegation created by a successful access request. The value is a link back to the `/access/confirm` invocation.
const GrantCommand = "/access/grant"
const RequestMetaKey = "accessRequest"
RequestFactKey is the key in metadata in any delegation created by a successful access request. The value is a link back to the `/access/request` invocation.
Variables ¶
var ( ErrInvalidAccessConfirmSubject = errors.New(InvalidAccessConfirmSubjectErrorName, "the subject of an access confirm invocation must be the service itself") ErrInvalidAccessConfirmIssuer = errors.New(InvalidAccessConfirmIssuerErrorName, "the issuer of an access confirm invocation must be a valid mailto DID") )
var ( ErrMissingCapability = errors.New(MissingCapabilityErrorName, "grant requires one or more capabilities") ErrMissingCause = errors.New(MissingCauseErrorName, "grant requires a supporting contextual invocation") ErrUnknownCause = errors.New(UnknownCauseErrorName, "unknown cause invocation") )
var Claim = binding.Bind[*ClaimArguments, *ClaimOK](command.MustParse("/access/claim"))
Claim can be invoked by an agent to claim a set of delegations from the account.
var Confirm = binding.Bind[*ConfirmArguments, *ConfirmOK](command.MustParse("/access/confirm"))
Confirm can be invoked by an agent to confirm an access request.
var Delegate = binding.Bind[*DelegateArguments, *DelegateOK](command.MustParse("/access/delegate"))
Delegate can be invoked by an agent to delegate a set of capabilities that may be subsequently claimed by another agent.
var Grant = binding.Bind[*GrantArguments, *GrantOK](command.MustParse(GrantCommand))
Grant can be invoked by an agent to request that a set of capabilities be granted directly. Unlike Request -> Confirm, Grant is one-shot: the executor decides immediately whether to issue the delegation.
var Request = binding.Bind[*RequestArguments, *RequestOK](command.MustParse("/access/request"))
Request can be invoked by an agent to request set of capabilities from the account.
Functions ¶
This section is empty.
Types ¶
type CapabilityRequest ¶
func (*CapabilityRequest) MarshalCBOR ¶
func (t *CapabilityRequest) MarshalCBOR(w io.Writer) error
func (*CapabilityRequest) MarshalDagJSON ¶
func (t *CapabilityRequest) MarshalDagJSON(w io.Writer) error
func (*CapabilityRequest) UnmarshalCBOR ¶
func (t *CapabilityRequest) UnmarshalCBOR(r io.Reader) (err error)
func (*CapabilityRequest) UnmarshalDagJSON ¶
func (t *CapabilityRequest) UnmarshalDagJSON(r io.Reader) (err error)
type ClaimArguments ¶
type ClaimOK ¶
type ConfirmArguments ¶
type ConfirmArguments struct {
Cause cid.Cid `cborgen:"cause" dagjsongen:"cause"`
Issuer did.DID `cborgen:"iss" dagjsongen:"iss"`
Audience did.DID `cborgen:"aud" dagjsongen:"aud"`
Attenuations []CapabilityRequest `cborgen:"att" dagjsongen:"att"`
}
func (*ConfirmArguments) MarshalCBOR ¶
func (t *ConfirmArguments) MarshalCBOR(w io.Writer) error
func (*ConfirmArguments) MarshalDagJSON ¶
func (t *ConfirmArguments) MarshalDagJSON(w io.Writer) error
func (*ConfirmArguments) UnmarshalCBOR ¶
func (t *ConfirmArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*ConfirmArguments) UnmarshalDagJSON ¶
func (t *ConfirmArguments) UnmarshalDagJSON(r io.Reader) (err error)
type ConfirmOK ¶
type ConfirmOK = ClaimOK
ConfirmOK mirrors ClaimOK — confirming an access request grants the same shape of delegations bundle as claiming them.
type DelegateArguments ¶
type DelegateArguments struct {
// The delegations to store.
Delegations []cid.Cid `cborgen:"delegations" dagjsongen:"delegations"`
}
func (*DelegateArguments) MarshalCBOR ¶
func (t *DelegateArguments) MarshalCBOR(w io.Writer) error
func (*DelegateArguments) MarshalDagJSON ¶
func (t *DelegateArguments) MarshalDagJSON(w io.Writer) error
func (*DelegateArguments) UnmarshalCBOR ¶
func (t *DelegateArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*DelegateArguments) UnmarshalDagJSON ¶
func (t *DelegateArguments) UnmarshalDagJSON(r io.Reader) (err error)
type DelegateOK ¶
type GrantArguments ¶
type GrantArguments struct {
// Attenuations are the capabilities the agent wishes to be granted.
Attenuations []CapabilityRequest `cborgen:"att" dagjsongen:"att"`
// Cause optionally links to a UCAN invocation that contextualizes the
// grant request. Leave nil when no cause is needed; otherwise the
// linked invocation MUST be present in the request container.
Cause *cid.Cid `cborgen:"cause,omitempty" dagjsongen:"cause,omitempty"`
}
func (*GrantArguments) MarshalCBOR ¶
func (t *GrantArguments) MarshalCBOR(w io.Writer) error
func (*GrantArguments) MarshalDagJSON ¶
func (t *GrantArguments) MarshalDagJSON(w io.Writer) error
func (*GrantArguments) UnmarshalCBOR ¶
func (t *GrantArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*GrantArguments) UnmarshalDagJSON ¶
func (t *GrantArguments) UnmarshalDagJSON(r io.Reader) (err error)
type GrantOK ¶
type GrantOK = ClaimOK
GrantOK mirrors ClaimOK / ConfirmOK: a successful grant resolves into a bundle of delegation CIDs. The actual delegation envelopes ride in the receipt response container as metadata.
type RequestArguments ¶
type RequestArguments struct {
// DID of the Account authorization is requested from.
Issuer did.DID `cborgen:"iss" dagjsongen:"iss"`
// Capabilities agent wishes to be granted.
Attenuations []CapabilityRequest `cborgen:"att" dagjsongen:"att"`
}
func (*RequestArguments) MarshalCBOR ¶
func (t *RequestArguments) MarshalCBOR(w io.Writer) error
func (*RequestArguments) MarshalDagJSON ¶
func (t *RequestArguments) MarshalDagJSON(w io.Writer) error
func (*RequestArguments) UnmarshalCBOR ¶
func (t *RequestArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*RequestArguments) UnmarshalDagJSON ¶
func (t *RequestArguments) UnmarshalDagJSON(r io.Reader) (err error)
type RequestOK ¶
type RequestOK struct {
// Request is a link to the access request invocation.
Request cid.Cid `cborgen:"req" dagjsongen:"req"`
// Confirm is the task that will confirm the access request.
Confirm promise.AwaitOK `cborgen:"confirm" dagjsongen:"confirm"`
// Expiration is the time at which the confirmation will expire.
Expiration int64 `cborgen:"exp" dagjsongen:"exp"`
}