Skip to content

bosskabouter/ep2

Repository files navigation

ep² - encrypted P2P [online & offline]

ep2 is a Typescript library that enables secure peer-to-peer communication between browsers, both online and offline. It uses the libsodium library for hybrid encryption and signature verification between online peers using peerjs and the web-push library for encrypted push messaging between offline peers.

Getting started

To try out ep2, clone the project and start an example server and client using the following commands:

git clone https://github.com/bosskabouter/ep2.git
cd ep2
npm i
npm start

Packages

The ep2 library consists of the following packages:

  • Client packages:
    • EP2Peer - encrypted P2P WebRTC client
    • EP2Push - encrypted PushSubscription/Notification client
  • Server packages:
  • Key encryption packages
    • EP2Key - the core component, already included in client and server packages
    • EP2KeyBIP - BIP32 HD Key and BIP39 mnemonic recovery phrase

For detailed information about each package, see their respective pages.

Usage: In short

An example Push and Peer client

import { EP2Peer, EP2Key } from "@ep2/peer";
import { EP2Push } from "@ep2/push";

EP2Key.create('*strong* seed').then(async (key) => {
  const ep2Push = await EP2Push.register(key);
  const ep2Peer = new EP2Peer(key);


});

An example Push and Peer server

import {EP2PeerServer, EP2Key} from '@ep2/peerserver'
import {EP2PushServer} from '@ep2/pushserver'

EP2Key.create('*stronger* seed').then( key => {
   EP2PushServer(key, { path: "/myPushServer" });
   EP2PeerServer(key, { path: "/myPeerServer" })
 })

Contributions

Contributions to this project are welcome! If you would like to contribute, please open an issue or pull request on the GitHub repository.

License

ep2 is open-source software licensed under the MIT license.

About

Typescript framework for encrypted online P2P & Offline Push communication

Resources

License

Stars

Watchers

Forks

Packages

No packages published