ecosistema-social-decentral.../protocols/peergos.md

40 lines
4.2 KiB
Markdown
Raw Normal View History

2020-03-01 05:43:17 +01:00
# Peergos
2020-05-18 02:09:48 +02:00
Peergos is a peer-to-peer end-to-end encrypted storage, social and application protocol and platform. It is built on top of IPFS. More information is available in their [book](https://book.peergos.org) or their [source](https://github.com/peergos/peergos).
It is designed to be independent of DNS and TLS certificate authorities and use strong quantum resistant encryption and design.
2020-03-01 05:43:17 +01:00
### Identity
2020-04-27 09:31:11 +02:00
There is a global append-only log for the public key to username mappings. This is mirrored on every node in the peergos system. Names are taken on a first come first served basis. Consensus is currently a single server, but long term this would make sense to put into a stripped down blockchain for more decentralization.
2020-03-06 04:25:53 +01:00
2020-04-27 09:31:11 +02:00
Login and key management: A peergos user's private keys are derived every time they log in using their username, password and a published salt. Specifically, a signing keypair, boxing keypair, and symmetric key is derived. Users store their friends keys in their encrypted storage space in a TOFU keystore. Users can verify key of friends in person or over the phone using QR codes or fingerprints.
2020-03-01 05:43:17 +01:00
2020-04-27 09:34:35 +02:00
This enables multiple device support, and no awkward key management UX. The user never needs to see a key or a hash.
2020-03-01 05:43:17 +01:00
### Data storage
2020-05-18 02:09:48 +02:00
Each user must have at least one peergos server (A server can host any number of users and any server can choose to mirror data for any user). The servers run an instance of IPFS. Data is content-addressed: stored in mappings from hash to data. During upload the client splits files into 5 MiB chunks which are each independently encrypted (along with encrypted metadata) and stored in a merkle-CHAMP (compressed hash array mapped prefix trie) in ipfs. Directories can't be distinguished from small files, nor are the sizes of files, or the number of files, or directory structure, or who has access to them visible to the server.
2020-03-01 05:43:17 +01:00
2020-04-27 09:31:11 +02:00
The user lists the IPFS node id of the server (hash of its public key). It synchronizes their writes and displays the latest root hashes. Data is always encrypted on the servers. The servers are in fact trustless - in that they don't have access to any sensitive information, and clients don't rely on them for authenticity or privacy. Furthermore, the servers don't trust IPFS, or the data store (which can be further removed, e.g. S3).
2020-03-01 05:43:17 +01:00
2020-05-18 02:09:48 +02:00
Peergos can handle arbitrarily large files, including random access, upload and download, even on under powered devices like mobile phones. This is largely due to the independently encrypting each 5 MiB section, as well as our novel "[zero IO](https://peergos.org/posts/fast-seeking)" seeking within a file.
2020-03-01 05:43:17 +01:00
### Social
2020-04-27 09:34:35 +02:00
Users can follow each other. Follow requests are sent through a users storage server, which is contacted via its public key. Follows are one-way, and allow sharing files and sending messages. Critically, the server never sees who is following who (even follow requests are blinded). You store your own social graph encrypted in your peergos space.
2020-03-06 04:25:53 +01:00
### Privacy and Access Control
2020-04-27 09:31:11 +02:00
All encryption happens on the client, which might be a native peergos client, or just a browser. The Peergos nodes (the servers) don't have access to any metadata.
2020-03-06 04:25:53 +01:00
2020-04-27 09:31:11 +02:00
Access to files gained through social follows can be revoked by rotating cryptographic keys. Access is hierarchical, and stored in an encrypted structure call [cryptree](https://book.peergos.org/security/cryptree.html).
2020-03-06 04:25:53 +01:00
2020-04-27 09:31:11 +02:00
Access is controlled through cryptographic capabilities. A read-only capability consists of the hash of the public key of the owner of the file, the writer of the file, a random label, and a symmetric encryption key:
(owner hash, writer hash, 32 byte random label, 32 byte symmetric key)
2020-03-06 04:25:53 +01:00
2020-04-27 09:31:11 +02:00
A writable capability additionally includes the privat eky corresponding to the writer key, which is used to sign updates.
2020-03-06 04:25:53 +01:00
A user can publish a capability of a file or folder they control which makes it publicly visible.
2020-04-27 09:31:11 +02:00
A user can also share secret links to files, like a google doc "share" link, which lets anyone who views it view the file. These secret links still don't expose the file to the server. The file is not transmitted unencrypted over the network, as the key to decrypt it is in the URL itself, and is interpreted locally in the browser.