Discret

A Rust back-end to create peer to peer (P2P) applications, using a GraphQL inspired syntax


It provides the following features:

Discret will automatically synchronize your data with other peers, based on the access rights you have defined.

Create your datamodel

{
    Person {
        name: String,
        children: [Person],
        pets: [Pet],
    }

    Pet {
        name: String,
    }
}

Define Access Rights

mutate {
    sys.Room {
        admin: [{
            verif_key: $peer_key
        }]

        authorisations: [{
            name: "house"
            rights:[{
                entity: "Person"
                mutate_self: true
                mutate_all: true
            },{
                entity: "Pet"
                mutate_self: true
                mutate_all: false
            }]
        }]
    }
}

Insert and mutate data

mutate {
    p1: Person { 
        room_id: $room_id
        name: "Alice" 
        pets: [{name: "Truffle"}] 
    }
    
    p2: Person { 
        room_id: $room_id
        name: "Bob" 
        children: [
            {name: "Neela"}, 
            {name: "Assa"}
        ]
    }
} 

Query

query {
    q1: Person(room_id=$room_id) { 
        id
        name 
        pets(name="Truffle") {
            name
        } 
    }
    
    q2: Person(search("bob")) { 
        id
        name 
        children(order_by(name DESC)){
            id
            name
        }
    }
} 

And let Discret securely synchronize your data with the peers you invited.

Getting Started with Rust Getting Started with Flutter Learn Github

  • Learn more by getting started in the Tutorials.

  • A Flutter binding is provided to easily develop P2P applications without having to write a single line of Rust. Getting Started with Flutter provides all the necessary steps to bootstrap a Flutter app.

  • Dive deeper in the Learn section.

  • And contribution are always welcome in the Github projects!

This website is also available in french.

Features

Ease of use

Discret hides the complexity of peer to peer networks and reduces it to a data access problem.

The API allows you to:

  • manage your data using a GraphQL syntax,
  • add access right to your data (in graphQL too),
  • create and accept invites from other peers.

Discret will synchronize your data with other peers, depending on the access right you have given to those peers.

Privacy First

Your data is not stored in any cloud or third party company. It is up to you to decide who is able to see your data.

There is no central user discovery service. You manually invite people to connect with you, and only them will know that you are using the application.

Strong Security

Discret provides strong security features out of the box:

  • data is encrypted at rest by using the SQLCipher database
  • encrypted communication using the QUIC protocol
  • data is signed with the peer signing key, making it very hard to synchronize bad data
  • data access control is provided by the Room concept

Easy connections

On local network, peer connections happens without requiring any server. This greatly eases the deployment and use of applications using Discret.

Limitations

As your data lives on your devices, Discret is not suited for Internet scale applications and communities with thousands of connected peoples.

It should only be used for applications generating a reasonable amount of data, synchronizing with hundreds of peers at most.

For peer to peer connections over the Internet, a discovery server is needed to allow peers to discover each others. Discret provides an implementation of the discovery server named Beacon.

However, connections over the internet is not 100% guaranteed to work, because certain types of enterprise firewalls will block the connection attempts. Implementing a relay server would fix the issue, but it is in not planned yet.

P2P connections leaks your IP address and should only be used with trusted peers. It may exposes you to the following threats:

  • Leak of your "Real World" location via geolocation services.
  • Distributed denial of service ( DDOS )
  • State sponsored surveillance: A state watching the network may be able to determine which peer connect to which, giving a lot of knowledge about your social network.