feat(client): add delegation bundle(s) to client.pool

This commit is contained in:
Steve Moyer
2025-03-18 14:18:53 -04:00
committed by Michael Muré
parent 4aedc4de39
commit 06f478b9c3

View File

@@ -3,6 +3,7 @@ package client
import (
"context"
"fmt"
"iter"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/crypto"
@@ -35,6 +36,16 @@ func NewClient(privKey crypto.PrivKey, requester DelegationRequester) (*Client,
}, nil
}
// AddBundle adds a delegation.Bundle to the client's pool.
func (c *Client) AddBundle(bundle *delegation.Bundle) {
c.pool.AddBundle(bundle)
}
// AddBundles adds a sequence of delegation.Bundles to the client's pool.
func (c *Client) AddBundles(bundles iter.Seq[*delegation.Bundle]) {
c.pool.AddBundles(bundles)
}
// PrepareInvoke returns an invocation, bundled in a container.Writer with the necessary proofs.
func (c *Client) PrepareInvoke(ctx context.Context, cmd command.Command, subject did.DID, opts ...invocation.Option) (container.Writer, error) {
proof, err := c.findProof(ctx, cmd, subject)