SynopsisThis is a simple package to generate (pseudo) random strings of specified
lengthseparated into "blocks" of specified
blockLengths by specified
separatorcharacters. This makes this package suitable for generating license or product or serial keys.
The similar looking characters (and numbers) I, 1, 0 and O are always left out of the generated strings to avoid confusion.
Note that the generated keys are just random strings and there's no provision to check their validity cryptographically.
InstallationFrom npm registry:
npm i -S generate-serial-key
Directly from gist:
npm i -S gist:ed14ef9bcae9b9188833e583313b0d21
Usage ExampleThe package exposes a single function with signature
generate(length = 16, separator = '-', blockLength = 4)which may be used as follows:
serial.generate() // Outputs 'AG8D-ZGYG-A8YV-PVMK' serial.generate(20, "", 5) // Outputs 'UL3MVBTPXBMBEU9QK3MC'