earthstar-project / earthstar

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

Invite-only shares #273

Closed sgwilym closed 1 year ago

sgwilym commented 1 year ago

What's the problem you solved?

Currently knowing a share's address grants read/write access. The consequences:

What solution are you recommending?

This PR makes it so that share addresses become public keys with an associated secret. Read access is granted by knowledge of the public key (+gardening.bxxxxxxxxxxx), and write access granted by the private key.

When new documents are written, they use the share keypair to create a shareSignature property on a document, which is verified by other peers upon ingestion.

Generation of a new share can be done using Crypto.generateShareKeypair.

There's one drawback to this: an extra signature on documents means signing and verifying each document takes twice as long. I feel like this is an acceptable trade-off.