Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@jverify/jverify-js
Advanced tools
A JavaScript library for the JVerify phone number verification APIs
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.
You need to have the JVerify library installed as well as node.js requests.
npm i jverify-js requests
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'
}
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.
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
}
}
FAQs
A JavaScript library for the JVerify phone number verification APIs
The npm package @jverify/jverify-js receives a total of 0 weekly downloads. As such, @jverify/jverify-js popularity was classified as not popular.
We found that @jverify/jverify-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.