Coder Social home page Coder Social logo

isabella232 / rif-communications-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rsksmart/rif-communications-js

0.0 0.0 0.0 3.84 MB

RIF Communication TypeScript library for developers

Home Page: https://rifos.org

License: MIT License

JavaScript 2.37% TypeScript 97.63%

rif-communications-js's Introduction

RIF Communication lib.js

CircleCI Dependency Status standard-readme compliant js-standard-style Managed by tAsEgir

Library for decentralized communication build as part of RIF OS

Table of Contents

Install

npm

> npm install @rsksmart/rif-communications

Usage

Import the library

var RifCommunications = require('@rsksmart/rif-communications');

Initialization

// Create a key or load from a secure storage to skip this step
var key = await RifCommunications.createKey();

// Create peer id
var peerId = await RifCommunications.createPeerIdFromJSON(key);

// Create peer information
var peerInfo = await RifCommunications.createPeerInfo(peerId);

// Create your peer node
var node = RifCommunications.createNode(peerInfo, host, port, sendMsgFunc);

// Connect to a bootnode using a multiaddress string
await RifCommunications.connectToNode(node, BOOTNODE_ADDRESS);

Send a message to another peer

// Create recipient from their public key (<recipientID>)
var recipient = await RifCommunications.createPeerIdFromPublicKey(recipientID);

// Send a message
await RifCommunications.sendMsg(node, recipient, message, msgNonce);

API

Contribute

There are some ways you can make this module better:

  • Consult our open issues and take on one of them
  • Help our tests reach 100% coverage!

License

MIT

rif-communications-js's People

Contributors

dependabot-preview[bot] avatar leandroyalet avatar vojtechsimetka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.