Skip to content

Commit aba2bd2

Browse files
authored
feat: add /ucan/revoke command (#47)
Refs https://github.com/ucan-wg/revocation
1 parent aac837a commit aba2bd2

5 files changed

Lines changed: 373 additions & 0 deletions

File tree

commands/ucan/cbor_gen.go

Lines changed: 165 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commands/ucan/gen/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func tag(path string) {
2525
func main() {
2626
models := []any{
2727
ucan.ConcludeArguments{},
28+
ucan.RevokeArguments{},
2829
}
2930
const (
3031
cborFile = "../cbor_gen.go"

commands/ucan/json_gen.go

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commands/ucan/revoke.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//go:build !codegen
2+
3+
package ucan
4+
5+
import (
6+
"github.com/fil-forge/libforge/commands"
7+
"github.com/fil-forge/ucantone/binding"
8+
"github.com/fil-forge/ucantone/ucan/command"
9+
)
10+
11+
type RevokeOK = commands.Unit
12+
13+
var Revoke = binding.Bind[*RevokeArguments, *RevokeOK](command.MustParse("/ucan/revoke"))

commands/ucan/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ import "github.com/ipfs/go-cid"
55
type ConcludeArguments struct {
66
Receipt cid.Cid `cborgen:"receipt" dagjsongen:"receipt"`
77
}
8+
9+
type RevokeArguments struct {
10+
// Revoke is the CID of the UCAN delegation to revoke.
11+
Revoke cid.Cid `cborgen:"revoke" dagjsongen:"revoke"`
12+
// Path is the delegation path to the UCAN delegation to revoke. The path is a
13+
// list of CIDs that represent the delegation chain from the root UCAN to the
14+
// UCAN being revoked.
15+
Path []cid.Cid `cborgen:"path" dagjsongen:"path"`
16+
}

0 commit comments

Comments
 (0)