arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

Export database for sneakernet #168

Open KyleMaas opened 3 years ago

KyleMaas commented 3 years ago

It would be nice if there was a way to export the user's profile to a backup file, optionally including replicated content. That way, if a user was only connected to rooms or was otherwise not connected to someone else who replicated them, they'd have a way to preserve their data if the browser's local storage was cleared.

To do this, we would need to also be able to support importing from whatever format we output in.

And as an additional bonus, if we could import exports from other folks, then ssb-browser-demo could theoretically be used offline while exchanging feed data over USB flash drives.

Would need some help figuring out how to do this, but I think this could be a really great feature for data durability and overall robustness.

arj03 commented 3 years ago

There is already a export feed key to mnemonic code under /profile that should cover this. Maybe the name is a bit to cryptic ;)

KyleMaas commented 3 years ago

Perhaps I should clarify. I've used the mnemonic key stuff several times with testing. But what happens if you only connect to rooms (not pubs) and the people you would normally connect to (who would have copies of the data you need to be able to use a mnemonic code without forking your identity) are not online? Or if you're on a terrible internet connection and want to preseed your database with already previously-downloaded data? I could see recovering an account going something like this:

  1. Import prior exported data.
  2. Import mnemonic key to recover the private key and continue using your normal identity.

And you now have data without connecting to anyone.

arj03 commented 3 years ago

Ah right, now I see.

KyleMaas commented 3 years ago

Updated the name of this issue to make it clearer what I meant.

KyleMaas commented 3 years ago

Pretty sure we can do the export in a memory-efficient way using this:

https://github.com/jimmywarting/StreamSaver.js

KyleMaas commented 3 years ago

@arj03 Didn't realize that you had already done something similar to this in another project:

https://github.com/arj03/ssb-exporter

Just saw it mentioned on SSB. That would make this quite easy to do within ssb-browser-demo.

arj03 commented 3 years ago

Yeah, that is a few years ago, I guess it's mainly a question then of bundling it into a zip or something like that :)