storacha / w3cli

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

When authorizing additional capabilities, `authorize` should keep polling until it gets the *new* capabilities #110

Open travis opened 1 year ago

travis commented 1 year ago

Currently, if a user runs authorize more than once with the same agent, it will return immediately after sending the authorization email and will not automatically claim new delegations once the user has gone through the email authorization flow.

They can get the new capabilities later with w3 can access claim but a) this is non-obvious and b) it would be better to poll the way we do on our first trip through.

I think the best fix here would be to implement a more sophisticated DelegationChecker to use here:

https://github.com/web3-storage/w3up/blob/main/packages/access-client/src/agent-use-cases.js#L150

The new DelegationChecker should compare the delegations it gets with the list of delegations that were requested in the current authorization.