Documentation
¶
Overview ¶
Package capabilities defines the public definitions for tlog UCAN capabilities.
Package capabilities defines the public types for tlog UCAN capabilities.
Index ¶
Constants ¶
const ( AbilityCreate = "tlog/create" AbilityAppend = "tlog/append" AbilityRead = "tlog/read" AbilityRevoke = "tlog/revoke" // Changed from tlog/admin/revoke )
Capability ability constants
Variables ¶
var ( // TlogCreate is the capability parser for tlog/create TlogCreate = validator.NewCapability( AbilityCreate, schema.DIDString(), schema.Struct[CreateCaveats](createCaveatsType(), nil), nil, ) // TlogAppend is the capability parser for tlog/append TlogAppend = validator.NewCapability( AbilityAppend, schema.DIDString(), schema.Struct[AppendCaveats](appendCaveatsType(), nil), nil, ) // TlogRead is the capability parser for tlog/read TlogRead = validator.NewCapability( AbilityRead, schema.DIDString(), schema.Struct[ReadCaveats](readCaveatsType(), nil), nil, ) // TlogRevoke is the capability parser for tlog/revoke TlogRevoke = validator.NewCapability( AbilityRevoke, schema.DIDString(), schema.Struct[RevokeCaveats](revokeCaveatsType(), nil), nil, ) )
Capability parsers
Functions ¶
This section is empty.
Types ¶
type AppendCaveats ¶
type AppendCaveats struct {
// Data is the base64-encoded data to append
Data string `json:"data"`
// IndexCID is the expected current head CID for optimistic concurrency (optional)
IndexCID *string `json:"index_cid,omitempty"`
// Delegation is the base64-encoded UCAN delegation (required)
Delegation string `json:"delegation"`
}
AppendCaveats represents the caveats for tlog/append capability
type AppendFailure ¶
type AppendFailure struct {
// contains filtered or unexported fields
}
AppendFailure is the failure result for tlog/append
func NewAppendFailure ¶
func NewAppendFailure(name, message string) AppendFailure
NewAppendFailure creates a new AppendFailure
func (AppendFailure) Error ¶
func (f AppendFailure) Error() string
func (AppendFailure) Name ¶
func (f AppendFailure) Name() string
type AppendSuccess ¶
type AppendSuccess struct {
Index int64 `json:"index"`
TreeSize uint64 `json:"tree_size"` // New tree size
Checkpoint string `json:"checkpoint,omitempty"` // base64-encoded signed checkpoint note
HeadCID string `json:"head_cid,omitempty"` // pre-computed CID of the head CAR
RevHeadCID string `json:"rev_head_cid,omitempty"` // head CID of the revocations log (empty if no revocations)
}
AppendSuccess is the success result for tlog/append
type CreateCaveats ¶
type CreateCaveats struct {
// Delegation is the base64-encoded UCAN delegation granting write access to the space
Delegation string `json:"delegation"`
}
CreateCaveats represents the caveats for tlog/create capability
type CreateFailure ¶
type CreateFailure struct {
// contains filtered or unexported fields
}
CreateFailure is the failure result for tlog/create
func NewCreateFailure ¶
func NewCreateFailure(name, message string) CreateFailure
NewCreateFailure creates a new CreateFailure
func (CreateFailure) Error ¶
func (f CreateFailure) Error() string
func (CreateFailure) Name ¶
func (f CreateFailure) Name() string
type CreateSuccess ¶
type CreateSuccess struct {
LogID string `json:"logId"`
IndexCID string `json:"index_cid"` // Initial head CID
TreeSize uint64 `json:"tree_size"` // Initial tree size (0)
}
CreateSuccess is the success result for tlog/create
type ReadCaveats ¶
type ReadCaveats struct {
// Offset is the starting index (optional)
Offset *int64
// Limit is the maximum number of entries to return (optional)
Limit *int64
}
ReadCaveats represents the caveats for tlog/read capability
type ReadFailure ¶
type ReadFailure struct {
// contains filtered or unexported fields
}
ReadFailure is the failure result for tlog/read
func NewReadFailure ¶
func NewReadFailure(name, message string) ReadFailure
NewReadFailure creates a new ReadFailure
func (ReadFailure) Error ¶
func (f ReadFailure) Error() string
func (ReadFailure) Name ¶
func (f ReadFailure) Name() string
type ReadSuccess ¶
ReadSuccess is the success result for tlog/read
type RevokeCaveats ¶
type RevokeCaveats struct {
// Cid is the CID of the delegation to revoke.
// The delegation must be stored in the space (uploaded by the client).
Cid string `json:"cid"`
// Delegation grants access to the space for fetching the delegation
// and writing to the revocation log (base64-encoded)
Delegation string `json:"delegation"`
}
RevokeCaveats represents the caveats for tlog/revoke capability
type RevokeFailure ¶
type RevokeFailure struct {
// contains filtered or unexported fields
}
RevokeFailure is the failure result for tlog/revoke
func NewRevokeFailure ¶
func NewRevokeFailure(name, message string) RevokeFailure
NewRevokeFailure creates a new RevokeFailure
func (RevokeFailure) Error ¶
func (f RevokeFailure) Error() string
func (RevokeFailure) Name ¶
func (f RevokeFailure) Name() string
type RevokeSuccess ¶
type RevokeSuccess struct {
Revoked bool `json:"revoked"`
}
RevokeSuccess is the success result for tlog/revoke