Skip to content

feat: proof attestations#5

Merged
alanshaw merged 3 commits into
ash/feat/login-access-capsfrom
ash/feat/proof-attestations
May 11, 2026
Merged

feat: proof attestations#5
alanshaw merged 3 commits into
ash/feat/login-access-capsfrom
ash/feat/proof-attestations

Conversation

@alanshaw
Copy link
Copy Markdown
Member

@alanshaw alanshaw commented May 7, 2026

Adds a function that gets attestations for a given set of proofs for an invocation.

i.e. you call ProofChain(..) and then pass the proofs you recieve to ProofAttestations(...) to get any needed attestations.

I have also refactored the interfaces for dependencies to proof chain - they are now function types and not interfaces (which should actually be a bit easier to pass in) and have also been renamed. What was a "finder" is now a "lister", but "matcher" stays the same. The reason is that "finder" and "matcher" are a bit too similar (and actually have the same signature for their functions), "finder" (now "lister") gets delegations with the EXACT parameters, whereas "matcher" gets delegations that match the parameters. e.g. subject could be an exact match or it could be nil (for a powerline delegation) and command could be an exact match on /msg/send or it could be /msg or /.

@alanshaw alanshaw requested a review from Peeja May 7, 2026 15:32
Comment thread ucan/attestations.go Outdated
Comment on lines +41 to +48
proofArgs := attest.ProofArguments{}
err := datamodel.Rebind(datamodel.NewAny(inv.Arguments()), &proofArgs)
if err != nil {
continue
}
if proofArgs.Proof != proof.Link() {
continue
}
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.

Could we just do:

proofCid, ok := inv.Arguments()["proof"].(cid.Cid)
if !ok || proofCid != proof.Link() {
  continue
}

Same outcome and drops the datamodel import from this file.

More generally, re-encoding an already-decoded map to do a type assertion is the wrong shape, and I'd like to see the Rebind pattern dropped from libforge. For multi-field arg structs the answer (imho) is a raw-bytes accessor on Invocation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes that's much neater

Copy link
Copy Markdown
Member

@frrist frrist left a comment

Choose a reason for hiding this comment

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

LGTM. One comment, but its less a review of this change and more targeted at ucantone design.

alanshaw and others added 2 commits May 11, 2026 19:48
Cherry picks from #2 and adds
the remaining missing capabilities.

Also, (sorry!) removes the `CborTime` type. This is unnecessarily
accurate (to nanoseconds) and was being used to specify expiry time of a
UCAN, which has a resolution of seconds, so was unnecessary.

Moves error definitions from Sprue to the library so that they can be
used in clients to disambiguate invocation errors.

Upgrades `dag-json-gen` dependency and re-generates `dag-json`
serializers/deserializers. Error messages are a lot more informative,
and avoid linter complains about capitalization.

Ports `jobqueue` and `bytemap` from `storacha/go-libstoracha`.

---------

Co-authored-by: Petra Jaros <peeja@peeja.com>
@alanshaw alanshaw merged commit 6a0c6fa into ash/feat/login-access-caps May 11, 2026
@alanshaw alanshaw deleted the ash/feat/proof-attestations branch May 11, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants