
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
common-id-validator
Advanced tools
A light-weight low-dependency package to syntactically validate commonly used resource identifiers in databases and other systems.
A light-weight low-dependency package to syntactically validate commonly used resource identifiers in databases and other systems.
npm install common-id-validator
const { isUUID } = require("common-id-validator");
isUUID("21b7a7a8-cec5-4b67-9a55-74f800326045"); // true
isUUID("Hello World"); // false
isUUID("82ac7f18-e860-11ee-a5c4-325096b39f47", 4); // false
isUUID("000003e8-e861-21ee-b700-325096b39f47", 2); // true
const { isObjectId } = require("common-id-validator");
const { ObjectId } = require("bson"); // ObjectId wrapper used in mongoDB adapter
isObjectId(new ObjectId()); // true
isObjectId("5f92cbf10cf217478ba93561"); // true
isObjectId("000003e8-e861-21ee-b700-325096b39f47"); // false
const { isTypeId } = require("common-id-validator");
isTypeId("user_2x4y6z8a0b1c2d3e4f5g6h7j8k"); // true
isTypeId("user2x4y6z8a0b1c2d3e4f5g6h7j8k"); // false
const { isMacAddress } = require("common-id-validator");
isMacAddress("BC-50-D5-2C-5D-AC"); // true
isMacAddress("60:C1:9A:AE:A8:71"); // true
isMacAddress("3542.D272.908E"); // true
isMacAddress("BC-50-D5-2C-5D-AC-2C"); // false
isMacAddress("60:C1:9A-AE:A8:71"); // false
Snowflake ID should be either BigInt or String to be represented properly as unsigned 64-bit integers. Any other data type including Number will return false.
const { isTwitterSnowflakeId } = require("common-id-validator");
isTwitterSnowflakeId(BigInt("1771647565570244608")); // true
isTwitterSnowflakeId("7178357033781956611"); // true
isTwitterSnowflakeId("717835703378A956611"); // false
isTwitterSnowflakeId(1771647565570244608); // false
IMEI should be provided as either a string or a number in these accepted formats. IMEISV is not accepted currently.
const { isIMEI } = require("common-id-validator");
isIMEI(356303483752836); // true
isIMEI("35-630348-375283-6"); // true
isIMEI("35-630-348-375283-6"); // false
isIMEI("35-630348-375283-7"); // incorrect check digit - false
https://github.com/kkhtun/common-id-validator
FAQs
A light-weight low-dependency package to syntactically validate commonly used resource identifiers in databases and other systems.
We found that common-id-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.