How to safely delete public_keys created as part of `near login` flow?

Viewed 28

i've been practicing with the near-cli as part of my personal project to automate some tasks, this requires running near login quite a few times in debugging. However, when i do near login it seems to create a new public key every time, as when I do near keys <account> from time to time I see this list grow. When I did near keys delete <public_key> to cleanup, it did give a warning about accidentally deleting the wrong public key, so I attempted dropping keys older than the last one entered, however running near login again gave an error that I had deleted the key that gave access thru the web login. (I kept the key value and did near keys add <public_key> to restore access.

My question is, how best do I keep track of which public_keys are safe to delete when experimenting with the CLI this way?

1 Answers

The simplest answer is: Make sure you always have one keypair left. Keys are stored in ~/.near-credentials, with files containing both the private and public part of the key. Always keep one of these files, and make you don't remove the corresponding key from the account.

Related