@licensespring/node-sdk 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,1446 @@
1
- # sdk-javascript
1
+ # LicenseSpring node.js SDK
2
+
3
+ This package is a node.js implementation of Licensespring SDK. For more information and tutorials, see: [https://docs.licensespring.com/sdk](https://docs.licensespring.com/sdk)
4
+
5
+ ### Install
6
+
7
+ To install the SDK in your nodejs or typescript project run:
8
+ ```
9
+ npm i --save @licensespring/node-sdk
10
+ ```
11
+
12
+ ## LicenseAPI
13
+
14
+ Provides a direct interface to the [LicenseSpring API](https://docs.licensespring.com/license-api/). The `LicenseAPI` class encapsulates API calls, input checks, authentication and signature verification. Typescript definitions are provided for the arguments and return types of the class methods.
15
+
16
+ To import the LicenseAPI class use:
17
+ ```javascript
18
+ const { LicenseAPI } = require('@licensespring/node-sdk');
19
+ ```
20
+
21
+ ### Creating an instance
22
+
23
+ ```javascript
24
+ const licenseAPI = new LicenseAPI({
25
+ apiKey: '12345678-4bfe-4e3a-8737-757004d6294c',
26
+ sharedKey: 'eYuHrlajvIVTiSFIXpxpKhw78f4Ewy-00-12345678',
27
+ appName: 'js-sdk-test-1',
28
+ appVersion: '0.0.1',
29
+ /** NOTE: the following properties are set to their default values by the SDK and can be overriden manually: */
30
+ // apiPath: 'http://api.dev.licensespring.com/api/v4',
31
+ // publicKey: '...',
32
+ });
33
+ ```
34
+
35
+ The constructor takes the a single argument of the following type:
36
+ ```typescript
37
+ {
38
+ /** your Licensespring API key */
39
+ apiKey: string,
40
+ /** your Licensespring API Shared key **/
41
+ sharedKey: string,
42
+ /** custom name for your application */
43
+ appName: string,
44
+ /** custom version string for your application */
45
+ appVersion: string,
46
+ /** your Air Gap Activation key (optional) */
47
+ airGapKey?: string,
48
+ /** override for License API url (default is https://api.licensespring.com/api/v4/) **/
49
+ apiPath?: string,
50
+ /** override for License API public key (default is pub key for api.licensespring.com) **/
51
+ publicKey?: string,
52
+ /** override for License File filename (default is "License") */
53
+ filename?: string,
54
+ /** override for License File path (default is current directory) */
55
+ filePath?: string,
56
+ /** override for License File encryption key */
57
+ fileKey?: string,
58
+ /** override for license grace period duration in hours (default is 24) */
59
+ gracePeriod?: number,
60
+ /** override for License File guard file (default is false) */
61
+ isGuardFileEnabled?: boolean,
62
+ /** override for Hardware ID calculation method (default is 0, for more info see "Hardware ID" section) */
63
+ hardwareIDMethod?: number,
64
+ }
65
+ ```
66
+
67
+ ### API methods
68
+
69
+ For more information on API functionality, see our [LicenseSpring API docs](https://docs.licensespring.com/license-api/).
70
+
71
+ For type definitions see [Types](#types).
72
+
73
+ #### getHardwareID
74
+
75
+ Generates a [Hardware ID](#hardware-id). This value is required for various API method calls.
76
+
77
+ If the optional argument is not provided, it defaults to the value set in the configuration object provided when instantiating the LicensespringAPI object. If no value was provided in the config object, it defaults to 0 (the default Hardware ID method).
78
+
79
+ ```typescript
80
+ getHardwareID(algorithm?: HardwareIdAlgorithm): string
81
+ ```
82
+
83
+ #### Check License
84
+ [https://docs.licensespring.com/license-api/check](https://docs.licensespring.com/license-api/check)
85
+
86
+ ```typescript
87
+ checkLicense(payload: LicenseIdentificator, includeExpiredFeatures: boolean = false): Promise<LicenseResponse>
88
+ ```
89
+
90
+ #### Activate License Online
91
+
92
+ [https://docs.licensespring.com/license-api/activation-deactivation/activation](https://docs.licensespring.com/license-api/activation-deactivation/activation)
93
+
94
+ ```typescript
95
+ activateLicense(payload: LicenseActivationIdentificatorWithVariables): Promise<LicenseResponse>
96
+ ```
97
+
98
+ #### Deactivate License Online
99
+
100
+ [https://docs.licensespring.com/license-api/activation-deactivation/deactivation](https://docs.licensespring.com/license-api/activation-deactivation/deactivation)
101
+
102
+ ```typescript
103
+ deactivateLicense(payload: LicenseIdentificator): Promise<boolean>
104
+ ```
105
+
106
+ #### Activate License Offline
107
+
108
+ [https://docs.licensespring.com/license-api/activation-deactivation/offline-activation](https://docs.licensespring.com/license-api/activation-deactivation/offline-activation)
109
+
110
+ ```typescript
111
+ activateOffline(payload: LicenseActivationIdentificatorOfflineWithVariables): Promise<LicenseResponseOffline>
112
+ ```
113
+
114
+ #### Deactivate License Offline
115
+
116
+ [https://docs.licensespring.com/license-api/activation-deactivation/offline-deactivation](https://docs.licensespring.com/license-api/activation-deactivation/offline-deactivation)
117
+
118
+ ```typescript
119
+ deactivateOffline(payload: LicenseIdentificator): Promise<boolean>
120
+ ```
121
+
122
+ #### Get Trial License Key
123
+
124
+ [https://docs.licensespring.com/license-api/trial-key](https://docs.licensespring.com/license-api/trial-key)
125
+
126
+ ```typescript
127
+ getTrialKey(payload: TrialKeyPayload): Promise<LicenseTrialResponse>
128
+ ```
129
+
130
+ #### List Licenses for a User
131
+
132
+ [https://docs.licensespring.com/license-api/user-licenses](https://docs.licensespring.com/license-api/user-licenses)
133
+
134
+ ```typescript
135
+ getUserLicenses(payload: GetUserLicensesPayload): Promise<LicenseResponse[]>
136
+ ```
137
+
138
+ #### List License Users for a Customer
139
+
140
+ [https://docs.licensespring.com/license-api/customer-license-users](https://docs.licensespring.com/license-api/customer-license-users)
141
+
142
+ ```typescript
143
+ getCustomerLicenseUsers(payload: GetCustomerLicensesPayload): Promise<CustomerLicenseUsersResponse>
144
+ ```
145
+
146
+ #### Check License Feature
147
+
148
+ [https://docs.licensespring.com/license-api/license-feature-check](https://docs.licensespring.com/license-api/license-feature-check)
149
+
150
+ ```typescript
151
+ checkLicenseFeature(payload: LicenseIdentificatorAndFeature): Promise<LicenseFeatureResponse>
152
+ ```
153
+
154
+ #### Add License Consumption
155
+
156
+ [https://docs.licensespring.com/license-api/consumption/add](https://docs.licensespring.com/license-api/consumption/add)
157
+
158
+ ```typescript
159
+ addConsumption(payload: LicenseIdentificatorAddConsumptions): Promise<LicenseConsumptionsResponse>
160
+ ```
161
+
162
+ #### Add License Feature Consumption
163
+
164
+ [https://docs.licensespring.com/license-api/consumption/add-feature](https://docs.licensespring.com/license-api/consumption/add-feature)
165
+
166
+ ```typescript
167
+ addFeatureConsumption(payload: LicenseIdentificatorAddFeatureConsumptions): Promise<LicenseFeatureConsumptionResponse>
168
+ ```
169
+
170
+ #### Product Details
171
+
172
+ [https://docs.licensespring.com/license-api/product-details](https://docs.licensespring.com/license-api/product-details)
173
+
174
+ ```typescript
175
+ getProductDetails(payload: ProductDetailsPayload): Promise<ProductDetailsResponse>
176
+ ```
177
+
178
+ #### Get Device Variables
179
+
180
+ [https://docs.licensespring.com/license-api/device-variables/get](https://docs.licensespring.com/license-api/device-variables/get)
181
+
182
+ ```typescript
183
+ getDeviceVariables(payload: LicenseIdentificator): Promise<DeviceVariable[]>
184
+ ```
185
+
186
+ #### Track Device Variables
187
+
188
+ [https://docs.licensespring.com/license-api/device-variables/track](https://docs.licensespring.com/license-api/device-variables/track)
189
+
190
+ ```typescript
191
+ trackDeviceVariables(payload: LicenseIdentificatorWithVariables): Promise<DeviceVariable[]>
192
+ ```
193
+
194
+ #### Borrow Floating License
195
+
196
+ [https://docs.licensespring.com/license-api/floating/license/borrow](https://docs.licensespring.com/license-api/floating/license/borrow)
197
+
198
+ ```typescript
199
+ floatingBorrow(payload: LicenseIdentificatorWithBorrowedUntil): Promise<LicenseBorrowResponse>
200
+ ```
201
+
202
+ #### Release Floating License
203
+
204
+ [https://docs.licensespring.com/license-api/floating/license/release](https://docs.licensespring.com/license-api/floating/license/release)
205
+
206
+ ```typescript
207
+ floatingRelease(payload: LicenseIdentificator): Promise<boolean>
208
+ ```
209
+
210
+ #### Release Floating Feature
211
+
212
+ [https://docs.licensespring.com/license-api/floating/feature/release](https://docs.licensespring.com/license-api/floating/feature/release)
213
+
214
+ ```typescript
215
+ featureRelease(payload: LicenseIdentificatorAndFeature): Promise<boolean>
216
+ ```
217
+
218
+ #### Change User Password
219
+
220
+ [https://docs.licensespring.com/license-api/change-password](https://docs.licensespring.com/license-api/change-password)
221
+
222
+ ```typescript
223
+ changePassword(payload: PasswordChangePayload): Promise<boolean>
224
+ ```
225
+
226
+ #### List Product Versions for License
227
+
228
+ [https://docs.licensespring.com/license-api/versions](https://docs.licensespring.com/license-api/versions)
229
+
230
+ ```typescript
231
+ getVersions(payload: LicenseIdentificator): Promise<VersionsResponse>
232
+ ```
233
+
234
+ #### Product Installation File Info for License
235
+
236
+ [https://docs.licensespring.com/license-api/installation-file](https://docs.licensespring.com/license-api/installation-file)
237
+
238
+ ```typescript
239
+ getInstallationFile(payload: LicenseIdentificatorWithInstallation): Promise<InstallationFileResponse>
240
+ ```
241
+
242
+ #### Get Single Sign On URL
243
+
244
+ [https://docs.licensespring.com/license-api/sso-url](https://docs.licensespring.com/license-api/sso-url)
245
+
246
+ ```typescript
247
+ getSSOUrl(payload: SSOURLParams): Promise<{ url: string }>
248
+ ```
249
+
250
+ #### Get Air Gap Activation Code
251
+
252
+ [https://docs.licensespring.com/license-entitlements/activation-types/air-gapped](https://docs.licensespring.com/license-entitlements/activation-types/air-gapped)
253
+
254
+ ```typescript
255
+ getAirGapActivationCode(initializationCode: string, licenseKey: string): string
256
+ ```
257
+
258
+ #### Verify Air-Gap Confirmation Code
259
+
260
+ ```typescript
261
+ verifyConfirmationCode(confirmationCode: string, licenseKey: string, policyId?: string): boolean
262
+ ```
263
+
264
+ #### Activate Air-Gapped License
265
+
266
+ [https://docs.licensespring.com/license-entitlements/activation-types/air-gapped](https://docs.licensespring.com/license-entitlements/activation-types/air-gapped)
267
+
268
+ ```typescript
269
+ activateAirgappedLicense(activationPayload: OfflineActivation, licenseKey: string, policyId: string): LicenseResponse
270
+ ```
271
+
272
+ ## LicenseManager
273
+
274
+ 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.
275
+
276
+ To import the LicenseManager class use:
277
+ ```javascript
278
+ const { LicenseManager } = require('@licensespring/node-sdk');
279
+ ```
280
+
281
+ To create an instance:
282
+
283
+ ```javascript
284
+ const licenseManager = new LicenseManager({
285
+ apiKey: '12345678-4bfe-4e3a-8737-757004d6294c',
286
+ sharedKey: 'eYuHrlajvIVTiSFIXpxpKhw78f4Ewy-00-12345678',
287
+ appName: 'js-sdk-test-1',
288
+ appVersion: '0.0.1',
289
+ productCode: 'lkp',
290
+ /** NOTE: the following properties are set to their default values by the SDK and can be overriden manually: */
291
+ // apiPath: 'http://api.dev.licensespring.com/api/v4',
292
+ // publicKey: '...',
293
+ });
294
+ ```
295
+
296
+ The constructor takes the a single argument of the following type:
297
+ ```typescript
298
+ {
299
+ /** your Licensespring API key */
300
+ apiKey: string,
301
+ /** your Licensespring API Shared key **/
302
+ sharedKey: string,
303
+ /** custom name for your application */
304
+ appName: string,
305
+ /** custom version string for your application */
306
+ appVersion: string,
307
+ /** your product short code */
308
+ productCode: string,
309
+ /** your Air Gap Activation key (optional) */
310
+ airGapKey?: string,
311
+ /** override for License API url (default is https://api.licensespring.com/api/v4/) **/
312
+ apiPath?: string,
313
+ /** override for License API public key (default is pub key for api.licensespring.com) **/
314
+ publicKey?: string,
315
+ /** override for License File filename (default is "License") */
316
+ filename?: string,
317
+ /** override for License File path (default is current directory) */
318
+ filePath?: string,
319
+ /** override for License File encryption key */
320
+ fileKey?: string,
321
+ /** override for license grace period duration in hours (default is 24) */
322
+ gracePeriod?: number,
323
+ /** override for License File guard file (default is false) */
324
+ isGuardFileEnabled?: boolean,
325
+ /** override for Hardware ID calculation method (default is 0, for more info see "Hardware ID" section) */
326
+ hardwareIDMethod?: number,
327
+ }
328
+ ```
329
+
330
+ ### Methods
331
+
332
+ Methods that take a `Managed` License identificator are the same as in License API, except that `product` and `hardware_id` do not have to be specified in the payload as they are provided by the License Manager object.
333
+
334
+ #### Check License
335
+ [https://docs.licensespring.com/license-api/check](https://docs.licensespring.com/license-api/check)
336
+
337
+ ```javascript
338
+ checkLicense(payload: Managed<LicenseIdentificator>): Promise<LicenseResponse>
339
+ ```
340
+
341
+ #### Activate License Online
342
+
343
+ [https://docs.licensespring.com/license-api/activation-deactivation/activation](https://docs.licensespring.com/license-api/activation-deactivation/activation)
344
+
345
+ ```javascript
346
+ activateLicense(payload: Managed<LicenseIdentificatorWithVariables>): Promise<LicenseResponse>
347
+ ```
348
+
349
+ #### Deactivate License Online
350
+
351
+ [https://docs.licensespring.com/license-api/activation-deactivation/deactivation](https://docs.licensespring.com/license-api/activation-deactivation/deactivation)
352
+
353
+ ```javascript
354
+ deactivateLicense(payload: Managed<LicenseIdentificator>): Promise<boolean>
355
+ ```
356
+
357
+ #### Activate License Offline
358
+
359
+ [https://docs.licensespring.com/license-api/activation-deactivation/offline-activation](https://docs.licensespring.com/license-api/activation-deactivation/offline-activation)
360
+
361
+ ```javascript
362
+ activateOffline(payload: Managed<LicenseIdentificatorOfflineWithVariables>): Promise<LicenseResponseOffline>
363
+ ```
364
+
365
+ #### Deactivate License Offline
366
+
367
+ [https://docs.licensespring.com/license-api/activation-deactivation/offline-deactivation](https://docs.licensespring.com/license-api/activation-deactivation/offline-deactivation)
368
+
369
+ ```javascript
370
+ deactivateOffline(payload: Managed<LicenseIdentificator>): Promise<boolean>
371
+ ```
372
+
373
+ #### Get Trial License Key
374
+
375
+ [https://docs.licensespring.com/license-api/trial-key](https://docs.licensespring.com/license-api/trial-key)
376
+
377
+ ```javascript
378
+ getTrialKey(payload: Managed<TrialKeyPayload>): Promise<LicenseTrialResponse>
379
+ ```
380
+
381
+ #### List Licenses for a User
382
+
383
+ [https://docs.licensespring.com/license-api/user-licenses](https://docs.licensespring.com/license-api/user-licenses)
384
+
385
+ ```javascript
386
+ getUserLicenses(payload: Managed<GetUserLicensesPayload>): Promise<LicenseResponse[]>
387
+ ```
388
+
389
+ #### List License Users for a Customer
390
+
391
+ [https://docs.licensespring.com/license-api/customer-license-users](https://docs.licensespring.com/license-api/customer-license-users)
392
+
393
+ ```javascript
394
+ getCustomerLicenseUsers(payload: Managed<GetCustomerLicensesPayload>): Promise<CustomerLicenseUsersResponse>
395
+ ```
396
+
397
+ #### Check License Feature
398
+
399
+ [https://docs.licensespring.com/license-api/license-feature-check](https://docs.licensespring.com/license-api/license-feature-check)
400
+
401
+ ```javascript
402
+ checkLicenseFeature(payload: Managed<LicenseIdentificatorAndFeature>): Promise<LicenseFeatureResponse>
403
+ ```
404
+
405
+ #### Add License Consumption
406
+
407
+ [https://docs.licensespring.com/license-api/consumption/add](https://docs.licensespring.com/license-api/consumption/add)
408
+
409
+ ```javascript
410
+ addConsumption(payload: Managed<LicenseIdentificatorAddConsumptions>): Promise<LicenseConsumptionsResponse>
411
+ ```
412
+
413
+ #### Add License Feature Consumption
414
+
415
+ [https://docs.licensespring.com/license-api/consumption/add-feature](https://docs.licensespring.com/license-api/consumption/add-feature)
416
+
417
+ ```javascript
418
+ addFeatureConsumption(payload: Managed<LicenseIdentificatorAddFeatureConsumptions>): Promise<LicenseFeatureConsumptionResponse>
419
+ ```
420
+
421
+ #### Product Details
422
+
423
+ [https://docs.licensespring.com/license-api/product-details](https://docs.licensespring.com/license-api/product-details)
424
+
425
+ ```javascript
426
+ getProductDetails(payload: Managed<ProductDetailsPayload>): Promise<ProductDetailsResponse>
427
+ ```
428
+
429
+ #### Get Device Variables
430
+
431
+ [https://docs.licensespring.com/license-api/device-variables/get](https://docs.licensespring.com/license-api/device-variables/get)
432
+
433
+ ```javascript
434
+ getDeviceVariables(payload: Managed<LicenseIdentificator>): Promise<DeviceVariable[]>
435
+ ```
436
+
437
+ #### Track Device Variables
438
+
439
+ [https://docs.licensespring.com/license-api/device-variables/track](https://docs.licensespring.com/license-api/device-variables/track)
440
+
441
+ ```javascript
442
+ trackDeviceVariables(payload: Managed<LicenseIdentificatorWithVariables>): Promise<DeviceVariable[]>
443
+ ```
444
+
445
+ #### Borrow Floating License
446
+
447
+ [https://docs.licensespring.com/license-api/floating/license/borrow](https://docs.licensespring.com/license-api/floating/license/borrow)
448
+
449
+ ```javascript
450
+ floatingBorrow(payload: Managed<LicenseIdentificatorWithBorrowedUntil>): Promise<LicenseBorrowResponse>
451
+ ```
452
+
453
+ #### Release Floating License
454
+
455
+ [https://docs.licensespring.com/license-api/floating/license/release](https://docs.licensespring.com/license-api/floating/license/release)
456
+
457
+ ```javascript
458
+ floatingRelease(payload: Managed<LicenseIdentificator>): Promise<boolean>
459
+ ```
460
+
461
+ #### Release Floating Feature
462
+
463
+ [https://docs.licensespring.com/license-api/floating/feature/release](https://docs.licensespring.com/license-api/floating/feature/release)
464
+
465
+ ```javascript
466
+ featureRelease(payload: Managed<LicenseIdentificatorAndFeature>): Promise<boolean>
467
+ ```
468
+
469
+ #### Change User Password
470
+
471
+ [https://docs.licensespring.com/license-api/change-password](https://docs.licensespring.com/license-api/change-password)
472
+
473
+ ```javascript
474
+ changePassword(payload: PasswordChangePayload): Promise<boolean>
475
+ ```
476
+
477
+ #### List Product Versions for License
478
+
479
+ [https://docs.licensespring.com/license-api/versions](https://docs.licensespring.com/license-api/versions)
480
+
481
+ ```javascript
482
+ getVersions(payload: Managed<LicenseIdentificator>): Promise<VersionsResponse>
483
+ ```
484
+
485
+ #### Product Installation File Info for License
486
+
487
+ [https://docs.licensespring.com/license-api/installation-file](https://docs.licensespring.com/license-api/installation-file)
488
+
489
+ ```javascript
490
+ getInstallationFile(payload: Managed<LicenseIdentificatorWithInstallation>): Promise<InstallationFileResponse>
491
+ ```
492
+
493
+ #### Get Single Sign On URL
494
+
495
+ [https://docs.licensespring.com/license-api/sso-url](https://docs.licensespring.com/license-api/sso-url)
496
+
497
+ ```javascript
498
+ getSSOUrl(payload: SSOURLParams): Promise<{ url: string }>
499
+ ```
500
+
501
+ #### Get Air Gap Activation Code
502
+
503
+ [https://docs.licensespring.com/license-entitlements/activation-types/air-gapped](https://docs.licensespring.com/license-entitlements/activation-types/air-gapped)
504
+
505
+ ```javascript
506
+ getAirGapActivationCode(initializationCode: string, licenseKey: string)
507
+ ```
508
+
509
+ #### Activate Air-Gapped License
510
+
511
+ Performs `verifyConfirmationCode` and activates Air-Gapped License:
512
+ ```javascript
513
+ activateAirGapLicense(confirmationCode: string, licenseKey: string, policyFilePath: string, policyID: string)
514
+ ```
515
+
516
+ #### Is License Valid
517
+
518
+ Checks if License is enabled, active and not expired:
519
+ ```javascript
520
+ isValid(license: LicenseResponse): boolean
521
+ ```
522
+
523
+ #### Maintenance Days Remaining
524
+
525
+ Returns days remaining in maintenance period:
526
+ ```javascript
527
+ maintenanceDaysRemaining(license: LicenseResponse): number
528
+ ```
529
+
530
+ #### Validity Days Remaining
531
+
532
+ Returns days remaining in license validity period:
533
+ ```javascript
534
+ daysRemaining(license: LicenseResponse): number
535
+ ```
536
+
537
+ #### Load License File
538
+
539
+ See [License File](#license-file)
540
+
541
+ ```javascript
542
+ loadLicense(): License
543
+ ```
544
+
545
+ #### Check License File For Corruption
546
+
547
+ ```javascript
548
+ isLicenseFileCorrupted(): boolean
549
+ ```
550
+
551
+ #### Clear Local Storage
552
+
553
+ ```javascript
554
+ clearLocalStorage(): void
555
+ ```
556
+
557
+ ## License File
558
+
559
+ For more info see our docs: [https://docs.licensespring.com/sdks/tutorials/best-practices/local-license-file](https://docs.licensespring.com/sdks/tutorials/best-practices/local-license-file) and [https://docs.licensespring.com/sdks/python/licensefile](https://docs.licensespring.com/sdks/python/licensefile)
560
+
561
+ To load a local license file, create an instance of `LicenseManager` and call the method `loadLicense`:
562
+ ```javascript
563
+ const licenseFile = licenseManager.loadLicense();
564
+ ```
565
+
566
+ The License class provides an interface for working with the License File.
567
+
568
+ ### Methods
569
+
570
+ #### Get Feature Data
571
+ ```javascript
572
+ public featureData(featureCode: string): ProductFeature
573
+ ```
574
+
575
+ #### Check License Status
576
+ Throws an exception if the license is disabled, inactive or expired
577
+ ```javascript
578
+ checkLicenseStatus(): void
579
+ ```
580
+
581
+ #### Perform Full License Check
582
+ Checks License status and saves to local license file
583
+ ```javascript
584
+ check(includeExpiredFeatures: boolean = false): Promise<LicenseResponse>
585
+ ```
586
+
587
+ #### Get Air-Gap License Deactivation Code
588
+ ```javascript
589
+ getDeactivationCode(initializationCode: string): string
590
+ ```
591
+
592
+ #### Deactivate Air-Gap License
593
+ ```javascript
594
+ deactivateAirGap(confirmationCode: string): void
595
+ ```
596
+
597
+ #### Deactivate License
598
+ Deactivates a License, updates local license file. Optionally deletes license file
599
+ ```javascript
600
+ deactivate(deleteLicense: boolean = false): Promise<boolean>
601
+ ```
602
+
603
+ #### Local License Check
604
+ Performs a local check using the local license file. Throws an exception if license is not valid
605
+ ```javascript
606
+ localCheck(): Promise<true>
607
+ ```
608
+
609
+ #### Change Password
610
+ Performs password change for user associated to License
611
+ ```javascript
612
+ changePassword(oldPassword: string, newPassword: string): Promise<boolean>
613
+ ```
614
+
615
+ #### Add Local Consumption
616
+ Adds a License consumption to the local license data
617
+ ```javascript
618
+ addLocalConsumption(consumptions: number = 1)
619
+ ```
620
+
621
+ #### Add Local Feature Consumption
622
+ Adds a License feature consumption to the local license data
623
+ ```javascript
624
+ addLocalFeatureConsumption(featureCode: string, consumptions: number = 1)
625
+ ```
626
+
627
+ #### Sync License Feature Consumption
628
+ Sends a feature consumption request to the server and updates local data
629
+ ```javascript
630
+ syncFeatureConsumption(feature: { code: string, local_consumption: number }): Promise<boolean>
631
+ ```
632
+
633
+ #### Sync License Consumption
634
+ Syncs local consumptions to server
635
+ ```javascript
636
+ syncConsumption(overages: number = -1): Promise<boolean>
637
+ ```
638
+
639
+ #### Borrow Floating License
640
+ ```javascript
641
+ floatingBorrow(borrowUntil: string, password?: string): Promise<boolean>
642
+ ```
643
+
644
+ #### Release Floating License
645
+ ```javascript
646
+ floatingRelease(): Promise<boolean>
647
+ ```
648
+
649
+ #### Check Feature Status
650
+ Checks License Feature status, throws exception if not active
651
+ ```javascript
652
+ checkFeature(featureCode: string): Promise<void>
653
+ ```
654
+
655
+ #### Release Borrowed Feature
656
+ ```javascript
657
+ releaseFeature(featureCode: string): Promise<void>
658
+ ```
659
+
660
+ #### Update Offline
661
+ ```javascript
662
+ Update local cache from Offline License File (at given `path`). Optionally reset local consumption value.
663
+ public updateOffline(path: string, resetConsumption: boolean): boolean
664
+ ```
665
+
666
+ #### Deactivate Offline License
667
+ ```javascript
668
+ deactivateOffline(offlinePath: string): Promise<void>
669
+ ```
670
+
671
+ #### Get Product Details
672
+ Retrieves Product Details from server
673
+ ```javascript
674
+ productDetails(includeLatestVersion: boolean = false, includeCustomFields: boolean = false, includeExpiredFeatures: boolean = false): Promise<ProductDetailsResponse>
675
+ ```
676
+
677
+ #### Get Product Details Local
678
+ Retrieves Product Details from local data
679
+ ```javascript
680
+ get productDetailsLocal()
681
+ ```
682
+
683
+ #### Set Device Variables Local
684
+ Set custom variables to local data
685
+ ```javascript
686
+ setDeviceVariablesLocal(variables: { [key: string]: string|number }, save: boolean = true): void
687
+ ```
688
+
689
+ #### Set Device Variables
690
+ Send locally stored variables to server. Optionally save to license file
691
+ ```javascript
692
+ setDeviceVariables(save: boolean = false): Promise<void>
693
+ ```
694
+
695
+ #### Get Device Variable Local
696
+ Get the value of a variable from local data
697
+ ```javascript
698
+ getDeviceVariableLocal(variable: string)
699
+ ```
700
+
701
+ #### Get Device Variables Local
702
+ Get all variables from local data
703
+ ```javascript
704
+ getDeviceVariablesLocal()
705
+ ```
706
+
707
+ #### Get Device Variables
708
+ ```javascript
709
+ getDeviceVariables(): Promise<DeviceVariable[]>
710
+ ```
711
+
712
+ ### Getters
713
+
714
+ ```javascript
715
+ get allowGraceSubscriptionPeriod()
716
+ get allowOverages()
717
+ get allowUnlimitedActivations()
718
+ get allowUnlimitedConsumptions()
719
+ get borrowUntil()
720
+ get consumptionPeriod()
721
+ get consumptionReset()
722
+ get customerInformation()
723
+ get customFields()
724
+ get daysRemaining()
725
+ get daysSinceLastCheck()
726
+ get expiryDate()
727
+ get features()
728
+ get floatingClientId()
729
+ get floatingEndDate()
730
+ get floatingInUseDevices()
731
+ get floatingTimeout()
732
+ get gracePeriod()
733
+ get gracePeriodHoursRemaining()
734
+ get id()
735
+ get isAirGapped()
736
+ get isBorrowed()
737
+ get isControlledByFloatingServer()
738
+ get isDeviceTransferAllowed()
739
+ get isDeviceTransferLimited()
740
+ get isExpired()
741
+ get isFloating()
742
+ get isFloatingExpired()
743
+ get isGracePeriod()
744
+ get isGracePeriodStarted()
745
+ get isMaintenancePeriodExpired()
746
+ get isSubcriptionGracePeriodStarted()
747
+ get isTrial()
748
+ get isValid()
749
+ get isValidityPeriodExpired()
750
+ get lastCheck()
751
+ get lastUsage()
752
+ get licenseActive()
753
+ get licenseEnabled()
754
+ get licenseKey()
755
+ get licenseType()
756
+ get licenseUser()
757
+ get localConsumptions()
758
+ get maintenanceDaysRemaining()
759
+ get maintenancePeriod()
760
+ get maxActivations()
761
+ get maxConsumptions()
762
+ get maxFloatingUsers()
763
+ get maxOverages()
764
+ get maxTransfers()
765
+ get metadata()
766
+ get policyID()
767
+ get preventVm()
768
+ get startDate()
769
+ get subscriptionGracePeriod()
770
+ get totalConsumptions()
771
+ get transferCount()
772
+ get validityPeriod()
773
+ get validityWithGracePeriod()
774
+ ```
775
+
776
+ ## Hardware ID
777
+
778
+ Both LicenseAPI and LicenseManager use the Hardware ID module to calculate a unique fingerprint for the local machine. The module provides multiple methods of determining the ID:
779
+ ```typescript
780
+ export enum HardwareIdAlgorithm {
781
+ Default = 0,
782
+ WindowsHardwareFingerprintId = 1,
783
+ WindowsComputerSystemProductId = 2,
784
+ WindowsCryptographyId = 3,
785
+ LinuxMachineId = 4,
786
+ CloudPlatformsId = 5,
787
+ };
788
+ ```
789
+ The default method (0) covers all cases and fallbacks. If you override the default method, the method used should be consistent accross your project. For both LicenseAPI and LicenseManager, this can be overriden globally by setting the required value in the config object when initializing the LicenseAPI/LicenseManager, e.g.:
790
+
791
+ ```javascript
792
+ const licenseAPI = new LicenseAPI({
793
+ apiKey: '12345678-4bfe-4e3a-8737-757004d6294c',
794
+ sharedKey: 'eYuHrlajvIVTiSFIXpxpKhw78f4Ewy-00-12345678',
795
+ appName: 'js-sdk-test-1',
796
+ appVersion: '0.0.1',
797
+ hardwareIDMethod: 5,
798
+ });
799
+ ```
800
+
801
+
802
+ ## Types
803
+
804
+ The following are typescript definitions for all the types used in the SDK:
805
+
806
+ ```typescript
807
+ /** Date string in ISO 8601 format (always in UTC timezone) with optional separators and optional time component, e.g.:
808
+ *
809
+ * "2024-09-27T23:30:48.016Z"
810
+ *
811
+ * "2024-09-27 23:30:48.016"
812
+ *
813
+ * "2024-09-27 23:30:48"
814
+ *
815
+ * "2024-09-27 23:30"
816
+ *
817
+ * "2024-09-27"
818
+ *
819
+ */
820
+ export type DateInputString = string;
821
+
822
+ /** Date string in full ISO 8601 format, e.g. "2024-09-27T23:30:48.016Z". Note: this is always in UTC timezone */
823
+ export type DateISO8601UTC = string;
824
+
825
+ /** Date string in RFC 7231 format, e.g. "Fri, 27 Sep 2024 23:30:48 GMT". Note: this is always in GMT timezone */
826
+ export type DateRFC7231 = string;
827
+
828
+ /** Length of time expressed in days, months or years, e.g. 5d, 2m, 3y */
829
+ export type TimeLength = string;
830
+
831
+ export type LicensespringConfig = {
832
+ apiKey: string,
833
+ sharedKey: string,
834
+ apiPath: string,
835
+ publicKey: string,
836
+ productCode: string,
837
+ appName: string,
838
+ appVersion: string,
839
+ filePath: string,
840
+ filename: string,
841
+ gracePeriod: number,
842
+ fileKey: string,
843
+ airGapKey?: string,
844
+ isGuardFileEnabled: boolean,
845
+ hardwareIDMethod: number,
846
+ sdkVersion: string,
847
+ };
848
+
849
+ export type LicensespringAPIConfig = Omit<LicensespringConfig, 'productCode'>;
850
+
851
+ export type LicensespringConfigDef = Omit<LicensespringConfig, 'apiPath'|'publicKey'|'filename'|'filePath'|'gracePeriod'|'fileKey'|'isGuardFileEnabled'|'hardwareIDMethod'|'sdkVersion'> & {
852
+ apiPath?: string,
853
+ publicKey?: string,
854
+ filename?: string,
855
+ filePath?: string,
856
+ gracePeriod?: number,
857
+ fileKey?: string,
858
+ isGuardFileEnabled?: boolean,
859
+ hardwareIDMethod?: number,
860
+ };
861
+
862
+ export type LicensespringAPIConfigDef = Omit<LicensespringAPIConfig, 'apiPath'|'publicKey'|'filename'|'filePath'|'gracePeriod'|'fileKey'|'isGuardFileEnabled'|'hardwareIDMethod'|'sdkVersion'> & {
863
+ apiPath?: string,
864
+ publicKey?: string,
865
+ filename?: string,
866
+ filePath?: string,
867
+ gracePeriod?: number,
868
+ fileKey?: string,
869
+ isGuardFileEnabled?: boolean,
870
+ hardwareIDMethod?: number,
871
+ };
872
+
873
+ export type LicensespringFloatingConfig = {
874
+ apiPath: string,
875
+ appVersion: string,
876
+ hardwareIDMethod: number,
877
+ sdkVersion: string,
878
+ };
879
+
880
+ export type LicensespringFloatingConfigDef = Omit<LicensespringFloatingConfig, 'hardwareIDMethod'|'sdkVersion'> & {
881
+ hardwareIDMethod?: number,
882
+ };
883
+
884
+ type LicenseIdentificatorKeyBased = {
885
+ license_key: string,
886
+ };
887
+
888
+ type LicenseIdentificatorUserBased = {
889
+ username: string,
890
+ };
891
+
892
+ type LicenseActivationIdentificatorUserBased = {
893
+ username: string,
894
+ password: string,
895
+ };
896
+
897
+ type LicenseIdentificatorUserSSOBased = ({
898
+ id_token: string,
899
+ } | {
900
+ code: string,
901
+ }) & {
902
+ customer_account_code: string,
903
+ };
904
+
905
+ export type SSOURLParams = {
906
+ product: string,
907
+ type: 'token'|'code',
908
+ };
909
+
910
+ type LicenseIdentificatiorRequired = {
911
+ hardware_id: string,
912
+ product: string,
913
+ bundle_code?: string,
914
+ license_id?: number,
915
+ };
916
+
917
+ export type LicenseActivationIdentificatorWithVariables = LicenseActivationIdentificator & { variables?: Dictionary<string> };
918
+ export type LicenseActivationIdentificatorOfflineWithVariables = LicenseActivationIdentificator & OfflineActivationRequest & { variables?: Dictionary<string> };
919
+
920
+ export type LicenseIdentificatorWithVariables = LicenseIdentificator & { variables?: Dictionary<string> };
921
+
922
+ export type LicenseIdentificatorOfflineWithVariables = LicenseIdentificator & OfflineActivationRequest & { variables?: Dictionary<string> };
923
+
924
+ export type TrialKeyPayload = { email: string, product: string, hardware_id: string };
925
+
926
+ export type GetUserLicensesPayload = { username: string, password: string, product: string };
927
+
928
+ export type GetCustomerLicensesPayload = { customer: string, product: string };
929
+
930
+ export type LicenseIdentificatorAndFeature = LicenseIdentificator & { feature: string };
931
+
932
+ export type LicenseIdentificatorAddConsumptions = LicenseIdentificator & { consumptions: number };
933
+
934
+ export type LicenseIdentificatorAddFeatureConsumptions = LicenseIdentificator & { feature: string, consumptions: number };
935
+
936
+ export type ProductDetailsPayload = {
937
+ product: string,
938
+ /** @defaultValue false */
939
+ include_expired_features?: boolean,
940
+ /** @defaultValue false */
941
+ include_latest_version?: boolean,
942
+ /** @defaultValue false */
943
+ include_custom_fields?: boolean,
944
+ }
945
+
946
+ export type LicenseIdentificatorWithBorrowedUntil = LicenseIdentificator & { borrowed_until: DateInputString };
947
+
948
+ export type PasswordChangePayload = { username: string, password: string, new_password: string };
949
+
950
+ export type LicenseIdentificatorWithInstallation = LicenseIdentificator & { env: string, channel: string, version: string };
951
+
952
+ export type Managed<T> = Omit<T, 'product' | 'hardware_id'>;
953
+
954
+ /**
955
+ * @type {LicenseIdentificator}
956
+ *
957
+ * An object that identifies a License using either a license-key, user credentials or single sign-on credentials.
958
+ * Optionally can include a `license_id` property to force a specific license is being selected.
959
+ */
960
+ export type LicenseIdentificator = (
961
+ XOR<LicenseIdentificatorKeyBased, LicenseIdentificatorUserBased>
962
+ ) & LicenseIdentificatiorRequired;
963
+
964
+ export type LicenseActivationIdentificator = (
965
+ XOR<LicenseIdentificatorKeyBased, LicenseActivationIdentificatorUserBased, LicenseIdentificatorUserSSOBased>
966
+ ) & LicenseIdentificatiorRequired;
967
+
968
+ /**
969
+ * @type {LicenseUser}
970
+ *
971
+ * An object describing a User associated to a specific license
972
+ */
973
+ export type LicenseUser = {
974
+ id: number,
975
+ email: string,
976
+ first_name: string,
977
+ last_name: string,
978
+ phone_number: string,
979
+ is_initial_password: boolean,
980
+ allow_unlimited_activations: boolean,
981
+ max_activations: number,
982
+ total_activations: number,
983
+ };
984
+
985
+ /**
986
+ * @type {ProductDetails}
987
+ *
988
+ * An object describing the basic properties of a Product
989
+ */
990
+ export type ProductDetails = {
991
+ product_id: number,
992
+ product_name: string,
993
+ short_code: string,
994
+ authorization_method: 'license-key' | 'user',
995
+ metadata: JSON,
996
+ };
997
+
998
+ /**
999
+ * @type {Customer}
1000
+ *
1001
+ * An object describing a Customer
1002
+ */
1003
+ export type Customer = {
1004
+ email: string,
1005
+ company_name: string,
1006
+ reference: string,
1007
+ phone: string,
1008
+ first_name: string,
1009
+ last_name: string,
1010
+ city: string,
1011
+ postcode: string,
1012
+ state: string,
1013
+ country: string,
1014
+ address: string,
1015
+ customer_account: string|null,
1016
+ metadata: JSON,
1017
+ };
1018
+
1019
+ /**
1020
+ * @type {CustomField}
1021
+ *
1022
+ * An object describing a Custom Field. These are key-value pairs assigned to a Product and inherited by that product's Licenses. They can be overriden on the License level
1023
+ */
1024
+ export type CustomField = {
1025
+ name: string,
1026
+ data_type: 'numer' | 'text' | 'date/time',
1027
+ value: string,
1028
+ };
1029
+
1030
+ /**
1031
+ * @type {ProductFeature}
1032
+ *
1033
+ * An object describing a Product Feature. These are custom attributes assigned to a Product and inherited by that product's Licenses
1034
+ */
1035
+ export type ProductFeature = {
1036
+ id: number,
1037
+ code: string,
1038
+ name: string,
1039
+ expiry_date: string,
1040
+ metadata: JSON,
1041
+ is_floating_cloud: boolean,
1042
+ } & XOR<{
1043
+ feature_type: 'activation',
1044
+ }, {
1045
+ feature_type: 'consumption',
1046
+ max_consumption: number,
1047
+ allow_unlimited_consumptions: boolean,
1048
+ total_consumptions: number,
1049
+ allow_overages: number,
1050
+ max_overages: number,
1051
+ reset_consumption: boolean,
1052
+ consumption_period: 'daily' | 'weekly' | 'monthly' | 'annualy' | null,
1053
+ }> & XOR<{
1054
+ is_floating: false
1055
+ }, {
1056
+ is_floating: true,
1057
+ floating_users: number,
1058
+ floating_timeout?: number,
1059
+ }>;
1060
+
1061
+ /**
1062
+ * @type {LicenseType}
1063
+ *
1064
+ * Declares the type of License which is always one of the following:
1065
+ *
1066
+ * - *perpetual*: A perpetual license does not expire. The `is_expired` field on such a license will always be `false`.
1067
+ * Note that a perpetual *trial* license (`is_trial` flag is set to `true`) does have an `validity_period`, which refers to the end of the trial period.
1068
+ *
1069
+ * - *time-limited*: Has a `validity_period` set as a calendar date. After the date has passed, the `is_expired` flag will be set to `true`.
1070
+ *
1071
+ * - *subscription*: Uses an external source of truth such as a 3rd party service to determine the state of the License.
1072
+ *
1073
+ * - *consumption*: Permits usage metering. These licenses set a value the vendor wishes to meter, and then record the times that resource has been used.
1074
+ * Includes the following properties: `max_consumptions`, `total_consumptions`, `allow_unlimited_consumptions`, `allow_overages`, `max_overages`, `reset_consumption` and `consumption_period`.
1075
+ *
1076
+ */
1077
+ export type LicenseType = 'perpetual' | 'time-limited' | 'consumption' | 'subscription';
1078
+
1079
+ /**
1080
+ * @type {LicenseResponse}
1081
+ *
1082
+ * The License object received as a response when checking or activating a License. Includes a set of common properties and additional ones which may or may not appear depending on `license_type`, `is_trial`, `is_floating`/`is_floating_cloud` and Product `authorization_method` (key-based vs. user based).
1083
+ */
1084
+ export type LicenseResponse = {
1085
+ id: number;
1086
+ allow_grace_period: boolean,
1087
+ allow_overages: boolean,
1088
+ allow_unlimited_activations: boolean,
1089
+ borrowed_until: string | null,
1090
+ can_borrow: boolean,
1091
+ channel: string,
1092
+ device_id: number,
1093
+ enable_maintenance_period: boolean
1094
+ environment: string,
1095
+ eula_link: string,
1096
+ floating_timeout: number,
1097
+ grace_period: number,
1098
+ hash_md5: string,
1099
+ installation_file: string,
1100
+ is_air_gapped: boolean,
1101
+ is_borrowed: boolean,
1102
+ is_expired: boolean,
1103
+ is_hardware_key_auth: boolean,
1104
+ license_active: boolean,
1105
+ license_enabled: boolean,
1106
+ license_signature: string,
1107
+ license_type: LicenseType,
1108
+ maintenance_period: string | null,
1109
+ max_activations: number,
1110
+ max_borrow_time: number,
1111
+ max_license_users: number,
1112
+ max_overages: number,
1113
+ max_transfers: number,
1114
+ order_store_id: string,
1115
+ prevent_vm: boolean,
1116
+ release_date: string,
1117
+ release_notes_link: string,
1118
+ requires_version: string,
1119
+ size: string,
1120
+ start_date: string | null,
1121
+ times_activated: number,
1122
+ transfer_count: number,
1123
+ validity_period: DateISO8601UTC | null,
1124
+ version: string,
1125
+ product_features: ProductFeature[],
1126
+ custom_fields: CustomField[],
1127
+ customer: Customer,
1128
+ product_details: ProductDetails,
1129
+ metadata: JSON,
1130
+ }
1131
+ & XOR<{
1132
+ license_key: string,
1133
+ }, {
1134
+ user: LicenseUser,
1135
+ }>
1136
+ & XOR<({
1137
+ is_floating: true,
1138
+ is_floating_cloud: boolean,
1139
+ floating_in_use_devices: number,
1140
+ } | {
1141
+ is_floating: boolean,
1142
+ is_floating_cloud: true,
1143
+ floating_in_use_devices: number,
1144
+ }) & {
1145
+ floating_users: number,
1146
+ },
1147
+ {
1148
+ is_floating_cloud: false,
1149
+ is_floating: false,
1150
+ }>
1151
+ & XOR<{
1152
+ is_trial: false,
1153
+ }, {
1154
+ is_trial: true,
1155
+ trial_days: number,
1156
+ }>
1157
+ & XOR<{
1158
+ license_type: 'consumption',
1159
+ max_consumptions: number,
1160
+ total_consumptions: number,
1161
+ allow_unlimited_consumptions: boolean,
1162
+ allow_overages: boolean,
1163
+ max_overages: number,
1164
+ reset_consumption: boolean,
1165
+ consumption_period: 'daily' | 'weekly' | 'monthly' | 'annually' | null,
1166
+ },
1167
+ {}
1168
+ >;
1169
+
1170
+ /**
1171
+ * @type {LicenseResponseOffline}
1172
+ *
1173
+ * The License object received as a response when activating a License using the Offline method.
1174
+ * This type is equal to LicenseResponse with the addition of the `license_signature_v2` property.
1175
+ */
1176
+ export type LicenseResponseOffline = LicenseResponse & {
1177
+ license_signature_v2: string,
1178
+ };
1179
+
1180
+ export type LicenseFilePayload = LicenseResponseOffline & {
1181
+ offline_signature: string,
1182
+ };
1183
+
1184
+ export type OfflineActivationRequest = {
1185
+ prefix?: string;
1186
+ os_ver?: string;
1187
+ sdk_build_version?: string;
1188
+ hostname?: string;
1189
+ ip?: string;
1190
+ external_ip?: string;
1191
+ app_ver?: string;
1192
+ mac_address?: string;
1193
+ };
1194
+
1195
+ export type DeviceVariable = {
1196
+ id: number,
1197
+ device_id: number,
1198
+ created_at: DateISO8601UTC,
1199
+ variable: string,
1200
+ value: string,
1201
+ };
1202
+
1203
+ type LicenseTrialExisting = {
1204
+ };
1205
+
1206
+ type LicenseTrialNewCommon = {
1207
+ license_key: string,
1208
+ id: number,
1209
+ order_id: number,
1210
+ product_id: number,
1211
+ max_license_users: number,
1212
+ max_activations: number,
1213
+ times_activated: number,
1214
+ is_trial: true,
1215
+ active: boolean,
1216
+ enabled: boolean,
1217
+ max_transfers: number,
1218
+ trial_days: number,
1219
+ maintenance_duration: TimeLength | null,
1220
+ validity_period: DateISO8601UTC | null,
1221
+ enable_maintenance_period: boolean,
1222
+ prevent_vm: boolean,
1223
+ is_hardware_key_auth: boolean,
1224
+ license_user: string,
1225
+ initial_password: string,
1226
+ metadata: JSON,
1227
+ created_at: number,
1228
+ updated_at: number,
1229
+ LicenseProductFeatures: LicenseProductFeature[],
1230
+ LicenseCustomFields: {
1231
+ product_custom_field_id: number,
1232
+ value: string
1233
+ }[],
1234
+ };
1235
+
1236
+ type LicenseTrialNew = LicenseTrialNewCommon
1237
+ & (XOR<
1238
+ {
1239
+ is_floating_cloud: true,
1240
+ floating_users: number,
1241
+ floating_timeout: number,
1242
+ },
1243
+ {}
1244
+ >)
1245
+ & (XOR<
1246
+ {
1247
+ license_type: 'consumption',
1248
+ allow_overages: boolean,
1249
+ max_overages: number,
1250
+ max_consumptions: number,
1251
+ valid_duration: null,
1252
+ consumption_period: 'daily' | 'weekly' | 'monthly' | 'annually' | null,
1253
+ reset_consumption: boolean,
1254
+ },
1255
+ XOR<
1256
+ {
1257
+ license_type: 'subscription',
1258
+ grace_period: number,
1259
+ allow_grace_period: boolean,
1260
+ },
1261
+ {
1262
+ license_type: 'perpetual' | 'time-limited',
1263
+ }
1264
+ >
1265
+ >
1266
+ );
1267
+
1268
+ export type LicenseTrialResponse = (LicenseTrialNew | LicenseTrialExisting) & {
1269
+ license_type: LicenseType,
1270
+ is_trial: boolean,
1271
+ /** Username */
1272
+ license_user: string,
1273
+ };
1274
+
1275
+ type CustomerLicenseUser = {
1276
+ email: string,
1277
+ is_active: boolean,
1278
+ first_name: string,
1279
+ last_name: string,
1280
+ phone_number: string,
1281
+ is_initial_password: boolean,
1282
+ initial_password: string,
1283
+ max_activations: number,
1284
+ total_activations: number,
1285
+ license_id: number,
1286
+ order_id: number,
1287
+ order_store_id: string,
1288
+ };
1289
+
1290
+ export type CustomerLicenseUsersResponse = {
1291
+ customer: {
1292
+ email: string | null,
1293
+ first_name: string | null,
1294
+ last_name: string | null,
1295
+ company_name: string | null,
1296
+ phone: string | null,
1297
+ reference: string | null,
1298
+ address: string | null,
1299
+ postcode: string | null,
1300
+ city: string | null,
1301
+ country: string | null,
1302
+ state: string | null,
1303
+ customer_account: null | {
1304
+ id: string,
1305
+ name: string,
1306
+ code: string,
1307
+ },
1308
+ metadata: JSON,
1309
+ },
1310
+ users: CustomerLicenseUser[]
1311
+ };
1312
+
1313
+ export type LicenseFeatureResponse = {
1314
+ id: number,
1315
+ code: string,
1316
+ name: string,
1317
+ floating_timeout: number | null,
1318
+ floating_users: number | null,
1319
+ feature_type: 'activation' | 'consumption'
1320
+ expiry_date: DateISO8601UTC | null,
1321
+ metadata: JSON,
1322
+ is_floating: boolean,
1323
+ is_floating_cloud: boolean,
1324
+ floating_in_use_devices: number,
1325
+ license_id: number,
1326
+ };
1327
+
1328
+ export type LicenseProductFeature = {
1329
+ id: number,
1330
+ product_feature_id: number,
1331
+ max_consumption: number,
1332
+ allow_overages: boolean,
1333
+ max_overages: number,
1334
+ reset_consumption: number,
1335
+ consumption_period: 'daily' | 'weekly' | 'monthly' | 'annually' | null,
1336
+ expiry_date: DateISO8601UTC | null,
1337
+ is_floating: boolean,
1338
+ is_floating_cloud: boolean,
1339
+ metadata: JSON,
1340
+ } & XOR<({ is_floating: true } | { is_floating_cloud: true }) & {
1341
+ floating_timeout: number,
1342
+ floating_users: number,
1343
+ },
1344
+ {}>;
1345
+
1346
+ export type LicenseConsumptionsResponse = {
1347
+ id: number,
1348
+ max_consumptions: number,
1349
+ total_consumptions: number,
1350
+ allow_unlimited_consumptions: boolean,
1351
+ allow_negative_consumptions: boolean,
1352
+ allow_overages: boolean,
1353
+ max_overages: number,
1354
+ reset_consumption: boolean,
1355
+ consumption_period: 'daily' | 'weekly' | 'monthly' | 'annually' | null,
1356
+ };
1357
+
1358
+ export type LicenseFeatureConsumptionResponse = {
1359
+ total_consumptions: number,
1360
+ is_floating: boolean,
1361
+ is_floating_cloud: boolean,
1362
+ floating_timeout: number,
1363
+ floating_users: number,
1364
+ };
1365
+
1366
+ export type ProductDetailsResponse = ProductDetails & {
1367
+ floating_timeout: number,
1368
+ max_overages: number,
1369
+ trial_days: number,
1370
+ allow_overages: boolean,
1371
+ allow_trial: boolean,
1372
+ prevent_vm: boolean,
1373
+ custom_fields: {
1374
+ id: number,
1375
+ name: string,
1376
+ default_value: string,
1377
+ }[],
1378
+ latest_version: null | (InstallationFileBase & {
1379
+ id: number,
1380
+ product_id: number,
1381
+ enabled: boolean,
1382
+ created_at: DateISO8601UTC,
1383
+ updated_at: DateISO8601UTC,
1384
+ full_link: string | null,
1385
+ filename: string | null,
1386
+ })
1387
+ };
1388
+
1389
+ export type LicenseBorrowResponse = {
1390
+ license_id: number,
1391
+ device_id: number,
1392
+ borrowed_until: DateInputString,
1393
+ max_borrow_time: number,
1394
+ };
1395
+
1396
+ type InstallationFileBase = {
1397
+ version: string | null,
1398
+ environment: string | null,
1399
+ hash_md5: string | null,
1400
+ eula_link: string | null,
1401
+ release_notes_link: string | null,
1402
+ size: string | null,
1403
+ requires_version: string | null,
1404
+ channel: string | null,
1405
+ release_date: DateISO8601UTC | null,
1406
+ };
1407
+
1408
+ export type InstallationFileResponse = InstallationFileBase & {
1409
+ installation_file: string | null
1410
+ };
1411
+
1412
+ export type VersionsResponse = {
1413
+ version: string,
1414
+ release_date: DateISO8601UTC,
1415
+ }[];
1416
+
1417
+ export type LicenseDataMethod = 'check_license'
1418
+ |'activate_license'
1419
+ |'activate_license_offline'
1420
+ |'activate_air_gap'
1421
+ |'update_license_offline'
1422
+ |'product_details'
1423
+ |'device_variables'
1424
+ |'normal'
1425
+ |'license_consumption'
1426
+ |'feature_consumption'
1427
+ |'register_feature'
1428
+ |'floating_server_register'
1429
+ ;
1430
+
1431
+ export enum HardwareIdAlgorithm {
1432
+ Default = 0,
1433
+ WindowsHardwareFingerprintId = 1,
1434
+ WindowsComputerSystemProductId = 2,
1435
+ WindowsCryptographyId = 3,
1436
+ LinuxMachineId = 4,
1437
+ CloudPlatformsId = 5,
1438
+ };
1439
+
1440
+ ```
1441
+
1442
+ ## License
1443
+
1444
+ * node.js SDK license: [LicenseSpring SDK Source Code License](LICENSE.md)
1445
+
1446
+ * Included 3rd-part library licenses: [https://docs.licensespring.com/sdk-licensing](https://docs.licensespring.com/sdk-licensing)