Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kuda-node

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kuda-node

NodeJS wrapper for making secure request to Kuda API

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Kuda Node.js Library

NodeJS wrapper for making secure request to Kuda API

Getting started

  • paste your private and public key (both in XML format) in your project directory
  • Your client key is the name of your private key file

Using the library

run npm install kuda-node

Library setup

const fs = require("fs");
const Kuda = require('kuda-node'); 

const publicKey = fs.readFileSync("./kuda.public.xml"); // or path to your kuda public key
const privateKey = fs.readFileSync("./path-to-private-key.xml"); // or path to your kuda kuda private key
const clientKey = "name-of-private-key-file"; // name of private key file without the .xml suffix (extension)

const kuda = Kuda({
  publicKey,
  privateKey,
  clientKey
}); // this initialize the Kuda function

Making a request

kuda({
  serviceType: "SERVICE_TYPE",
  requestRef: "requestReference",
  data: {
    param: value
  }
});

Sample request

// account creation
const shortid = require("shortid"); // this libarary will generate random id for you. You can install with `yarn add shortid` or `npm i shortid`. You can use any other random key generatring library of your choice

kuda(
  {
    serviceType: "CREATE_VIRTUAL_ACCOUNT",
    requestRef: Math.floor(Math.random() * 1000000000000 + 1), // you can generate your random number your own way. This is just an example.
    data: {
      email: "ajala@obi.com",
      phoneNumber: "08012345678",
      firstName: "Ajala",
      lastName: "Obi",
      trackingReference: "vAcc-" + shortid.generate() // you can generate your trackingReference some other way you choose.
    }
  },
  data => {
    // data => decrypted response from Kuda API
    // do anything with your data
    console.log(JSON.stringify(data, null, 2));
  }
);

// it can also be called with in an async await fashion like so
const onboardUser = async(email, phoneNumber, firstName, lastName, trackingReference) => {
  const response = await kuda({
    serviceType: 'CREATE_VIRTUAL_ACCOUNT',
    requestRef: Number, // like Math.floor(Math.random() * 1000000000000 + 1)
    data: { email, phoneNumber, firstName, lastName, trackingReference }
  })
}

Refer to documentation for respective data types for each fields in the payload

Contribution & Issues

  • Simply fork the repo, make changes and make a pull request
  • You can open an issue for support or suggestions

Authors

  • Ajala Abdulsamii
  • Abdulazeez Murainah
  • Azeez Adio

Acknowledgements

FAQs

Package last updated on 15 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc