
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.
Generate unique human readable codes (e.g. vouchers, referrals, passwords, keys)
TokenGen is a small library that will allow you to generate human readable codes for your voucher codes, keys, etc.
npm install token-gen
Just add the package from atmosphere:
meteor add hirespace:token-gen
The most common usage would be:
import TokenGen from 'token-gen'; // var TokenGen = require('token-gen');
var code = TokenGen();
console.log(code.toString()); // "48CML"
The generated code can be customised passing an options object to the constructor:
var code = TokenGen({
tokenLength: 3, // Default: 5
alphabet: 'ABC' // Default: '0123456789ACDEFGHJKLMNPQRTUVWXYZ'
});
console.log(code.toString()); // "BBA"
It's the generated code character length.
5Note: The amount of different codes you could generate is
alphabetLength ^ codeLength. Therefore, with the default
alphabet, the maximum amount of different
codes with a 5 characters code is 33554432. We found 33 million codes is more
than enough for most usages. If you need more, the code
length can be customised.
As this is the most common option, it is possible to call the generator directly with a number, which represents the tokenLength:
var code = TokenGen(3);
console.log(code.toString()); // "20A"
The character included in this string will be the only characters used to generate the code. The generated codes are any combination of these characters.
0123456789ACDEFGHJKLMNPQRTUVWXYZWe use a default alphabet composed of 32 characters that are not confusing to read (e.g. we removed B because it could be confused with an 8).
Made with :heart: by Hire Space (hirespace.com) and distributed using a ISC license.
FAQs
Generate unique human readable codes (e.g. vouchers, referrals, passwords, keys)
The npm package token-gen receives a total of 5 weekly downloads. As such, token-gen popularity was classified as not popular.
We found that token-gen 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.

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.