storacha / w3cli

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

feat: add reset command #170

Closed alanshaw closed 9 months ago

alanshaw commented 9 months ago

Adds a reset command so you can reset you agent and login again to gain access to spaces. Retains agent DID.

I called this reset and not logout because we can't guarantee the agent retains any delegations that are not associated with the currently logged in account(s).

$ w3 whoami
did:key:z6MkiK3h93N8kE6jmAgTWd33QmuyDcsMnaAeQrGjp9iixT2B

$ w3 space ls
  did:key:z6MkoEBnTj96thGj7H7c1DrdNHF4AiA9VPDRVqTmp4teYd6B 
  did:key:z6MketbAFtbeqDeVHxSzSSDH2PfMTquQ3vzZCcPFweXBGe3R 
  did:key:z6MkgVNAd3rDAtvYwp5NscNteZjqW496dERwkMWiDKcZ13xa 
  did:key:z6MkjCoKJcunQgzihb4tXBYDd9xunhpGNoC14HEypgAe5cNW 
  did:key:z6MkfUw42NQV6Gs8ZLr4sujwRFZGQ789LVuRfkgRxFnTkRBz 
* did:key:z6MkwDuRThQcyWjqNsK54yKAmzfsiH6BTkASyiucThMtHt1T Test

$ w3 reset   
⁂ Agent reset.

$ w3 whoami
did:key:z6MkiK3h93N8kE6jmAgTWd33QmuyDcsMnaAeQrGjp9iixT2B

$ w3 space ls

$ w3 login alan.shaw@protocol.ai
⁂ Agent was authorized by did:mailto:protocol.ai:alan.shaw

$ w3 space ls                   
  did:key:z6MkoEBnTj96thGj7H7c1DrdNHF4AiA9VPDRVqTmp4teYd6B 
  did:key:z6MketbAFtbeqDeVHxSzSSDH2PfMTquQ3vzZCcPFweXBGe3R 
  did:key:z6MkgVNAd3rDAtvYwp5NscNteZjqW496dERwkMWiDKcZ13xa 
* did:key:z6MkwDuRThQcyWjqNsK54yKAmzfsiH6BTkASyiucThMtHt1T Test
  did:key:z6MkmyzUC328sSpm8Mncq9aUZuXLsBtARMXhZnEqfWcq11sw Claimer
  did:key:z6MkjCoKJcunQgzihb4tXBYDd9xunhpGNoC14HEypgAe5cNW 
  did:key:z6MkfUw42NQV6Gs8ZLr4sujwRFZGQ789LVuRfkgRxFnTkRBz 

...and look I gained access to a space I didn't have before!

alanshaw commented 9 months ago

Perhaps this should be available in the client?