@rm-graph/core 0.1.10 → 0.1.12
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 +3 -52
- package/dist/{chunk-KATRK3C3.js → chunk-4JQVY6S5.js} +2 -10
- package/dist/chunk-4JQVY6S5.js.map +1 -0
- package/dist/{chunk-Q2ZHY445.mjs → chunk-7GF5X23V.mjs} +3 -10
- package/dist/chunk-7GF5X23V.mjs.map +1 -0
- package/dist/chunk-BJTO5JO5.mjs +10 -0
- package/dist/chunk-BJTO5JO5.mjs.map +1 -0
- package/dist/chunk-DGUM43GV.js +12 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/chunk-PKJHVSFI.mjs +199 -0
- package/dist/chunk-PKJHVSFI.mjs.map +1 -0
- package/dist/chunk-RLQMHQEV.js +218 -0
- package/dist/chunk-RLQMHQEV.js.map +1 -0
- package/dist/index.d.mts +208 -17
- package/dist/index.d.ts +208 -17
- package/dist/index.js +135 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -27
- package/dist/index.mjs.map +1 -1
- package/dist/license-MTK7WNNA.mjs +4 -0
- package/dist/license-MTK7WNNA.mjs.map +1 -0
- package/dist/license-U7ZNTU6D.js +81 -0
- package/dist/license-U7ZNTU6D.js.map +1 -0
- package/dist/themes/index.js +8 -7
- package/dist/themes/index.mjs +2 -1
- package/package.json +14 -12
- package/dist/chunk-KATRK3C3.js.map +0 -1
- package/dist/chunk-Q2ZHY445.mjs.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scichart = require('scichart');
|
|
4
|
+
|
|
5
|
+
// src/license/index.ts
|
|
6
|
+
|
|
7
|
+
// src/license/crypto.ts
|
|
8
|
+
var ALGORITHM = "AES-GCM";
|
|
9
|
+
var KEY_LENGTH = 256;
|
|
10
|
+
var STORAGE_KEY = "RMGRAPH_LICENSE_DATA";
|
|
11
|
+
function isCryptoAvailable() {
|
|
12
|
+
return typeof window !== "undefined" && typeof crypto !== "undefined" && crypto.subtle !== void 0;
|
|
13
|
+
}
|
|
14
|
+
function simpleEncode(data) {
|
|
15
|
+
const obfuscated = `rmgraph:${data}`;
|
|
16
|
+
return btoa(obfuscated);
|
|
17
|
+
}
|
|
18
|
+
function simpleDecode(encoded) {
|
|
19
|
+
try {
|
|
20
|
+
const decoded = atob(encoded);
|
|
21
|
+
if (decoded.startsWith("rmgraph:")) {
|
|
22
|
+
return decoded.substring(8);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function deriveKey(passphrase) {
|
|
30
|
+
if (!isCryptoAvailable()) {
|
|
31
|
+
throw new Error("Web Crypto API is not available. Requires HTTPS or localhost.");
|
|
32
|
+
}
|
|
33
|
+
const encoder = new TextEncoder();
|
|
34
|
+
const keyMaterial = await crypto.subtle.importKey(
|
|
35
|
+
"raw",
|
|
36
|
+
encoder.encode(passphrase),
|
|
37
|
+
"PBKDF2",
|
|
38
|
+
false,
|
|
39
|
+
["deriveKey"]
|
|
40
|
+
);
|
|
41
|
+
const salt = encoder.encode("rmgraph-license-salt-v1");
|
|
42
|
+
return crypto.subtle.deriveKey(
|
|
43
|
+
{
|
|
44
|
+
name: "PBKDF2",
|
|
45
|
+
salt,
|
|
46
|
+
iterations: 1e5,
|
|
47
|
+
hash: "SHA-256"
|
|
48
|
+
},
|
|
49
|
+
keyMaterial,
|
|
50
|
+
{ name: ALGORITHM, length: KEY_LENGTH },
|
|
51
|
+
false,
|
|
52
|
+
["encrypt", "decrypt"]
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
async function encryptLicense(licenseKey, passphrase) {
|
|
56
|
+
if (!isCryptoAvailable()) {
|
|
57
|
+
return simpleEncode(licenseKey);
|
|
58
|
+
}
|
|
59
|
+
const key = await deriveKey(passphrase);
|
|
60
|
+
const encoder = new TextEncoder();
|
|
61
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
62
|
+
const encrypted = await crypto.subtle.encrypt(
|
|
63
|
+
{ name: ALGORITHM, iv },
|
|
64
|
+
key,
|
|
65
|
+
encoder.encode(licenseKey)
|
|
66
|
+
);
|
|
67
|
+
const combined = new Uint8Array(iv.length + encrypted.byteLength);
|
|
68
|
+
combined.set(iv);
|
|
69
|
+
combined.set(new Uint8Array(encrypted), iv.length);
|
|
70
|
+
return btoa(String.fromCharCode(...combined));
|
|
71
|
+
}
|
|
72
|
+
async function decryptLicense(encryptedData, passphrase) {
|
|
73
|
+
try {
|
|
74
|
+
const simpleDecoded = simpleDecode(encryptedData);
|
|
75
|
+
if (simpleDecoded !== null) {
|
|
76
|
+
return simpleDecoded;
|
|
77
|
+
}
|
|
78
|
+
if (!isCryptoAvailable()) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const key = await deriveKey(passphrase);
|
|
82
|
+
const combined = Uint8Array.from(atob(encryptedData), (c) => c.charCodeAt(0));
|
|
83
|
+
const iv = combined.slice(0, 12);
|
|
84
|
+
const data = combined.slice(12);
|
|
85
|
+
const decrypted = await crypto.subtle.decrypt(
|
|
86
|
+
{ name: ALGORITHM, iv },
|
|
87
|
+
key,
|
|
88
|
+
data
|
|
89
|
+
);
|
|
90
|
+
return new TextDecoder().decode(decrypted);
|
|
91
|
+
} catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function saveEncryptedLicense(licenseKey, passphrase) {
|
|
96
|
+
if (typeof window === "undefined" || !window.localStorage) {
|
|
97
|
+
throw new Error("localStorage is not available");
|
|
98
|
+
}
|
|
99
|
+
const encrypted = await encryptLicense(licenseKey, passphrase);
|
|
100
|
+
localStorage.setItem(STORAGE_KEY, encrypted);
|
|
101
|
+
}
|
|
102
|
+
async function loadEncryptedLicense(passphrase) {
|
|
103
|
+
if (typeof window === "undefined" || !window.localStorage) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const encrypted = localStorage.getItem(STORAGE_KEY);
|
|
107
|
+
if (!encrypted) return null;
|
|
108
|
+
return decryptLicense(encrypted, passphrase);
|
|
109
|
+
}
|
|
110
|
+
function hasEncryptedLicense() {
|
|
111
|
+
if (typeof window === "undefined" || !window.localStorage) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return localStorage.getItem(STORAGE_KEY) !== null;
|
|
115
|
+
}
|
|
116
|
+
function clearStoredLicense() {
|
|
117
|
+
if (typeof window === "undefined" || !window.localStorage) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
121
|
+
}
|
|
122
|
+
function getLicenseStorageKey() {
|
|
123
|
+
return STORAGE_KEY;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/license/index.ts
|
|
127
|
+
var DEFAULT_PASSPHRASE = "rmgraph-default-key-2024";
|
|
128
|
+
var currentPassphrase = DEFAULT_PASSPHRASE;
|
|
129
|
+
var licenseApplied = false;
|
|
130
|
+
function configureLicenseEncryption(config) {
|
|
131
|
+
if (config.passphrase) {
|
|
132
|
+
currentPassphrase = config.passphrase;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function getCurrentPassphrase() {
|
|
136
|
+
return currentPassphrase;
|
|
137
|
+
}
|
|
138
|
+
function resetPassphrase() {
|
|
139
|
+
currentPassphrase = DEFAULT_PASSPHRASE;
|
|
140
|
+
}
|
|
141
|
+
async function setLicense(licenseKey) {
|
|
142
|
+
try {
|
|
143
|
+
if (!licenseKey || typeof licenseKey !== "string") {
|
|
144
|
+
throw new Error("Invalid license key");
|
|
145
|
+
}
|
|
146
|
+
await saveEncryptedLicense(licenseKey.trim(), currentPassphrase);
|
|
147
|
+
scichart.SciChartSurface.setRuntimeLicenseKey(licenseKey.trim());
|
|
148
|
+
licenseApplied = true;
|
|
149
|
+
return true;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.error("Failed to set license:", error);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async function loadLicense() {
|
|
156
|
+
try {
|
|
157
|
+
const licenseKey = await loadEncryptedLicense(currentPassphrase);
|
|
158
|
+
if (licenseKey) {
|
|
159
|
+
scichart.SciChartSurface.setRuntimeLicenseKey(licenseKey);
|
|
160
|
+
licenseApplied = true;
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.error("Failed to load license:", error);
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function hasStoredLicense() {
|
|
170
|
+
return hasEncryptedLicense();
|
|
171
|
+
}
|
|
172
|
+
function isLicenseApplied() {
|
|
173
|
+
return licenseApplied;
|
|
174
|
+
}
|
|
175
|
+
function removeLicense() {
|
|
176
|
+
clearStoredLicense();
|
|
177
|
+
licenseApplied = false;
|
|
178
|
+
}
|
|
179
|
+
function applyLicenseKey(licenseKey) {
|
|
180
|
+
if (licenseKey && typeof licenseKey === "string") {
|
|
181
|
+
scichart.SciChartSurface.setRuntimeLicenseKey(licenseKey.trim());
|
|
182
|
+
licenseApplied = true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function getLicenseStatus() {
|
|
186
|
+
return {
|
|
187
|
+
hasLicense: hasStoredLicense(),
|
|
188
|
+
isApplied: licenseApplied
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function validateLicenseFormat(licenseKey) {
|
|
192
|
+
if (!licenseKey || typeof licenseKey !== "string") {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
const trimmed = licenseKey.trim();
|
|
196
|
+
return trimmed.length >= 10 && trimmed.length <= 5e3;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
exports.applyLicenseKey = applyLicenseKey;
|
|
200
|
+
exports.clearStoredLicense = clearStoredLicense;
|
|
201
|
+
exports.configureLicenseEncryption = configureLicenseEncryption;
|
|
202
|
+
exports.decryptLicense = decryptLicense;
|
|
203
|
+
exports.encryptLicense = encryptLicense;
|
|
204
|
+
exports.getCurrentPassphrase = getCurrentPassphrase;
|
|
205
|
+
exports.getLicenseStatus = getLicenseStatus;
|
|
206
|
+
exports.getLicenseStorageKey = getLicenseStorageKey;
|
|
207
|
+
exports.hasEncryptedLicense = hasEncryptedLicense;
|
|
208
|
+
exports.hasStoredLicense = hasStoredLicense;
|
|
209
|
+
exports.isLicenseApplied = isLicenseApplied;
|
|
210
|
+
exports.loadEncryptedLicense = loadEncryptedLicense;
|
|
211
|
+
exports.loadLicense = loadLicense;
|
|
212
|
+
exports.removeLicense = removeLicense;
|
|
213
|
+
exports.resetPassphrase = resetPassphrase;
|
|
214
|
+
exports.saveEncryptedLicense = saveEncryptedLicense;
|
|
215
|
+
exports.setLicense = setLicense;
|
|
216
|
+
exports.validateLicenseFormat = validateLicenseFormat;
|
|
217
|
+
//# sourceMappingURL=chunk-RLQMHQEV.js.map
|
|
218
|
+
//# sourceMappingURL=chunk-RLQMHQEV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/license/crypto.ts","../src/license/index.ts"],"names":["SciChartSurface"],"mappings":";;;;;;;AASA,IAAM,SAAA,GAAY,SAAA;AAClB,IAAM,UAAA,GAAa,GAAA;AACnB,IAAM,WAAA,GAAc,sBAAA;AAMpB,SAAS,iBAAA,GAA6B;AACpC,EAAA,OACE,OAAO,MAAA,KAAW,WAAA,IAClB,OAAO,MAAA,KAAW,WAAA,IAClB,OAAO,MAAA,KAAW,MAAA;AAEtB;AAMA,SAAS,aAAa,IAAA,EAAsB;AAE1C,EAAA,MAAM,UAAA,GAAa,WAAW,IAAI,CAAA,CAAA;AAClC,EAAA,OAAO,KAAK,UAAU,CAAA;AACxB;AAKA,SAAS,aAAa,OAAA,EAAgC;AACpD,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAA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IAAA,OAAA,CAAQ,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAOO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,OAAO,mBAAA,EAAoB;AAC7B;AAOO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,OAAO,cAAA;AACT;AAMO,SAAS,aAAA,GAAsB;AACpC,EAAA,kBAAA,EAAmB;AACnB,EAAA,cAAA,GAAiB,KAAA;AACnB;AAQO,SAAS,gBAAgB,UAAA,EAA0B;AACxD,EAAA,IAAI,UAAA,IAAc,OAAO,UAAA,KAAe,QAAA,EAAU;AAChD,IAAAA,wBAAA,CAAgB,oBAAA,CAAqB,UAAA,CAAW,IAAA,EAAM,CAAA;AACtD,IAAA,cAAA,GAAiB,IAAA;AAAA,EACnB;AACF;AAOO,SAAS,gBAAA,GAAkC;AAChD,EAAA,OAAO;AAAA,IACL,YAAY,gBAAA,EAAiB;AAAA,IAC7B,SAAA,EAAW;AAAA,GACb;AACF;AASO,SAAS,sBAAsB,UAAA,EAA6B;AACjE,EAAA,IAAI,CAAC,UAAA,IAAc,OAAO,UAAA,KAAe,QAAA,EAAU;AACjD,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAU,WAAW,IAAA,EAAK;AAGhC,EAAA,OAAO,OAAA,CAAQ,MAAA,IAAU,EAAA,IAAM,OAAA,CAAQ,MAAA,IAAU,GAAA;AACnD","file":"chunk-RLQMHQEV.js","sourcesContent":["/**\r\n * Generic encryption/decryption utilities using Web Crypto API\r\n * Provides obfuscation for license keys stored in localStorage\r\n * \r\n * Note: This provides obfuscation, not true security.\r\n * The decryption key is in client code, so determined attackers can still decrypt.\r\n * For production, combine with SciChart's domain-locking for real protection.\r\n */\r\n\r\nconst ALGORITHM = 'AES-GCM';\r\nconst KEY_LENGTH = 256;\r\nconst STORAGE_KEY = 'RMGRAPH_LICENSE_DATA';\r\n\r\n/**\r\n * Check if Web Crypto API is available\r\n * Web Crypto API requires HTTPS or localhost (secure context)\r\n */\r\nfunction isCryptoAvailable(): boolean {\r\n return (\r\n typeof window !== 'undefined' &&\r\n typeof crypto !== 'undefined' &&\r\n crypto.subtle !== undefined\r\n );\r\n}\r\n\r\n/**\r\n * Simple base64 encoding fallback when Web Crypto is not available\r\n * This provides basic obfuscation (not encryption)\r\n */\r\nfunction simpleEncode(data: string): string {\r\n // Add a simple obfuscation prefix to distinguish from plain text\r\n const obfuscated = `rmgraph:${data}`;\r\n return btoa(obfuscated);\r\n}\r\n\r\n/**\r\n * Simple base64 decoding fallback\r\n */\r\nfunction simpleDecode(encoded: string): string | null {\r\n try {\r\n const decoded = atob(encoded);\r\n if (decoded.startsWith('rmgraph:')) {\r\n return decoded.substring(8); // Remove prefix\r\n }\r\n return null;\r\n } catch {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Derive a consistent cryptographic key from a passphrase\r\n */\r\nasync function deriveKey(passphrase: string): Promise<CryptoKey> {\r\n if (!isCryptoAvailable()) {\r\n throw new Error('Web Crypto API is not available. Requires HTTPS or localhost.');\r\n }\r\n\r\n const encoder = new TextEncoder();\r\n const keyMaterial = await crypto.subtle!.importKey(\r\n 'raw',\r\n encoder.encode(passphrase),\r\n 'PBKDF2',\r\n false,\r\n ['deriveKey']\r\n );\r\n\r\n // Use a fixed salt for consistency across encrypt/decrypt\r\n const salt = encoder.encode('rmgraph-license-salt-v1');\r\n\r\n return crypto.subtle!.deriveKey(\r\n {\r\n name: 'PBKDF2',\r\n salt,\r\n iterations: 100000,\r\n hash: 'SHA-256',\r\n },\r\n keyMaterial,\r\n { name: ALGORITHM, length: KEY_LENGTH },\r\n false,\r\n ['encrypt', 'decrypt']\r\n );\r\n}\r\n\r\n/**\r\n * Encrypt a license key string\r\n * @param licenseKey - The plain text license key\r\n * @param passphrase - The passphrase to derive encryption key from\r\n * @returns Base64 encoded encrypted data\r\n */\r\nexport async function encryptLicense(\r\n licenseKey: string,\r\n passphrase: string\r\n): Promise<string> {\r\n // Fallback to simple encoding if Web Crypto is not available\r\n if (!isCryptoAvailable()) {\r\n return simpleEncode(licenseKey);\r\n }\r\n\r\n const key = await deriveKey(passphrase);\r\n const encoder = new TextEncoder();\r\n const iv = crypto.getRandomValues(new Uint8Array(12));\r\n\r\n const encrypted = await crypto.subtle!.encrypt(\r\n { name: ALGORITHM, iv },\r\n key,\r\n encoder.encode(licenseKey)\r\n );\r\n\r\n // Combine IV + encrypted data and encode as base64\r\n const combined = new Uint8Array(iv.length + encrypted.byteLength);\r\n combined.set(iv);\r\n combined.set(new Uint8Array(encrypted), iv.length);\r\n\r\n return btoa(String.fromCharCode(...combined));\r\n}\r\n\r\n/**\r\n * Decrypt an encrypted license key\r\n * @param encryptedData - Base64 encoded encrypted data\r\n * @param passphrase - The passphrase to derive decryption key from\r\n * @returns The decrypted license key or null if decryption fails\r\n */\r\nexport async function decryptLicense(\r\n encryptedData: string,\r\n passphrase: string\r\n): Promise<string | null> {\r\n try {\r\n // Try simple decode first (for fallback encoding)\r\n const simpleDecoded = simpleDecode(encryptedData);\r\n if (simpleDecoded !== null) {\r\n return simpleDecoded;\r\n }\r\n\r\n // If Web Crypto is not available, we can't decrypt AES-encrypted data\r\n if (!isCryptoAvailable()) {\r\n return null;\r\n }\r\n\r\n // Try AES decryption\r\n const key = await deriveKey(passphrase);\r\n const combined = Uint8Array.from(atob(encryptedData), (c) => c.charCodeAt(0));\r\n\r\n const iv = combined.slice(0, 12);\r\n const data = combined.slice(12);\r\n\r\n const decrypted = await crypto.subtle!.decrypt(\r\n { name: ALGORITHM, iv },\r\n key,\r\n data\r\n );\r\n\r\n return new TextDecoder().decode(decrypted);\r\n } catch {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Save encrypted license to localStorage\r\n * @param licenseKey - The plain text license key\r\n * @param passphrase - The passphrase for encryption\r\n */\r\nexport async function saveEncryptedLicense(\r\n licenseKey: string,\r\n passphrase: string\r\n): Promise<void> {\r\n if (typeof window === 'undefined' || !window.localStorage) {\r\n throw new Error('localStorage is not available');\r\n }\r\n const encrypted = await encryptLicense(licenseKey, passphrase);\r\n localStorage.setItem(STORAGE_KEY, encrypted);\r\n}\r\n\r\n/**\r\n * Load and decrypt license from localStorage\r\n * @param passphrase - The passphrase for decryption\r\n * @returns The decrypted license key or null if not found/decryption fails\r\n */\r\nexport async function loadEncryptedLicense(\r\n passphrase: string\r\n): Promise<string | null> {\r\n if (typeof window === 'undefined' || !window.localStorage) {\r\n return null;\r\n }\r\n const encrypted = localStorage.getItem(STORAGE_KEY);\r\n if (!encrypted) return null;\r\n return decryptLicense(encrypted, passphrase);\r\n}\r\n\r\n/**\r\n * Check if an encrypted license exists in localStorage\r\n */\r\nexport function hasEncryptedLicense(): boolean {\r\n if (typeof window === 'undefined' || !window.localStorage) {\r\n return false;\r\n }\r\n return localStorage.getItem(STORAGE_KEY) !== null;\r\n}\r\n\r\n/**\r\n * Clear stored license from localStorage\r\n */\r\nexport function clearStoredLicense(): void {\r\n if (typeof window === 'undefined' || !window.localStorage) {\r\n return;\r\n }\r\n localStorage.removeItem(STORAGE_KEY);\r\n}\r\n\r\n/**\r\n * Get the storage key used for license data\r\n */\r\nexport function getLicenseStorageKey(): string {\r\n return STORAGE_KEY;\r\n}\r\n","/**\r\n * License management module for @rm-graph packages\r\n * \r\n * Provides encrypted storage and retrieval of SciChart license keys.\r\n * License keys are encrypted using AES-256-GCM before storing in localStorage.\r\n * \r\n * @example\r\n * ```typescript\r\n * import { setLicense, loadLicense, configureLicenseEncryption } from '@rm-graph/core';\r\n * \r\n * // Optional: Configure custom passphrase\r\n * configureLicenseEncryption({ passphrase: 'your-app-secret' });\r\n * \r\n * // Save a license (encrypts and stores in localStorage)\r\n * await setLicense('your-scichart-license-key');\r\n * \r\n * // Load license on app startup\r\n * await loadLicense();\r\n * ```\r\n */\r\n\r\nimport { SciChartSurface } from 'scichart';\r\nimport {\r\n encryptLicense,\r\n decryptLicense,\r\n saveEncryptedLicense,\r\n loadEncryptedLicense,\r\n hasEncryptedLicense,\r\n clearStoredLicense,\r\n getLicenseStorageKey,\r\n} from './crypto';\r\n\r\n// Re-export crypto utilities for advanced usage\r\nexport {\r\n encryptLicense,\r\n decryptLicense,\r\n saveEncryptedLicense,\r\n loadEncryptedLicense,\r\n hasEncryptedLicense,\r\n clearStoredLicense,\r\n getLicenseStorageKey,\r\n};\r\n\r\n/**\r\n * Configuration options for license encryption\r\n */\r\nexport interface LicenseConfig {\r\n /** Custom passphrase for encryption/decryption (optional) */\r\n passphrase?: string;\r\n}\r\n\r\n/**\r\n * License status information\r\n */\r\nexport interface LicenseStatus {\r\n /** Whether a license is stored */\r\n hasLicense: boolean;\r\n /** Whether the license was successfully loaded and applied */\r\n isApplied: boolean;\r\n /** Error message if any */\r\n error?: string;\r\n}\r\n\r\n// Default passphrase (can be overridden by the application)\r\nconst DEFAULT_PASSPHRASE = 'rmgraph-default-key-2024';\r\n\r\n// Current passphrase (mutable)\r\nlet currentPassphrase = DEFAULT_PASSPHRASE;\r\n\r\n// Track if license has been applied\r\nlet licenseApplied = false;\r\n\r\n/**\r\n * Configure the license encryption passphrase\r\n * Call this before saving or loading licenses if you want to use a custom passphrase\r\n * \r\n * @param config - Configuration options\r\n * \r\n * @example\r\n * ```typescript\r\n * configureLicenseEncryption({ passphrase: 'my-app-secret-key' });\r\n * ```\r\n */\r\nexport function configureLicenseEncryption(config: LicenseConfig): void {\r\n if (config.passphrase) {\r\n currentPassphrase = config.passphrase;\r\n }\r\n}\r\n\r\n/**\r\n * Get the current passphrase (for internal use)\r\n */\r\nexport function getCurrentPassphrase(): string {\r\n return currentPassphrase;\r\n}\r\n\r\n/**\r\n * Reset passphrase to default\r\n */\r\nexport function resetPassphrase(): void {\r\n currentPassphrase = DEFAULT_PASSPHRASE;\r\n}\r\n\r\n/**\r\n * Save and apply a SciChart license key\r\n * Encrypts the key and stores it in localStorage, then applies it to SciChart\r\n * \r\n * @param licenseKey - The SciChart license key to save\r\n * @returns Promise resolving to true if successful, false otherwise\r\n * \r\n * @example\r\n * ```typescript\r\n * const success = await setLicense('your-scichart-license-key');\r\n * if (success) {\r\n * console.log('License saved and applied!');\r\n * }\r\n * ```\r\n */\r\nexport async function setLicense(licenseKey: string): Promise<boolean> {\r\n try {\r\n if (!licenseKey || typeof licenseKey !== 'string') {\r\n throw new Error('Invalid license key');\r\n }\r\n\r\n // Save encrypted to localStorage\r\n await saveEncryptedLicense(licenseKey.trim(), currentPassphrase);\r\n\r\n // Apply to SciChart\r\n SciChartSurface.setRuntimeLicenseKey(licenseKey.trim());\r\n licenseApplied = true;\r\n\r\n return true;\r\n } catch (error) {\r\n console.error('Failed to set license:', error);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Load license from localStorage and apply to SciChart\r\n * \r\n * @returns Promise resolving to true if license was found and applied, false otherwise\r\n * \r\n * @example\r\n * ```typescript\r\n * // Call on app startup\r\n * const loaded = await loadLicense();\r\n * if (loaded) {\r\n * console.log('License loaded from storage');\r\n * } else {\r\n * console.log('No license found - charts will show watermark');\r\n * }\r\n * ```\r\n */\r\nexport async function loadLicense(): Promise<boolean> {\r\n try {\r\n const licenseKey = await loadEncryptedLicense(currentPassphrase);\r\n\r\n if (licenseKey) {\r\n SciChartSurface.setRuntimeLicenseKey(licenseKey);\r\n licenseApplied = true;\r\n return true;\r\n }\r\n\r\n return false;\r\n } catch (error) {\r\n console.error('Failed to load license:', error);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Check if a license is stored in localStorage\r\n * \r\n * @returns true if a license exists in storage\r\n */\r\nexport function hasStoredLicense(): boolean {\r\n return hasEncryptedLicense();\r\n}\r\n\r\n/**\r\n * Check if a license has been applied to SciChart in this session\r\n * \r\n * @returns true if a license has been applied\r\n */\r\nexport function isLicenseApplied(): boolean {\r\n return licenseApplied;\r\n}\r\n\r\n/**\r\n * Remove stored license from localStorage\r\n * Note: This doesn't remove the license from SciChart (requires page reload)\r\n */\r\nexport function removeLicense(): void {\r\n clearStoredLicense();\r\n licenseApplied = false;\r\n}\r\n\r\n/**\r\n * Apply a license key directly without storing it\r\n * Useful for temporary/session-only license application\r\n * \r\n * @param licenseKey - The SciChart license key\r\n */\r\nexport function applyLicenseKey(licenseKey: string): void {\r\n if (licenseKey && typeof licenseKey === 'string') {\r\n SciChartSurface.setRuntimeLicenseKey(licenseKey.trim());\r\n licenseApplied = true;\r\n }\r\n}\r\n\r\n/**\r\n * Get current license status\r\n * \r\n * @returns License status information\r\n */\r\nexport function getLicenseStatus(): LicenseStatus {\r\n return {\r\n hasLicense: hasStoredLicense(),\r\n isApplied: licenseApplied,\r\n };\r\n}\r\n\r\n/**\r\n * Validate a license key format (basic validation)\r\n * Note: This doesn't validate if the license is actually valid with SciChart\r\n * \r\n * @param licenseKey - The license key to validate\r\n * @returns true if the format appears valid\r\n */\r\nexport function validateLicenseFormat(licenseKey: string): boolean {\r\n if (!licenseKey || typeof licenseKey !== 'string') {\r\n return false;\r\n }\r\n \r\n const trimmed = licenseKey.trim();\r\n \r\n // Basic validation: must be non-empty and have reasonable length\r\n return trimmed.length >= 10 && trimmed.length <= 5000;\r\n}\r\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -245,14 +245,6 @@ interface Column3DChartConfig extends ChartConfig {
|
|
|
245
245
|
maxCameraRadius?: number;
|
|
246
246
|
/** Minimum camera radius */
|
|
247
247
|
minCameraRadius?: number;
|
|
248
|
-
/** Minimum yaw angle in degrees (horizontal). Default -179. */
|
|
249
|
-
minYaw?: number;
|
|
250
|
-
/** Maximum yaw angle in degrees (horizontal). Default 179. */
|
|
251
|
-
maxYaw?: number;
|
|
252
|
-
/** Minimum pitch angle in degrees (vertical). Default 0. */
|
|
253
|
-
minPitch?: number;
|
|
254
|
-
/** Maximum pitch angle in degrees (vertical). Default 88. */
|
|
255
|
-
maxPitch?: number;
|
|
256
248
|
/** Camera preset positions */
|
|
257
249
|
cameraPresets?: CameraPreset[];
|
|
258
250
|
/** Use cylinder point markers instead of columns */
|
|
@@ -295,9 +287,8 @@ declare class Column3DChart {
|
|
|
295
287
|
*/
|
|
296
288
|
private createSurface;
|
|
297
289
|
/**
|
|
298
|
-
* Setup camera clamping to restrict camera movement
|
|
299
|
-
*
|
|
300
|
-
* Pitch clamped to [0, 89]. Radius clamped to [495, 805].
|
|
290
|
+
* Setup camera clamping to restrict camera movement
|
|
291
|
+
* Matches the original ThreeDGraph.jsx behavior
|
|
301
292
|
*/
|
|
302
293
|
private setupCameraClamping;
|
|
303
294
|
/**
|
|
@@ -360,11 +351,6 @@ declare class Column3DChart {
|
|
|
360
351
|
* Get the SciChart surface for advanced operations
|
|
361
352
|
*/
|
|
362
353
|
getSurface(): SciChart3DSurface | null;
|
|
363
|
-
/**
|
|
364
|
-
* Notify SciChart that the container has resized so the WebGL canvas
|
|
365
|
-
* adjusts to the new dimensions. Call after maximize / minimize.
|
|
366
|
-
*/
|
|
367
|
-
resize(): void;
|
|
368
354
|
/**
|
|
369
355
|
* Destroy and clean up
|
|
370
356
|
*/
|
|
@@ -542,12 +528,217 @@ declare function lerp(start: number, end: number, t: number): number;
|
|
|
542
528
|
*/
|
|
543
529
|
declare function hexToRgba(hex: string, alpha?: number): string;
|
|
544
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Generic encryption/decryption utilities using Web Crypto API
|
|
533
|
+
* Provides obfuscation for license keys stored in localStorage
|
|
534
|
+
*
|
|
535
|
+
* Note: This provides obfuscation, not true security.
|
|
536
|
+
* The decryption key is in client code, so determined attackers can still decrypt.
|
|
537
|
+
* For production, combine with SciChart's domain-locking for real protection.
|
|
538
|
+
*/
|
|
539
|
+
/**
|
|
540
|
+
* Encrypt a license key string
|
|
541
|
+
* @param licenseKey - The plain text license key
|
|
542
|
+
* @param passphrase - The passphrase to derive encryption key from
|
|
543
|
+
* @returns Base64 encoded encrypted data
|
|
544
|
+
*/
|
|
545
|
+
declare function encryptLicense(licenseKey: string, passphrase: string): Promise<string>;
|
|
546
|
+
/**
|
|
547
|
+
* Decrypt an encrypted license key
|
|
548
|
+
* @param encryptedData - Base64 encoded encrypted data
|
|
549
|
+
* @param passphrase - The passphrase to derive decryption key from
|
|
550
|
+
* @returns The decrypted license key or null if decryption fails
|
|
551
|
+
*/
|
|
552
|
+
declare function decryptLicense(encryptedData: string, passphrase: string): Promise<string | null>;
|
|
553
|
+
/**
|
|
554
|
+
* Save encrypted license to localStorage
|
|
555
|
+
* @param licenseKey - The plain text license key
|
|
556
|
+
* @param passphrase - The passphrase for encryption
|
|
557
|
+
*/
|
|
558
|
+
declare function saveEncryptedLicense(licenseKey: string, passphrase: string): Promise<void>;
|
|
559
|
+
/**
|
|
560
|
+
* Load and decrypt license from localStorage
|
|
561
|
+
* @param passphrase - The passphrase for decryption
|
|
562
|
+
* @returns The decrypted license key or null if not found/decryption fails
|
|
563
|
+
*/
|
|
564
|
+
declare function loadEncryptedLicense(passphrase: string): Promise<string | null>;
|
|
565
|
+
/**
|
|
566
|
+
* Check if an encrypted license exists in localStorage
|
|
567
|
+
*/
|
|
568
|
+
declare function hasEncryptedLicense(): boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Clear stored license from localStorage
|
|
571
|
+
*/
|
|
572
|
+
declare function clearStoredLicense(): void;
|
|
573
|
+
/**
|
|
574
|
+
* Get the storage key used for license data
|
|
575
|
+
*/
|
|
576
|
+
declare function getLicenseStorageKey(): string;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* License management module for @rm-graph packages
|
|
580
|
+
*
|
|
581
|
+
* Provides encrypted storage and retrieval of SciChart license keys.
|
|
582
|
+
* License keys are encrypted using AES-256-GCM before storing in localStorage.
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```typescript
|
|
586
|
+
* import { setLicense, loadLicense, configureLicenseEncryption } from '@rm-graph/core';
|
|
587
|
+
*
|
|
588
|
+
* // Optional: Configure custom passphrase
|
|
589
|
+
* configureLicenseEncryption({ passphrase: 'your-app-secret' });
|
|
590
|
+
*
|
|
591
|
+
* // Save a license (encrypts and stores in localStorage)
|
|
592
|
+
* await setLicense('your-scichart-license-key');
|
|
593
|
+
*
|
|
594
|
+
* // Load license on app startup
|
|
595
|
+
* await loadLicense();
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Configuration options for license encryption
|
|
601
|
+
*/
|
|
602
|
+
interface LicenseConfig {
|
|
603
|
+
/** Custom passphrase for encryption/decryption (optional) */
|
|
604
|
+
passphrase?: string;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* License status information
|
|
608
|
+
*/
|
|
609
|
+
interface LicenseStatus {
|
|
610
|
+
/** Whether a license is stored */
|
|
611
|
+
hasLicense: boolean;
|
|
612
|
+
/** Whether the license was successfully loaded and applied */
|
|
613
|
+
isApplied: boolean;
|
|
614
|
+
/** Error message if any */
|
|
615
|
+
error?: string;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Configure the license encryption passphrase
|
|
619
|
+
* Call this before saving or loading licenses if you want to use a custom passphrase
|
|
620
|
+
*
|
|
621
|
+
* @param config - Configuration options
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```typescript
|
|
625
|
+
* configureLicenseEncryption({ passphrase: 'my-app-secret-key' });
|
|
626
|
+
* ```
|
|
627
|
+
*/
|
|
628
|
+
declare function configureLicenseEncryption(config: LicenseConfig): void;
|
|
629
|
+
/**
|
|
630
|
+
* Get the current passphrase (for internal use)
|
|
631
|
+
*/
|
|
632
|
+
declare function getCurrentPassphrase(): string;
|
|
633
|
+
/**
|
|
634
|
+
* Reset passphrase to default
|
|
635
|
+
*/
|
|
636
|
+
declare function resetPassphrase(): void;
|
|
637
|
+
/**
|
|
638
|
+
* Save and apply a SciChart license key
|
|
639
|
+
* Encrypts the key and stores it in localStorage, then applies it to SciChart
|
|
640
|
+
*
|
|
641
|
+
* @param licenseKey - The SciChart license key to save
|
|
642
|
+
* @returns Promise resolving to true if successful, false otherwise
|
|
643
|
+
*
|
|
644
|
+
* @example
|
|
645
|
+
* ```typescript
|
|
646
|
+
* const success = await setLicense('your-scichart-license-key');
|
|
647
|
+
* if (success) {
|
|
648
|
+
* console.log('License saved and applied!');
|
|
649
|
+
* }
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
652
|
+
declare function setLicense(licenseKey: string): Promise<boolean>;
|
|
653
|
+
/**
|
|
654
|
+
* Load license from localStorage and apply to SciChart
|
|
655
|
+
*
|
|
656
|
+
* @returns Promise resolving to true if license was found and applied, false otherwise
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* // Call on app startup
|
|
661
|
+
* const loaded = await loadLicense();
|
|
662
|
+
* if (loaded) {
|
|
663
|
+
* console.log('License loaded from storage');
|
|
664
|
+
* } else {
|
|
665
|
+
* console.log('No license found - charts will show watermark');
|
|
666
|
+
* }
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
declare function loadLicense(): Promise<boolean>;
|
|
670
|
+
/**
|
|
671
|
+
* Check if a license is stored in localStorage
|
|
672
|
+
*
|
|
673
|
+
* @returns true if a license exists in storage
|
|
674
|
+
*/
|
|
675
|
+
declare function hasStoredLicense(): boolean;
|
|
676
|
+
/**
|
|
677
|
+
* Check if a license has been applied to SciChart in this session
|
|
678
|
+
*
|
|
679
|
+
* @returns true if a license has been applied
|
|
680
|
+
*/
|
|
681
|
+
declare function isLicenseApplied(): boolean;
|
|
682
|
+
/**
|
|
683
|
+
* Remove stored license from localStorage
|
|
684
|
+
* Note: This doesn't remove the license from SciChart (requires page reload)
|
|
685
|
+
*/
|
|
686
|
+
declare function removeLicense(): void;
|
|
687
|
+
/**
|
|
688
|
+
* Apply a license key directly without storing it
|
|
689
|
+
* Useful for temporary/session-only license application
|
|
690
|
+
*
|
|
691
|
+
* @param licenseKey - The SciChart license key
|
|
692
|
+
*/
|
|
693
|
+
declare function applyLicenseKey(licenseKey: string): void;
|
|
694
|
+
/**
|
|
695
|
+
* Get current license status
|
|
696
|
+
*
|
|
697
|
+
* @returns License status information
|
|
698
|
+
*/
|
|
699
|
+
declare function getLicenseStatus(): LicenseStatus;
|
|
700
|
+
/**
|
|
701
|
+
* Validate a license key format (basic validation)
|
|
702
|
+
* Note: This doesn't validate if the license is actually valid with SciChart
|
|
703
|
+
*
|
|
704
|
+
* @param licenseKey - The license key to validate
|
|
705
|
+
* @returns true if the format appears valid
|
|
706
|
+
*/
|
|
707
|
+
declare function validateLicenseFormat(licenseKey: string): boolean;
|
|
708
|
+
|
|
545
709
|
/**
|
|
546
710
|
* SciChart UI - A customizable charting library built on SciChart
|
|
547
711
|
*
|
|
548
712
|
* @packageDocumentation
|
|
549
713
|
*/
|
|
550
714
|
|
|
715
|
+
/**
|
|
716
|
+
* Setup SciChart license from multiple sources (legacy API - kept for backward compatibility)
|
|
717
|
+
* Tries sources in order: env variable → localStorage → direct key
|
|
718
|
+
*
|
|
719
|
+
* @deprecated Use loadLicense() or setLicense() instead
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```ts
|
|
723
|
+
* import { setupSciChartLicense } from '@rm-graph/core';
|
|
724
|
+
*
|
|
725
|
+
* setupSciChartLicense({
|
|
726
|
+
* fromEnv: true,
|
|
727
|
+
* fromLocalStorage: true,
|
|
728
|
+
* licenseKey: 'fallback-key'
|
|
729
|
+
* });
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
declare function setupSciChartLicense(options: {
|
|
733
|
+
fromEnv?: boolean;
|
|
734
|
+
fromLocalStorage?: boolean;
|
|
735
|
+
licenseKey?: string;
|
|
736
|
+
}): Promise<boolean>;
|
|
737
|
+
/**
|
|
738
|
+
* Configure SciChart license key directly (legacy API)
|
|
739
|
+
* @deprecated Use setLicense() for encrypted storage or applyLicenseKey() for direct application
|
|
740
|
+
*/
|
|
741
|
+
declare function configureSciChartLicense(licenseKey: string): void;
|
|
551
742
|
declare const VERSION = "0.1.1";
|
|
552
743
|
|
|
553
744
|
/**
|
|
@@ -569,4 +760,4 @@ declare function configureSciChart(options: {
|
|
|
569
760
|
wasmUrl?: string;
|
|
570
761
|
}): void;
|
|
571
762
|
|
|
572
|
-
export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, throttle };
|
|
763
|
+
export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, type LicenseConfig, type LicenseStatus, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, applyLicenseKey, calculateDataRange, clamp, clearStoredLicense, configureLicenseEncryption, configureSciChart, configureSciChartLicense, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, decryptLicense, deepMerge, encryptLicense, extractXValues, extractYValues, formatNumber, generateId, getCurrentPassphrase, getLicenseStatus, getLicenseStorageKey, hasEncryptedLicense, hasStoredLicense, hexToRgba, isLicenseApplied, lerp, loadEncryptedLicense, loadLicense, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, removeLicense, resetPassphrase, saveEncryptedLicense, setLicense, setupSciChartLicense, throttle, validateLicenseFormat };
|