Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
185 changes: 185 additions & 0 deletions capabilities/access/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions capabilities/access/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func main() {
access.ClaimOK{},
access.ConfirmArguments{},
access.DelegateArguments{},
access.GrantArguments{},
}
const (
cborFile = "../cbor_gen.go"
Expand Down
35 changes: 35 additions & 0 deletions capabilities/access/grant.go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a rebase - these are in commands dir now.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//go:build !codegen

package access

import (
"github.com/fil-forge/libforge/capabilities"
"github.com/fil-forge/ucantone/errors"
)

const GrantCommand = "/access/grant"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string is inlined into the MustNew call for all other commands.


// 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 GrantOK = ClaimOK

// 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 Grant = capabilities.MustNew[*GrantArguments](GrantCommand)

const (
UnknownAbilityErrorName = "UnknownAbility"
MissingCapabilityErrorName = "MissingCapability"
UnknownCauseErrorName = "UnknownCause"
MissingCauseErrorName = "MissingCause"
InvalidCauseErrorName = "InvalidCause"
UnauthorizedCauseErrorName = "UnauthorizedCause"
)

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")
)
Loading
Loading