Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
strong-license
Advanced tools
Simple license generator/validator using JWT with the pre-defined claim names (fields) and validation semantics.
product
- a string identifying the product the license applies tofeatures
- an array of strings identifying features of the productactivationDate
- a Date indicating when the license period startsexpirationDate
- a Date indicating when the license period endsemail
- a string identifing who the license is for (primarily used for
logging and identification for support purposes)Both the product
and features
fields support *
as a wildcard to indicate
that all products or features are covered by the license. When the product
field is a wildcard, any product check matches but it does not imply that all
features are covered. When the features list contains a wildcard as one of its
entries, any feature check matches.
The strong-license module defines the License class, which can be used for generating, parsing, and validating a license key.
var License = require('strong-license').License;
var details = {
email: 'user@example.com',
product: 'enterprise-node',
features: ['foo', 'bar', 'baz'],
activationDate: new Date(),
expirationDate: new Date(Date.now() + 1000*60*60*24*365),
};
var lic = new License(details, 'super secret key!');
process.env.LICENSE_KEY = lic.key;
It is also possible to generate a null license, which does not cover any products or features and is perpetually expired. It does, however, cover the null query scenario.
var License = require('strong-license').License;
var nullLicense = new License();
nullLicense.covers(); // => true! Can't do anything, but can do nothing!
If a license coverage query omits a field, that field is considered a match.
var License = require('strong-license').License;
var now = new Date();
var yesterday = new Date(Date.now() - 1000*60*60*24);
var lic = new License(process.env.LICENSE_KEY, 'super secret key!');
lic.covers('enterprise-node', 'foo', now); // => true
lic.covers('myProduct', 'featurex', now); // => false
If a parameter is omitted, is considered a match.
lic.covers('enterprise-node', 'bar', null); // => true
lic.covers('enterprise-node', null, now); // => true
lic.cocers(null, 'baz', yesterday); // => false
lic.covers(); // => true! any license covers "nothing"
FAQs
Simple license generator/validator using JWT.
The npm package strong-license receives a total of 138 weekly downloads. As such, strong-license popularity was classified as not popular.
We found that strong-license demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 21 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.