Skip to content

feat: add delegation ls and delegation revoke commands with local cleanup#368

Open
Pranav-1100 wants to merge 4 commits intostoracha:mainfrom
Pranav-1100:delegation_cmds
Open

feat: add delegation ls and delegation revoke commands with local cleanup#368
Pranav-1100 wants to merge 4 commits intostoracha:mainfrom
Pranav-1100:delegation_cmds

Conversation

@Pranav-1100
Copy link
Contributor

This PR brings the remaining delegation management commands from the JS client over to Guppy so we can manage and revoke the permission slips we give out right from the terminal. Resolves #367.

Here is a breakdown of what was added:

  • guppy delegation ls
    A local command that queries the agent store to list all permission slips given away by this agent. It filters out received proofs and internal session proofs so you only see what you've actually delegated to others.

  • guppy delegation revoke :
    A network command that invokes the ucan/revoke capability to permanently blacklist a specific UCAN CID on the Storacha servers.

  • Core SDK Fix (RemoveDelegation):
    While building revoke, I noticed the Go client lacked the JS client's ability to delete a specific delegation locally. I added RemoveDelegation(cid) to the agentstore.Store interface (along with memory/fs implementations and tests). Now, when a delegation is successfully revoked on the network, it is properly deleted from the user's local config file, preventing ghost delegations from cluttering up delegation ls.

  • Fix for delegation create:
    I updated guppy delegation create to automatically save the newly created delegation to the local agent datastore via c.AddProofs(). Before this, it wasn't saving locally, which meant delegation ls couldn't actually index or find them.

Verification with Output

  1. Create and List Delegations (create & ls)
$ guppy delegation create did:key:z6Mkk... did:key:z6Mk4... -c "space/info"
bafy.....

$ guppy delegation ls
Delegations created by this agent:
CID:      bafy.....
Audience: did:key:z6Mk4.....
Capabilities:
  - space/info (with: did:key:z6Mk4.....)

Total: 1 delegation(s)
  1. Revoke and Verify Cleanup (revoke & ls)
$ guppy delegation revoke bafy......
Revoking delegation bafy.....
Success! Delegation has been revoked.

$ guppy delegation ls
No external delegations created by this agent found.

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.

feat: add 'delegation ls' and 'delegation revoke' management commands (JS -> GO)

1 participant