0.11.0 • Published 2 years ago

chatternet-lib v0.11.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Chatter Net

Chatter Net is a modern decentralized web with social identity at its core.

Find more information chatternet.github.io.

Warning: Chatter Net is currently in the prototype phase. Features are missing, features are broken, and the public interface will change.

Technology

Chatter Net is a library and protocol for building open social web platforms.

Networking

The network stack is implemented with Libp2p. It allows for secure peer-to-peer and peer-to-server communication.

Data format

Activity Stream is semantic, self-describing JSON-based data format. It can be used to describe arbitrary digital data as well as interactions between actors and the data.

Identity

The did key standard uses public-private key pair cryptography to prove identity. User accounts are created locally by a user, and the private credentials created by that user allow them to prove their identity to other users. Verifiable credentials are used to attach information (e.g. a name, avatar, number) to an identity.

Project Objectives

  • Open: anyone can participate in, extend, and innovate on the platform.
  • Decentralized: there is no central point of failure, network consensus determines what content arrives to a user.
  • Spam resistant: only contacts are able to send one another data, and that data contains the chain of contacts linking back to its author.
  • Platform: Chatter Net is not itself the innovation, rather innovation can be built on top of Chatter Net.

Examples

Coming soon.

Development

Requirements

The only system requirement is Node JS and a web browser. You can get Node JS on macOS or Linux with the following command:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install --lts

Installation

Get the source code using Git:

git clone https://github.com/chatternet/chatternet-lib.git

Or by downloading and extracting from https://github.com/chatternet/chatternet-lib/archive/refs/heads/main.zip.

Then install using NPM:

npm install

Commands

  • npm run clean: remove the built package
  • npm run fmt: format all source code
  • npm run build: build the package
  • npm run test: run all tests (in a node environment)
  • npm run deploy: chain together commands used to prepare for deployment

Package configuration

Package building is handled by aegir: https://ipfs.github.io/aegir/. This is a Typescript template which necessitates further configuration: https://github.com/ipfs/aegir/blob/master/md/ts-jsdoc.md.

package.json

  • The types key is set to module such that the project is exported as an ESM.
  • TS types are output at dist/src/index.d.ts.
  • The files key avoids packaging the compiled tests.
  • The exports key specifies which module exports can be imported from the package.
  • The typesVersions key is a workaround to allow importing types for other parts of the code.

Testing

Test are added to the test directory with the suffix .spec.ts. They can import from src using Typescript imports and ESM imports.

The tests are themselves built and output in dist/test. From there, they import from the built dist/src. In this way the tests run as compiled JS, calling code from the distributed module.

TODO

Here is a list of short term development priorities:

  • Data lifecycle policy: currently a node accumulates data and could eventually overwhelm the browser storage. A lifecycle policy can be developed to discard old data.
  • Multi-device: currently a user account is tied to a single device.
  • Account migration: currently if an account is lost or stolen, the user has no recourse. A system can be developed such that a new account can be made to replace the old one, and the contacts of the old account can vouch for the migration to the new one. A system can be developed to synchronize account data between multiple devices.
  • Batch synchronization: currently data is exchanged one record at a time. A protocol can be developed to allow two nodes to synchronize large numbers of records (e.g. on first connect).
  • Share server information: currently servers can be used for stability an availability, but only one server is hard coded in the source. Server information can be exchanged dynamically between peers.
  • Decouple storage from the indexed DB implementation: currently storage (persistence) is achieved only using indexed DB which is not available in node-based (server) environments. The library can rely on a generic interface which can be backed by different storage technologies.
  • Audience filter: currently every user receives every record from the network. A user can be able to specify their interests and receive only records matching those interests.
  • Optimizations: the library is developed with to the point of being correct, but not optimal. Many optimizations will be necessary for the library to operate in various networking conditions.

Help

  • Typescript library development and deployment
  • Libp2p best practices and future-proofing
  • Open source community management