@licensespring/node-sdk 1.1.18 → 1.2.0

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.
Files changed (66) hide show
  1. package/License.key +1 -0
  2. package/dist/package.json +16 -9
  3. package/dist/src/abstract-manager.d.ts +42 -15
  4. package/dist/src/abstract-manager.js +248 -22
  5. package/dist/src/abstract-manager.js.map +1 -1
  6. package/dist/src/api.d.ts +25 -4978
  7. package/dist/src/api.js +1596 -4511
  8. package/dist/src/api.js.map +1 -1
  9. package/dist/src/bundle-file.d.ts +11 -0
  10. package/dist/src/bundle-file.js +110 -0
  11. package/dist/src/bundle-file.js.map +1 -0
  12. package/dist/src/bundle-manager.d.ts +17 -0
  13. package/dist/src/bundle-manager.js +252 -0
  14. package/dist/src/bundle-manager.js.map +1 -0
  15. package/dist/src/common.d.ts +1 -0
  16. package/dist/src/common.js +5 -1
  17. package/dist/src/common.js.map +1 -1
  18. package/dist/src/index.d.ts +2 -1
  19. package/dist/src/index.js +3 -1
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/license-data.d.ts +13 -7
  22. package/dist/src/license-data.js +66 -71
  23. package/dist/src/license-data.js.map +1 -1
  24. package/dist/src/license-file.d.ts +8 -19
  25. package/dist/src/license-file.js +38 -315
  26. package/dist/src/license-file.js.map +1 -1
  27. package/dist/src/license-manager.d.ts +23 -32
  28. package/dist/src/license-manager.js +213 -313
  29. package/dist/src/license-manager.js.map +1 -1
  30. package/dist/src/license.d.ts +16 -15
  31. package/dist/src/license.js +145 -142
  32. package/dist/src/license.js.map +1 -1
  33. package/dist/src/logger.d.ts +1 -0
  34. package/dist/src/logger.js +28 -5
  35. package/dist/src/logger.js.map +1 -1
  36. package/dist/src/offline-activation.d.ts +2 -1
  37. package/dist/src/offline-activation.js.map +1 -1
  38. package/dist/src/response-types.d.ts +489 -0
  39. package/dist/src/response-types.js +12 -0
  40. package/dist/src/response-types.js.map +1 -0
  41. package/dist/src/schema.d.ts +4 -2
  42. package/dist/src/schema.js +6 -2
  43. package/dist/src/schema.js.map +1 -1
  44. package/dist/src/storage-file.d.ts +24 -0
  45. package/dist/src/storage-file.js +354 -0
  46. package/dist/src/storage-file.js.map +1 -0
  47. package/dist/src/test/api-response-mock.d.ts +1435 -0
  48. package/dist/src/test/api-response-mock.js +1966 -0
  49. package/dist/src/test/api-response-mock.js.map +1 -0
  50. package/dist/src/test/api.test.d.ts +1 -0
  51. package/dist/src/test/api.test.js +228 -0
  52. package/dist/src/test/api.test.js.map +1 -0
  53. package/dist/src/test/bundle-manager.test.d.ts +0 -0
  54. package/dist/src/test/bundle-manager.test.js +15 -0
  55. package/dist/src/test/bundle-manager.test.js.map +1 -0
  56. package/dist/src/test/jest.setup.d.ts +1 -0
  57. package/dist/src/test/jest.setup.js +17 -0
  58. package/dist/src/test/jest.setup.js.map +1 -0
  59. package/dist/src/test/license-manager.test.d.ts +1 -0
  60. package/dist/src/test/license-manager.test.js +1011 -0
  61. package/dist/src/test/license-manager.test.js.map +1 -0
  62. package/dist/src/types.d.ts +35 -219
  63. package/dist/src/types.js.map +1 -1
  64. package/dist/src/watchdog.js +1 -1
  65. package/dist/src/watchdog.js.map +1 -1
  66. package/package.json +16 -9
@@ -0,0 +1,1011 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const license_manager_1 = __importDefault(require("../license-manager"));
39
+ const fs = __importStar(require("node:fs"));
40
+ const crypto = __importStar(require("node:crypto"));
41
+ let licenseManager;
42
+ describe('license-manager.ts', () => {
43
+ beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
44
+ licenseManager = new license_manager_1.default({
45
+ apiKey: 'API_KEY_MOCK',
46
+ sharedKey: 'SHARED_KEY_MOCK',
47
+ appName: 'test',
48
+ appVersion: '0.0.1',
49
+ apiPath: 'http://127.0.0.1:3333/api/v4/',
50
+ productCode: 'product',
51
+ filename: 'Test',
52
+ hardwareID: 'hwid',
53
+ fileKey: 'FILE_KEY',
54
+ });
55
+ if (fs.existsSync('Test.key')) {
56
+ fs.unlinkSync('Test.key');
57
+ }
58
+ }));
59
+ it('Should handle license check when license file doesn\'t exist', () => __awaiter(void 0, void 0, void 0, function* () {
60
+ const check = yield licenseManager.checkLicense({
61
+ 'license_key': 'KEY_MOCK_VALID',
62
+ });
63
+ expect(check).toEqual({
64
+ 'allow_grace_period': false,
65
+ 'allow_negative_consumptions': true,
66
+ 'allow_offline_activation': true,
67
+ 'allow_overages': false,
68
+ 'allow_unlimited_activations': false,
69
+ 'allow_unlimited_consumptions': true,
70
+ 'borrowed_until': null,
71
+ 'can_borrow': false,
72
+ 'channel': '',
73
+ 'company': {
74
+ 'id': 276
75
+ },
76
+ 'consumption_period': null,
77
+ 'custom_fields': [
78
+ {
79
+ 'data_type': null,
80
+ 'name': 'a',
81
+ 'value': 'a'
82
+ }
83
+ ],
84
+ 'customer': {
85
+ 'address': '',
86
+ 'city': '',
87
+ 'company_name': 'This',
88
+ 'country': '',
89
+ 'customer_account': null,
90
+ 'email': 'b@b.com',
91
+ 'first_name': '',
92
+ 'last_name': '',
93
+ 'metadata': {},
94
+ 'phone': '',
95
+ 'postcode': '',
96
+ 'reference': '',
97
+ 'state': ''
98
+ },
99
+ 'device_id': 1749551075232009,
100
+ 'enable_maintenance_period': false,
101
+ 'environment': 'mac',
102
+ 'eula_link': '',
103
+ 'floating_timeout': 120,
104
+ 'grace_period': 0,
105
+ 'hash_md5': '',
106
+ 'id': 1749538876210079,
107
+ 'installation_file': '',
108
+ 'is_air_gapped': false,
109
+ 'is_borrowed': false,
110
+ 'is_expired': false,
111
+ 'is_floating': false,
112
+ 'is_floating_cloud': false,
113
+ 'is_hardware_key_auth': false,
114
+ 'is_trial': false,
115
+ 'license_active': true,
116
+ 'license_enabled': true,
117
+ 'license_key': 'KEY_MOCK_VALID',
118
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
119
+ 'license_template_id': null,
120
+ 'license_type': 'consumption',
121
+ 'maintenance_period': null,
122
+ 'max_activations': 1,
123
+ 'max_borrow_time': 0,
124
+ 'max_consumptions': 1,
125
+ 'max_license_users': 1,
126
+ 'max_overages': 0,
127
+ 'max_transfers': 0,
128
+ 'metadata': {},
129
+ 'order_store_id': 'sfsafsa',
130
+ 'prevent_vm': false,
131
+ 'product_details': {
132
+ 'authorization_method': 'license-key',
133
+ 'metadata': {},
134
+ 'product_id': 1584723961091040,
135
+ 'product_name': 'product',
136
+ 'short_code': 'product'
137
+ },
138
+ 'product_features': [
139
+ {
140
+ 'allow_negative_consumptions': true,
141
+ 'allow_overages': false,
142
+ 'allow_unlimited_consumptions': true,
143
+ 'code': 'd',
144
+ 'consumption_period': 'daily',
145
+ 'expiry_date': null,
146
+ 'feature_type': 'consumption',
147
+ 'id': 1749538876119069,
148
+ 'is_floating': false,
149
+ 'is_floating_cloud': false,
150
+ 'max_consumption': 1,
151
+ 'max_overages': 0,
152
+ 'metadata': {},
153
+ 'name': 'd',
154
+ 'reset_consumption': false,
155
+ 'total_consumptions': 0
156
+ },
157
+ {
158
+ 'code': 'b',
159
+ 'expiry_date': null,
160
+ 'feature_type': 'activation',
161
+ 'id': 1749538876113049,
162
+ 'is_floating': false,
163
+ 'is_floating_cloud': false,
164
+ 'metadata': {},
165
+ 'name': 'b'
166
+ }
167
+ ],
168
+ 'release_date': '2025-10-03T00:00:00.000Z',
169
+ 'release_notes_link': '',
170
+ 'requires_version': null,
171
+ 'reset_consumption': false,
172
+ 'size': null,
173
+ 'start_date': null,
174
+ 'times_activated': 1,
175
+ 'total_consumptions': 0,
176
+ 'transfer_count': 0,
177
+ 'validity_period': null,
178
+ 'version': '2.0'
179
+ });
180
+ const file = fs.readFileSync('Test.key').toString();
181
+ const decryptedFile = decrypt('FILE_KEY', file);
182
+ expect(decryptedFile).toEqual(expect.any(String));
183
+ const parsedPayload = JSON.parse(decryptedFile);
184
+ expect(parsedPayload).toEqual({
185
+ 'product': {
186
+ 'allow_grace_period': false,
187
+ 'allow_negative_consumptions': true,
188
+ 'allow_offline_activation': true,
189
+ 'allow_overages': false,
190
+ 'allow_unlimited_activations': false,
191
+ 'allow_unlimited_consumptions': true,
192
+ 'borrowed_until': null,
193
+ 'can_borrow': false,
194
+ 'channel': '',
195
+ 'company': {
196
+ 'id': 276
197
+ },
198
+ 'consumption_period': null,
199
+ 'custom_fields': [
200
+ {
201
+ 'data_type': null,
202
+ 'name': 'a',
203
+ 'value': 'a'
204
+ }
205
+ ],
206
+ 'customer': {
207
+ 'address': '',
208
+ 'city': '',
209
+ 'company_name': 'This',
210
+ 'country': '',
211
+ 'customer_account': null,
212
+ 'email': 'b@b.com',
213
+ 'first_name': '',
214
+ 'last_name': '',
215
+ 'metadata': {},
216
+ 'phone': '',
217
+ 'postcode': '',
218
+ 'reference': '',
219
+ 'state': ''
220
+ },
221
+ 'device_id': 1749551075232009,
222
+ 'enable_maintenance_period': false,
223
+ 'environment': 'mac',
224
+ 'eula_link': '',
225
+ 'features': {
226
+ 'b': {
227
+ 'code': 'b',
228
+ 'feature_type': 'activation',
229
+ 'local_consumption': 0
230
+ },
231
+ 'd': {
232
+ 'code': 'd',
233
+ 'feature_type': 'consumption',
234
+ 'local_consumption': 0
235
+ }
236
+ },
237
+ 'floating_period': expect.stringMatching(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/),
238
+ 'floating_timeout': 120,
239
+ 'grace_period': 24,
240
+ 'hardware_id': 'hwid',
241
+ 'hash_md5': '',
242
+ 'id': 1749538876210079,
243
+ 'installation_file': '',
244
+ 'is_air_gapped': false,
245
+ 'is_borrowed': false,
246
+ 'is_expired': false,
247
+ 'is_floating': false,
248
+ 'is_floating_cloud': false,
249
+ 'is_hardware_key_auth': false,
250
+ 'is_trial': false,
251
+ 'last_check': expect.stringMatching(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/),
252
+ 'license_active': true,
253
+ 'license_enabled': true,
254
+ 'license_key': 'KEY_MOCK_VALID',
255
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
256
+ 'license_template_id': null,
257
+ 'license_type': 'consumption',
258
+ 'maintenance_period': null,
259
+ 'max_activations': 1,
260
+ 'max_borrow_time': 0,
261
+ 'max_consumptions': 1,
262
+ 'max_license_users': 1,
263
+ 'max_overages': 0,
264
+ 'max_transfers': 0,
265
+ 'metadata': {},
266
+ 'order_store_id': 'sfsafsa',
267
+ 'prevent_vm': false,
268
+ 'product': 'product',
269
+ 'product_details': {
270
+ 'authorization_method': 'license-key',
271
+ 'metadata': {},
272
+ 'product_id': 1584723961091040,
273
+ 'product_name': 'product',
274
+ 'short_code': 'product'
275
+ },
276
+ 'product_features': [
277
+ {
278
+ 'allow_negative_consumptions': true,
279
+ 'allow_overages': false,
280
+ 'allow_unlimited_consumptions': true,
281
+ 'code': 'd',
282
+ 'consumption_period': 'daily',
283
+ 'expiry_date': null,
284
+ 'feature_type': 'consumption',
285
+ 'id': 1749538876119069,
286
+ 'is_floating': false,
287
+ 'is_floating_cloud': false,
288
+ 'max_consumption': 1,
289
+ 'max_overages': 0,
290
+ 'metadata': {},
291
+ 'name': 'd',
292
+ 'reset_consumption': false,
293
+ 'total_consumptions': 0
294
+ },
295
+ {
296
+ 'code': 'b',
297
+ 'expiry_date': null,
298
+ 'feature_type': 'activation',
299
+ 'id': 1749538876113049,
300
+ 'is_floating': false,
301
+ 'is_floating_cloud': false,
302
+ 'metadata': {},
303
+ 'name': 'b'
304
+ }
305
+ ],
306
+ 'release_date': '2025-10-03T00:00:00.000Z',
307
+ 'release_notes_link': '',
308
+ 'requires_version': null,
309
+ 'reset_consumption': false,
310
+ 'size': null,
311
+ 'start_date': null,
312
+ 'times_activated': 1,
313
+ 'total_consumptions': 0,
314
+ 'transfer_count': 0,
315
+ 'validity_period': null,
316
+ 'variables': [],
317
+ 'version': '2.0'
318
+ }
319
+ });
320
+ }));
321
+ it('Should handle license check when license file exists', () => __awaiter(void 0, void 0, void 0, function* () {
322
+ const mockedFilePayload = {
323
+ 'product1': { 'foo': 'bar' },
324
+ 'product2': { 'foo': 'baz' },
325
+ };
326
+ fs.writeFileSync('Test.key', encrypt('FILE_KEY', JSON.stringify(mockedFilePayload)));
327
+ const check = yield licenseManager.checkLicense({
328
+ 'license_key': 'KEY_MOCK_VALID',
329
+ });
330
+ expect(check).toEqual({
331
+ 'allow_grace_period': false,
332
+ 'allow_negative_consumptions': true,
333
+ 'allow_offline_activation': true,
334
+ 'allow_overages': false,
335
+ 'allow_unlimited_activations': false,
336
+ 'allow_unlimited_consumptions': true,
337
+ 'borrowed_until': null,
338
+ 'can_borrow': false,
339
+ 'channel': '',
340
+ 'company': {
341
+ 'id': 276
342
+ },
343
+ 'consumption_period': null,
344
+ 'custom_fields': [
345
+ {
346
+ 'data_type': null,
347
+ 'name': 'a',
348
+ 'value': 'a'
349
+ }
350
+ ],
351
+ 'customer': {
352
+ 'address': '',
353
+ 'city': '',
354
+ 'company_name': 'This',
355
+ 'country': '',
356
+ 'customer_account': null,
357
+ 'email': 'b@b.com',
358
+ 'first_name': '',
359
+ 'last_name': '',
360
+ 'metadata': {},
361
+ 'phone': '',
362
+ 'postcode': '',
363
+ 'reference': '',
364
+ 'state': ''
365
+ },
366
+ 'device_id': 1749551075232009,
367
+ 'enable_maintenance_period': false,
368
+ 'environment': 'mac',
369
+ 'eula_link': '',
370
+ 'floating_timeout': 120,
371
+ 'grace_period': 0,
372
+ 'hash_md5': '',
373
+ 'id': 1749538876210079,
374
+ 'installation_file': '',
375
+ 'is_air_gapped': false,
376
+ 'is_borrowed': false,
377
+ 'is_expired': false,
378
+ 'is_floating': false,
379
+ 'is_floating_cloud': false,
380
+ 'is_hardware_key_auth': false,
381
+ 'is_trial': false,
382
+ 'license_active': true,
383
+ 'license_enabled': true,
384
+ 'license_key': 'KEY_MOCK_VALID',
385
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
386
+ 'license_template_id': null,
387
+ 'license_type': 'consumption',
388
+ 'maintenance_period': null,
389
+ 'max_activations': 1,
390
+ 'max_borrow_time': 0,
391
+ 'max_consumptions': 1,
392
+ 'max_license_users': 1,
393
+ 'max_overages': 0,
394
+ 'max_transfers': 0,
395
+ 'metadata': {},
396
+ 'order_store_id': 'sfsafsa',
397
+ 'prevent_vm': false,
398
+ 'product_details': {
399
+ 'authorization_method': 'license-key',
400
+ 'metadata': {},
401
+ 'product_id': 1584723961091040,
402
+ 'product_name': 'product',
403
+ 'short_code': 'product'
404
+ },
405
+ 'product_features': [
406
+ {
407
+ 'allow_negative_consumptions': true,
408
+ 'allow_overages': false,
409
+ 'allow_unlimited_consumptions': true,
410
+ 'code': 'd',
411
+ 'consumption_period': 'daily',
412
+ 'expiry_date': null,
413
+ 'feature_type': 'consumption',
414
+ 'id': 1749538876119069,
415
+ 'is_floating': false,
416
+ 'is_floating_cloud': false,
417
+ 'max_consumption': 1,
418
+ 'max_overages': 0,
419
+ 'metadata': {},
420
+ 'name': 'd',
421
+ 'reset_consumption': false,
422
+ 'total_consumptions': 0
423
+ },
424
+ {
425
+ 'code': 'b',
426
+ 'expiry_date': null,
427
+ 'feature_type': 'activation',
428
+ 'id': 1749538876113049,
429
+ 'is_floating': false,
430
+ 'is_floating_cloud': false,
431
+ 'metadata': {},
432
+ 'name': 'b'
433
+ }
434
+ ],
435
+ 'release_date': '2025-10-03T00:00:00.000Z',
436
+ 'release_notes_link': '',
437
+ 'requires_version': null,
438
+ 'reset_consumption': false,
439
+ 'size': null,
440
+ 'start_date': null,
441
+ 'times_activated': 1,
442
+ 'total_consumptions': 0,
443
+ 'transfer_count': 0,
444
+ 'validity_period': null,
445
+ 'version': '2.0'
446
+ });
447
+ const file = fs.readFileSync('Test.key').toString();
448
+ const decryptedFile = decrypt('FILE_KEY', file);
449
+ expect(decryptedFile).toEqual(expect.any(String));
450
+ const parsedPayload = JSON.parse(decryptedFile);
451
+ expect(parsedPayload).toEqual({
452
+ 'product1': { 'foo': 'bar' },
453
+ 'product2': { 'foo': 'baz' },
454
+ 'product': {
455
+ 'allow_grace_period': false,
456
+ 'allow_negative_consumptions': true,
457
+ 'allow_offline_activation': true,
458
+ 'allow_overages': false,
459
+ 'allow_unlimited_activations': false,
460
+ 'allow_unlimited_consumptions': true,
461
+ 'borrowed_until': null,
462
+ 'can_borrow': false,
463
+ 'channel': '',
464
+ 'company': {
465
+ 'id': 276
466
+ },
467
+ 'consumption_period': null,
468
+ 'custom_fields': [
469
+ {
470
+ 'data_type': null,
471
+ 'name': 'a',
472
+ 'value': 'a'
473
+ }
474
+ ],
475
+ 'customer': {
476
+ 'address': '',
477
+ 'city': '',
478
+ 'company_name': 'This',
479
+ 'country': '',
480
+ 'customer_account': null,
481
+ 'email': 'b@b.com',
482
+ 'first_name': '',
483
+ 'last_name': '',
484
+ 'metadata': {},
485
+ 'phone': '',
486
+ 'postcode': '',
487
+ 'reference': '',
488
+ 'state': ''
489
+ },
490
+ 'device_id': 1749551075232009,
491
+ 'enable_maintenance_period': false,
492
+ 'environment': 'mac',
493
+ 'eula_link': '',
494
+ 'features': {
495
+ 'b': {
496
+ 'code': 'b',
497
+ 'feature_type': 'activation',
498
+ 'local_consumption': 0
499
+ },
500
+ 'd': {
501
+ 'code': 'd',
502
+ 'feature_type': 'consumption',
503
+ 'local_consumption': 0
504
+ }
505
+ },
506
+ 'floating_period': expect.stringMatching(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/),
507
+ 'floating_timeout': 120,
508
+ 'grace_period': 24,
509
+ 'hardware_id': 'hwid',
510
+ 'hash_md5': '',
511
+ 'id': 1749538876210079,
512
+ 'installation_file': '',
513
+ 'is_air_gapped': false,
514
+ 'is_borrowed': false,
515
+ 'is_expired': false,
516
+ 'is_floating': false,
517
+ 'is_floating_cloud': false,
518
+ 'is_hardware_key_auth': false,
519
+ 'is_trial': false,
520
+ 'last_check': expect.stringMatching(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/),
521
+ 'license_active': true,
522
+ 'license_enabled': true,
523
+ 'license_key': 'KEY_MOCK_VALID',
524
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
525
+ 'license_template_id': null,
526
+ 'license_type': 'consumption',
527
+ 'maintenance_period': null,
528
+ 'max_activations': 1,
529
+ 'max_borrow_time': 0,
530
+ 'max_consumptions': 1,
531
+ 'max_license_users': 1,
532
+ 'max_overages': 0,
533
+ 'max_transfers': 0,
534
+ 'metadata': {},
535
+ 'order_store_id': 'sfsafsa',
536
+ 'prevent_vm': false,
537
+ 'product': 'product',
538
+ 'product_details': {
539
+ 'authorization_method': 'license-key',
540
+ 'metadata': {},
541
+ 'product_id': 1584723961091040,
542
+ 'product_name': 'product',
543
+ 'short_code': 'product'
544
+ },
545
+ 'product_features': [
546
+ {
547
+ 'allow_negative_consumptions': true,
548
+ 'allow_overages': false,
549
+ 'allow_unlimited_consumptions': true,
550
+ 'code': 'd',
551
+ 'consumption_period': 'daily',
552
+ 'expiry_date': null,
553
+ 'feature_type': 'consumption',
554
+ 'id': 1749538876119069,
555
+ 'is_floating': false,
556
+ 'is_floating_cloud': false,
557
+ 'max_consumption': 1,
558
+ 'max_overages': 0,
559
+ 'metadata': {},
560
+ 'name': 'd',
561
+ 'reset_consumption': false,
562
+ 'total_consumptions': 0
563
+ },
564
+ {
565
+ 'code': 'b',
566
+ 'expiry_date': null,
567
+ 'feature_type': 'activation',
568
+ 'id': 1749538876113049,
569
+ 'is_floating': false,
570
+ 'is_floating_cloud': false,
571
+ 'metadata': {},
572
+ 'name': 'b'
573
+ }
574
+ ],
575
+ 'release_date': '2025-10-03T00:00:00.000Z',
576
+ 'release_notes_link': '',
577
+ 'requires_version': null,
578
+ 'reset_consumption': false,
579
+ 'size': null,
580
+ 'start_date': null,
581
+ 'times_activated': 1,
582
+ 'total_consumptions': 0,
583
+ 'transfer_count': 0,
584
+ 'validity_period': null,
585
+ 'variables': [],
586
+ 'version': '2.0'
587
+ }
588
+ });
589
+ }));
590
+ it('Should handle license check when legacy license file exists', () => __awaiter(void 0, void 0, void 0, function* () {
591
+ const mockedFilePayload = {
592
+ 'allow_grace_period': false,
593
+ 'allow_negative_consumptions': true,
594
+ 'allow_offline_activation': true,
595
+ 'allow_overages': false,
596
+ 'allow_unlimited_activations': false,
597
+ 'allow_unlimited_consumptions': true,
598
+ 'borrowed_until': null,
599
+ 'can_borrow': false,
600
+ 'channel': '',
601
+ 'company': {
602
+ 'id': 276
603
+ },
604
+ 'consumption_period': null,
605
+ 'custom_fields': [
606
+ {
607
+ 'data_type': null,
608
+ 'name': 'a',
609
+ 'value': 'a'
610
+ }
611
+ ],
612
+ 'customer': {
613
+ 'address': '',
614
+ 'city': '',
615
+ 'company_name': 'This',
616
+ 'country': '',
617
+ 'customer_account': null,
618
+ 'email': 'b@b.com',
619
+ 'first_name': '',
620
+ 'last_name': '',
621
+ 'metadata': {},
622
+ 'phone': '',
623
+ 'postcode': '',
624
+ 'reference': '',
625
+ 'state': ''
626
+ },
627
+ 'device_id': 1749551075232009,
628
+ 'enable_maintenance_period': false,
629
+ 'environment': 'mac',
630
+ 'eula_link': '',
631
+ 'features': {
632
+ 'b': {
633
+ 'code': 'b',
634
+ 'feature_type': 'activation',
635
+ 'local_consumption': 0
636
+ },
637
+ 'd': {
638
+ 'code': 'd',
639
+ 'feature_type': 'consumption',
640
+ 'local_consumption': 0
641
+ }
642
+ },
643
+ 'floating_period': '2025-10-03T00:00:00.000Z',
644
+ 'floating_timeout': 120,
645
+ 'grace_period': 24,
646
+ 'hardware_id': 'hwid',
647
+ 'hash_md5': '',
648
+ 'id': 1749538876210079,
649
+ 'installation_file': '',
650
+ 'is_air_gapped': false,
651
+ 'is_borrowed': false,
652
+ 'is_expired': false,
653
+ 'is_floating': false,
654
+ 'is_floating_cloud': false,
655
+ 'is_hardware_key_auth': false,
656
+ 'is_trial': false,
657
+ 'last_check': '2025-10-03T00:00:00.000Z',
658
+ 'license_active': true,
659
+ 'license_enabled': true,
660
+ 'license_key': 'KEY_MOCK_VALID',
661
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
662
+ 'license_template_id': null,
663
+ 'license_type': 'consumption',
664
+ 'maintenance_period': null,
665
+ 'max_activations': 1,
666
+ 'max_borrow_time': 0,
667
+ 'max_consumptions': 1,
668
+ 'max_license_users': 1,
669
+ 'max_overages': 0,
670
+ 'max_transfers': 0,
671
+ 'metadata': {},
672
+ 'order_store_id': 'sfsafsa',
673
+ 'prevent_vm': false,
674
+ 'product': 'product2',
675
+ 'product_details': {
676
+ 'authorization_method': 'license-key',
677
+ 'metadata': {},
678
+ 'product_id': 1584723961091040,
679
+ 'product_name': 'product2',
680
+ 'short_code': 'product2'
681
+ },
682
+ 'product_features': [
683
+ {
684
+ 'allow_negative_consumptions': true,
685
+ 'allow_overages': false,
686
+ 'allow_unlimited_consumptions': true,
687
+ 'code': 'd',
688
+ 'consumption_period': 'daily',
689
+ 'expiry_date': null,
690
+ 'feature_type': 'consumption',
691
+ 'id': 1749538876119069,
692
+ 'is_floating': false,
693
+ 'is_floating_cloud': false,
694
+ 'max_consumption': 1,
695
+ 'max_overages': 0,
696
+ 'metadata': {},
697
+ 'name': 'd',
698
+ 'reset_consumption': false,
699
+ 'total_consumptions': 0
700
+ },
701
+ {
702
+ 'code': 'b',
703
+ 'expiry_date': null,
704
+ 'feature_type': 'activation',
705
+ 'id': 1749538876113049,
706
+ 'is_floating': false,
707
+ 'is_floating_cloud': false,
708
+ 'metadata': {},
709
+ 'name': 'b'
710
+ }
711
+ ],
712
+ 'release_date': '2025-10-03T00:00:00.000Z',
713
+ 'release_notes_link': '',
714
+ 'requires_version': null,
715
+ 'reset_consumption': false,
716
+ 'size': null,
717
+ 'start_date': null,
718
+ 'times_activated': 1,
719
+ 'total_consumptions': 0,
720
+ 'transfer_count': 0,
721
+ 'validity_period': null,
722
+ 'variables': [],
723
+ 'version': '2.0'
724
+ };
725
+ fs.writeFileSync('Test.key', encrypt('FILE_KEY', JSON.stringify(mockedFilePayload)));
726
+ const check = yield licenseManager.checkLicense({
727
+ 'license_key': 'KEY_MOCK_VALID',
728
+ });
729
+ expect(check).toEqual({
730
+ 'allow_grace_period': false,
731
+ 'allow_negative_consumptions': true,
732
+ 'allow_offline_activation': true,
733
+ 'allow_overages': false,
734
+ 'allow_unlimited_activations': false,
735
+ 'allow_unlimited_consumptions': true,
736
+ 'borrowed_until': null,
737
+ 'can_borrow': false,
738
+ 'channel': '',
739
+ 'company': {
740
+ 'id': 276
741
+ },
742
+ 'consumption_period': null,
743
+ 'custom_fields': [
744
+ {
745
+ 'data_type': null,
746
+ 'name': 'a',
747
+ 'value': 'a'
748
+ }
749
+ ],
750
+ 'customer': {
751
+ 'address': '',
752
+ 'city': '',
753
+ 'company_name': 'This',
754
+ 'country': '',
755
+ 'customer_account': null,
756
+ 'email': 'b@b.com',
757
+ 'first_name': '',
758
+ 'last_name': '',
759
+ 'metadata': {},
760
+ 'phone': '',
761
+ 'postcode': '',
762
+ 'reference': '',
763
+ 'state': ''
764
+ },
765
+ 'device_id': 1749551075232009,
766
+ 'enable_maintenance_period': false,
767
+ 'environment': 'mac',
768
+ 'eula_link': '',
769
+ 'floating_timeout': 120,
770
+ 'grace_period': 0,
771
+ 'hash_md5': '',
772
+ 'id': 1749538876210079,
773
+ 'installation_file': '',
774
+ 'is_air_gapped': false,
775
+ 'is_borrowed': false,
776
+ 'is_expired': false,
777
+ 'is_floating': false,
778
+ 'is_floating_cloud': false,
779
+ 'is_hardware_key_auth': false,
780
+ 'is_trial': false,
781
+ 'license_active': true,
782
+ 'license_enabled': true,
783
+ 'license_key': 'KEY_MOCK_VALID',
784
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
785
+ 'license_template_id': null,
786
+ 'license_type': 'consumption',
787
+ 'maintenance_period': null,
788
+ 'max_activations': 1,
789
+ 'max_borrow_time': 0,
790
+ 'max_consumptions': 1,
791
+ 'max_license_users': 1,
792
+ 'max_overages': 0,
793
+ 'max_transfers': 0,
794
+ 'metadata': {},
795
+ 'order_store_id': 'sfsafsa',
796
+ 'prevent_vm': false,
797
+ 'product_details': {
798
+ 'authorization_method': 'license-key',
799
+ 'metadata': {},
800
+ 'product_id': 1584723961091040,
801
+ 'product_name': 'product',
802
+ 'short_code': 'product'
803
+ },
804
+ 'product_features': [
805
+ {
806
+ 'allow_negative_consumptions': true,
807
+ 'allow_overages': false,
808
+ 'allow_unlimited_consumptions': true,
809
+ 'code': 'd',
810
+ 'consumption_period': 'daily',
811
+ 'expiry_date': null,
812
+ 'feature_type': 'consumption',
813
+ 'id': 1749538876119069,
814
+ 'is_floating': false,
815
+ 'is_floating_cloud': false,
816
+ 'max_consumption': 1,
817
+ 'max_overages': 0,
818
+ 'metadata': {},
819
+ 'name': 'd',
820
+ 'reset_consumption': false,
821
+ 'total_consumptions': 0
822
+ },
823
+ {
824
+ 'code': 'b',
825
+ 'expiry_date': null,
826
+ 'feature_type': 'activation',
827
+ 'id': 1749538876113049,
828
+ 'is_floating': false,
829
+ 'is_floating_cloud': false,
830
+ 'metadata': {},
831
+ 'name': 'b'
832
+ }
833
+ ],
834
+ 'release_date': '2025-10-03T00:00:00.000Z',
835
+ 'release_notes_link': '',
836
+ 'requires_version': null,
837
+ 'reset_consumption': false,
838
+ 'size': null,
839
+ 'start_date': null,
840
+ 'times_activated': 1,
841
+ 'total_consumptions': 0,
842
+ 'transfer_count': 0,
843
+ 'validity_period': null,
844
+ 'version': '2.0'
845
+ });
846
+ const file = fs.readFileSync('Test.key').toString();
847
+ const decryptedFile = decrypt('FILE_KEY', file);
848
+ expect(decryptedFile).toEqual(expect.any(String));
849
+ const parsedPayload = JSON.parse(decryptedFile);
850
+ expect(parsedPayload).toEqual({
851
+ 'product2': mockedFilePayload,
852
+ 'product': {
853
+ 'allow_grace_period': false,
854
+ 'allow_negative_consumptions': true,
855
+ 'allow_offline_activation': true,
856
+ 'allow_overages': false,
857
+ 'allow_unlimited_activations': false,
858
+ 'allow_unlimited_consumptions': true,
859
+ 'borrowed_until': null,
860
+ 'can_borrow': false,
861
+ 'channel': '',
862
+ 'company': {
863
+ 'id': 276
864
+ },
865
+ 'consumption_period': null,
866
+ 'custom_fields': [
867
+ {
868
+ 'data_type': null,
869
+ 'name': 'a',
870
+ 'value': 'a'
871
+ }
872
+ ],
873
+ 'customer': {
874
+ 'address': '',
875
+ 'city': '',
876
+ 'company_name': 'This',
877
+ 'country': '',
878
+ 'customer_account': null,
879
+ 'email': 'b@b.com',
880
+ 'first_name': '',
881
+ 'last_name': '',
882
+ 'metadata': {},
883
+ 'phone': '',
884
+ 'postcode': '',
885
+ 'reference': '',
886
+ 'state': ''
887
+ },
888
+ 'device_id': 1749551075232009,
889
+ 'enable_maintenance_period': false,
890
+ 'environment': 'mac',
891
+ 'eula_link': '',
892
+ 'features': {
893
+ 'b': {
894
+ 'code': 'b',
895
+ 'feature_type': 'activation',
896
+ 'local_consumption': 0
897
+ },
898
+ 'd': {
899
+ 'code': 'd',
900
+ 'feature_type': 'consumption',
901
+ 'local_consumption': 0
902
+ }
903
+ },
904
+ 'floating_period': expect.stringMatching(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/),
905
+ 'floating_timeout': 120,
906
+ 'grace_period': 24,
907
+ 'hardware_id': 'hwid',
908
+ 'hash_md5': '',
909
+ 'id': 1749538876210079,
910
+ 'installation_file': '',
911
+ 'is_air_gapped': false,
912
+ 'is_borrowed': false,
913
+ 'is_expired': false,
914
+ 'is_floating': false,
915
+ 'is_floating_cloud': false,
916
+ 'is_hardware_key_auth': false,
917
+ 'is_trial': false,
918
+ 'last_check': expect.stringMatching(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/),
919
+ 'license_active': true,
920
+ 'license_enabled': true,
921
+ 'license_key': 'KEY_MOCK_VALID',
922
+ 'license_signature': 'U66wPyHe52oIKv5RRIS25KdMoJcrNGSit0HJnhJ+ThiFC0dbgigyCohjTkWGbNPNchZ1nSTWX5a1VizxPVSrLMusC3/EwfijA95jUpyVoUIhEBhOD+aZgaiv0SSSOQMhbRN8GBHL5JSv5hQQPo+/DbBZ1GEA9e+hSooBjr3iWFyiCHuNpBHyTMJ5ymqLkNrW2zy/05cK4INvm3Yzgpye2c7GzYS8HSGlgGZAw1sanl7Z3c2aUXDSL9Jbhd/0tpAwEJzlCicy9mVuuCSK0lAaB5mkJR2GWVYGNBjRWgmv7F9PZC3JaWblkrK2U+k4O0B8iv0JcdVd+/Rb0Y1lB19a1OYxQ1M6K1DOgRfC8JF/QjSfyCcwQ1vJD1akYuYVdgi2sCeOkN2AGdOUBtXyNfde9zalqJW90R6DRl5+CP/yZ8ghqMUwX0Jg7ZPUkdHdC2x34bbzMyhX3DV9PqetrPuQPucDllJuAPwvqzk6h8Cs85ZXyU7ODkQo2hqRM1PlxHl8r9BLdjxRYOWYCVhbH7rGrM/TE0IzkES7sGhRbC6WTwINKw+ai6RGKV+E3/9VzbF3FA8jjfW7YUEu9tYcXt8BTK749kp9G6obIx/S3GkTeoScuzT4qO2Wq5UUBjkxgVm3UFUR4bjsdocVu4BD6G0FP78ZKn9pzvCgOtUXO4wNhuw=',
923
+ 'license_template_id': null,
924
+ 'license_type': 'consumption',
925
+ 'maintenance_period': null,
926
+ 'max_activations': 1,
927
+ 'max_borrow_time': 0,
928
+ 'max_consumptions': 1,
929
+ 'max_license_users': 1,
930
+ 'max_overages': 0,
931
+ 'max_transfers': 0,
932
+ 'metadata': {},
933
+ 'order_store_id': 'sfsafsa',
934
+ 'prevent_vm': false,
935
+ 'product': 'product',
936
+ 'product_details': {
937
+ 'authorization_method': 'license-key',
938
+ 'metadata': {},
939
+ 'product_id': 1584723961091040,
940
+ 'product_name': 'product',
941
+ 'short_code': 'product'
942
+ },
943
+ 'product_features': [
944
+ {
945
+ 'allow_negative_consumptions': true,
946
+ 'allow_overages': false,
947
+ 'allow_unlimited_consumptions': true,
948
+ 'code': 'd',
949
+ 'consumption_period': 'daily',
950
+ 'expiry_date': null,
951
+ 'feature_type': 'consumption',
952
+ 'id': 1749538876119069,
953
+ 'is_floating': false,
954
+ 'is_floating_cloud': false,
955
+ 'max_consumption': 1,
956
+ 'max_overages': 0,
957
+ 'metadata': {},
958
+ 'name': 'd',
959
+ 'reset_consumption': false,
960
+ 'total_consumptions': 0
961
+ },
962
+ {
963
+ 'code': 'b',
964
+ 'expiry_date': null,
965
+ 'feature_type': 'activation',
966
+ 'id': 1749538876113049,
967
+ 'is_floating': false,
968
+ 'is_floating_cloud': false,
969
+ 'metadata': {},
970
+ 'name': 'b'
971
+ }
972
+ ],
973
+ 'release_date': '2025-10-03T00:00:00.000Z',
974
+ 'release_notes_link': '',
975
+ 'requires_version': null,
976
+ 'reset_consumption': false,
977
+ 'size': null,
978
+ 'start_date': null,
979
+ 'times_activated': 1,
980
+ 'total_consumptions': 0,
981
+ 'transfer_count': 0,
982
+ 'validity_period': null,
983
+ 'variables': [],
984
+ 'version': '2.0'
985
+ }
986
+ });
987
+ }));
988
+ afterAll(() => __awaiter(void 0, void 0, void 0, function* () {
989
+ fs.unlinkSync('Test.key');
990
+ }));
991
+ });
992
+ function encrypt(fileKey, payload) {
993
+ const key = crypto.createHash('sha256').update(fileKey).digest('base64').slice(0, 32);
994
+ const iv = crypto.randomBytes(16);
995
+ const header = iv.toString('base64').slice(0, 24);
996
+ const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
997
+ let encrypted = cipher.update(payload, 'utf8', 'base64');
998
+ encrypted += cipher.final('base64');
999
+ return header + encrypted;
1000
+ }
1001
+ function decrypt(fileKey, encryptedPayload) {
1002
+ const key = crypto.createHash('sha256').update(fileKey).digest('base64').slice(0, 32);
1003
+ const ivBase64 = encryptedPayload.slice(0, 24);
1004
+ const encryptedBase64 = encryptedPayload.slice(24);
1005
+ const iv = Buffer.from(ivBase64, 'base64');
1006
+ const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
1007
+ let decrypted = decipher.update(encryptedBase64, 'base64', 'utf8');
1008
+ decrypted += decipher.final('utf8');
1009
+ return decrypted;
1010
+ }
1011
+ //# sourceMappingURL=license-manager.test.js.map