npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jverify/jverify-js

v1.2.0

Published

A JavaScript library for the JVerify phone number verification APIs

Downloads

4

Readme

JVerify JavaScript Library

If you haven't already familiarized yourself with the general docs, we recommend doing that before beginning a project.

JVerify offers both an HTTP endpoint as well as libraries for your language of choice. This documents the usage of our JavaScript library.

Prerequisites

You need to have the JVerify library installed as well as node.js requests.

npm i jverify-js requests

Importing & intializing

In your node.js file, enter the following code:

const JVerify_lib = require('jverify-js');

const JVerify = new JVerify_lib({
  token:'T3h5N3RyUPNT4NkQ73cuUtdh_cpNsXHG...', // Get a token from the JVerify dashboard (jverify.us/dashboard)
  vendor:'JVerify' // Set this to your company name
});

Now the JVerify library is set up to send messages!

Notice how the constructor takes an object, with schema:

{
  token:'your-token',
  vendor:'your-company-name'
}

The Start Method

Sample implementation:

let hash; // Globally initialize a variable to hold the hash

JVerify.start({
  name:'John Smith', // Name of your user
  number:2025550106 // Phone number of your user (where the message will be sent)
}).then(r => {
  if(r.code == 200 || r.code == 203) {
    hash = r.body.hash; // Save the hash to the global variable
    // Server-side logic for a properly sent message.
    // Tell the frontend the message was sent properly
  } else {
    // Something has gone wrong, lets throw an error and check it out in the console
    // Tell the frontend something has gone wrong.
    throw new Error(`JVerify threw error ${r.code} (${r.status}): ${r.message}`);
  }
})

Just like the constructor, the .start method takes an object with schema:

{
  name:'users-name',
  number:'users-phone-number'
}

The start method returns a promise which will evaluate in the then block in the sample code. The promise will return an object with schema:

{
  code:200, // The HTTP response code directly from our request
  message:'what the above code means (from the JVerify documentation)',
  status:'what the above code officially means (official name)',
  body:{
    success:true,
    hash:'hash-of-sent-pin'
  }
}

Data types:

{
  code:int,
  message:string,
  status:string,
  body:object:{
    success:boolean,
    hash:string
  }
}

You should save body.hash to use in the verify request. The hash is non-sensitive, meaning it is safe to be sent to your front end or saved in user's cookies.

The Verify Method

Sample implementation:

JVerify.verify({
  hash:'hash-from-start-method', // This should be the hash variable we got in the start method
  pin:393545 // The pin the user entered
}).then(r => {
  if(r.code > 199 && r.code < 300) { // Make sure the request returned a code in the 200s
    	// The user entered the correct pin.
    	// Implement server-side logic and tell the frontend the pin was entered correctly
      console.log('PIN Correct!')
    } else {
      // The user has entered the incorrect pin
      // Tell the frontend the pin was wrong and potentially ask them if they want to send another
      console.log('PIN Incorect')
    }
	} else {
    // Something has gone wrong. Lets throw an error and check it out in the console
    // Tell the frontend something has gone wrong
    throw new Error(`JVerify threw error ${r.code} (${r.status}): ${r.message}`);
  }
})

Just like the constructor and start method, the .verify endpoint takes an object with schema:

{
  hash:'hash-from-start-method',
  pin:'pin from frontend' // Needs to be an integer
}

Just like the .start method, the .verify method returns a promise which will evaluate in the then block in the sample code. The promise will return an object with schema:

{
  code:200 // The HTTP response code directly from our request
  message:'what the above code means (from the JVerify documentation)'
  status:'what the above code officially means (official name)'
  body:{
    correct:true // Set to true if the user entered the correct pin, false if incorrect.
  }
}

With data types:

{
  code:int,
  message:string,
  status:string,
  body:object:{
    correct:boolean
  }
}