Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@juspay/simple-card-validator
Advanced tools
Card validation helpers for card number, expiry and CVV.
Generic helpers for card number, expiry and CVV validations
Import the library and initialize card object.
Install from npm:
npm i @juspay/simple-card-validator --save
var cardValidator = require('simple-card-validator');
Or, you can simply use the file from dist/validator.js
if you are not using node/npm.
var card = new cardValidator('4242-4242-4242-4242');
card.getCardDetails();
This would output, card brand and different validation outputs like below:
{ card_type: 'visa',
valid: true,
luhn_valid: true,
length_valid: true,
cvv_length: [ 3 ],
gaps: [ 4, 8, 12 ],
supported_lengths: [ 16 ],
max_length: 16 }
Field | Description | Type |
---|---|---|
card_type | The card issuer for the provided card | String |
valid | Are the card details valid | Boolean |
luhn_valid | Is the card number valid | Boolean |
length_valid | If the card number length is valid | Boolean |
cvv_length | If the CVV/CAVV length is valid | Array [ Integer ] |
gaps | Gaps for UI as printed in cards | Array [ Integer ] |
supported_lengths | Supported lengths for the card type | Array [ Integer ] |
max_length | Maximum length for the card type | Integer |
To simply validate a card, call:
card.validateCard();
The result will be a validity boolean.
For validating expiry date,
card.validateExpiry('12/2018');
Additionally, the base date can be set for expiry validations. The base month and date can be provided by using,
card.setBaseDate(month, year);
eg: card.setBaseDate('02', '2016');
For validating CVV, use:
card.validateCvv(111);
CVV will be validated based on the brand of the card.
Read through the development guidelines.
MIT license. Copyright © 2018 - juspay.in.
FAQs
Card validation helpers for card number, expiry and CVV.
The npm package @juspay/simple-card-validator receives a total of 249 weekly downloads. As such, @juspay/simple-card-validator popularity was classified as not popular.
We found that @juspay/simple-card-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers 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 threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.