SDKs
...
Getting Started
nodeJS SDK
6 min
about this package implements licensespring sdk functionality for javascript and typescript installation the package is published on npmjs com and can be installed as follows npm i save @licensespring/node sdk interface the sdk provides several classes which are used to interface with licensenspring services as well as functionality for local license files licenseapi this is a wrapper class for interacting with the license api it provides all the api endpoints as class methods, provides input validation and response signature checks if you prefer to implement your own logic for working with licensespring data, this class contains all the necessary functionality const { licenseapi } = require('@licensespring/node sdk'); const licenseapi = new licenseapi({ apikey '12345678 4bfe 4e3a 8737 757004d6294c', sharedkey 'eyuhrlajvivtisfixpxpkhw78f4ewy 00 12345678', appname 'js sdk test 1', appversion '0 0 1', }); const licenseactivation = await licenseapi activatelicense({ license key 'string', product 'string', hardware id 'string' }); const bundleactivation = await licenseapi activatebundle({ license key 'string', product 'string', hardware id 'string' }); const licensecheck = await licenseapi checklicense({ license key 'string', product 'string', hardware id 'string' }); const bundlecheck = await licenseapi checkbundle({ license key 'string', product 'string', hardware id 'string' }); const addconsumption = await licenseapi addconsumption({ license key 'string', product 'string', hardware id 'string', consumptions 10 }); const addfeatureconsumption = await licenseapi addfeatureconsumption({ license key 'string', product 'string', hardware id 'string', feature 'string', consumptions 10 }); const licensefeaturecheck = await licenseapi checklicensefeature({ license key 'string', product 'string', hardware id 'string', feature 'string' }); const trackdevicevariables = await licenseapi trackdevicevariables({ license key 'string', product 'string', hardware id 'string', variables { key1 'value1' } }); const getdevicevariables = await licenseapi getdevicevariables({ license key 'string', product 'string', hardware id 'string' }); const licensedeactivation = await licenseapi deactivatelicense({ license key 'string', product 'string', hardware id 'string' }); const bundledeactivation = await licenseapi deactivatebundle({ license key 'string', product 'string', hardware id 'string' }); / note the hardware id value can be either generated by your app (eg using custom made hardware fingerprinting logic) or you can use the hardware id module exposed by this class / const hardwareid = licenseapi gethardwareid(); for a more detailed overview of this class see license api docid\ rw7pvb8trym2nqlrpo mg licensemanager this class extends the functionality provided by the licenseapi class and provides methods for managing licenses in addition to encapsulating api calls, this class reads and writes local license files and handles hardware id generation internally const { licenseapi } = require('@licensespring/node sdk'); const licensemanager = new licensemanager({ apikey '12345678 4bfe 4e3a 8737 757004d6294c', sharedkey 'eyuhrlajvivtisfixpxpkhw78f4ewy 00 12345678', appname 'js sdk test 1', appversion '0 0 1', productcode 'myproduct1', // note each licensemanager instance is attached to a specific product }); const licenseactivation = await licensemanager activatelicense({ license key 'string' }); const licensecheck = await licensemanager checklicense({ license key 'string' }); const addconsumption = await licensemanager addconsumption({ license key 'string', consumptions 10 }); const addfeatureconsumption = await licensemanager addfeatureconsumption({ license key 'string', feature 'string', consumptions 10 }); const licensefeaturecheck = await licensemanager checklicensefeature({ license key 'string', feature 'string' }); const trackdevicevariables = await licensemanager trackdevicevariables({ license key 'string', variables { key1 'value1' } }); const getdevicevariables = await licensemanager getdevicevariables({ license key 'string' }); const licensedeactivation = await licensemanager deactivatelicense({ license key 'string' }); // this loads the license object from the local license file; const license = licensemanager loadlicense(); const localcheck = await license localcheck(); license addlocalconsumption(10); license addlocalfeatureconsumption('feature1', 5); for a more detailed overview of this class see license manager docid\ tbxzhrg7eyxtcwbt45lsh bundlemanager this class extends the functionality provided by the licenseapi class and provides methods for managing license bundles the behaviour of this class is similar to licensemanager, the only difference being that this class is used for license bundles , as opposed to single licenses for a more detailed overview of this class see bundle manager docid\ n 5c4u vxlwkd hxiilhy licensefile this class encapsulates the local license file produced by the licensemanager or bundlemanager this file is used by client applications to track the license state on local storage for a more detailed overview of this class see license file docid\ kvsi spar2aysn8jvqztt
