react-js-plugins 3.14.2 → 3.14.3
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/dist/chunkautils/chunkLicense.d.ts +11 -0
- package/dist/chunkautils/chunkLicense.js +98 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12 -2
- package/dist/licenseGenerator.d.ts +23 -0
- package/dist/licenseGenerator.js +73 -0
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const initLicense: (key: string) => {
|
|
2
|
+
success: boolean;
|
|
3
|
+
message: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const isLicensed: () => boolean;
|
|
6
|
+
export declare const getLicenseInfo: () => {
|
|
7
|
+
licensedTo: string;
|
|
8
|
+
expiresAt: string;
|
|
9
|
+
issuedAt: string;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare const _assertLicensed: () => void;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import CryptoJS from 'crypto-js';
|
|
2
|
+
// ── Obfuscated master secret ─────────────────────────────────────────────────
|
|
3
|
+
// Parts are hex-escaped so they are NOT plain-text searchable in the bundle.
|
|
4
|
+
// IMPORTANT: Change ALL six parts together when rotating your signing secret.
|
|
5
|
+
// Rotating invalidates every existing license key — issue new ones.
|
|
6
|
+
var _P1 = '\x37\x62\x64\x34\x65\x39\x61\x32'; // 7bd4e9a2
|
|
7
|
+
var _P2 = '\x66\x31\x63\x38\x61\x30\x35\x62'; // f1c8a05b
|
|
8
|
+
var _P3 = '\x32\x65\x37\x64\x39\x62\x34\x63'; // 2e7d9b4c
|
|
9
|
+
var _P4 = '\x61\x35\x66\x33\x63\x38\x65\x31'; // a5f3c8e1
|
|
10
|
+
var _P5 = '\x39\x30\x62\x32\x64\x35\x61\x38'; // 90b2d5a8
|
|
11
|
+
var _P6 = '\x63\x36\x65\x31\x66\x34\x39\x62'; // c6e1f49b
|
|
12
|
+
// Interleaved order + null-byte separator makes naive string search harder
|
|
13
|
+
var _ms = function () { return [_P1, _P3, _P5, _P2, _P6, _P4].join('\u0000'); };
|
|
14
|
+
// ── Salts (hex-escaped) ───────────────────────────────────────────────────────
|
|
15
|
+
// rjp_sig_v1
|
|
16
|
+
var _SS = '\x72\x6a\x70\x5f\x73\x69\x67\x5f\x76\x31';
|
|
17
|
+
// rjp_enc_v1
|
|
18
|
+
var _ES = '\x72\x6a\x70\x5f\x65\x6e\x63\x5f\x76\x31';
|
|
19
|
+
// ── Lazy-derived keys (computed once, cached) ─────────────────────────────────
|
|
20
|
+
var _cachedSK = null;
|
|
21
|
+
var _cachedEK = null;
|
|
22
|
+
var _SK = function () {
|
|
23
|
+
if (!_cachedSK)
|
|
24
|
+
_cachedSK = CryptoJS.PBKDF2(_ms(), _SS, { keySize: 8, iterations: 2048 }).toString();
|
|
25
|
+
return _cachedSK;
|
|
26
|
+
};
|
|
27
|
+
var _EK = function () {
|
|
28
|
+
if (!_cachedEK)
|
|
29
|
+
_cachedEK = CryptoJS.PBKDF2(_ms(), _ES, { keySize: 8, iterations: 2048 }).toString();
|
|
30
|
+
return _cachedEK;
|
|
31
|
+
};
|
|
32
|
+
// ── Runtime state ─────────────────────────────────────────────────────────────
|
|
33
|
+
var _active = false;
|
|
34
|
+
var _info = null;
|
|
35
|
+
// ── Timing-safe comparison (prevents timing-oracle attacks) ───────────────────
|
|
36
|
+
var _tsEq = function (a, b) {
|
|
37
|
+
if (a.length !== b.length)
|
|
38
|
+
return false;
|
|
39
|
+
var d = 0;
|
|
40
|
+
for (var i = 0; i < a.length; i++)
|
|
41
|
+
d |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
42
|
+
return d === 0;
|
|
43
|
+
};
|
|
44
|
+
// ── Public: activate ──────────────────────────────────────────────────────────
|
|
45
|
+
export var initLicense = function (key) {
|
|
46
|
+
try {
|
|
47
|
+
if (!key || typeof key !== 'string')
|
|
48
|
+
return { success: false, message: 'A license key is required.' };
|
|
49
|
+
var trimmed = key.trim();
|
|
50
|
+
var dot = trimmed.lastIndexOf('.');
|
|
51
|
+
if (dot < 1)
|
|
52
|
+
return { success: false, message: 'Invalid license key format.' };
|
|
53
|
+
var encPayload = trimmed.slice(0, dot);
|
|
54
|
+
var sig = trimmed.slice(dot + 1);
|
|
55
|
+
// ① Verify HMAC-SHA256 signature — prevents forgery & tampering
|
|
56
|
+
var expected = CryptoJS.HmacSHA256(encPayload, _SK()).toString();
|
|
57
|
+
if (!_tsEq(expected, sig))
|
|
58
|
+
return { success: false, message: 'Invalid license key.' };
|
|
59
|
+
// ② Decrypt AES-256 payload
|
|
60
|
+
var raw = CryptoJS.AES.decrypt(encPayload, _EK()).toString(CryptoJS.enc.Utf8);
|
|
61
|
+
if (!raw)
|
|
62
|
+
return { success: false, message: 'Invalid license key.' };
|
|
63
|
+
var payload = JSON.parse(raw);
|
|
64
|
+
// ③ Schema version
|
|
65
|
+
if (payload.v !== 1)
|
|
66
|
+
return { success: false, message: 'Unsupported license version.' };
|
|
67
|
+
// ④ Expiry
|
|
68
|
+
if (Date.now() > payload.exp) {
|
|
69
|
+
var d = new Date(payload.exp).toLocaleDateString();
|
|
70
|
+
return { success: false, message: "License expired on ".concat(d, ". Please renew.") };
|
|
71
|
+
}
|
|
72
|
+
_active = true;
|
|
73
|
+
_info = payload;
|
|
74
|
+
return { success: true, message: "License activated for: ".concat(payload.uid) };
|
|
75
|
+
}
|
|
76
|
+
catch (_a) {
|
|
77
|
+
return { success: false, message: 'Invalid license key.' };
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// ── Public: query ─────────────────────────────────────────────────────────────
|
|
81
|
+
export var isLicensed = function () { return _active; };
|
|
82
|
+
export var getLicenseInfo = function () {
|
|
83
|
+
return _info
|
|
84
|
+
? {
|
|
85
|
+
licensedTo: _info.uid,
|
|
86
|
+
expiresAt: new Date(_info.exp).toISOString(),
|
|
87
|
+
issuedAt: new Date(_info.iat).toISOString(),
|
|
88
|
+
}
|
|
89
|
+
: null;
|
|
90
|
+
};
|
|
91
|
+
// ── Internal guard (used by every export) ─────────────────────────────────────
|
|
92
|
+
export var _assertLicensed = function () {
|
|
93
|
+
if (!_active) {
|
|
94
|
+
throw new Error('[react-js-plugins] No valid license detected.\n' +
|
|
95
|
+
'Call initLicense(key) once at app startup before using this package.\n' +
|
|
96
|
+
'To get a license visit: https://your-website.com/license');
|
|
97
|
+
}
|
|
98
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import 'nprogress/nprogress.css';
|
|
2
|
-
import { LazyLoader } from './chunkautils/chunk23111';
|
|
2
|
+
import { LazyLoader as _LazyLoader } from './chunkautils/chunk23111';
|
|
3
|
+
import { initLicense, isLicensed, getLicenseInfo } from './chunkautils/chunkLicense';
|
|
4
|
+
export { initLicense, isLicensed, getLicenseInfo };
|
|
5
|
+
export declare const LazyLoader: (...args: Parameters<typeof _LazyLoader>) => ReturnType<typeof _LazyLoader>;
|
|
3
6
|
import { _isNotEmpty, _isLeapYear, _isWeekend, _removeFalsy, _escapeHTML, _handleApi, _handleSafe, _clearRouteState, _UUID } from "./chunkautils/chunk22123";
|
|
4
7
|
import { createAxiosInstance } from "./chunkautils/chunk83454";
|
|
5
8
|
import { _alert, _capitalize, _confirm, _convertToCurrency, _decodeURI, _deepClone, _decryptJson, _decryptString, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _exportExcel, _flattenArray, _flattenArrayByKey, _findExactRoute, _generatePassword, _genericReducer, _getBrowserInfo, _getCookie, _getFinancialYear, _getStartStopTime, _getStorage, _globalizeDateTime, _formatInternationalDate, _hasElement, _hasItem, _importExcel, _isEmptyArray, _isEmptyObject, _isEqual, _isMobile, _mapObject, _mergeObjects, _parseJSON, _sleep, _promise, _setCookie, _stringifyJSON, _thousandSeparator, _encryptData, _decryptData, _convertLocalToUTC, _convertUTCToLocal } from "./chunkautils/chunk65431";
|
|
@@ -8,4 +11,4 @@ import { _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _
|
|
|
8
11
|
import { _disableDevTools, _isTruncate, _toTitleCase, _truncateText } from './chunkautils/chunk21211';
|
|
9
12
|
import { _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _go, _goBack, _goForward, _navigate } from './chunkautils/chunk22523';
|
|
10
13
|
import { _injectCSS } from './chunkautils/chunk91172';
|
|
11
|
-
export {
|
|
14
|
+
export { createAxiosInstance, _addEventListenerToElement, _alert, _allowAlphaKeys, _allowAlphaNumericKeys, _allowDecimalKeys, _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _arrayToObjectByKey, _asyncDebounce, _throttle, _asyncMap, _average, _base64ToBlob, _batchProcess, _bytesToSize, _combineClasses, _clearRouteState, _calPercentage, _capitalize, _chunk, _clearNode, _cloneElement, _confirm, _convertToCurrency, _convertLocalToUTC, _convertUTCToLocal, _copyText, _dateFormat, _dateTransformer, _decodeURI, _deepClone, _deepCloneArray, _deepCompareArrays, _deepEqual, _deepMerge, _decryptJson, _decryptString, _decryptData, _domSelector, _disableDevTools, _downloadBase64File, _downloadBlob, _downloadFile, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _encryptData, _escapeRegExpMatch, _exportExcel, _escapeHTML, _extractUniqueValues, _extractKeyValues, _extractNestedKeyValues, _fileToBase64, _filterArrayByKeyValue, _filterByMatchedKey, _filterByMatchingKey, _filterDuplicates, _filterObjectByKey, _findExactRoute, _findObjectById, _flattenArray, _flattenArrayByKey, _flattenObject, _formatDate, _localeDateFormat, _globalizeDateTime, _formatInternationalDate, _freeze, _generatePassword, _genericReducer, _getArrayOfObjectsByProperty, _getBrowserInfo, _getChildElements, _getCookie, _getElementAttribute, _getElementsByClass, _getElementsByTag, _getFinancialYear, _getKeysByValue, _getKeyByValue, _getMaxMinValue, _getNestedProperty, _getObjectValues, _getParent, _getPriceAfterTax, _getScrollPosition, _getStartStopTime, _getStorage, _getUniqueValues, _getValueByKey, _groupBy, _go, _goBack, _goForward, _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _handleApi, _handleSafe, _handleChildrenMenu, _handleParentNode, _handleParentsMenu, _handlePasteAlphabetKeys, _handlePasteDecimalKeys, _handlePermissions, _hasElement, _hasItem, _hideElement, _importExcel, _initializeFormValues, _insertHTML, _injectCSS, _isLeapYear, _isWeekend, _isTruncate, _isDocumentLoaded, _isElementInViewport, _isElementPresent, _isNotEmpty, _isEmptyArray, _isEmptyObject, _isEqual, _isExactMatch, _isFreeze, _isInArray, _isMobile, _isSeal, _isValidBase64, _isValidBlob, _isValidBoolean, _isValidCreditCard, _isValidDate, _isValidDateObject, _isValidDateRange, _isValidDateString, _isValidDateTime, _isValidEmail, _isValidEvent, _isValidFile, _isValidForm, _isValidFormData, _isValidFunction, _isValidHTMLElement, _isValidHexColor, _isValidIP, _isValidJSON, _isValidMacAddress, _isValidNode, _isValidNodeList, _isValidNumber, _isValidPassword, _isValidPhoneNumber, _isValidPromise, _isValidRegExp, _isValidString, _isValidTime, _isValidURL, _isValidURLSearchParams, _isValidUUID, _log, _mapAsync, _mapObject, _mergeArrays, _mergeArraysByKey, _mergeObjects, _navigate, _objectToArray, _parseJSON, _pasteText, _promise, _reloadAfterLoad, _removeAllChildren, _removeDuplicates, _removeDuplicateByKey, _removeElement, _removeElementAttribute, _removeEventListenerFromElement, _removeNode, _removeFalsy, _removeSafeElement, _replaceContent, _runOnIframeLoad, _sanitizeArray, _scrollToElement, _scrollToTop, _sleep, _seal, _setCookie, _setElementAttribute, _setElementDisabled, _setMultipleStyles, _setNestedProperty, _setTouchedFields, _showElement, _snipDecimals, _sortByKey, _stringifyJSON, _swapArrayByKey, _swapArrayElements, _thousandSeparator, _throwError, _toCamelCase, _truncateText, _toTitleCase, _transformArray, _transformAsyncData, _uint8ArrayToBlob, _updateObjectInArray, _UUID, _validateFormRef, _getQueryString, _onDOMLoad, _onFullReload, _onWindowLoad, _octetToBlob, };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import 'nprogress/nprogress.css';
|
|
2
|
-
import { LazyLoader } from './chunkautils/chunk23111';
|
|
2
|
+
import { LazyLoader as _LazyLoader } from './chunkautils/chunk23111';
|
|
3
|
+
import { initLicense, isLicensed, getLicenseInfo, _assertLicensed } from './chunkautils/chunkLicense';
|
|
4
|
+
export { initLicense, isLicensed, getLicenseInfo };
|
|
5
|
+
export var LazyLoader = function () {
|
|
6
|
+
var args = [];
|
|
7
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
+
args[_i] = arguments[_i];
|
|
9
|
+
}
|
|
10
|
+
_assertLicensed();
|
|
11
|
+
return _LazyLoader.apply(void 0, args);
|
|
12
|
+
};
|
|
3
13
|
import { _isNotEmpty, _isLeapYear, _isWeekend, _removeFalsy, _escapeHTML, _handleApi, _handleSafe, _clearRouteState, _UUID } from "./chunkautils/chunk22123";
|
|
4
14
|
import { createAxiosInstance } from "./chunkautils/chunk83454";
|
|
5
15
|
import { _alert, _capitalize, _confirm, _convertToCurrency, _decodeURI, _deepClone, _decryptJson, _decryptString, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _exportExcel, _flattenArray, _flattenArrayByKey, _findExactRoute, _generatePassword, _genericReducer, _getBrowserInfo, _getCookie, _getFinancialYear, _getStartStopTime, _getStorage, _globalizeDateTime, _formatInternationalDate, _hasElement, _hasItem, _importExcel, _isEmptyArray, _isEmptyObject, _isEqual, _isMobile, _mapObject, _mergeObjects, _parseJSON, _sleep, _promise, _setCookie, _stringifyJSON, _thousandSeparator, _encryptData, _decryptData, _convertLocalToUTC, _convertUTCToLocal } from "./chunkautils/chunk65431";
|
|
@@ -8,4 +18,4 @@ import { _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _
|
|
|
8
18
|
import { _disableDevTools, _isTruncate, _toTitleCase, _truncateText } from './chunkautils/chunk21211';
|
|
9
19
|
import { _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _go, _goBack, _goForward, _navigate } from './chunkautils/chunk22523';
|
|
10
20
|
import { _injectCSS } from './chunkautils/chunk91172';
|
|
11
|
-
export {
|
|
21
|
+
export { createAxiosInstance, _addEventListenerToElement, _alert, _allowAlphaKeys, _allowAlphaNumericKeys, _allowDecimalKeys, _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _arrayToObjectByKey, _asyncDebounce, _throttle, _asyncMap, _average, _base64ToBlob, _batchProcess, _bytesToSize, _combineClasses, _clearRouteState, _calPercentage, _capitalize, _chunk, _clearNode, _cloneElement, _confirm, _convertToCurrency, _convertLocalToUTC, _convertUTCToLocal, _copyText, _dateFormat, _dateTransformer, _decodeURI, _deepClone, _deepCloneArray, _deepCompareArrays, _deepEqual, _deepMerge, _decryptJson, _decryptString, _decryptData, _domSelector, _disableDevTools, _downloadBase64File, _downloadBlob, _downloadFile, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _encryptData, _escapeRegExpMatch, _exportExcel, _escapeHTML, _extractUniqueValues, _extractKeyValues, _extractNestedKeyValues, _fileToBase64, _filterArrayByKeyValue, _filterByMatchedKey, _filterByMatchingKey, _filterDuplicates, _filterObjectByKey, _findExactRoute, _findObjectById, _flattenArray, _flattenArrayByKey, _flattenObject, _formatDate, _localeDateFormat, _globalizeDateTime, _formatInternationalDate, _freeze, _generatePassword, _genericReducer, _getArrayOfObjectsByProperty, _getBrowserInfo, _getChildElements, _getCookie, _getElementAttribute, _getElementsByClass, _getElementsByTag, _getFinancialYear, _getKeysByValue, _getKeyByValue, _getMaxMinValue, _getNestedProperty, _getObjectValues, _getParent, _getPriceAfterTax, _getScrollPosition, _getStartStopTime, _getStorage, _getUniqueValues, _getValueByKey, _groupBy, _go, _goBack, _goForward, _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _handleApi, _handleSafe, _handleChildrenMenu, _handleParentNode, _handleParentsMenu, _handlePasteAlphabetKeys, _handlePasteDecimalKeys, _handlePermissions, _hasElement, _hasItem, _hideElement, _importExcel, _initializeFormValues, _insertHTML, _injectCSS, _isLeapYear, _isWeekend, _isTruncate, _isDocumentLoaded, _isElementInViewport, _isElementPresent, _isNotEmpty, _isEmptyArray, _isEmptyObject, _isEqual, _isExactMatch, _isFreeze, _isInArray, _isMobile, _isSeal, _isValidBase64, _isValidBlob, _isValidBoolean, _isValidCreditCard, _isValidDate, _isValidDateObject, _isValidDateRange, _isValidDateString, _isValidDateTime, _isValidEmail, _isValidEvent, _isValidFile, _isValidForm, _isValidFormData, _isValidFunction, _isValidHTMLElement, _isValidHexColor, _isValidIP, _isValidJSON, _isValidMacAddress, _isValidNode, _isValidNodeList, _isValidNumber, _isValidPassword, _isValidPhoneNumber, _isValidPromise, _isValidRegExp, _isValidString, _isValidTime, _isValidURL, _isValidURLSearchParams, _isValidUUID, _log, _mapAsync, _mapObject, _mergeArrays, _mergeArraysByKey, _mergeObjects, _navigate, _objectToArray, _parseJSON, _pasteText, _promise, _reloadAfterLoad, _removeAllChildren, _removeDuplicates, _removeDuplicateByKey, _removeElement, _removeElementAttribute, _removeEventListenerFromElement, _removeNode, _removeFalsy, _removeSafeElement, _replaceContent, _runOnIframeLoad, _sanitizeArray, _scrollToElement, _scrollToTop, _sleep, _seal, _setCookie, _setElementAttribute, _setElementDisabled, _setMultipleStyles, _setNestedProperty, _setTouchedFields, _showElement, _snipDecimals, _sortByKey, _stringifyJSON, _swapArrayByKey, _swapArrayElements, _thousandSeparator, _throwError, _toCamelCase, _truncateText, _toTitleCase, _transformArray, _transformAsyncData, _uint8ArrayToBlob, _updateObjectInArray, _UUID, _validateFormRef, _getQueryString, _onDOMLoad, _onFullReload, _onWindowLoad, _octetToBlob, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
3
|
+
* ║ LICENSE KEY GENERATOR — PACKAGE AUTHOR TOOL ║
|
|
4
|
+
* ║ ║
|
|
5
|
+
* ║ ⚠️ DO NOT include this file in the npm bundle. ║
|
|
6
|
+
* ║ ⚠️ Keep this file PRIVATE — it contains the signing secret. ║
|
|
7
|
+
* ║ ║
|
|
8
|
+
* ║ Usage (generate a key): ║
|
|
9
|
+
* ║ npx ts-node src/licenseGenerator.ts <email> <days> ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ Examples: ║
|
|
12
|
+
* ║ npx ts-node src/licenseGenerator.ts customer@email.com 365 ║
|
|
13
|
+
* ║ npx ts-node src/licenseGenerator.ts company@org.com 30 ║
|
|
14
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Generates a signed, encrypted license key for the given user.
|
|
18
|
+
*
|
|
19
|
+
* @param uid Licensee identifier (email or company name)
|
|
20
|
+
* @param expiryDays Number of days until the license expires
|
|
21
|
+
* @returns Opaque license key string
|
|
22
|
+
*/
|
|
23
|
+
export declare const generateLicenseKey: (uid: string, expiryDays: number) => string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
3
|
+
* ║ LICENSE KEY GENERATOR — PACKAGE AUTHOR TOOL ║
|
|
4
|
+
* ║ ║
|
|
5
|
+
* ║ ⚠️ DO NOT include this file in the npm bundle. ║
|
|
6
|
+
* ║ ⚠️ Keep this file PRIVATE — it contains the signing secret. ║
|
|
7
|
+
* ║ ║
|
|
8
|
+
* ║ Usage (generate a key): ║
|
|
9
|
+
* ║ npx ts-node src/licenseGenerator.ts <email> <days> ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ Examples: ║
|
|
12
|
+
* ║ npx ts-node src/licenseGenerator.ts customer@email.com 365 ║
|
|
13
|
+
* ║ npx ts-node src/licenseGenerator.ts company@org.com 30 ║
|
|
14
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
15
|
+
*/
|
|
16
|
+
import CryptoJS from 'crypto-js';
|
|
17
|
+
// ── MUST exactly match src/chunkautils/chunkLicense.ts ────────────────────────
|
|
18
|
+
var _P1 = '\x37\x62\x64\x34\x65\x39\x61\x32';
|
|
19
|
+
var _P2 = '\x66\x31\x63\x38\x61\x30\x35\x62';
|
|
20
|
+
var _P3 = '\x32\x65\x37\x64\x39\x62\x34\x63';
|
|
21
|
+
var _P4 = '\x61\x35\x66\x33\x63\x38\x65\x31';
|
|
22
|
+
var _P5 = '\x39\x30\x62\x32\x64\x35\x61\x38';
|
|
23
|
+
var _P6 = '\x63\x36\x65\x31\x66\x34\x39\x62';
|
|
24
|
+
var _ms = function () { return [_P1, _P3, _P5, _P2, _P6, _P4].join('\u0000'); };
|
|
25
|
+
var _SS = '\x72\x6a\x70\x5f\x73\x69\x67\x5f\x76\x31'; // rjp_sig_v1
|
|
26
|
+
var _ES = '\x72\x6a\x70\x5f\x65\x6e\x63\x5f\x76\x31'; // rjp_enc_v1
|
|
27
|
+
var _SK = function () { return CryptoJS.PBKDF2(_ms(), _SS, { keySize: 8, iterations: 2048 }).toString(); };
|
|
28
|
+
var _EK = function () { return CryptoJS.PBKDF2(_ms(), _ES, { keySize: 8, iterations: 2048 }).toString(); };
|
|
29
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
30
|
+
/**
|
|
31
|
+
* Generates a signed, encrypted license key for the given user.
|
|
32
|
+
*
|
|
33
|
+
* @param uid Licensee identifier (email or company name)
|
|
34
|
+
* @param expiryDays Number of days until the license expires
|
|
35
|
+
* @returns Opaque license key string
|
|
36
|
+
*/
|
|
37
|
+
export var generateLicenseKey = function (uid, expiryDays) {
|
|
38
|
+
if (!uid || typeof uid !== 'string')
|
|
39
|
+
throw new Error('uid is required.');
|
|
40
|
+
if (!Number.isFinite(expiryDays) || expiryDays <= 0)
|
|
41
|
+
throw new Error('expiryDays must be a positive number.');
|
|
42
|
+
var payload = {
|
|
43
|
+
uid: uid,
|
|
44
|
+
exp: Date.now() + expiryDays * 24 * 60 * 60 * 1000,
|
|
45
|
+
iat: Date.now(),
|
|
46
|
+
v: 1,
|
|
47
|
+
};
|
|
48
|
+
// AES-256 encrypt the payload (hides uid / expiry from end users)
|
|
49
|
+
var encPayload = CryptoJS.AES.encrypt(JSON.stringify(payload), _EK()).toString();
|
|
50
|
+
// HMAC-SHA256 sign the encrypted payload (prevents forgery / tampering)
|
|
51
|
+
var sig = CryptoJS.HmacSHA256(encPayload, _SK()).toString();
|
|
52
|
+
return "".concat(encPayload, ".").concat(sig);
|
|
53
|
+
};
|
|
54
|
+
// ── CLI entry point ───────────────────────────────────────────────────────────
|
|
55
|
+
var _a = process.argv, uid = _a[2], daysArg = _a[3];
|
|
56
|
+
if (!uid) {
|
|
57
|
+
console.error('\nUsage: npx ts-node src/licenseGenerator.ts <email> <days>\n');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
var days = Number(daysArg !== null && daysArg !== void 0 ? daysArg : 365);
|
|
61
|
+
var key = generateLicenseKey(uid, days);
|
|
62
|
+
var expiry = new Date(Date.now() + days * 86400000).toDateString();
|
|
63
|
+
console.log('\n╔══════════════════════════════════════════════╗');
|
|
64
|
+
console.log('║ react-js-plugins License Key ║');
|
|
65
|
+
console.log('╠══════════════════════════════════════════════╣');
|
|
66
|
+
console.log("\u2551 Licensee : ".concat(uid));
|
|
67
|
+
console.log("\u2551 Duration : ".concat(days, " days"));
|
|
68
|
+
console.log("\u2551 Expires : ".concat(expiry));
|
|
69
|
+
console.log('╠══════════════════════════════════════════════╣');
|
|
70
|
+
console.log('║ Key (share this with the customer): ║');
|
|
71
|
+
console.log('╚══════════════════════════════════════════════╝\n');
|
|
72
|
+
console.log(key);
|
|
73
|
+
console.log('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-js-plugins",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.3",
|
|
4
4
|
"description": "A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/crypto-js": "^4.2.2",
|
|
50
50
|
"@types/luxon": "^3.6.2",
|
|
51
|
-
"@types/node": "^22.
|
|
51
|
+
"@types/node": "^22.19.17",
|
|
52
52
|
"@types/nprogress": "^0.2.3",
|
|
53
53
|
"@types/react": "^18.3.24",
|
|
54
54
|
"tslib": "^2.6.3",
|