@carchalabs/seal-electron 0.0.0-stage → 0.5.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.
- package/LICENSE +21 -0
- package/README.md +35 -2
- package/dist/fingerprint.d.ts +33 -0
- package/dist/fingerprint.js +97 -0
- package/dist/fingerprint.js.map +1 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +524 -0
- package/dist/index.js.map +1 -0
- package/package.json +24 -4
- package/src/fingerprint.ts +103 -0
- package/src/index.ts +623 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LicenseKit = exports.Seal = exports.LicenseError = exports.SDK_VERSION = exports.readMachineId = exports.MachineIdUnavailableError = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_module_1 = require("node:module");
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const node_vm_1 = require("node:vm");
|
|
10
|
+
const seal_core_1 = require("@carchalabs/seal-core");
|
|
11
|
+
const fingerprint_1 = require("./fingerprint");
|
|
12
|
+
Object.defineProperty(exports, "MachineIdUnavailableError", { enumerable: true, get: function () { return fingerprint_1.MachineIdUnavailableError; } });
|
|
13
|
+
Object.defineProperty(exports, "readMachineId", { enumerable: true, get: function () { return fingerprint_1.readMachineId; } });
|
|
14
|
+
/** This SDK's version, sent to the server so vendors can see (and require) which SDK each device runs. */
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
16
|
+
exports.SDK_VERSION = require('../package.json').version;
|
|
17
|
+
/** File formats of offline activation, shared with the license server. */
|
|
18
|
+
const OFFLINE_REQUEST_FORMAT = 'licensekit-offline-request';
|
|
19
|
+
const OFFLINE_LICENSE_FORMAT = 'licensekit-offline-license';
|
|
20
|
+
const OFFLINE_DEACTIVATION_FORMAT = 'licensekit-offline-deactivation';
|
|
21
|
+
const DEFINITIVE = new Set(['invalid_key', 'not_activated', 'license_suspended', 'license_revoked', 'license_expired', 'sdk_update_required', 'app_update_required', 'vm_not_allowed']);
|
|
22
|
+
/** The native hardware module. A non-literal require: bundlers leave it to Node, which must load the .node file from disk. */
|
|
23
|
+
const HWID_PACKAGE = '@carchalabs/seal-hwid';
|
|
24
|
+
/** Loads the native module once per process; null when it is not installed or has no build for this platform. */
|
|
25
|
+
let hwidModule;
|
|
26
|
+
function loadHwid() {
|
|
27
|
+
if (hwidModule === undefined) {
|
|
28
|
+
try {
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
30
|
+
hwidModule = require(HWID_PACKAGE);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
hwidModule = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return hwidModule;
|
|
37
|
+
}
|
|
38
|
+
/** The server accepts at most this many components. */
|
|
39
|
+
const MAX_COMPONENTS = 32;
|
|
40
|
+
/** The license itself is gone: forget the key too. The other refusals can be undone on the server (resume, renew,
|
|
41
|
+
* re-activate), so the key is kept and the next successful online check restores the license on its own. */
|
|
42
|
+
const FORGET_KEY = new Set(['invalid_key', 'license_revoked']);
|
|
43
|
+
const CLOCK_TOLERANCE_SECONDS = 24 * 3600;
|
|
44
|
+
const DEFAULT_GRACE_DAYS = 7;
|
|
45
|
+
const CLOCK_MESSAGE = 'The date and time on this computer look wrong. Correct them, then connect to the internet.';
|
|
46
|
+
class LicenseError extends Error {
|
|
47
|
+
code;
|
|
48
|
+
status;
|
|
49
|
+
constructor(code, message, status) {
|
|
50
|
+
super(message);
|
|
51
|
+
this.code = code;
|
|
52
|
+
this.status = status;
|
|
53
|
+
this.name = 'LicenseError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.LicenseError = LicenseError;
|
|
57
|
+
const REASON_TEXT = {
|
|
58
|
+
malformed: 'The saved license is damaged. Please activate again.',
|
|
59
|
+
bad_signature: 'The saved license was modified. Please activate again.',
|
|
60
|
+
unsupported_algorithm: 'Please update the app.',
|
|
61
|
+
wrong_type: 'Please update the app.',
|
|
62
|
+
unknown_key: 'Please update the app.',
|
|
63
|
+
wrong_issuer: 'This license was issued by a different license server.',
|
|
64
|
+
not_yet_valid: CLOCK_MESSAGE,
|
|
65
|
+
wrong_product: 'This license is for a different product.',
|
|
66
|
+
wrong_device: 'This license is activated on another device.',
|
|
67
|
+
expired: 'Your license has expired.',
|
|
68
|
+
revalidation_required: 'Connect to the internet to confirm your license.',
|
|
69
|
+
};
|
|
70
|
+
const toIso = (seconds) => new Date(seconds * 1000).toISOString();
|
|
71
|
+
function noticesFrom(response) {
|
|
72
|
+
const list = Array.isArray(response?.notices) ? response.notices.filter((n) => n && typeof n.code === 'string') : [];
|
|
73
|
+
return list.length ? { notices: list } : {};
|
|
74
|
+
}
|
|
75
|
+
class Seal {
|
|
76
|
+
opts;
|
|
77
|
+
file;
|
|
78
|
+
keys;
|
|
79
|
+
fingerprintCache;
|
|
80
|
+
hardwareCache;
|
|
81
|
+
/** The native lease verifier, when it trusts every key this app was given (undefined = not looked up yet). */
|
|
82
|
+
nativeLease;
|
|
83
|
+
deviceKeyCache;
|
|
84
|
+
constructor(opts) {
|
|
85
|
+
this.opts = opts;
|
|
86
|
+
this.file = (0, node_path_1.join)(opts.storageDir, 'license.dat');
|
|
87
|
+
this.keys = (0, seal_core_1.keySet)(Array.isArray(opts.publicKey) ? opts.publicKey : [opts.publicKey]);
|
|
88
|
+
}
|
|
89
|
+
get fetch() {
|
|
90
|
+
return this.opts.fetchImpl ?? fetch;
|
|
91
|
+
}
|
|
92
|
+
nowSec() {
|
|
93
|
+
return Math.floor((this.opts.now?.() ?? Date.now()) / 1000);
|
|
94
|
+
}
|
|
95
|
+
get storageProtected() {
|
|
96
|
+
const store = this.opts.secureStore;
|
|
97
|
+
return store !== undefined && (store.isProtected?.() ?? true);
|
|
98
|
+
}
|
|
99
|
+
async fingerprint() {
|
|
100
|
+
if (!this.fingerprintCache) {
|
|
101
|
+
let raw;
|
|
102
|
+
try {
|
|
103
|
+
raw = await (this.opts.machineId ?? (() => (0, fingerprint_1.readMachineId)({ allowFallback: this.opts.allowFallbackFingerprint })))();
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (e instanceof fingerprint_1.MachineIdUnavailableError)
|
|
107
|
+
throw new LicenseError(e.code, e.message);
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
this.fingerprintCache = (0, seal_core_1.hashFingerprint)(raw, this.opts.product);
|
|
111
|
+
}
|
|
112
|
+
return this.fingerprintCache;
|
|
113
|
+
}
|
|
114
|
+
/** Read once per instance: hardware does not change while the app runs. Never throws. */
|
|
115
|
+
hardware() {
|
|
116
|
+
this.hardwareCache ??= (async () => {
|
|
117
|
+
const source = this.opts.hardware;
|
|
118
|
+
if (source === false)
|
|
119
|
+
return null;
|
|
120
|
+
try {
|
|
121
|
+
if (source)
|
|
122
|
+
return await source();
|
|
123
|
+
const hwid = loadHwid();
|
|
124
|
+
if (!hwid)
|
|
125
|
+
return null;
|
|
126
|
+
const { components, vm } = hwid.collect(`licensekit:${this.opts.product}`);
|
|
127
|
+
return { components, vm };
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return null; // not installed, or no module for this platform: send nothing, as before
|
|
131
|
+
}
|
|
132
|
+
})();
|
|
133
|
+
return this.hardwareCache.then((report) => report && report.components.length ? { components: report.components.slice(0, MAX_COMPONENTS), vm: report.vm === true } : {});
|
|
134
|
+
}
|
|
135
|
+
async load() {
|
|
136
|
+
try {
|
|
137
|
+
const buf = await (0, promises_1.readFile)(this.file);
|
|
138
|
+
const text = this.opts.secureStore ? await this.opts.secureStore.decrypt(buf) : buf.toString('utf8');
|
|
139
|
+
return JSON.parse(text);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async save(stored) {
|
|
146
|
+
await (0, promises_1.mkdir)(this.opts.storageDir, { recursive: true });
|
|
147
|
+
const text = JSON.stringify(stored);
|
|
148
|
+
await (0, promises_1.writeFile)(this.file, this.opts.secureStore ? await this.opts.secureStore.encrypt(text) : text, { mode: 0o600 });
|
|
149
|
+
}
|
|
150
|
+
async clear() {
|
|
151
|
+
await (0, promises_1.rm)(this.file, { force: true });
|
|
152
|
+
}
|
|
153
|
+
async post(path, body) {
|
|
154
|
+
let res;
|
|
155
|
+
try {
|
|
156
|
+
res = await this.fetch(this.opts.serverUrl.replace(/\/+$/, '') + path, {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
headers: { 'Content-Type': 'application/json' },
|
|
159
|
+
body: JSON.stringify(body),
|
|
160
|
+
signal: AbortSignal.timeout(this.opts.requestTimeoutMs ?? 8000),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
throw new LicenseError('network', 'Could not reach the license server.');
|
|
165
|
+
}
|
|
166
|
+
const json = await res.json().catch(() => ({}));
|
|
167
|
+
if (!res.ok)
|
|
168
|
+
throw new LicenseError(json.error ?? 'server_error', json.message ?? `License server error (${res.status})`, res.status);
|
|
169
|
+
return json;
|
|
170
|
+
}
|
|
171
|
+
emptyState(status, offline, extra = {}) {
|
|
172
|
+
return { status, offline, storageProtected: this.storageProtected, features: [], expiresAt: null, ...extra };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The device's public key, sent with activation and check-ins so the server wraps feature keys for
|
|
176
|
+
* this machine only. Only when the native module verifies for this app (it then also decrypts, with
|
|
177
|
+
* the matching secret it derives itself) and hardware is not turned off. Never throws.
|
|
178
|
+
*/
|
|
179
|
+
deviceKey() {
|
|
180
|
+
if (this.deviceKeyCache === undefined) {
|
|
181
|
+
let key = null;
|
|
182
|
+
try {
|
|
183
|
+
const native = this.opts.hardware === false ? null : this.native();
|
|
184
|
+
if (native && typeof native.devicePublicKey === 'function' && typeof native.decryptFeature === 'function') {
|
|
185
|
+
key = native.devicePublicKey(`licensekit:${this.opts.product}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
key = null;
|
|
190
|
+
}
|
|
191
|
+
this.deviceKeyCache = key;
|
|
192
|
+
}
|
|
193
|
+
return this.deviceKeyCache ? { devicePublicKey: this.deviceKeyCache } : {};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The native verifier, used only when its compiled-in keys include every key this app was given:
|
|
197
|
+
* an app that trusts other keys (a self-hosted server) is checked by the JavaScript verifier alone.
|
|
198
|
+
*/
|
|
199
|
+
native() {
|
|
200
|
+
if (this.nativeLease === undefined) {
|
|
201
|
+
const hwid = loadHwid();
|
|
202
|
+
let native = null;
|
|
203
|
+
if (hwid && typeof hwid.verifyLease === 'function' && typeof hwid.leaseKeyIds === 'function') {
|
|
204
|
+
const trusted = new Set(hwid.leaseKeyIds());
|
|
205
|
+
if ([...this.keys.keys()].every((kid) => trusted.has(kid)))
|
|
206
|
+
native = hwid;
|
|
207
|
+
}
|
|
208
|
+
this.nativeLease = native;
|
|
209
|
+
}
|
|
210
|
+
return this.nativeLease;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Verifies a lease twice, in JavaScript and in the native module, when the native verifier applies.
|
|
214
|
+
* Both follow the same rules, so a different answer means one of them was tampered with: the lease
|
|
215
|
+
* is then treated as modified.
|
|
216
|
+
*/
|
|
217
|
+
verify(token, options) {
|
|
218
|
+
const result = (0, seal_core_1.verifyLease)(token, options);
|
|
219
|
+
const native = this.native();
|
|
220
|
+
if (!native)
|
|
221
|
+
return result;
|
|
222
|
+
const check = native.verifyLease(token, {
|
|
223
|
+
product: options.product,
|
|
224
|
+
fingerprintHash: options.fingerprintHash,
|
|
225
|
+
now: options.now ?? Math.floor(Date.now() / 1000),
|
|
226
|
+
...(options.graceSeconds !== undefined ? { graceSeconds: options.graceSeconds } : {}),
|
|
227
|
+
});
|
|
228
|
+
const agree = check.ok === result.ok && (result.ok || check.reason === result.reason);
|
|
229
|
+
return agree ? result : { ok: false, reason: 'bad_signature' };
|
|
230
|
+
}
|
|
231
|
+
stateFromLease(stored, offline) {
|
|
232
|
+
const fingerprintHash = this.fingerprintCache;
|
|
233
|
+
const now = this.nowSec();
|
|
234
|
+
const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
|
|
235
|
+
if (offline && stored.lastSeen !== undefined && now < stored.lastSeen - CLOCK_TOLERANCE_SECONDS) {
|
|
236
|
+
return this.emptyState('clock_suspect', offline, { reason: 'clock_rollback', message: CLOCK_MESSAGE, keyHint });
|
|
237
|
+
}
|
|
238
|
+
const verifyOptions = { keys: this.keys, product: this.opts.product, fingerprintHash, now };
|
|
239
|
+
const strict = this.verify(stored.token, verifyOptions);
|
|
240
|
+
const fromClaims = (claims) => ({
|
|
241
|
+
customer: claims.cus,
|
|
242
|
+
features: claims.feat,
|
|
243
|
+
expiresAt: claims.exp === undefined ? null : toIso(claims.exp),
|
|
244
|
+
maintenanceUntil: claims.mnt === undefined ? null : toIso(claims.mnt),
|
|
245
|
+
storageProtected: this.storageProtected,
|
|
246
|
+
keyHint,
|
|
247
|
+
...(stored.notices ? { notices: stored.notices } : {}),
|
|
248
|
+
...(stored.offline ? { offlineActivated: true } : {}),
|
|
249
|
+
});
|
|
250
|
+
if (strict.ok) {
|
|
251
|
+
return { status: 'valid', offline, ...fromClaims(strict.claims), revalidateBy: toIso(strict.claims.rev) };
|
|
252
|
+
}
|
|
253
|
+
if (strict.reason === 'not_yet_valid') {
|
|
254
|
+
return this.emptyState('clock_suspect', offline, { reason: 'lease_from_future', message: CLOCK_MESSAGE, keyHint });
|
|
255
|
+
}
|
|
256
|
+
if (strict.reason === 'revalidation_required' && strict.claims) {
|
|
257
|
+
const grace = strict.claims.grc ?? (this.opts.graceDays ?? DEFAULT_GRACE_DAYS) * 86400;
|
|
258
|
+
const lenient = this.verify(stored.token, { ...verifyOptions, graceSeconds: grace });
|
|
259
|
+
if (lenient.ok) {
|
|
260
|
+
return {
|
|
261
|
+
status: 'grace',
|
|
262
|
+
offline,
|
|
263
|
+
reason: 'offline_grace',
|
|
264
|
+
message: stored.offline
|
|
265
|
+
? 'This offline license is past its renewal date. Load a new offline license file soon to keep using the app.'
|
|
266
|
+
: 'Working offline. Connect to the internet soon to keep using the app.',
|
|
267
|
+
...fromClaims(lenient.claims),
|
|
268
|
+
revalidateBy: toIso(Math.min(lenient.claims.rev + grace, lenient.claims.exp ?? Infinity)),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return this.emptyState('invalid', offline, { reason: strict.reason, message: REASON_TEXT[strict.reason], keyHint });
|
|
273
|
+
}
|
|
274
|
+
async activate(licenseKey, machineName = (0, node_os_1.hostname)()) {
|
|
275
|
+
const fingerprint = await this.fingerprint();
|
|
276
|
+
const key = licenseKey.trim().toUpperCase();
|
|
277
|
+
const response = await this.post('/v1/activate', {
|
|
278
|
+
licenseKey: key,
|
|
279
|
+
product: this.opts.product,
|
|
280
|
+
fingerprint,
|
|
281
|
+
machineName: machineName.slice(0, 80),
|
|
282
|
+
platform: (0, node_os_1.platform)(),
|
|
283
|
+
appVersion: this.opts.appVersion,
|
|
284
|
+
sdkVersion: exports.SDK_VERSION,
|
|
285
|
+
...(await this.hardware()),
|
|
286
|
+
...this.deviceKey(),
|
|
287
|
+
});
|
|
288
|
+
const stored = { licenseKey: key, token: response.token, lastSeen: this.nowSec(), ...noticesFrom(response) };
|
|
289
|
+
const state = this.stateFromLease(stored, false);
|
|
290
|
+
if (state.status !== 'valid')
|
|
291
|
+
throw new LicenseError(state.status === 'clock_suspect' ? 'clock_suspect' : state.reason ?? 'invalid', state.message ?? 'Server returned an unusable license');
|
|
292
|
+
await this.save(stored);
|
|
293
|
+
return state;
|
|
294
|
+
}
|
|
295
|
+
async check() {
|
|
296
|
+
try {
|
|
297
|
+
await this.fingerprint();
|
|
298
|
+
}
|
|
299
|
+
catch (e) {
|
|
300
|
+
// Nothing is changed on disk: the next check tries to read the id again.
|
|
301
|
+
if (e instanceof LicenseError && e.code === 'machine_id_unavailable')
|
|
302
|
+
return this.emptyState('invalid', false, { reason: e.code, message: e.message });
|
|
303
|
+
throw e;
|
|
304
|
+
}
|
|
305
|
+
const stored = await this.load();
|
|
306
|
+
if (!stored)
|
|
307
|
+
return this.emptyState('unlicensed', false);
|
|
308
|
+
if (stored.offline && stored.token) {
|
|
309
|
+
// Activated from an offline license file: the machine is not expected to reach the server.
|
|
310
|
+
const state = this.stateFromLease({ ...stored, token: stored.token }, true);
|
|
311
|
+
if (state.status === 'valid' || state.status === 'grace') {
|
|
312
|
+
await this.save({ ...stored, lastSeen: Math.max(stored.lastSeen ?? 0, this.nowSec()) });
|
|
313
|
+
}
|
|
314
|
+
return state;
|
|
315
|
+
}
|
|
316
|
+
try {
|
|
317
|
+
const response = await this.post('/v1/validate', {
|
|
318
|
+
licenseKey: stored.licenseKey,
|
|
319
|
+
product: this.opts.product,
|
|
320
|
+
fingerprint: this.fingerprintCache,
|
|
321
|
+
appVersion: this.opts.appVersion,
|
|
322
|
+
sdkVersion: exports.SDK_VERSION,
|
|
323
|
+
...(await this.hardware()),
|
|
324
|
+
...this.deviceKey(),
|
|
325
|
+
});
|
|
326
|
+
const fresh = { licenseKey: stored.licenseKey, token: response.token, lastSeen: this.nowSec(), ...noticesFrom(response) };
|
|
327
|
+
await this.save(fresh);
|
|
328
|
+
return this.stateFromLease(fresh, false);
|
|
329
|
+
}
|
|
330
|
+
catch (e) {
|
|
331
|
+
const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
|
|
332
|
+
if (e instanceof LicenseError && DEFINITIVE.has(e.code)) {
|
|
333
|
+
// Persist the refusal: drop the signed lease so going offline cannot bring the license back.
|
|
334
|
+
if (FORGET_KEY.has(e.code))
|
|
335
|
+
await this.clear();
|
|
336
|
+
else
|
|
337
|
+
await this.save({ licenseKey: stored.licenseKey, lastSeen: stored.lastSeen, refused: { code: e.code, message: e.message, at: this.nowSec() } });
|
|
338
|
+
return this.emptyState('invalid', false, { reason: e.code, message: e.message, keyHint });
|
|
339
|
+
}
|
|
340
|
+
if (!stored.token) {
|
|
341
|
+
const refused = stored.refused ?? { code: 'not_activated', message: 'This device is not activated for this license' };
|
|
342
|
+
return this.emptyState('invalid', true, { reason: refused.code, message: refused.message, keyHint });
|
|
343
|
+
}
|
|
344
|
+
const state = this.stateFromLease({ ...stored, token: stored.token }, true);
|
|
345
|
+
if (state.status === 'valid' || state.status === 'grace') {
|
|
346
|
+
await this.save({ ...stored, lastSeen: Math.max(stored.lastSeen ?? 0, this.nowSec()) });
|
|
347
|
+
}
|
|
348
|
+
return state;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Decrypts data you encrypted for a feature (encryptForFeature in @carchalabs/seal-core, with the
|
|
353
|
+
* feature's content key from the console). Works offline: it uses the saved lease, which must be valid
|
|
354
|
+
* (or in its offline grace period), grant the feature and carry its key, and the saved license key.
|
|
355
|
+
* The native module does the work when it trusts this app's keys, so the content key never reaches
|
|
356
|
+
* JavaScript; without it the JavaScript implementation is used. Throws a LicenseError:
|
|
357
|
+
* `unlicensed`, a lease failure reason, `clock_suspect`, `feature_not_licensed` or `decrypt_failed`.
|
|
358
|
+
*/
|
|
359
|
+
async decrypt(feature, data) {
|
|
360
|
+
return (await this.opener(feature))(data);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Envelope: loads a CommonJS module you encrypted for a feature (seal-encrypt, one file or a
|
|
364
|
+
* folder) and returns its exports, like require(). The code is decrypted with the lease's feature key
|
|
365
|
+
* (see decrypt) and compiled from memory; it never exists as a plain file. Relative requires inside
|
|
366
|
+
* it load encrypted neighbours (`./x` finds `x.lke`, `x.js.lke` or `x/index.js.lke`), anything else
|
|
367
|
+
* goes to Node as usual. Loaded once per process, like require(). Throws the same LicenseErrors as
|
|
368
|
+
* decrypt. A licensed user can still read the code from memory: this keeps an app with the license
|
|
369
|
+
* check removed from having the feature, it does not hide the code from its licensed users.
|
|
370
|
+
*/
|
|
371
|
+
async requireEncrypted(feature, file) {
|
|
372
|
+
const open = await this.opener(feature);
|
|
373
|
+
return this.loadEncrypted((0, node_path_1.resolve)(file), feature, open);
|
|
374
|
+
}
|
|
375
|
+
encryptedModules = new Map();
|
|
376
|
+
loadEncrypted(file, feature, open) {
|
|
377
|
+
const cacheKey = `${feature}\0${file}`;
|
|
378
|
+
const cached = this.encryptedModules.get(cacheKey);
|
|
379
|
+
if (cached)
|
|
380
|
+
return cached.exports;
|
|
381
|
+
const source = open((0, node_fs_1.readFileSync)(file)).toString('utf8');
|
|
382
|
+
const filename = file.replace(/\.lke$/, '');
|
|
383
|
+
const mod = { exports: {}, filename, id: filename, loaded: false };
|
|
384
|
+
// Registered before it runs, so a require cycle gets the partial exports, as in Node.
|
|
385
|
+
this.encryptedModules.set(cacheKey, mod);
|
|
386
|
+
const nodeRequire = (0, node_module_1.createRequire)(filename);
|
|
387
|
+
const localRequire = ((request) => {
|
|
388
|
+
if (request.startsWith('./') || request.startsWith('../')) {
|
|
389
|
+
const base = (0, node_path_1.resolve)((0, node_path_1.dirname)(filename), request);
|
|
390
|
+
const encrypted = [`${base}.lke`, `${base}.js.lke`, (0, node_path_1.join)(base, 'index.js.lke')].find((candidate) => (0, node_fs_1.existsSync)(candidate));
|
|
391
|
+
if (encrypted)
|
|
392
|
+
return this.loadEncrypted(encrypted, feature, open);
|
|
393
|
+
}
|
|
394
|
+
return nodeRequire(request);
|
|
395
|
+
});
|
|
396
|
+
Object.assign(localRequire, { resolve: nodeRequire.resolve, cache: nodeRequire.cache, main: nodeRequire.main, extensions: nodeRequire.extensions });
|
|
397
|
+
try {
|
|
398
|
+
const run = (0, node_vm_1.compileFunction)(source, ['exports', 'require', 'module', '__filename', '__dirname'], { filename });
|
|
399
|
+
run.call(mod.exports, mod.exports, localRequire, mod, filename, (0, node_path_1.dirname)(filename));
|
|
400
|
+
}
|
|
401
|
+
catch (e) {
|
|
402
|
+
this.encryptedModules.delete(cacheKey);
|
|
403
|
+
throw e;
|
|
404
|
+
}
|
|
405
|
+
mod.loaded = true;
|
|
406
|
+
return mod.exports;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Checks the saved lease once for a feature and returns a synchronous decrypter bound to it: decrypt
|
|
410
|
+
* uses it once, requireEncrypted for a module and the encrypted modules it requires.
|
|
411
|
+
*/
|
|
412
|
+
async opener(feature) {
|
|
413
|
+
const fingerprintHash = await this.fingerprint();
|
|
414
|
+
const stored = await this.load();
|
|
415
|
+
if (!stored?.token)
|
|
416
|
+
throw new LicenseError('unlicensed', 'This device has no license.');
|
|
417
|
+
const leased = { ...stored, token: stored.token };
|
|
418
|
+
const state = this.stateFromLease(leased, true);
|
|
419
|
+
if (state.status !== 'valid' && state.status !== 'grace') {
|
|
420
|
+
throw new LicenseError(state.status === 'clock_suspect' ? 'clock_suspect' : (state.reason ?? 'invalid'), state.message ?? 'The license is not valid.');
|
|
421
|
+
}
|
|
422
|
+
const claims = (0, seal_core_1.decodeLease)(leased.token)?.claims;
|
|
423
|
+
const graceSeconds = state.status === 'grace' ? (claims?.grc ?? (this.opts.graceDays ?? DEFAULT_GRACE_DAYS) * 86400) : 0;
|
|
424
|
+
const check = { product: this.opts.product, fingerprintHash, now: this.nowSec(), ...(graceSeconds ? { graceSeconds } : {}) };
|
|
425
|
+
const native = this.native();
|
|
426
|
+
return (data) => {
|
|
427
|
+
const result = native && typeof native.decryptFeature === 'function'
|
|
428
|
+
? native.decryptFeature(leased.token, check, leased.licenseKey, feature, Buffer.from(data))
|
|
429
|
+
: (0, seal_core_1.decryptFeature)(leased.token, { keys: this.keys, ...check }, leased.licenseKey, feature, Buffer.from(data));
|
|
430
|
+
if (result.ok && result.data)
|
|
431
|
+
return Buffer.from(result.data);
|
|
432
|
+
if (result.reason === 'not_licensed')
|
|
433
|
+
throw new LicenseError('feature_not_licensed', `This license does not include "${feature}".`);
|
|
434
|
+
if (result.reason === 'decrypt_failed')
|
|
435
|
+
throw new LicenseError('decrypt_failed', 'The data could not be decrypted with this license.');
|
|
436
|
+
throw new LicenseError(result.reason ?? 'invalid', REASON_TEXT[result.reason] ?? 'The license is not valid.');
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Offline activation, step 1 on a machine that cannot reach the server: the request file (JSON text)
|
|
441
|
+
* the user takes to a connected device. The license server turns it into a license file at
|
|
442
|
+
* POST /v1/offline/activate (or its offline activation page). It holds what activate() would send:
|
|
443
|
+
* the license key, this device's fingerprint and hashed hardware parts, never raw serial numbers.
|
|
444
|
+
*/
|
|
445
|
+
async offlineRequest(licenseKey, machineName = (0, node_os_1.hostname)()) {
|
|
446
|
+
const fingerprint = await this.fingerprint();
|
|
447
|
+
const activation = {
|
|
448
|
+
licenseKey: licenseKey.trim().toUpperCase(),
|
|
449
|
+
product: this.opts.product,
|
|
450
|
+
fingerprint,
|
|
451
|
+
machineName: machineName.slice(0, 80),
|
|
452
|
+
platform: (0, node_os_1.platform)(),
|
|
453
|
+
appVersion: this.opts.appVersion,
|
|
454
|
+
sdkVersion: exports.SDK_VERSION,
|
|
455
|
+
...(await this.hardware()),
|
|
456
|
+
...this.deviceKey(),
|
|
457
|
+
};
|
|
458
|
+
return JSON.stringify({ format: OFFLINE_REQUEST_FORMAT, version: 1, activation }, null, 2);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Offline activation, step 2: loads the license file the server issued for this machine's request.
|
|
462
|
+
* It is verified like an online lease (signature, product, this device) and then saved; from then on
|
|
463
|
+
* check() works without the server until the lease's renewal date plus the offline grace. Throws a
|
|
464
|
+
* LicenseError: `invalid_file`, `wrong_product`, or a lease failure reason such as `wrong_device`.
|
|
465
|
+
*/
|
|
466
|
+
async activateOffline(licenseFile) {
|
|
467
|
+
await this.fingerprint();
|
|
468
|
+
let file;
|
|
469
|
+
try {
|
|
470
|
+
file = JSON.parse(licenseFile);
|
|
471
|
+
}
|
|
472
|
+
catch {
|
|
473
|
+
throw new LicenseError('invalid_file', 'This is not a Carcha Seal offline license file.');
|
|
474
|
+
}
|
|
475
|
+
if (!file || file.format !== OFFLINE_LICENSE_FORMAT || file.version !== 1 || typeof file.token !== 'string' || typeof file.licenseKey !== 'string') {
|
|
476
|
+
throw new LicenseError('invalid_file', 'This is not a Carcha Seal offline license file.');
|
|
477
|
+
}
|
|
478
|
+
if (file.product !== this.opts.product)
|
|
479
|
+
throw new LicenseError('wrong_product', 'This offline license file is for another product.');
|
|
480
|
+
const stored = { licenseKey: file.licenseKey.trim().toUpperCase(), token: file.token, lastSeen: this.nowSec(), offline: true };
|
|
481
|
+
const state = this.stateFromLease(stored, true);
|
|
482
|
+
if (state.status !== 'valid') {
|
|
483
|
+
throw new LicenseError(state.status === 'clock_suspect' ? 'clock_suspect' : state.reason ?? 'invalid', state.message ?? 'This offline license file cannot be used on this computer.');
|
|
484
|
+
}
|
|
485
|
+
await this.save(stored);
|
|
486
|
+
return state;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Gives an offline machine's seat back: removes the license from this device and returns the
|
|
490
|
+
* deactivation file (JSON text) for the vendor, who frees the seat by uploading it in the console.
|
|
491
|
+
* Throws `unlicensed` when there is no license to remove.
|
|
492
|
+
*/
|
|
493
|
+
async deactivateOffline() {
|
|
494
|
+
const stored = await this.load();
|
|
495
|
+
if (!stored?.token)
|
|
496
|
+
throw new LicenseError('unlicensed', 'This device has no license.');
|
|
497
|
+
await this.clear();
|
|
498
|
+
return JSON.stringify({ format: OFFLINE_DEACTIVATION_FORMAT, version: 1, product: this.opts.product, token: stored.token }, null, 2);
|
|
499
|
+
}
|
|
500
|
+
async deactivate() {
|
|
501
|
+
const stored = await this.load();
|
|
502
|
+
if (!stored)
|
|
503
|
+
return;
|
|
504
|
+
try {
|
|
505
|
+
await this.post('/v1/deactivate', {
|
|
506
|
+
licenseKey: stored.licenseKey,
|
|
507
|
+
product: this.opts.product,
|
|
508
|
+
fingerprint: await this.fingerprint(),
|
|
509
|
+
...(await this.hardware()),
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
catch (e) {
|
|
513
|
+
if (!(e instanceof LicenseError && (e.code === 'not_activated' || e.code === 'invalid_key')))
|
|
514
|
+
throw e;
|
|
515
|
+
}
|
|
516
|
+
await this.clear();
|
|
517
|
+
}
|
|
518
|
+
static hasFeature(state, feature) {
|
|
519
|
+
return (state.status === 'valid' || state.status === 'grace') && state.features.includes(feature);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
exports.Seal = Seal;
|
|
523
|
+
exports.LicenseKit = Seal;
|
|
524
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,qCAAmD;AACnD,+CAAkE;AAClE,6CAA4C;AAC5C,qCAA6C;AAC7C,yCAAmD;AACnD,qCAA0C;AAC1C,qDAA4K;AAC5K,+CAAyE;AAEhE,0GAFA,uCAAyB,OAEA;AAAE,8FAFA,2BAAa,OAEA;AAEjD,0GAA0G;AAC1G,iEAAiE;AACpD,QAAA,WAAW,GAAW,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;AAkFtE,0EAA0E;AAC1E,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAC5D,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAC5D,MAAM,2BAA2B,GAAG,iCAAiC,CAAC;AAEtE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACxL,8HAA8H;AAC9H,MAAM,Y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AmB,EAAE,OAAe;QACpD,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpG,CAAC;CACF;AA1bD,oBA0bC;AAGgB,0BAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carchalabs/seal-electron",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Carcha Seal (formerly LicenseKit) SDK for the Electron main process and Node: activation, offline verification, grace period",
|
|
5
|
+
"keywords": ["electron", "licensing", "license-key", "software-licensing", "offline-licensing", "node-locked", "ed25519", "jws", "carcha-seal"],
|
|
6
|
+
"homepage": "https://seal.carchalabs.com/docs/",
|
|
7
|
+
"repository": { "type": "git", "url": "git+https://github.com/carcha-labs/carcha-seal-sdk.git", "directory": "packages/sdk-electron" },
|
|
8
|
+
"bugs": { "url": "https://github.com/carcha-labs/carcha-seal-sdk/issues" },
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"files": ["dist", "src", "!dist/**/*.test.*", "!src/**/*.test.ts"],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc -p tsconfig.json",
|
|
14
|
+
"prepublishOnly": "npm run build",
|
|
15
|
+
"test": "node --no-warnings=ExperimentalWarning --test dist/*.test.js"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@carchalabs/seal-core": "0.4.0"
|
|
19
|
+
},
|
|
20
|
+
"optionalDependencies": {
|
|
21
|
+
"@carchalabs/seal-hwid": "0.3.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": { "node": ">=22.13" },
|
|
24
|
+
"publishConfig": { "access": "public" },
|
|
25
|
+
"license": "MIT"
|
|
26
|
+
}
|