From 7e54be49e19dad559303ade87cfa1020737f041b Mon Sep 17 00:00:00 2001 From: Steve Moyer Date: Wed, 27 Nov 2024 15:01:06 -0500 Subject: [PATCH 1/3] chore(delegationtest): eliminate dependency on dave/jennifer/jen package Resolves #68 --- .../data/TokenCarolDan_InvalidExpired.dagcbor | Bin 337 -> 337 bytes .../data/TokenDanErin_InvalidExpired.dagcbor | Bin 337 -> 337 bytes .../TokenErinFrank_InvalidExpired.dagcbor | Bin 337 -> 337 bytes .../delegationtest/generator/generator.go | 55 +++++----- token/delegation/delegationtest/token_gen.go | 94 +++++++++--------- 5 files changed, 79 insertions(+), 70 deletions(-) diff --git a/token/delegation/delegationtest/data/TokenCarolDan_InvalidExpired.dagcbor b/token/delegation/delegationtest/data/TokenCarolDan_InvalidExpired.dagcbor index 2c3342fa3d8f802047b4e5d1bb77264690acbe18..89b029850a4041376d902284d97bf0b2b57b0b2d 100644 GIT binary patch delta 81 zcmV-X0IvVh0?`6Pf>=NoZLk^=VcD2MjIxDm*m`aXx<(w)Cmy+C#O n=rL7zz|HHgAoVRY1*1_3SiR=DIXBeo!VLwHLwEvt43WK*x_l(0 delta 81 zcmV-X0IvVh0?`6Pf>=PlQ(_1P7cMc-f-o~buZJA_jmXH0m1N+PBp^>U6{ue$5v=wl nJBqggsyqW2aWAjd3v`u+h41(qGLqfq9vcCXLwEu$pOL+kIrbs3 diff --git a/token/delegation/delegationtest/data/TokenDanErin_InvalidExpired.dagcbor b/token/delegation/delegationtest/data/TokenDanErin_InvalidExpired.dagcbor index d491d6b09c1b46af5fd688129daba2b32a985304..c910a1c5b455b9b17e7d5ebee69e5fa323025318 100644 GIT binary patch delta 81 zcmV-X0IvVh0?`6Pf>=PHM8w2<3Fxy?Z}(;WG1s8RA^u2Aknj7oFhATd4bdIPJ?S5% nL7{MGd-#O#u&rB_<*~Rqw)z(ycyO1#sI&=@LwEvt43WK*y2B~Y delta 81 zcmV-X0IvVh0?`6Pf>=PoH%tlh7$YfoX9Q?7O}goc(J$)vFqOi)*)#iD(8w5vp1VDe nqx~dVH=OzXkIh*=^mZEtB+(cURW|K=okm~n|hHyU)&^Iob{x&f8{c) nk7qp^tDb=VFCjP=bgV}=QH^~X6y^Cr!#m&*rTcWk?O#6yW2@K0&IwH5#0S#Db=r7age n8gDiM>?!roK90T9?KABF)i}T+=w&OjtaApDLwEu$pOL+kSiC0( diff --git a/token/delegation/delegationtest/generator/generator.go b/token/delegation/delegationtest/generator/generator.go index c15f29f..f2f088d 100644 --- a/token/delegation/delegationtest/generator/generator.go +++ b/token/delegation/delegationtest/generator/generator.go @@ -1,12 +1,12 @@ package main import ( + "fmt" "os" "path/filepath" "slices" "time" - "github.com/dave/jennifer/jen" "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p/core/crypto" @@ -30,7 +30,6 @@ var constantNonce = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, type newDelegationParams struct { privKey crypto.PrivKey aud did.DID - sub did.DID cmd command.Command pol policy.Policy opts []delegation.Option @@ -203,36 +202,46 @@ func (g *generator) createProofChain(name string, prf []cid.Cid) { } func (g *generator) writeGoFile() error { - file := jen.NewFile("delegationtest") - file.HeaderComment("Code generated by delegationtest - DO NOT EDIT.") + var err error - refs := map[cid.Cid]string{} + f, err := os.Create("../token_gen.go") + if err != nil { + return err + } + + defer func() { + err = f.Close() + }() + + fmt.Fprintln(f, "// Code generated by delegationtest - DO NOT EDIT.") + fmt.Fprintln(f) + fmt.Fprintln(f, "package delegationtest") + fmt.Fprintln(f) + fmt.Fprintln(f, "import \"github.com/ipfs/go-cid\"") + + refs := make(map[cid.Cid]string, len(g.dlgs)) for _, d := range g.dlgs { refs[d.id] = d.name + "CID" - file.Var().Defs( - jen.Id(d.name+"CID").Op("=").Qual("github.com/ipfs/go-cid", "MustParse").Call(jen.Lit(d.id.String())), - jen.Id(d.name).Op("=").Id("mustGetDelegation").Call(jen.Id(d.name+"CID")), - ) - file.Line() + fmt.Fprintln(f) + fmt.Fprintln(f, "var (") + fmt.Fprintf(f, "\t%s = cid.MustParse(\"%s\")\n", d.name+"CID", d.id.String()) + fmt.Fprintf(f, "\t%s = mustGetDelegation(%s)\n", d.name, d.name+"CID") + fmt.Fprintln(f, ")") } for _, c := range g.chains { - g := jen.CustomFunc(jen.Options{ - Multi: true, - Separator: ",", - Close: "\n", - }, func(g *jen.Group) { - slices.Reverse(c.prf) - for _, p := range c.prf { - g.Id(refs[p]) - } - }) + fmt.Fprintln(f) + fmt.Fprintf(f, "var %s = []cid.Cid{\n", c.name) + + slices.Reverse(c.prf) + for _, d := range c.prf { + fmt.Fprintf(f, "\t%s,\n", refs[d]) + } - file.Var().Id(c.name).Op("=").Index().Qual("github.com/ipfs/go-cid", "Cid").Values(g) - file.Line() + fmt.Fprintln(f, "}") } - return file.Save("../token_gen.go") + return err } diff --git a/token/delegation/delegationtest/token_gen.go b/token/delegation/delegationtest/token_gen.go index 63359ae..2918178 100644 --- a/token/delegation/delegationtest/token_gen.go +++ b/token/delegation/delegationtest/token_gen.go @@ -2,146 +2,146 @@ package delegationtest -import gocid "github.com/ipfs/go-cid" +import "github.com/ipfs/go-cid" var ( - TokenAliceBobCID = gocid.MustParse("bafyreicidrwvmac5lvjypucgityrtjsknojraio7ujjli4r5eyby66wjzm") + TokenAliceBobCID = cid.MustParse("bafyreicidrwvmac5lvjypucgityrtjsknojraio7ujjli4r5eyby66wjzm") TokenAliceBob = mustGetDelegation(TokenAliceBobCID) ) var ( - TokenBobCarolCID = gocid.MustParse("bafyreihxv2uhq43oxllzs2xfvxst7wtvvvl7pohb2chcz6hjvfv2ntea5u") + TokenBobCarolCID = cid.MustParse("bafyreihxv2uhq43oxllzs2xfvxst7wtvvvl7pohb2chcz6hjvfv2ntea5u") TokenBobCarol = mustGetDelegation(TokenBobCarolCID) ) var ( - TokenCarolDanCID = gocid.MustParse("bafyreihclsgiroazq3heqdswvj2cafwqbpboicq7immo65scl7ahktpsdq") + TokenCarolDanCID = cid.MustParse("bafyreihclsgiroazq3heqdswvj2cafwqbpboicq7immo65scl7ahktpsdq") TokenCarolDan = mustGetDelegation(TokenCarolDanCID) ) var ( - TokenDanErinCID = gocid.MustParse("bafyreicja6ihewy64p3ake56xukotafjlkh4uqep2qhj52en46zzfwby3e") + TokenDanErinCID = cid.MustParse("bafyreicja6ihewy64p3ake56xukotafjlkh4uqep2qhj52en46zzfwby3e") TokenDanErin = mustGetDelegation(TokenDanErinCID) ) var ( - TokenErinFrankCID = gocid.MustParse("bafyreicjlx3lobxm6hl5s4htd4ydwkkqeiou6rft4rnvulfdyoew565vka") + TokenErinFrankCID = cid.MustParse("bafyreicjlx3lobxm6hl5s4htd4ydwkkqeiou6rft4rnvulfdyoew565vka") TokenErinFrank = mustGetDelegation(TokenErinFrankCID) ) var ( - TokenCarolDan_InvalidExpandedCommandCID = gocid.MustParse("bafyreid3m3pk53gqgp5rlzqhvpedbwsqbidqlp4yz64vknwbzj7bxrmsr4") + TokenCarolDan_InvalidExpandedCommandCID = cid.MustParse("bafyreid3m3pk53gqgp5rlzqhvpedbwsqbidqlp4yz64vknwbzj7bxrmsr4") TokenCarolDan_InvalidExpandedCommand = mustGetDelegation(TokenCarolDan_InvalidExpandedCommandCID) ) var ( - TokenDanErin_InvalidExpandedCommandCID = gocid.MustParse("bafyreifn4sy5onwajx3kqvot5mib6m6xarzrqjozqbzgmzpmc5ox3g2uzm") + TokenDanErin_InvalidExpandedCommandCID = cid.MustParse("bafyreifn4sy5onwajx3kqvot5mib6m6xarzrqjozqbzgmzpmc5ox3g2uzm") TokenDanErin_InvalidExpandedCommand = mustGetDelegation(TokenDanErin_InvalidExpandedCommandCID) ) var ( - TokenErinFrank_InvalidExpandedCommandCID = gocid.MustParse("bafyreidmpgd36jznmq42bs34o4qi3fcbrsh4idkg6ejahudejzwb76fwxe") + TokenErinFrank_InvalidExpandedCommandCID = cid.MustParse("bafyreidmpgd36jznmq42bs34o4qi3fcbrsh4idkg6ejahudejzwb76fwxe") TokenErinFrank_InvalidExpandedCommand = mustGetDelegation(TokenErinFrank_InvalidExpandedCommandCID) ) var ( - TokenCarolDan_ValidAttenuatedCommandCID = gocid.MustParse("bafyreiekhtm237vyapk3c6voeb5lnz54crebqdqi3x4wn4u4cbrrhzsqfe") + TokenCarolDan_ValidAttenuatedCommandCID = cid.MustParse("bafyreiekhtm237vyapk3c6voeb5lnz54crebqdqi3x4wn4u4cbrrhzsqfe") TokenCarolDan_ValidAttenuatedCommand = mustGetDelegation(TokenCarolDan_ValidAttenuatedCommandCID) ) var ( - TokenDanErin_ValidAttenuatedCommandCID = gocid.MustParse("bafyreicrvzqferyy7rgo75l5rn6r2nl7zyeexxjmu3dm4ff7rn2coblj4y") + TokenDanErin_ValidAttenuatedCommandCID = cid.MustParse("bafyreicrvzqferyy7rgo75l5rn6r2nl7zyeexxjmu3dm4ff7rn2coblj4y") TokenDanErin_ValidAttenuatedCommand = mustGetDelegation(TokenDanErin_ValidAttenuatedCommandCID) ) var ( - TokenErinFrank_ValidAttenuatedCommandCID = gocid.MustParse("bafyreie6fhspk53kplcc2phla3e7z7fzldlbmmpuwk6nbow5q6s2zjmw2q") + TokenErinFrank_ValidAttenuatedCommandCID = cid.MustParse("bafyreie6fhspk53kplcc2phla3e7z7fzldlbmmpuwk6nbow5q6s2zjmw2q") TokenErinFrank_ValidAttenuatedCommand = mustGetDelegation(TokenErinFrank_ValidAttenuatedCommandCID) ) var ( - TokenCarolDan_InvalidSubjectCID = gocid.MustParse("bafyreifgksz6756if42tnc6rqsnbaa2u3fdrveo7ek44lnj2d64d5sw26u") + TokenCarolDan_InvalidSubjectCID = cid.MustParse("bafyreifgksz6756if42tnc6rqsnbaa2u3fdrveo7ek44lnj2d64d5sw26u") TokenCarolDan_InvalidSubject = mustGetDelegation(TokenCarolDan_InvalidSubjectCID) ) var ( - TokenDanErin_InvalidSubjectCID = gocid.MustParse("bafyreibdwew5nypsxrm4fq73wu6hw3lgwwiolj3bi33xdrbgcf3ogm6fty") + TokenDanErin_InvalidSubjectCID = cid.MustParse("bafyreibdwew5nypsxrm4fq73wu6hw3lgwwiolj3bi33xdrbgcf3ogm6fty") TokenDanErin_InvalidSubject = mustGetDelegation(TokenDanErin_InvalidSubjectCID) ) var ( - TokenErinFrank_InvalidSubjectCID = gocid.MustParse("bafyreicr364mj3n7x4iyhcksxypelktcqkkw3ptg7ggxtqegw3p3mr6zc4") + TokenErinFrank_InvalidSubjectCID = cid.MustParse("bafyreicr364mj3n7x4iyhcksxypelktcqkkw3ptg7ggxtqegw3p3mr6zc4") TokenErinFrank_InvalidSubject = mustGetDelegation(TokenErinFrank_InvalidSubjectCID) ) var ( - TokenCarolDan_InvalidExpiredCID = gocid.MustParse("bafyreifrbm6bgyqdzhhcubbb7dnhq3aq6udvdbfs7mhqjs3d2ihraelufu") + TokenCarolDan_InvalidExpiredCID = cid.MustParse("bafyreieokte3abvnnj77uhhlwbem4fukvaujpp4jtirqof2r6zrdwv6may") TokenCarolDan_InvalidExpired = mustGetDelegation(TokenCarolDan_InvalidExpiredCID) ) var ( - TokenDanErin_InvalidExpiredCID = gocid.MustParse("bafyreibbh5ujs6udphkl3exffohxsg5mdknoqzjb3gdhmuncg3qnomzemy") + TokenDanErin_InvalidExpiredCID = cid.MustParse("bafyreia76qfn2krqnzzgzoyvttei5fc74ybyidqb6omoa26jn6u2wy4kmi") TokenDanErin_InvalidExpired = mustGetDelegation(TokenDanErin_InvalidExpiredCID) ) var ( - TokenErinFrank_InvalidExpiredCID = gocid.MustParse("bafyreiggzczmqlybhxljmlfot5t7o4w6fhdv7fme77a466ku73dhxtqzdq") + TokenErinFrank_InvalidExpiredCID = cid.MustParse("bafyreiaglb3rgguhlsjpkpuowr3zfwjrp2c6o2pl3llib3kj2pzusaecda") TokenErinFrank_InvalidExpired = mustGetDelegation(TokenErinFrank_InvalidExpiredCID) ) var ( - TokenCarolDan_InvalidInactiveCID = gocid.MustParse("bafyreicea5y2nvlitvxijkupeavtg23i7ktjk3uejnaquguurzptiabk4u") + TokenCarolDan_InvalidInactiveCID = cid.MustParse("bafyreicea5y2nvlitvxijkupeavtg23i7ktjk3uejnaquguurzptiabk4u") TokenCarolDan_InvalidInactive = mustGetDelegation(TokenCarolDan_InvalidInactiveCID) ) var ( - TokenDanErin_InvalidInactiveCID = gocid.MustParse("bafyreifsgqzkmxj2vexuts3z766mwcjreiisjg2jykyzf7tbj5sclutpvq") + TokenDanErin_InvalidInactiveCID = cid.MustParse("bafyreifsgqzkmxj2vexuts3z766mwcjreiisjg2jykyzf7tbj5sclutpvq") TokenDanErin_InvalidInactive = mustGetDelegation(TokenDanErin_InvalidInactiveCID) ) var ( - TokenErinFrank_InvalidInactiveCID = gocid.MustParse("bafyreifbfegon24c6dndiqyktahzs65vhyasrygbw7nhsvojn6distsdre") + TokenErinFrank_InvalidInactiveCID = cid.MustParse("bafyreifbfegon24c6dndiqyktahzs65vhyasrygbw7nhsvojn6distsdre") TokenErinFrank_InvalidInactive = mustGetDelegation(TokenErinFrank_InvalidInactiveCID) ) var ( - TokenCarolDan_ValidExamplePolicyCID = gocid.MustParse("bafyreibtfrp2njnkjrcuhxd4ebaecmpcql5knek2h2j2fjzu2sij2tv6ei") + TokenCarolDan_ValidExamplePolicyCID = cid.MustParse("bafyreibtfrp2njnkjrcuhxd4ebaecmpcql5knek2h2j2fjzu2sij2tv6ei") TokenCarolDan_ValidExamplePolicy = mustGetDelegation(TokenCarolDan_ValidExamplePolicyCID) ) var ( - TokenDanErin_ValidExamplePolicyCID = gocid.MustParse("bafyreidxfwbkzujpu7ivulkc7b6ff4cpbzrkeklmxqvyhhmkmym5b45e2e") + TokenDanErin_ValidExamplePolicyCID = cid.MustParse("bafyreidxfwbkzujpu7ivulkc7b6ff4cpbzrkeklmxqvyhhmkmym5b45e2e") TokenDanErin_ValidExamplePolicy = mustGetDelegation(TokenDanErin_ValidExamplePolicyCID) ) var ( - TokenErinFrank_ValidExamplePolicyCID = gocid.MustParse("bafyreiatkvtvgakqcrdk6vgrv7tbq5rbeiqct52ep4plcftp2agffjyvp4") + TokenErinFrank_ValidExamplePolicyCID = cid.MustParse("bafyreiatkvtvgakqcrdk6vgrv7tbq5rbeiqct52ep4plcftp2agffjyvp4") TokenErinFrank_ValidExamplePolicy = mustGetDelegation(TokenErinFrank_ValidExamplePolicyCID) ) -var ProofAliceBob = []gocid.Cid{ +var ProofAliceBob = []cid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarol = []gocid.Cid{ +var ProofAliceBobCarol = []cid.Cid{ TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDan = []gocid.Cid{ +var ProofAliceBobCarolDan = []cid.Cid{ TokenCarolDanCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin = []gocid.Cid{ +var ProofAliceBobCarolDanErin = []cid.Cid{ TokenDanErinCID, TokenCarolDanCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank = []cid.Cid{ TokenErinFrankCID, TokenDanErinCID, TokenCarolDanCID, @@ -149,20 +149,20 @@ var ProofAliceBobCarolDanErinFrank = []gocid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarolDan_InvalidExpandedCommand = []gocid.Cid{ +var ProofAliceBobCarolDan_InvalidExpandedCommand = []cid.Cid{ TokenCarolDan_InvalidExpandedCommandCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin_InvalidExpandedCommand = []gocid.Cid{ +var ProofAliceBobCarolDanErin_InvalidExpandedCommand = []cid.Cid{ TokenDanErin_InvalidExpandedCommandCID, TokenCarolDan_InvalidExpandedCommandCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank_InvalidExpandedCommand = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank_InvalidExpandedCommand = []cid.Cid{ TokenErinFrank_InvalidExpandedCommandCID, TokenDanErin_InvalidExpandedCommandCID, TokenCarolDan_InvalidExpandedCommandCID, @@ -170,20 +170,20 @@ var ProofAliceBobCarolDanErinFrank_InvalidExpandedCommand = []gocid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarolDan_ValidAttenuatedCommand = []gocid.Cid{ +var ProofAliceBobCarolDan_ValidAttenuatedCommand = []cid.Cid{ TokenCarolDan_ValidAttenuatedCommandCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin_ValidAttenuatedCommand = []gocid.Cid{ +var ProofAliceBobCarolDanErin_ValidAttenuatedCommand = []cid.Cid{ TokenDanErin_ValidAttenuatedCommandCID, TokenCarolDan_ValidAttenuatedCommandCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank_ValidAttenuatedCommand = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank_ValidAttenuatedCommand = []cid.Cid{ TokenErinFrank_ValidAttenuatedCommandCID, TokenDanErin_ValidAttenuatedCommandCID, TokenCarolDan_ValidAttenuatedCommandCID, @@ -191,20 +191,20 @@ var ProofAliceBobCarolDanErinFrank_ValidAttenuatedCommand = []gocid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarolDan_InvalidSubject = []gocid.Cid{ +var ProofAliceBobCarolDan_InvalidSubject = []cid.Cid{ TokenCarolDan_InvalidSubjectCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin_InvalidSubject = []gocid.Cid{ +var ProofAliceBobCarolDanErin_InvalidSubject = []cid.Cid{ TokenDanErin_InvalidSubjectCID, TokenCarolDan_InvalidSubjectCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank_InvalidSubject = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank_InvalidSubject = []cid.Cid{ TokenErinFrank_InvalidSubjectCID, TokenDanErin_InvalidSubjectCID, TokenCarolDan_InvalidSubjectCID, @@ -212,20 +212,20 @@ var ProofAliceBobCarolDanErinFrank_InvalidSubject = []gocid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarolDan_InvalidExpired = []gocid.Cid{ +var ProofAliceBobCarolDan_InvalidExpired = []cid.Cid{ TokenCarolDan_InvalidExpiredCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin_InvalidExpired = []gocid.Cid{ +var ProofAliceBobCarolDanErin_InvalidExpired = []cid.Cid{ TokenDanErin_InvalidExpiredCID, TokenCarolDan_InvalidExpiredCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank_InvalidExpired = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank_InvalidExpired = []cid.Cid{ TokenErinFrank_InvalidExpiredCID, TokenDanErin_InvalidExpiredCID, TokenCarolDan_InvalidExpiredCID, @@ -233,20 +233,20 @@ var ProofAliceBobCarolDanErinFrank_InvalidExpired = []gocid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarolDan_InvalidInactive = []gocid.Cid{ +var ProofAliceBobCarolDan_InvalidInactive = []cid.Cid{ TokenCarolDan_InvalidInactiveCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin_InvalidInactive = []gocid.Cid{ +var ProofAliceBobCarolDanErin_InvalidInactive = []cid.Cid{ TokenDanErin_InvalidInactiveCID, TokenCarolDan_InvalidInactiveCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank_InvalidInactive = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank_InvalidInactive = []cid.Cid{ TokenErinFrank_InvalidInactiveCID, TokenDanErin_InvalidInactiveCID, TokenCarolDan_InvalidInactiveCID, @@ -254,20 +254,20 @@ var ProofAliceBobCarolDanErinFrank_InvalidInactive = []gocid.Cid{ TokenAliceBobCID, } -var ProofAliceBobCarolDan_ValidExamplePolicy = []gocid.Cid{ +var ProofAliceBobCarolDan_ValidExamplePolicy = []cid.Cid{ TokenCarolDan_ValidExamplePolicyCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErin_ValidExamplePolicy = []gocid.Cid{ +var ProofAliceBobCarolDanErin_ValidExamplePolicy = []cid.Cid{ TokenDanErin_ValidExamplePolicyCID, TokenCarolDan_ValidExamplePolicyCID, TokenBobCarolCID, TokenAliceBobCID, } -var ProofAliceBobCarolDanErinFrank_ValidExamplePolicy = []gocid.Cid{ +var ProofAliceBobCarolDanErinFrank_ValidExamplePolicy = []cid.Cid{ TokenErinFrank_ValidExamplePolicyCID, TokenDanErin_ValidExamplePolicyCID, TokenCarolDan_ValidExamplePolicyCID, From 66675f7030f517d7f8ac773b8667841aaf9ab28f Mon Sep 17 00:00:00 2001 From: Steve Moyer Date: Wed, 27 Nov 2024 15:06:32 -0500 Subject: [PATCH 2/3] build: tidy Go module files --- go.mod | 1 - go.sum | 2 -- 2 files changed, 3 deletions(-) diff --git a/go.mod b/go.mod index 51d0d0e..2193ff4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/ucan-wg/go-ucan go 1.23 require ( - github.com/dave/jennifer v1.7.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/ipfs/go-cid v0.4.1 github.com/ipld/go-ipld-prime v0.21.0 diff --git a/go.sum b/go.sum index b7534ef..82932d5 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/dave/jennifer v1.7.1 h1:B4jJJDHelWcDhlRQxWeo0Npa/pYKBLrirAQoTN45txo= -github.com/dave/jennifer v1.7.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= From 5b7a63a2c6b3f2930eebaba7758e80085915d661 Mon Sep 17 00:00:00 2001 From: Steve Moyer Date: Thu, 28 Nov 2024 05:37:05 -0500 Subject: [PATCH 3/3] style(delegationtest/generator): adopt suggestions from PR --- .../data/TokenCarolDan_InvalidExpired.dagcbor | Bin 337 -> 337 bytes .../data/TokenDanErin_InvalidExpired.dagcbor | Bin 337 -> 337 bytes .../data/TokenErinFrank_InvalidExpired.dagcbor | Bin 337 -> 337 bytes .../delegationtest/generator/generator.go | 3 +-- token/delegation/delegationtest/token_gen.go | 6 +++--- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/token/delegation/delegationtest/data/TokenCarolDan_InvalidExpired.dagcbor b/token/delegation/delegationtest/data/TokenCarolDan_InvalidExpired.dagcbor index 89b029850a4041376d902284d97bf0b2b57b0b2d..8a74f363b0b604d9fddb54787fc859f63e53f1d2 100644 GIT binary patch delta 82 zcmV-Y0ImPg0?`6Pf>=P_BHYM(piW%{DT{%#kir#=i=NoZLk^=VcD2MjIxDm*m`aXx<(w)Cmy+C#O o=rL7zz|HHgAoVRY1*1_3SiR=DIXBeo!VLwHLw5s5c?^-gl-^<_>i_@% diff --git a/token/delegation/delegationtest/data/TokenDanErin_InvalidExpired.dagcbor b/token/delegation/delegationtest/data/TokenDanErin_InvalidExpired.dagcbor index c910a1c5b455b9b17e7d5ebee69e5fa323025318..c60d268c1113c17ecff197215a43ec11d774ca1c 100644 GIT binary patch delta 82 zcmV-Y0ImPg0?`6Pf>=N>pwtHrxj=PHM8w2<3Fxy?Z}(;WG1s8RA^u2Aknj7oFhATd4bdIPJ?S5% oL7{MGd-#O#u&rB_<*~Rqw)z(ycyO1#sI&=@Lw5s5c?^-gl;hMY761SM diff --git a/token/delegation/delegationtest/data/TokenErinFrank_InvalidExpired.dagcbor b/token/delegation/delegationtest/data/TokenErinFrank_InvalidExpired.dagcbor index f0b411f52b0fba9b51a26b61a94a91cab55d71e3..56a2f7e75bb790ea02efe51601d0057cdd4a56e8 100644 GIT binary patch delta 82 zcmV-Y0ImPg0?`6Pf>=N??_c_Ft&8s!@7^N!Bn2dx1$}!hFBk^hejsgE5Zjwg@2%%G oJU%LUJoi4Hic#?GWF3OV2+xd%YRjW{uQvvfLw5s6M?jIil>Xi&1ONa4 delta 82 zcmV-Y0ImPg0?`6Pf>=OzXkIh*=^mZEtB+(cURW|K=okm~n|hHyU)&^Iob{x&f8{c) ok7qp^tDb=VFCjP=bgV}Bldi2wiq diff --git a/token/delegation/delegationtest/generator/generator.go b/token/delegation/delegationtest/generator/generator.go index f2f088d..65982e5 100644 --- a/token/delegation/delegationtest/generator/generator.go +++ b/token/delegation/delegationtest/generator/generator.go @@ -235,8 +235,7 @@ func (g *generator) writeGoFile() error { fmt.Fprintln(f) fmt.Fprintf(f, "var %s = []cid.Cid{\n", c.name) - slices.Reverse(c.prf) - for _, d := range c.prf { + for _, d := range slices.Backward(c.prf) { fmt.Fprintf(f, "\t%s,\n", refs[d]) } diff --git a/token/delegation/delegationtest/token_gen.go b/token/delegation/delegationtest/token_gen.go index 2918178..0d367f7 100644 --- a/token/delegation/delegationtest/token_gen.go +++ b/token/delegation/delegationtest/token_gen.go @@ -75,17 +75,17 @@ var ( ) var ( - TokenCarolDan_InvalidExpiredCID = cid.MustParse("bafyreieokte3abvnnj77uhhlwbem4fukvaujpp4jtirqof2r6zrdwv6may") + TokenCarolDan_InvalidExpiredCID = cid.MustParse("bafyreici5ggrh6yyoqfqwfssks4737icit2exxrhhcsljpc6lniz64ejay") TokenCarolDan_InvalidExpired = mustGetDelegation(TokenCarolDan_InvalidExpiredCID) ) var ( - TokenDanErin_InvalidExpiredCID = cid.MustParse("bafyreia76qfn2krqnzzgzoyvttei5fc74ybyidqb6omoa26jn6u2wy4kmi") + TokenDanErin_InvalidExpiredCID = cid.MustParse("bafyreidnkdvkwhuoiwldua4z7mupuoaixktmuihd4h3gqff4nk4lfuoxlq") TokenDanErin_InvalidExpired = mustGetDelegation(TokenDanErin_InvalidExpiredCID) ) var ( - TokenErinFrank_InvalidExpiredCID = cid.MustParse("bafyreiaglb3rgguhlsjpkpuowr3zfwjrp2c6o2pl3llib3kj2pzusaecda") + TokenErinFrank_InvalidExpiredCID = cid.MustParse("bafyreighom66dfg3scp26huljbiovkuuv2bh4izdqahccutrilqz46nz3e") TokenErinFrank_InvalidExpired = mustGetDelegation(TokenErinFrank_InvalidExpiredCID) )