inkandswitch / backchannel

Local-first address book
68 stars 1 forks source link

Mailbox: Sending while peer is offline with a storage peer #26

Open okdistribute opened 3 years ago

okdistribute commented 3 years ago

We are using @localfirst/relay, it would be great to have the ability to use a storage peer that stores arbitrary automerge documents, given some documentId

okdistribute commented 3 years ago

From @ept

for your purposes, I think the short-term options are:

  1. encrypt individual field values before putting them in the automerge doc (this works as long as it's ok for the keys and structure of the document to be unencrypted, and only the field values to be encrypted); or
  2. nest an encrypted automerge doc inside an unencrypted one. the inner document contains your regular unencrypted data; then you take the changes to the inner document, encrypt and base64-encode them, and then add those encrypted strings to a list of strings in the outer document. the outer document can then sync as usual. to decrypt the document, take all the strings in the outer doc, base64-decode and decrypt, and then apply the resulting changes to an empty doc
okdistribute commented 3 years ago

Also see: https://github.com/HerbCaudill/robopeer