Skip to content

refactor(capabilities/pdp): add pdp capabilities#22

Closed
frrist wants to merge 3 commits into
mainfrom
frrist/inline-pdp-datamodel
Closed

refactor(capabilities/pdp): add pdp capabilities#22
frrist wants to merge 3 commits into
mainfrom
frrist/inline-pdp-datamodel

Conversation

@frrist
Copy link
Copy Markdown
Member

@frrist frrist commented May 16, 2026

No description provided.

@frrist frrist requested a review from alanshaw May 16, 2026 00:04
Base automatically changed from frrist/inline-capability-datamodel to main May 18, 2026 09:40
frrist and others added 3 commits May 18, 2026 11:24
capabilities/pdp/types.go imports github.com/fil-forge/libforge/merkletree
for the InclusionProof field but that package did not exist, so go build
./... failed.

Restore the package as a thin wrapper around
github.com/filecoin-project/go-data-segment/merkletree.ProofData (the
canonical implementation we already depend on elsewhere). CBOR is
delegated to the upstream type via a zero-cost named-type conversion;
DagJSON marshalers are added here because the upstream lacks them.

No port of the merkletree algorithm itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Mirrors the go-libstoracha access.Grant shape with UCAN 1.0 framing:

- Arguments carry an Attenuations list (capabilities the agent wishes
  to be granted) and an optional Cause CID. cid.Undef on Cause means
  no cause.
- OK aliases ClaimOK — a successful grant resolves into a bundle of
  delegation CIDs. Delegation envelopes themselves ride in the receipt
  response container as metadata, following the libforge pattern used
  by /access/claim and /access/confirm.
- Stable receipt failure names match the go-libstoracha originals so
  existing callers can keep their error matching.

This unblocks piri-signing-service's UCAN 1.0 migration: that service
gates all /pdp/sign/* abilities behind an /access/grant delegation and
needs a libforge binding to switch off go-libstoracha.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
"github.com/fil-forge/ucantone/errors"
)

const GrantCommand = "/access/grant"
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.

This string is inlined into the MustNew call for all other commands.

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.

Needs a rebase - these are in commands dir now.

Comment thread merkletree/proofdata.go

// MarshalDagJSON writes the proof as a DagJSON map: {"path": [<bytes>...], "index": N}.
// Path nodes use DagJSON's canonical bytes encoding ({"/": {"bytes": "<base64>"}}).
func (p *ProofData) MarshalDagJSON(w io.Writer) error {
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.

Is this not...generate-able?

@frrist
Copy link
Copy Markdown
Member Author

frrist commented May 20, 2026

closing in favor of #28

@frrist frrist closed this May 20, 2026
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