From 40514f387f2fa0dd5dab8f312e404db731f55238 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Jul 2026 15:20:08 +0000 Subject: [PATCH 1/2] feat: Attested Signatures + UCAN Principal Clarification Adapt to the ucantone PR #30 principal/signing refactor. A ucan.Signer is no longer a Principal and has no DID; the "signer bound to a Principal" role is now ucan.Issuer. The principal/* key packages moved to multikey/*. generateSigner now returns a ucan.Issuer built via each multikey package's GenerateIssuer helper (ed25519.GenerateIssuer / secp256k1.GenerateIssuer), so callers can still .DID() it and pass it to .Delegate/.Invoke. The mldsa44 branch is dropped because that key type is no longer provided by ucantone. Bumps ucantone and libforge to the refactored versions. See https://github.com/fil-forge/ucantone/pull/30 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014dZyvL474aA43c1C7E6ZpV --- .gitignore | 1 + go.mod | 10 +++++----- go.sum | 28 ++++++++++++++-------------- main.go | 22 ++++++++++++++-------- 4 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..082289a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bench-http-header-ucan-size diff --git a/go.mod b/go.mod index 5359166..49c4eb1 100644 --- a/go.mod +++ b/go.mod @@ -4,15 +4,14 @@ go 1.25.3 require ( github.com/dustin/go-humanize v1.0.1 - github.com/fil-forge/libforge v0.0.0-20260527182359-ebb22552c348 - github.com/fil-forge/ucantone v0.0.0-20260617091613-2a31cf8a668a + github.com/fil-forge/libforge v0.0.0-20260701162346-f0706e1641a3 + github.com/fil-forge/ucantone v0.0.0-20260630103048-a8f24fe31eb6 github.com/ipfs/go-cid v0.6.1 github.com/multiformats/go-multihash v0.2.3 ) require ( - filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e // indirect - github.com/alanshaw/dag-json-gen v0.0.5 // indirect + github.com/alanshaw/dag-json-gen v0.0.8 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -20,6 +19,7 @@ require ( github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multibase v0.3.0 // indirect + github.com/multiformats/go-multicodec v0.10.0 // indirect github.com/multiformats/go-varint v0.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/whyrusleeping/cbor-gen v0.3.1 // indirect @@ -29,5 +29,5 @@ require ( golang.org/x/sys v0.43.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect lukechampine.com/blake3 v1.4.1 // indirect - pitr.ca/jsontokenizer v0.3.0 // indirect + pitr.ca/jsontokenizer v0.3.2 // indirect ) diff --git a/go.sum b/go.sum index 323545e..ce67d99 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,13 @@ -filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e h1:VsUbObBMxXlc23Eb9VeeJYE4jvTs87qa5RqSN2U5FJU= -filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e/go.mod h1:32qQ5yj3R24Eu03iWFWchdC3OB653wPvoepWejkefbY= -github.com/alanshaw/dag-json-gen v0.0.5 h1:jUOqsTrfZ7ddkBqAsx/xbCeJtpe70jrFL2Z+i4qQB1U= -github.com/alanshaw/dag-json-gen v0.0.5/go.mod h1:rXxWw0SItP9QjxpRMpkju66h0KumF7TPCtvHdOKS5lY= -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/alanshaw/dag-json-gen v0.0.8 h1:Y0SfO2bp9ECDvcNbw6aQ91jmnfLC7UgRDshCeASDfT8= +github.com/alanshaw/dag-json-gen v0.0.8/go.mod h1:v1YBZcS4B355MqxtyQr+fGNbEhm0CzHd+gOqOO/MZ+I= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/fil-forge/libforge v0.0.0-20260527182359-ebb22552c348 h1:roYe4llNv0fpQnvXMontrdt/hy9kH5K/cnNsXmhqId4= -github.com/fil-forge/libforge v0.0.0-20260527182359-ebb22552c348/go.mod h1:1ytnrneNEeJcskEbsRDtNZY/Jvgo2Yw5szIUI/9EWPk= -github.com/fil-forge/ucantone v0.0.0-20260617091613-2a31cf8a668a h1:YseKVffr1pb4ywV4r/7WWJYuUegrdfT8KAo4CyH/+YM= -github.com/fil-forge/ucantone v0.0.0-20260617091613-2a31cf8a668a/go.mod h1:KrnXLXUFxSUqXGbTrlOvPeiILnbVQl5Un3TA8q9uiAQ= +github.com/fil-forge/libforge v0.0.0-20260701162346-f0706e1641a3 h1:/EDxpbuVeSXH3FLF7MK4G4wrDUFmCO9fLQHL23RZ2uU= +github.com/fil-forge/libforge v0.0.0-20260701162346-f0706e1641a3/go.mod h1:0kXihIQ4L2uZ00nR5XrZ/Y8Db7Ht/qQNuiWslwMJ95M= +github.com/fil-forge/ucantone v0.0.0-20260630103048-a8f24fe31eb6 h1:0k57ScNcbxTrveaJhos1veTS7jm4RXt2VBofNK+60ko= +github.com/fil-forge/ucantone v0.0.0-20260630103048-a8f24fe31eb6/go.mod h1:oFY5BfD0bDeodGlbBHh3/nK99MAS93rGXjoQz7s5qgE= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/ipfs/go-cid v0.6.1 h1:T5TnNb08+ueovG76Z5gx1L4Y7QOaGTXHg1F6raWFxIc= @@ -28,12 +26,14 @@ github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9 github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multibase v0.3.0 h1:8helZD2+4Db7NNWFiktk2NePbF0boolBe6bDQvM4r68= github.com/multiformats/go-multibase v0.3.0/go.mod h1:MoBLQPCkRTOL3eveIPO81860j2AQY8JwcnNlRkGRUfI= +github.com/multiformats/go-multicodec v0.10.0 h1:UpP223cig/Cx8J76jWt91njpK3GTAO1w02sdcjZDSuc= +github.com/multiformats/go-multicodec v0.10.0/go.mod h1:wg88pM+s2kZJEQfRCKBNU+g32F5aWBEjyFHXvZLTcLI= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-varint v0.1.0 h1:i2wqFp4sdl3IcIxfAonHQV9qU5OsZ4Ts9IOoETFs5dI= github.com/multiformats/go-varint v0.1.0/go.mod h1:5KVAVXegtfmNQQm/lCY+ATvDzvJJhSkUlGQV9wgObdI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= @@ -54,5 +54,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= -pitr.ca/jsontokenizer v0.3.0 h1:Qr70hk4/wcpFEgu/6aJ+nvYQ6x/xS0WOkC627ceiI/M= -pitr.ca/jsontokenizer v0.3.0/go.mod h1:3DJdA2QNOU6cI0XkH6pRKZ4Oe8G5SDRUQ6PFAwaQ3YY= +pitr.ca/jsontokenizer v0.3.2 h1:kzsKwfkWPV5XCmAF//hznh3L9IXbiL8aHbI0FswRkCs= +pitr.ca/jsontokenizer v0.3.2/go.mod h1:3DJdA2QNOU6cI0XkH6pRKZ4Oe8G5SDRUQ6PFAwaQ3YY= diff --git a/main.go b/main.go index 6e6d792..23c815f 100644 --- a/main.go +++ b/main.go @@ -7,9 +7,8 @@ import ( "github.com/dustin/go-humanize" contentcmds "github.com/fil-forge/libforge/commands/content" "github.com/fil-forge/ucantone/did" - "github.com/fil-forge/ucantone/principal/ed25519" - "github.com/fil-forge/ucantone/principal/mldsa44" - "github.com/fil-forge/ucantone/principal/secp256k1" + "github.com/fil-forge/ucantone/multikey/ed25519" + "github.com/fil-forge/ucantone/multikey/secp256k1" "github.com/fil-forge/ucantone/ucan" "github.com/fil-forge/ucantone/ucan/container" "github.com/fil-forge/ucantone/ucan/invocation" @@ -17,14 +16,21 @@ import ( mh "github.com/multiformats/go-multihash" ) -func generateSigner(name string) (ucan.Signer, error) { +// generateSigner produces a UCAN Issuer (a signer bound to a Principal) for the +// named key type. Under the post-PR#30 API a bare ucan.Signer is no longer a +// Principal and has no DID; the identities this benchmark delegates and invokes +// with must be ucan.Issuers, so we construct one via each multikey package's +// GenerateIssuer helper (which pairs a freshly generated signer with its +// did:key). Defaults to ed25519. +// +// Note: the mldsa44 key type is no longer provided by ucantone after the +// Attested Signatures refactor, so only ed25519 (default) and secp256k1 remain. +func generateSigner(name string) (ucan.Issuer, error) { switch name { - case "mldsa44": - return mldsa44.Generate() case "secp256k1": - return secp256k1.Generate() + return secp256k1.GenerateIssuer() } - return ed25519.Generate() + return ed25519.GenerateIssuer() } func main() { From 848573a5fd835975c8bf2531cd03305e53c92272 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Jul 2026 17:59:58 +0000 Subject: [PATCH 2/2] feat: restore mldsa44 via ucantone multikey/mldsa44 The earlier attested-signatures migration had to drop the mldsa44 (post-quantum ML-DSA-44) key branch because that key type did not exist on ucantone main after the principal/* -> multikey/* refactor. It has now been reinstated on the new layout in fil-forge/ucantone#37, so this restores the mldsa44 case using multikey/mldsa44.GenerateIssuer() and re-pins ucantone at that commit. Because ucantone#37 is not yet merged, this points at that unmerged commit (the new multikey/mldsa44 branch) rather than the old unmerged principal/mldsa44 commit it referenced before. Re-pin to a merged ucantone once #37 lands. See https://github.com/fil-forge/ucantone/pull/30 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014dZyvL474aA43c1C7E6ZpV --- go.mod | 3 ++- go.sum | 6 ++++-- main.go | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 49c4eb1..ffc019e 100644 --- a/go.mod +++ b/go.mod @@ -5,12 +5,13 @@ go 1.25.3 require ( github.com/dustin/go-humanize v1.0.1 github.com/fil-forge/libforge v0.0.0-20260701162346-f0706e1641a3 - github.com/fil-forge/ucantone v0.0.0-20260630103048-a8f24fe31eb6 + github.com/fil-forge/ucantone v0.0.0-20260702175651-12732483947f github.com/ipfs/go-cid v0.6.1 github.com/multiformats/go-multihash v0.2.3 ) require ( + filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e // indirect github.com/alanshaw/dag-json-gen v0.0.8 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect diff --git a/go.sum b/go.sum index ce67d99..2728e49 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e h1:VsUbObBMxXlc23Eb9VeeJYE4jvTs87qa5RqSN2U5FJU= +filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e/go.mod h1:32qQ5yj3R24Eu03iWFWchdC3OB653wPvoepWejkefbY= github.com/alanshaw/dag-json-gen v0.0.8 h1:Y0SfO2bp9ECDvcNbw6aQ91jmnfLC7UgRDshCeASDfT8= github.com/alanshaw/dag-json-gen v0.0.8/go.mod h1:v1YBZcS4B355MqxtyQr+fGNbEhm0CzHd+gOqOO/MZ+I= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -6,8 +8,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/fil-forge/libforge v0.0.0-20260701162346-f0706e1641a3 h1:/EDxpbuVeSXH3FLF7MK4G4wrDUFmCO9fLQHL23RZ2uU= github.com/fil-forge/libforge v0.0.0-20260701162346-f0706e1641a3/go.mod h1:0kXihIQ4L2uZ00nR5XrZ/Y8Db7Ht/qQNuiWslwMJ95M= -github.com/fil-forge/ucantone v0.0.0-20260630103048-a8f24fe31eb6 h1:0k57ScNcbxTrveaJhos1veTS7jm4RXt2VBofNK+60ko= -github.com/fil-forge/ucantone v0.0.0-20260630103048-a8f24fe31eb6/go.mod h1:oFY5BfD0bDeodGlbBHh3/nK99MAS93rGXjoQz7s5qgE= +github.com/fil-forge/ucantone v0.0.0-20260702175651-12732483947f h1:nDqQIz28mYWEe0ITH9TLf1JTIcY37MxwrSNm4Ey5PlY= +github.com/fil-forge/ucantone v0.0.0-20260702175651-12732483947f/go.mod h1:mPfEboTQwtNIChdbPbLnbWA38fVdD0PfQ3kgc46vYY0= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/ipfs/go-cid v0.6.1 h1:T5TnNb08+ueovG76Z5gx1L4Y7QOaGTXHg1F6raWFxIc= diff --git a/main.go b/main.go index 23c815f..a2956e9 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( contentcmds "github.com/fil-forge/libforge/commands/content" "github.com/fil-forge/ucantone/did" "github.com/fil-forge/ucantone/multikey/ed25519" + "github.com/fil-forge/ucantone/multikey/mldsa44" "github.com/fil-forge/ucantone/multikey/secp256k1" "github.com/fil-forge/ucantone/ucan" "github.com/fil-forge/ucantone/ucan/container" @@ -23,10 +24,12 @@ import ( // GenerateIssuer helper (which pairs a freshly generated signer with its // did:key). Defaults to ed25519. // -// Note: the mldsa44 key type is no longer provided by ucantone after the -// Attested Signatures refactor, so only ed25519 (default) and secp256k1 remain. +// mldsa44 (post-quantum ML-DSA-44) comes from ucantone's new multikey/mldsa44 +// package, reinstated on the post-#30 layout in fil-forge/ucantone#37. func generateSigner(name string) (ucan.Issuer, error) { switch name { + case "mldsa44": + return mldsa44.GenerateIssuer() case "secp256k1": return secp256k1.GenerateIssuer() }