storacha / w3cli

💾 w3 command line interface
Other
35 stars 7 forks source link

w3 delegation revoke command does not work #163

Open magror opened 10 months ago

magror commented 10 months ago

I am using @web3-storage/w3up-cli in my Node project. "@web3-storage/w3up-cli": "^3.0.1"

On the Github I see there is the command w3 delegation revoke <delegation-cid>

I want to delete delegations I've made because through the process of figuring out how the agent/delegation/proof system works, I ended up creating multiple delegations that have incorrect DID's as the audience.

I try running this command as follows: yarn w3 delegation revoke bafyreibo453ep...(continued cid)

The response is:

ERROR
    Invalid command: delegation revoke bafyreibo453epwps...(continued cid)

  Run `$ w3 --help` for more info.

Other commands such as yarn w3 delegation ls work perfectly fine.

I noticed on the NPM page for @web3-storage/w3up-cli that the version on NPM is version 3.0.1 which is a year old. The current version on GitHub is version 7.2.1. Is this the cause of the delegation revoke command not working?

magror commented 10 months ago

It turns out that the NPM package being so outdated was the reason that the revoke command was not recognized in the first place.

However, now trying to use the revoke command with the current version of the repo cloned from github, I run into a new issue with this command.

Steps:

npm exec w3 delegation ls - This returns a group of 4 different delegation CIDs (right?), each with an audience and permissions.

Then I copy the CID of one of the delegations to use in the revoke command;

npm exec w3 delegation revoke bafyreibo453epwps...(continued cid)

This give the message delegation bafyreibo453epwps...(continued cid) revoked

BUT then when I do npm exec w3 delegation ls again, all 4 original delegations still appear...

Does this mean the delegation revoke command failed without it knowing it? Do revoked delegations still appear in the delegation ls command output?

Perhaps there is some setup that I failed to do? I am pretty sure I am Logged In on the cli because I can do stuff like npm exec w3 space ls and it tells me the DID and name of my space.

I have not manually set up any environment variables. Could that be the cause? It is unclear to me in which scenarios environment variables would have to be set...

Part of me wonders if w3 doesn't even actually know about the delegations (could they be on my local machine only?) because when I do the parseProof function for ephemeral environments as shown in the w3up readme, the ipld CarReader.fromBytes(Buffer.from(data, 'base64')) function gives too many terminals, data makes no sense...