earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
623 stars 18 forks source link

Add way to check if Auth has been set up yet #339

Open sgwilym opened 1 month ago

sgwilym commented 1 month ago

What's the problem you want solved?

The new Auth class has no way to see if a password has previously been set or not, meaning you just have to try and construct one and see what happens. This makes building a UI where you set up a Peer for the first time difficult.

Is there a solution you'd like to recommend?

Add a new Auth.isSetup(storage) static method which checks if an encrypted challenge has already been set in the given storage.