Client API for NodeJS to access Cryptolens Software Licensing API.

Downloads in past


1.0.1-4.210 months ago5 years agoMinified + gzip package size for cryptolens in KB


Cryptolens Client API for NodeJS
This library contains helper methods to verify licenses in NodeJS.


```bash npm add cryptolens ```


Key Verification

To verify a license key, you can use the code below. The RSAPublicKey, token and the product id can be found on this page. ```js const key = require('cryptolens').Key; const Helpers = require('cryptolens').Helpers; var RSAPubKey = "Your RSA Public key, which can be found here:"; var result = key.Activate(token="Access token with with Activate permission", RSAPubKey, ProductId=3349, Key="GEBNC-WZZJD-VJIHG-GCMVD", MachineCode=Helpers.GetMachineCode()); result.then(function(license) {
// success
// Please see for a complete list of parameters.
}).catch(function(error) {
// in case of an error, an Error object is returned.
}); ```

Offline activation (saving/loading licenses)

Assuming the license key verification was successful, we can save the result in a file so that we can use it instead of contacting Cryptolens. First, we need to add the reference to the helper methods: ```js const Helpers = require('cryptolens').Helpers; ``` We can now proceed and save it as a string. ```js var licenseString = Helpers.SaveAsString(license); ``` When loading it back, we can use the code below: ```js var license = Helpers.LoadFromString(RSAPubKey, licenseString); ``` If you want to make sure that the license file is not too old, you can specify the maximum number of days as shown below (after 30 days, this method will return null). ```js var license = Helpers.LoadFromString(RSAPubKey, licenseString, 30); ```