0.2.0 • Published 4 years ago

openvasp-client v0.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

OpenVASP Client

OpenVASP Typescript Library

Build Status License npm GitHub last commit codecov

Documentation: https://notabene-id.github.io/openvasp-node-client/

Getting OpenVASP Client Library

To install:

$ npm i --save openvasp-client

Usage

Create a VASP Contract

A VASPCode with the corresponding VASP contract (to store the handshake and signing keys) needs to be created to use OpenVASP.

To create a VASPCode and Contract:

import { VASPFactory, Tools } from "openvasp-client";

//Create a random VASP Code
const vaspCode = Tools.randomVASPCode();

//Initialize VASP Factory
cont vaspFactory = new VASPFactory({
    rpcUrl: process.env.NODE_URL. // "https://rinkeby.infura.io/",
    privateKey: process.env.PRIVATE_KEY, //0x....
    vaspIndexAddress: process.env.VASP_INDEX_ADDRESS //0x....
})

//Create VASP
const ret = vaspFactory.createVASP(vaspCode);

/*
 ret = {
  vaspAddress: "0x...", // Address of deployed VASP contract
  handshakeKeys: { //Handshake Keys
      privateKey: "0x...",
      publicKey : "0x...",
  }
  signingKeys:{ // Signing Keys
      privateKey: "0x...",
      publicKey : "0x...",
  }
 }
 */

Tool

import { Tools } from "openvasp-client";

const vaspAddress = "0x36D706A02fE35C64Ba21cF7Ed51695FC8DD00E63";
const vaspCode = Tools.addressToVaspCode(vaspAddress);

Development

Instal dependencies

$ npm install

Build

$ npm run build

Test

$ npm test

To publish to NPM:

$ pika publish

To publish dosc:

$ npm run docs

Contributing

Contributions are welcome!

Want to file a bug, request a feature or contribute some code?

  • Check out the Code of Conduct
  • Check that there is no existing issue corresponding to your bug or feature
  • Before implementing a new feature, discuss your changes in an issue first!

License

MIT © Notabene