SDKs
node.js SDK
License Manager
29 min
licensemanager provides a high level interface for managing licenses, including local licenses the licensemanager is required to work with local license files typescript definitions are provided for the arguments and return types of the class methods to import the licensemanager class use const { licensemanager } = require('@licensespring/node sdk'); to create an instance const licensemanager = new licensemanager({ apikey '12345678 4bfe 4e3a 8737 757004d6294c', sharedkey 'eyuhrlajvivtisfixpxpkhw78f4ewy 00 12345678', appname 'js sdk test 1', appversion '0 0 1', productcode 'lkp', / note the following properties are set to their default values by the sdk and can be overriden manually / // apipath 'http //api dev licensespring com/api/v4', // publickey ' ', }); the constructor takes the a single argument of the following type { / your licensespring api key / apikey string, / your licensespring api shared key / sharedkey string, / custom name for your application / appname string, / custom version string for your application / appversion string, / your product short code / productcode string, / your air gap activation key (optional) / airgapkey? string, / override for license api url (default is https //api licensespring com/api/v4/) / apipath? string, / override for license api public key (default is pub key for api licensespring com) / publickey? string, / override for license file filename (default is "license") / filename? string, / override for license file path (default is current directory) / filepath? string, / override for license file encryption key / filekey? string, / override for license grace period duration in hours (default is 24) / graceperiod? number, / override for license file guard file (default is false) / isguardfileenabled? boolean, / override for hardware id calculation method (default is 0, for more info see "hardware id" section) / hardwareidmethod? number, / a custom provided hardware id (overrides hwid calculation) / hardwareid? string, } methods methods listed here which take a license payload are the similar to corresponding methods in the license api class, except that product and hardware id do not have to be specified in the payload as they are provided by the license manager object check license see check license docid\ zh4kfih s59tzibzkeb9o checklicense( payload checklicensepayload, includeexpiredfeatures boolean = false ) promise\<checklicenseresponse> type checklicensepayload = ({ username string; } | { license key string; }) & { env string | undefined; license id number | undefined; sdk ver string | undefined; app ver string | undefined; hostname string | undefined; os hostname string | undefined; ip local string | undefined; mac address string | undefined; ip string | undefined; os ver string | undefined; channel string | undefined; }; type checklicenseresponse = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, borrowed until string | null, floating in use devices? number, is borrowed boolean, is expired boolean, license active boolean, license enabled boolean, license signature string, }; activate license online see activate license (online method) docid\ mt2ygm6cjzh2bumu gfww activatelicense(payload activatelicensepayload) promise\<activatelicenseresponse> type activatelicensepayload = ({ license key string; } | { username string; password string; } | { code string; customer account code string; } | { id token string; customer account code string; }) & { variables { \[key string] string | number | boolean } | undefined; }; type activatelicenseresponse = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, request string, active boolean, device id number, validity period string | null, is expired boolean, hardware id string, username? string, max license users? number, is floating cloud boolean, floating in use? boolean, license signature string, variables? ({ value string; device id number; variable string; created at string | null; })\[]; }; deactivate license online see deactivate license (online method) docid\ iecdueumoslwn4biictdc deactivatelicense(payload ({ username string; } | { license key string; }) promise\<boolean> activate license offline see activate license (offline method) docid\ h vewme7ryj7qfbikvgup activateoffline(payload string) promise\<activateofflineresponse> type activateofflineresponse = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, request string, active boolean, device id number, validity period string | null, is expired boolean, hardware id string, username? string, max license users? number, is floating cloud boolean, floating in use? boolean, license signature string, variables? ({ value string; device id number; variable string; created at string | null; })\[]; date string, offline signature string, license signature v2 string, }; deactivate license offline performs an offline deactivation deactivateoffline() promise\<boolean> get trial key see trial key docid\ mtanosfyjyxu 2m0ovz a gettrialkey(payload gettrialkeypayload) promise\<trialresponse> type gettrialkeypayload = { sdk ver string | undefined; email string | undefined; license policy string | undefined; first name string | undefined; last name string | undefined; phone string | undefined; address string | undefined; postcode string | undefined; state string | undefined; country string | undefined; city string | undefined; reference string | undefined; company name string | undefined; }; type trialresponse = trialexistingresponse | trialnewresponse; type trialexistingresponse = { license type licensetypes, is trial boolean, license string, } | { license type licensetypes, is trial boolean, license user string, }; type trialnewresponse = { id number; order id number; product id number; created at number; updated at number; active boolean; enable maintenance period boolean; enabled boolean; is floating boolean; is hardware key auth boolean; is trial boolean; license type licensetypes; maintenance duration string | null; max activations number; max transfers number; metadata string string | undefined; metadata jsonobjectrequired, prevent vm boolean; times activated number; trial days number; validity period? string; company { id number; }; licenseproductfeatures ({ id number; product feature id number; max consumption number; allow overages boolean; max overages number; reset consumption boolean; consumption period? consumptionperiod; is floating boolean; is floating cloud boolean; metadata jsonobjectrequired, metadata string? string; floating timeout? number; floating users? number; })\[]; licensecustomfields ({ product custom field id number; value string | undefined; })\[]; is floating cloud boolean; floating users number; floating timeout number; allow overages boolean; max overages number; max consumptions number; valid duration null; consumption period consumptionperiod | null; reset consumption? boolean; grace period number; allow grace period boolean; } & ({ license string; license key string; } | { license user string; initial password string; license user id number | null; max license users number; }); list licenses for user see licenses for user docid\ rp314ys1tvcymb99k7uuv getuserlicenses(payload getuserlicensespayload) promise\<getuserlicensesresponse> type getuserlicensespayload = { license key string; } | { username string; password string; } | { code string; customer account code string; } | { id token string; customer account code string; }; type getuserlicensesresponse = ({ license { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, license active boolean, license enabled boolean, }, user { id number, email string, first name string, is initial password boolean, last name string, phone number string, allow unlimited activations? boolean, max activations? number, total activations? number, }, })\[]; list license users for customer see list license users for customer docid\ m4gokma1pfwxadk0cglkl getcustomerlicenseusers(payload { customer string; }) promise\<customerlicenseusersresponse> type customerlicenseusersresponse = { company { id number; }; customer customerresponse; users ({ email string | undefined; allow unlimited activations boolean; first name string; initial password string; is active boolean; is initial password boolean; last name string; license id number; max activations number; order id number; order store id string; phone number string; total activations number; })\[]; }; check license feature see license feature check docid\ nol8jafp0apia6di6w5vt checklicensefeature(payload checklicensefeaturepayload) promise\<checklicensefeatureresponse> type checklicensefeaturepayload = ({ license key string; } | { username string; }) & { license id number | undefined; sdk ver string | undefined; include metadata string boolean | undefined; feature string; }; type checklicensefeatureresponse = { id number; license id number; code string; name string; metadata jsonobjectrequired, metadata string? string; is floating boolean; is floating cloud boolean; floating in use devices? number; expiry date string | null; feature type 'activation'; } | { id number; license id number; code string; name string; metadata jsonobjectrequired, metadata string? string; is floating boolean; is floating cloud boolean; floating in use devices? number; expiry date string | null; feature type 'consumption'; consumption period consumptionperiod; allow negative consumptions boolean; allow overages boolean; allow unlimited consumptions boolean; max consumption number; max overages number; reset consumption boolean; total consumptions number; }; add license consumption see add consumption docid\ srwb9sggwhqxqncym3tbi addconsumption(payload addconsumptionpayload) promise\<addconsumptionresponse> type addconsumptionpayload = ({ license key string | undefined; } | { username string | undefined; }) & { consumptions number; sdk ver string | undefined; license id number | undefined; ignore events boolean | undefined; allow overages boolean | undefined; max overages number | undefined; event ("consumption add" | "offline floating consumptions sync")\[] | undefined; }; type addconsumptionresponse = { id number; max consumptions number; allow unlimited consumptions boolean; allow negative consumptions boolean; allow overages boolean; max overages number; reset consumption boolean; consumption period consumptionperiod | undefined; total consumptions number; company { id number; }; }; add feature consumption see add feature consumption docid\ vp8t3phttdpq46i9yktff addfeatureconsumption(payload addfeatureconsumptionpayload) promise\<addfeatureconsumptionresponse> type addfeatureconsumptionpayload = ({ license key string | undefined; } | { username string | undefined; }) & { consumptions number; feature string; sdk ver string | undefined; license id number | undefined; ignore events boolean | undefined; allow overages boolean | undefined; max overages number | undefined; event ("consumption add" | "offline floating consumptions sync")\[] | undefined; }; type addfeatureconsumptionresponse = { id number; license id number; company { id number; }; total consumptions number; max consumptions number; allow negative consumptions boolean; allow unlimited consumptions boolean; allow overages boolean; max overages number; reset consumption boolean; consumption period consumptionperiod; is floating boolean; is floating cloud boolean; floating timeout? number; floating users? number; }; get product details see get product details docid\ ar0igr0c1 dvx1yn044rr getproductdetails(payload productdetailspayload) promise\<getproductdetailsresponse> type productdetailspayload = { include latest version boolean | undefined; include custom fields boolean | undefined; env string | undefined; }; type getproductdetailsresponse = { product id number, product name string, short code string, allow trial boolean, trial days number, authorization method authorizationmethod, floating timeout number, allow overages boolean, max overages number, prevent vm boolean, metadata jsonobjectrequired, metadata string? string, company { id number }, latest version? { id number; version string | undefined; full link string | undefined; filename string | undefined; release date string | null; hash md5 string | undefined; environment string; eula link string | undefined; release notes link string | undefined; size string | undefined; requires version string | undefined; channel string | undefined; created at string | null; updated at string | null; enabled boolean; product id number; } | null, custom fields? { id number, name string, default value string }\[] }; get device variables see get device variables docid\ zjvswpdxa3gr 9kiq0gng getdevicevariables(payload getdevicevariablespayload) promise\<getdevicevariablesresponse> type getdevicevariablespayload = ({ license key string; } | { username string; }) & { sdk ver string | undefined; license id number | undefined; }; type getdevicevariablesresponse = { id number; created at string; variable? string; value? string; device id number; }\[]; track device variables see track device variables docid 9lcvdjjd nsjuu7uibeaa trackdevicevariables(payload trackdevicevariablespayload) promise\<trackdevicevariablesresponse> type trackdevicevariablespayload = ({ license key string; } | { username string; }) & { variables { \[key string] string | number | boolean }, sdk ver string | undefined; license id number | undefined; }; type trackdevicevariablesresponse = { variable string; value string; device id number; created at number; }\[]; borrow floating license see borrow floating license docid\ sooypvnwqodzw1rtwyust floatingborrow(payload floatingborrowpayload) promise\<floatingborrowresponse> type floatingborrowpayload = ({ license key string; } | { username string; password string; }) & { borrowed until string | null; sdk ver string | undefined; license id number | undefined; }; type floatingborrowresponse = { borrowed until string | null; max borrow time number; device id number; license id number; company { id number; }; }; release floating license see release floating license docid\ ac4qjdmmgxwjrzjv9mrru floatingrelease(payload floatingreleasepayload) promise\<boolean> type floatingreleasepayload = ({ license key string; } | { username string; }) & { sdk ver string | undefined; license id number | undefined; }; release floating feature see release floating feature docid\ vysqav5zovsk4lj93xvdi featurerelease(payload floatingfeaturereleasepayload) promise\<boolean> type floatingfeaturereleasepayload = ({ license key string; } | { username string; }) & { feature string; sdk ver string | undefined; license id number | undefined; }; change password see change password docid\ b4ixyzvah4talttuuajyi changepassword(payload { username string; password string; new password string; }) promise\<boolean> get product versions see get product versions docid\ mbq0ek4xlt jx8sldyhy9 getversions(payload getversionspayload) promise\<versionsresponse> type getversionspayload = ({ license key string; } | { username string; }) & { sdk ver string | undefined; env string | undefined; channel string | undefined; }; type versionsresponse = ({ version string | undefined; release date string | null; })\[]; get product installation file see get installation file docid\ lxpe6kv olj7hll grl1q getinstallationfile(payload getinstallationfilepayload) promise\<installationfileresponse> type getinstallationfilepayload = ({ license key string; } | { username string; }) & { sdk ver string | undefined; env string | undefined; channel string | undefined; version string | undefined; }; type installationfileresponse = { id number; version string | undefined; installation file string | undefined; release date string | null; hash md5 string | undefined; environment string; eula link string | undefined; release notes link string | undefined; size string | undefined; requires version string | undefined; channel string | undefined; company { id number; }; }; get single sign on url see single sign on url docid\ qbjwnphsdcs0l25uw6ptq getssourl(payload { response type 'token' | 'code' | undefined; product string; customer account code string; }) promise\<ssourlresponse> type ssourlresponse = { url string; openid configuration { \[key string] string | number | boolean; }; }; air gapped licenses https //docs licensespring com/license entitlements/activation types/air gapped https //docs licensespring com/license entitlements/activation types/air gapped getairgapactivationcode(initializationcode string, licensekey string) performs verifyconfirmationcode and activates air gapped license activateairgaplicense(confirmationcode string, licensekey string, policyfilepath string, policyid string) license utility methods the following methods on the licensemanager class take a single argument which is the license object returned from a license activation, a license check or parsed from the license file checks if license is enabled, active and not expired isvalid(license { license active boolean, license enabled boolean, validity period dateiso8601utc | null, }) boolean returns days remaining in maintenance period maintenancedaysremaining(license { enable maintenance period boolean maintenance period string | null, }) number returns days remaining in license validity period daysremaining(license { grace period number, validity period dateiso8601utc | null, }) number license file see license file https //www npmjs com/package/@licensespring/node sdk#license file / reads and parses the local license file and returns its data as a license object / loadlicense() license / verifies the local license file's integrity / islicensefilecorrupted() boolean / deletes the local license file and guard file / clearlocalstorage() void