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
2 changes: 1 addition & 1 deletion commands/access/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ type ClaimArguments = commands.Unit

// Claim can be invoked by an agent to claim a set of delegations from the
// account.
var Claim = commands.MustParse[*ClaimArguments]("/access/claim")
var Claim = commands.MustParse[*ClaimArguments, *ClaimOK]("/access/claim")
2 changes: 1 addition & 1 deletion commands/access/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ConfirmOK = ClaimOK
const ConfirmMetaKey = "accessConfirm"

// Confirm can be invoked by an agent to confirm an access request.
var Confirm = commands.MustParse[*ConfirmArguments]("/access/confirm")
var Confirm = commands.MustParse[*ConfirmArguments, *ConfirmOK]("/access/confirm")

const (
InvalidAccessConfirmSubjectErrorName = "InvalidAccessConfirmSubject"
Expand Down
2 changes: 1 addition & 1 deletion commands/access/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type DelegateOK = commands.Unit

// Delegate can be invoked by an agent to delegate a set of capabilities that
// may be subsequently claimed by another agent.
var Delegate = commands.MustParse[*DelegateArguments]("/access/delegate")
var Delegate = commands.MustParse[*DelegateArguments, *DelegateOK]("/access/delegate")

const (
DelegationNotFoundErrorName = "DelegationNotFound"
Expand Down
2 changes: 1 addition & 1 deletion commands/access/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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 = commands.MustParse[*GrantArguments](GrantCommand)
var Grant = commands.MustParse[*GrantArguments, *GrantOK](GrantCommand)

const (
UnknownAbilityErrorName = "UnknownAbility"
Expand Down
2 changes: 1 addition & 1 deletion commands/access/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const RequestMetaKey = "accessRequest"

// Request can be invoked by an agent to request set of capabilities from the
// account.
var Request = commands.MustParse[*RequestArguments]("/access/request")
var Request = commands.MustParse[*RequestArguments, *RequestOK]("/access/request")

const (
InvalidAuthorizationAccountErrorName = "InvalidAuthorizationAccount"
Expand Down
2 changes: 1 addition & 1 deletion commands/assert/equals.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ import "github.com/fil-forge/libforge/commands"
type EqualsOK = commands.Unit

// Equals claims data is referred to by another CID e.g CAR CID & Piece CID
var Equals = commands.MustParse[*EqualsArguments]("/assert/equals")
var Equals = commands.MustParse[*EqualsArguments, *EqualsOK]("/assert/equals")
2 changes: 1 addition & 1 deletion commands/assert/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ type IndexOK = commands.Unit

// Index claims that a content graph can be found in blob(s) that are identified
// and indexed in the given index CID.
var Index = commands.MustParse[*IndexArguments]("/assert/index")
var Index = commands.MustParse[*IndexArguments, *IndexOK]("/assert/index")
2 changes: 1 addition & 1 deletion commands/assert/location.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type LocationOK = commands.Unit

var Location = commands.MustParse[*LocationArguments]("/assert/location")
var Location = commands.MustParse[*LocationArguments, *LocationOK]("/assert/location")
11 changes: 7 additions & 4 deletions commands/bind.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package commands

import "github.com/fil-forge/ucantone/validator/bindcom"
import (
"github.com/fil-forge/ucantone/bind"
"github.com/fil-forge/ucantone/ucan"
)

// MustParse is like [bindcom.Parse] but panics if the command cannot be
// MustParse is like [bind.Parse] but panics if the command cannot be
// constructed. It exists for package-level command declarations where the
// command and options are static — any error indicates a programming bug
// (malformed command string, invalid option) and should fail loudly at init
// rather than be silently dropped with `, _`.
func MustParse[A bindcom.Arguments](cmd string) bindcom.Command[A] {
c, err := bindcom.Parse[A](cmd)
func MustParse[Args, OK ucan.CBORValue](cmd string) bind.Binding[Args, OK] {
c, err := bind.Parse[Args, OK](cmd)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion commands/blob/accept.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package blob

import "github.com/fil-forge/libforge/commands"

var Accept = commands.MustParse[*AcceptArguments]("/blob/accept")
var Accept = commands.MustParse[*AcceptArguments, *AcceptOK]("/blob/accept")
2 changes: 1 addition & 1 deletion commands/blob/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package blob

import "github.com/fil-forge/libforge/commands"

var Add = commands.MustParse[*AddArguments]("/blob/add")
var Add = commands.MustParse[*AddArguments, *AddOK]("/blob/add")
2 changes: 1 addition & 1 deletion commands/blob/allocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

const MaxBlobSize = 268_435_456

var Allocate = commands.MustParse[*AllocateArguments]("/blob/allocate")
var Allocate = commands.MustParse[*AllocateArguments, *AllocateOK]("/blob/allocate")
2 changes: 1 addition & 1 deletion commands/blob/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package blob

import "github.com/fil-forge/libforge/commands"

var List = commands.MustParse[*ListArguments]("/blob/list")
var List = commands.MustParse[*ListArguments, *ListOK]("/blob/list")
2 changes: 1 addition & 1 deletion commands/blob/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type RemoveOK = commands.Unit

var Remove = commands.MustParse[*RemoveArguments]("/blob/remove")
var Remove = commands.MustParse[*RemoveArguments, *RemoveOK]("/blob/remove")
2 changes: 1 addition & 1 deletion commands/blob/replica/allocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package replica

import "github.com/fil-forge/libforge/commands"

var Allocate = commands.MustParse[*AllocateArguments]("/blob/replica/allocate")
var Allocate = commands.MustParse[*AllocateArguments, *AllocateOK]("/blob/replica/allocate")
2 changes: 1 addition & 1 deletion commands/blob/replica/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package replica

import "github.com/fil-forge/libforge/commands"

var Transfer = commands.MustParse[*TransferArguments]("/blob/replica/transfer")
var Transfer = commands.MustParse[*TransferArguments, *TransferOK]("/blob/replica/transfer")
2 changes: 1 addition & 1 deletion commands/blob/replicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import "github.com/fil-forge/libforge/commands"
// transferred and stored the blob. The number of `/blob/replica/allocate` and
// `/blob/replica/transfer` tasks corresponds directly to number of replicas
// requested.
var Replicate = commands.MustParse[*ReplicateArguments]("/blob/replicate")
var Replicate = commands.MustParse[*ReplicateArguments, *ReplicateOK]("/blob/replicate")
2 changes: 1 addition & 1 deletion commands/blob/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ import "github.com/fil-forge/libforge/commands"
// For user-facing retrieval that requires an allocation in a specific space
// see `libforge/commands/content.Retrieve` (the `/content/retrieve`
// capability).
var Retrieve = commands.MustParse[*RetrieveArguments]("/blob/retrieve")
var Retrieve = commands.MustParse[*RetrieveArguments, *RetrieveOK]("/blob/retrieve")
2 changes: 1 addition & 1 deletion commands/claim/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type CacheOK = commands.Unit

var Cache = commands.MustParse[*CacheArguments]("/claim/cache")
var Cache = commands.MustParse[*CacheArguments, *CacheOK]("/claim/cache")
2 changes: 1 addition & 1 deletion commands/content/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type RetrieveOK = commands.Unit

var Retrieve = commands.MustParse[*RetrieveArguments]("/content/retrieve")
var Retrieve = commands.MustParse[*RetrieveArguments, *RetrieveOK]("/content/retrieve")
2 changes: 1 addition & 1 deletion commands/debug/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type EchoOK = EchoArguments

var Echo = commands.MustParse[*EchoArguments]("/debug/echo")
var Echo = commands.MustParse[*EchoArguments, *EchoOK]("/debug/echo")
2 changes: 1 addition & 1 deletion commands/http/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type PutOK = commands.Unit

var Put = commands.MustParse[*PutArguments]("/http/put")
var Put = commands.MustParse[*PutArguments, *PutOK]("/http/put")
2 changes: 1 addition & 1 deletion commands/index/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type AddOK = commands.Unit

var Add = commands.MustParse[*AddArguments]("/index/add")
var Add = commands.MustParse[*AddArguments, *AddOK]("/index/add")

const IndexNotFoundErrorName = "IndexNotFound"

Expand Down
2 changes: 1 addition & 1 deletion commands/pdp/accept.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package pdp

import "github.com/fil-forge/libforge/commands"

var Accept = commands.MustParse[*AcceptArguments]("/pdp/accept")
var Accept = commands.MustParse[*AcceptArguments, *AcceptOK]("/pdp/accept")
2 changes: 1 addition & 1 deletion commands/pdp/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

const InfoCommand = "/pdp/info"

var Info = commands.MustParse[*InfoArguments]("/pdp/info")
var Info = commands.MustParse[*InfoArguments, *InfoOK]("/pdp/info")
2 changes: 1 addition & 1 deletion commands/provider/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/fil-forge/ucantone/errors"
)

var Add = commands.MustParse[*AddArguments]("/provider/add")
var Add = commands.MustParse[*AddArguments, *AddOK]("/provider/add")

const (
InvalidAccountErrorName = "InvalidAccount"
Expand Down
2 changes: 1 addition & 1 deletion commands/space/egress/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ import "github.com/fil-forge/libforge/commands"
// `/content/retrieve` receipts. The tracking service responds by forking
// a `/space/egress/consolidate` sub-invocation onto the receipt's
// effects; the typed OK return is empty.
var Track = commands.MustParse[*TrackArguments]("/space/egress/track")
var Track = commands.MustParse[*TrackArguments, *TrackOK]("/space/egress/track")
2 changes: 1 addition & 1 deletion commands/space/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import "github.com/fil-forge/libforge/commands"

type InfoArguments = commands.Unit

var Info = commands.MustParse[*InfoArguments]("/space/info")
var Info = commands.MustParse[*InfoArguments, *InfoOK]("/space/info")

const UnknownSpaceErrorName = "UnknownSpace"
2 changes: 1 addition & 1 deletion commands/ucan/attest/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ type ProofOK = commands.Unit

// Issued by a trusted authority (usually the one handling invocation) that
// attests a specific UCAN delegation has been considered authentic.
var Proof = commands.MustParse[*ProofArguments]("/ucan/attest/proof")
var Proof = commands.MustParse[*ProofArguments, *ProofOK]("/ucan/attest/proof")
2 changes: 1 addition & 1 deletion commands/ucan/conclude.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type ConcludeOK = commands.Unit

var Conclude = commands.MustParse[*ConcludeArguments]("/ucan/conclude")
var Conclude = commands.MustParse[*ConcludeArguments, *ConcludeOK]("/ucan/conclude")

const ConclusionReceiptNotFoundErrorName = "ConclusionReceiptNotFound"

Expand Down
2 changes: 1 addition & 1 deletion commands/upload/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type AddOK = commands.Unit

var Add = commands.MustParse[*AddArguments]("/upload/add")
var Add = commands.MustParse[*AddArguments, *AddOK]("/upload/add")
2 changes: 1 addition & 1 deletion commands/upload/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package upload

import "github.com/fil-forge/libforge/commands"

var List = commands.MustParse[*ListArguments]("/upload/list")
var List = commands.MustParse[*ListArguments, *ListOK]("/upload/list")
2 changes: 1 addition & 1 deletion commands/upload/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands"

type RemoveOK = commands.Unit

var Remove = commands.MustParse[*RemoveArguments]("/upload/remove")
var Remove = commands.MustParse[*RemoveArguments, *RemoveOK]("/upload/remove")
2 changes: 1 addition & 1 deletion commands/upload/shard/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package shard

import "github.com/fil-forge/libforge/commands"

var List = commands.MustParse[*ListArguments]("/upload/shard/list")
var List = commands.MustParse[*ListArguments, *ListOK]("/upload/shard/list")
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.25.3
require (
github.com/alanshaw/dag-json-gen v0.0.5
github.com/fil-forge/automobile v0.0.1
github.com/fil-forge/ucantone v0.0.0-20260519193222-ad31490eaa10
github.com/fil-forge/ucantone v0.0.0-20260520204404-e2ce81a7ec06
github.com/filecoin-project/go-data-segment v0.0.1
github.com/gobwas/glob v0.2.3
github.com/ipfs/go-cid v0.6.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fil-forge/automobile v0.0.1 h1:9xB3yc4l5b9EdRJSJcNwudgBFNHoMPEAdcb7GfobLhA=
github.com/fil-forge/automobile v0.0.1/go.mod h1:TsO7jlO8ykJZY5tF8j4GsUcu3F02lEzxO7ULoB61hRA=
github.com/fil-forge/ucantone v0.0.0-20260519193222-ad31490eaa10 h1:ApgWAIpXjCYjZw/yDxLn8IA9WrH/ENPRWCWPT/MoCvU=
github.com/fil-forge/ucantone v0.0.0-20260519193222-ad31490eaa10/go.mod h1:vqgVEsy6LEEsY24Zyjxem0vSofj1XTIx29GbV635f+I=
github.com/fil-forge/ucantone v0.0.0-20260520204404-e2ce81a7ec06 h1:s7WcrsieqhOBYmQwTjdwIF/nMtgISRuSxTwki6tiS4A=
github.com/fil-forge/ucantone v0.0.0-20260520204404-e2ce81a7ec06/go.mod h1:vqgVEsy6LEEsY24Zyjxem0vSofj1XTIx29GbV635f+I=
github.com/filecoin-project/go-data-segment v0.0.1 h1:1wmDxOG4ubWQm3ZC1XI5nCon5qgSq7Ra3Rb6Dbu10Gs=
github.com/filecoin-project/go-data-segment v0.0.1/go.mod h1:H0/NKbsRxmRFBcLibmABv+yFNHdmtl5AyplYLnb0Zv4=
github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88OqLYEo6roi+GiIeOh8=
Expand Down
4 changes: 2 additions & 2 deletions ucan/retrieval/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import (
"net/url"
"testing"

"github.com/fil-forge/ucantone/bind"
"github.com/fil-forge/ucantone/execution"
"github.com/fil-forge/ucantone/ipld/datamodel"
"github.com/fil-forge/ucantone/testutil"
"github.com/fil-forge/ucantone/ucan/container"
"github.com/fil-forge/ucantone/ucan/invocation"
"github.com/fil-forge/ucantone/validator/bindcom"
"github.com/stretchr/testify/require"

"github.com/fil-forge/libforge/ucan/retrieval"
)

var contentRetrieve, _ = bindcom.Parse[*datamodel.Map]("/content/retrieve")
var contentRetrieve, _ = bind.Parse[*datamodel.Map, *datamodel.Map]("/content/retrieve")

func TestServer(t *testing.T) {
service := testutil.RandomSigner(t)
Expand Down
Loading