@carchalabs/seal-electron 0.5.0 → 0.6.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 CHANGED
@@ -1,21 +1,109 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Bugra Omer Aydemir
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Carcha Seal SDK License
2
+ Version 1.0, 7 November 2026
3
+
4
+ Copyright (c) 2026 Bugra Omer Aydemir (Carcha Labs) ("we", "us").
5
+ All rights not expressly granted below are reserved.
6
+
7
+ This license covers the software in the carcha-seal-sdk repository and the packages
8
+ built from it (the "SDK"). The source code is published so that you can review it;
9
+ publishing it does not make it open source. Versions of the SDK published before
10
+ 7 November 2026 were released under the MIT License, which still applies to those
11
+ versions.
12
+
13
+ 1. Definitions
14
+
15
+ "Carcha Seal Service" means a license server operated by us, or a license server you
16
+ run under a written agreement with us.
17
+
18
+ "Your Application" means software that you develop and provide to your own customers,
19
+ that uses the SDK to obtain and check licenses from the Carcha Seal Service, and whose
20
+ main purpose is not licensing, license management, copy protection or software
21
+ protection.
22
+
23
+ "End Users" means the people and organizations that receive Your Application from you.
24
+
25
+ 2. What you may do
26
+
27
+ As long as you comply with this license, we grant you a non-exclusive, worldwide,
28
+ royalty-free, non-transferable license, which you may not sublicense except as
29
+ section 2(c) allows, to:
30
+
31
+ (a) use, copy and modify the SDK to integrate Your Application with the Carcha Seal
32
+ Service;
33
+
34
+ (b) read and study the SDK's source code, for example to evaluate the SDK or to review
35
+ its security; and
36
+
37
+ (c) distribute the SDK, unmodified or modified under (a), only as part of Your
38
+ Application, in object code or source code form, and let your End Users use it
39
+ only as part of Your Application.
40
+
41
+ 3. What you may not do
42
+
43
+ You may not, and may not allow anyone else to:
44
+
45
+ (a) sell, license, rent, lend or otherwise distribute the SDK, or any part or modified
46
+ version of it, on its own or as part of a software development kit, library,
47
+ framework or other product for developers;
48
+
49
+ (b) use the SDK, or any part or modified version of it, with a license server or
50
+ service other than the Carcha Seal Service, except a test server you run only to
51
+ test Your Application;
52
+
53
+ (c) use the SDK, or any part, modified version or translation of it, in a product or
54
+ service that substitutes for the Carcha Seal Service or the SDK, or that offers the
55
+ same or substantially similar functionality;
56
+
57
+ (d) reverse engineer, decompile or disassemble the compiled parts of the SDK (such as
58
+ its native libraries), or otherwise try to derive source code we have not
59
+ published, except to the extent applicable law permits it despite this
60
+ restriction;
61
+
62
+ (e) disable, bypass or tamper with the SDK's license checks, signature verification,
63
+ encryption or device binding, or help anyone else do so, in any application that
64
+ uses the Carcha Seal Service, except in Your Application while you test it;
65
+
66
+ (f) remove or change this license or any copyright or other notice in the SDK; or
67
+
68
+ (g) use our names, logos or trademarks, including "Carcha Seal" and "Carcha Labs",
69
+ except to state truthfully that Your Application uses Carcha Seal.
70
+
71
+ 4. Your End Users
72
+
73
+ Your terms for Your Application must not give your End Users more rights in the SDK
74
+ than to use it as part of Your Application. You are responsible for your End Users'
75
+ use of the SDK as part of Your Application.
76
+
77
+ 5. Contributions
78
+
79
+ If you send us changes or suggestions for the SDK, you grant us a perpetual,
80
+ irrevocable, worldwide, royalty-free license to use, modify and distribute them for
81
+ any purpose.
82
+
83
+ 6. Termination
84
+
85
+ Your rights under this license end automatically if you breach it. If you end the
86
+ breach within 30 days after we notify you of it, your rights are restored, unless you
87
+ have breached this license before. When your rights end, you must stop using and
88
+ distributing the SDK; your End Users may keep using copies of Your Application they
89
+ received before then. Sections 3, 5, 7 and 8 continue to apply after termination.
90
+
91
+ 7. No warranty
92
+
93
+ To the extent the law allows, the SDK is provided "as is", without warranty of any
94
+ kind, express or implied, including warranties of merchantability, fitness for a
95
+ particular purpose and non-infringement. If you have a separate written agreement with
96
+ us for the Carcha Seal Service, its terms on warranty and liability apply to the SDK
97
+ instead of sections 7 and 8.
98
+
99
+ 8. Limitation of liability
100
+
101
+ To the extent the law allows, we are not liable for any damages arising from the SDK
102
+ or this license. Nothing in this license limits or excludes liability that cannot be
103
+ limited or excluded under applicable law, including liability for intent or gross
104
+ negligence, for death or personal injury, or under product liability law.
105
+
106
+ 9. New versions of this license
107
+
108
+ We may publish new versions of this license. Each version of the SDK stays under the
109
+ license it was published with.
package/README.md CHANGED
@@ -21,7 +21,7 @@ if (state.status === 'unlicensed') await kit.activate(userEnteredKey);
21
21
  if (Seal.hasFeature(state, 'export-pdf')) exportPdf();
22
22
  ```
23
23
 
24
- `check()` returns one of `valid`, `grace`, `invalid`, `unlicensed` or `clock_suspect`, with `offline` and `storageProtected` flags. A refusal from the server (suspended, expired, device removed, update required) is kept while offline and cleared by the next successful check-in. `notices` carries what the server asks your app to act on, such as `sdk_update_recommended` or `app_update_recommended` with a `minimum` version and a `requiredFrom` date; the SDK shows nothing itself. `activate(key, machineName)` sends the device name you pass; the default is the computer's host name. `deactivate()` releases the seat.
24
+ `check()` returns one of `valid`, `grace`, `invalid`, `unlicensed` or `clock_suspect`, with `offline` and `storageProtected` flags. A refusal from the server (suspended, expired, device removed, update required) is kept while offline and cleared by the next successful check-in. `notices` carries what the server asks your app to act on, such as `sdk_update_recommended` or `app_update_recommended` with a `minimum` version and a `requiredFrom` date; the SDK shows nothing itself. `activate(key, machineName)` sends the device name you pass, and none when you pass nothing (a computer's host name often holds its user's name). `deactivate()` releases the seat.
25
25
 
26
26
  Code can be protected the same way (Envelope): encrypt a CommonJS module or a folder of them with `seal-encrypt --feature pro dist/premium dist/premium`, and load it with `await kit.requireEncrypted('pro', path.join(__dirname, 'premium/index.js.lke'))`. Without the feature in the license the code cannot be read; a licensed user can still read it from memory.
27
27
 
@@ -33,4 +33,4 @@ The SDK sends the license key, a per-product SHA-256 hash of the operating syste
33
33
 
34
34
  **Hardware components.** When `@carchalabs/seal-hwid` is installed, the SDK also sends one keyed hash per hardware part (motherboard, disk, network card, OS install, CPU and graphics models) and whether the computer is a virtual machine. The license server then recognises the computer after a new disk, network card or operating system install, and refuses a copied disk or system image on other hardware. Raw serial numbers never leave the computer. Without the package, or on a platform it has no module for, nothing extra is sent. `hardware: false` turns it off. Bundlers must leave the package to Node (mark it external); electron-builder unpacks its native module from the asar archive.
35
35
 
36
- Integration guide (activate once, check at start, put feature code behind `decrypt`, ship the native module, harden the app): [seal.carchalabs.com/docs/#integration](https://seal.carchalabs.com/docs/#integration). Full reference: [seal.carchalabs.com/docs](https://seal.carchalabs.com/docs/#sdk). Requires Node 22.13 or later. MIT License.
36
+ Integration guide (activate once, check at start, put feature code behind `decrypt`, ship the native module, harden the app): [seal.carchalabs.com/docs/#integration](https://seal.carchalabs.com/docs/#integration). Full reference: [seal.carchalabs.com/docs](https://seal.carchalabs.com/docs/#sdk). Requires Node 22.13 or later. [Carcha Seal SDK License](LICENSE): for apps that use Carcha Seal; versions before 7 November 2026 are MIT.
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ export interface SecureStore {
45
45
  isProtected?(): boolean;
46
46
  }
47
47
  export interface SealOptions {
48
+ /** The license server: https://, or http:// on this computer only (localhost, 127.x.x.x, [::1]). */
48
49
  serverUrl: string;
49
50
  product: string;
50
51
  publicKey: string | string[];
@@ -86,7 +87,10 @@ export declare class Seal {
86
87
  fingerprint(): Promise<string>;
87
88
  /** Read once per instance: hardware does not change while the app runs. Never throws. */
88
89
  private hardware;
90
+ /** The saved record; null when there is none, or it cannot be read or is not a record (as no license). */
89
91
  private load;
92
+ /** Replaces license.dat whole: written to license.dat.tmp, then renamed over it, so a crash or full disk mid-write
93
+ * leaves the previous record. */
90
94
  private save;
91
95
  private clear;
92
96
  private post;
@@ -109,8 +113,11 @@ export declare class Seal {
109
113
  */
110
114
  private verify;
111
115
  private stateFromLease;
116
+ /** machineName: the name to show the vendor for this device. Nothing is sent when the app gives none (host names often hold a person's name). */
112
117
  activate(licenseKey: string, machineName?: string): Promise<LicenseState>;
113
118
  check(): Promise<LicenseState>;
119
+ /** The state from the saved record when the server gave no usable answer; a usable lease moves lastSeen forward. */
120
+ private offlineCheck;
114
121
  /**
115
122
  * Decrypts data you encrypted for a feature (encryptForFeature in @carchalabs/seal-core, with the
116
123
  * feature's content key from the console). Works offline: it uses the saved lease, which must be valid
package/dist/index.js CHANGED
@@ -41,6 +41,12 @@ const MAX_COMPONENTS = 32;
41
41
  * re-activate), so the key is kept and the next successful online check restores the license on its own. */
42
42
  const FORGET_KEY = new Set(['invalid_key', 'license_revoked']);
43
43
  const CLOCK_TOLERANCE_SECONDS = 24 * 3600;
44
+ /**
45
+ * A check-in answered 2xx whose lease fails for one of these reasons did not come from this app's license server for
46
+ * this device (a TLS-inspecting proxy's or captive portal's page, say): it is treated as no answer, and the saved lease
47
+ * is kept. A lease that fails only on time (not_yet_valid, expired, revalidation_required) is the server's, and is used.
48
+ */
49
+ const NOT_A_LEASE_FOR_THIS_DEVICE = new Set(['malformed', 'unsupported_algorithm', 'wrong_type', 'unknown_key', 'bad_signature', 'wrong_issuer', 'wrong_product', 'wrong_device']);
44
50
  const DEFAULT_GRACE_DAYS = 7;
45
51
  const CLOCK_MESSAGE = 'The date and time on this computer look wrong. Correct them, then connect to the internet.';
46
52
  class LicenseError extends Error {
@@ -54,6 +60,26 @@ class LicenseError extends Error {
54
60
  }
55
61
  }
56
62
  exports.LicenseError = LicenseError;
63
+ /**
64
+ * Refuses a server address that would send requests in plain text (OWASP ASVS 4.1.2, 12.2.1): every request
65
+ * carries the license key and the device's fingerprint. http:// is accepted for this computer only, where a server
66
+ * under development runs; `localhost` and the loopback addresses do not leave the machine.
67
+ */
68
+ function checkServerUrl(serverUrl) {
69
+ let url;
70
+ try {
71
+ url = new URL(serverUrl);
72
+ }
73
+ catch {
74
+ throw new LicenseError('invalid_server_url', 'serverUrl is not a valid URL.');
75
+ }
76
+ if (url.protocol === 'https:')
77
+ return;
78
+ const loopback = url.hostname === 'localhost' || url.hostname === '[::1]' || /^127(\.\d{1,3}){3}$/.test(url.hostname);
79
+ if (url.protocol === 'http:' && loopback)
80
+ return;
81
+ throw new LicenseError('insecure_server_url', 'serverUrl must start with https:// (http:// only for localhost).');
82
+ }
57
83
  const REASON_TEXT = {
58
84
  malformed: 'The saved license is damaged. Please activate again.',
59
85
  bad_signature: 'The saved license was modified. Please activate again.',
@@ -68,6 +94,27 @@ const REASON_TEXT = {
68
94
  revalidation_required: 'Connect to the internet to confirm your license.',
69
95
  };
70
96
  const toIso = (seconds) => new Date(seconds * 1000).toISOString();
97
+ /** A saved record of the shape save() writes, keeping only its known fields; null for anything else. */
98
+ function parseStored(value) {
99
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
100
+ return null;
101
+ const v = value;
102
+ if (typeof v.licenseKey !== 'string')
103
+ return null;
104
+ const stored = { licenseKey: v.licenseKey };
105
+ if (typeof v.token === 'string')
106
+ stored.token = v.token;
107
+ if (typeof v.lastSeen === 'number' && Number.isFinite(v.lastSeen))
108
+ stored.lastSeen = v.lastSeen;
109
+ const r = v.refused;
110
+ if (r && typeof r.code === 'string' && typeof r.message === 'string' && typeof r.at === 'number')
111
+ stored.refused = { code: r.code, message: r.message, at: r.at };
112
+ if (Array.isArray(v.notices))
113
+ stored.notices = v.notices.filter((n) => !!n && typeof n.code === 'string');
114
+ if (v.offline === true)
115
+ stored.offline = true;
116
+ return stored;
117
+ }
71
118
  function noticesFrom(response) {
72
119
  const list = Array.isArray(response?.notices) ? response.notices.filter((n) => n && typeof n.code === 'string') : [];
73
120
  return list.length ? { notices: list } : {};
@@ -83,6 +130,7 @@ class Seal {
83
130
  deviceKeyCache;
84
131
  constructor(opts) {
85
132
  this.opts = opts;
133
+ checkServerUrl(opts.serverUrl);
86
134
  this.file = (0, node_path_1.join)(opts.storageDir, 'license.dat');
87
135
  this.keys = (0, seal_core_1.keySet)(Array.isArray(opts.publicKey) ? opts.publicKey : [opts.publicKey]);
88
136
  }
@@ -132,20 +180,31 @@ class Seal {
132
180
  })();
133
181
  return this.hardwareCache.then((report) => report && report.components.length ? { components: report.components.slice(0, MAX_COMPONENTS), vm: report.vm === true } : {});
134
182
  }
183
+ /** The saved record; null when there is none, or it cannot be read or is not a record (as no license). */
135
184
  async load() {
136
185
  try {
137
186
  const buf = await (0, promises_1.readFile)(this.file);
138
187
  const text = this.opts.secureStore ? await this.opts.secureStore.decrypt(buf) : buf.toString('utf8');
139
- return JSON.parse(text);
188
+ return parseStored(JSON.parse(text));
140
189
  }
141
190
  catch {
142
191
  return null;
143
192
  }
144
193
  }
194
+ /** Replaces license.dat whole: written to license.dat.tmp, then renamed over it, so a crash or full disk mid-write
195
+ * leaves the previous record. */
145
196
  async save(stored) {
146
197
  await (0, promises_1.mkdir)(this.opts.storageDir, { recursive: true });
147
198
  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 });
199
+ const temp = this.file + '.tmp';
200
+ try {
201
+ await (0, promises_1.writeFile)(temp, this.opts.secureStore ? await this.opts.secureStore.encrypt(text) : text, { mode: 0o600, flush: true });
202
+ await (0, promises_1.rename)(temp, this.file);
203
+ }
204
+ catch (e) {
205
+ await (0, promises_1.rm)(temp, { force: true }).catch(() => { });
206
+ throw e;
207
+ }
149
208
  }
150
209
  async clear() {
151
210
  await (0, promises_1.rm)(this.file, { force: true });
@@ -157,6 +216,9 @@ class Seal {
157
216
  method: 'POST',
158
217
  headers: { 'Content-Type': 'application/json' },
159
218
  body: JSON.stringify(body),
219
+ // A redirect is refused, not followed: it could take the request, license key included, to another
220
+ // address or to http:// (ASVS 4.1.2). The server answers its API at the configured address.
221
+ redirect: 'error',
160
222
  signal: AbortSignal.timeout(this.opts.requestTimeoutMs ?? 8000),
161
223
  });
162
224
  }
@@ -271,14 +333,15 @@ class Seal {
271
333
  }
272
334
  return this.emptyState('invalid', offline, { reason: strict.reason, message: REASON_TEXT[strict.reason], keyHint });
273
335
  }
274
- async activate(licenseKey, machineName = (0, node_os_1.hostname)()) {
336
+ /** machineName: the name to show the vendor for this device. Nothing is sent when the app gives none (host names often hold a person's name). */
337
+ async activate(licenseKey, machineName) {
275
338
  const fingerprint = await this.fingerprint();
276
339
  const key = licenseKey.trim().toUpperCase();
277
340
  const response = await this.post('/v1/activate', {
278
341
  licenseKey: key,
279
342
  product: this.opts.product,
280
343
  fingerprint,
281
- machineName: machineName.slice(0, 80),
344
+ machineName: machineName?.slice(0, 80),
282
345
  platform: (0, node_os_1.platform)(),
283
346
  appVersion: this.opts.appVersion,
284
347
  sdkVersion: exports.SDK_VERSION,
@@ -313,8 +376,9 @@ class Seal {
313
376
  }
314
377
  return state;
315
378
  }
379
+ let response;
316
380
  try {
317
- const response = await this.post('/v1/validate', {
381
+ response = await this.post('/v1/validate', {
318
382
  licenseKey: stored.licenseKey,
319
383
  product: this.opts.product,
320
384
  fingerprint: this.fingerprintCache,
@@ -323,30 +387,42 @@ class Seal {
323
387
  ...(await this.hardware()),
324
388
  ...this.deviceKey(),
325
389
  });
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
390
  }
330
391
  catch (e) {
331
- const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
332
392
  if (e instanceof LicenseError && DEFINITIVE.has(e.code)) {
333
393
  // Persist the refusal: drop the signed lease so going offline cannot bring the license back.
334
394
  if (FORGET_KEY.has(e.code))
335
395
  await this.clear();
336
396
  else
337
397
  await this.save({ licenseKey: stored.licenseKey, lastSeen: stored.lastSeen, refused: { code: e.code, message: e.message, at: this.nowSec() } });
398
+ const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
338
399
  return this.emptyState('invalid', false, { reason: e.code, message: e.message, keyHint });
339
400
  }
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()) });
401
+ return this.offlineCheck(stored);
402
+ }
403
+ if (typeof response?.token === 'string') {
404
+ const fresh = { licenseKey: stored.licenseKey, token: response.token, lastSeen: this.nowSec(), ...noticesFrom(response) };
405
+ const state = this.stateFromLease(fresh, false);
406
+ if (!(state.status === 'invalid' && NOT_A_LEASE_FOR_THIS_DEVICE.has(state.reason ?? ''))) {
407
+ await this.save(fresh);
408
+ return state;
347
409
  }
348
- return state;
349
410
  }
411
+ // A 2xx without a lease from this server for this device: as no answer.
412
+ return this.offlineCheck(stored);
413
+ }
414
+ /** The state from the saved record when the server gave no usable answer; a usable lease moves lastSeen forward. */
415
+ async offlineCheck(stored) {
416
+ if (!stored.token) {
417
+ const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
418
+ const refused = stored.refused ?? { code: 'not_activated', message: 'This device is not activated for this license' };
419
+ return this.emptyState('invalid', true, { reason: refused.code, message: refused.message, keyHint });
420
+ }
421
+ const state = this.stateFromLease({ ...stored, token: stored.token }, true);
422
+ if (state.status === 'valid' || state.status === 'grace') {
423
+ await this.save({ ...stored, lastSeen: Math.max(stored.lastSeen ?? 0, this.nowSec()) });
424
+ }
425
+ return state;
350
426
  }
351
427
  /**
352
428
  * Decrypts data you encrypted for a feature (encryptForFeature in @carchalabs/seal-core, with the
@@ -442,13 +518,13 @@ class Seal {
442
518
  * POST /v1/offline/activate (or its offline activation page). It holds what activate() would send:
443
519
  * the license key, this device's fingerprint and hashed hardware parts, never raw serial numbers.
444
520
  */
445
- async offlineRequest(licenseKey, machineName = (0, node_os_1.hostname)()) {
521
+ async offlineRequest(licenseKey, machineName) {
446
522
  const fingerprint = await this.fingerprint();
447
523
  const activation = {
448
524
  licenseKey: licenseKey.trim().toUpperCase(),
449
525
  product: this.opts.product,
450
526
  fingerprint,
451
- machineName: machineName.slice(0, 80),
527
+ machineName: machineName?.slice(0, 80),
452
528
  platform: (0, node_os_1.platform)(),
453
529
  appVersion: this.opts.appVersion,
454
530
  sdkVersion: exports.SDK_VERSION,
package/dist/index.js.map CHANGED
@@ -1 +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,GA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;YAAE,OAAO;QACpB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBAChC,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO;gBAC1B,WAAW,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE;gBACrC,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;aAC3B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,YAAY,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;gBAAE,MAAM,CAAC,CAAC;QACxG,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,KAAmB,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;AAvdD,oBAudC;AAGgB,0BAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carchalabs/seal-electron",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Carcha Seal (formerly LicenseKit) SDK for the Electron main process and Node: activation, offline verification, grace period",
5
5
  "keywords": ["electron", "licensing", "license-key", "software-licensing", "offline-licensing", "node-locked", "ed25519", "jws", "carcha-seal"],
6
6
  "homepage": "https://seal.carchalabs.com/docs/",
@@ -15,12 +15,12 @@
15
15
  "test": "node --no-warnings=ExperimentalWarning --test dist/*.test.js"
16
16
  },
17
17
  "dependencies": {
18
- "@carchalabs/seal-core": "0.4.0"
18
+ "@carchalabs/seal-core": "0.5.0"
19
19
  },
20
20
  "optionalDependencies": {
21
- "@carchalabs/seal-hwid": "0.3.0"
21
+ "@carchalabs/seal-hwid": "0.4.0"
22
22
  },
23
23
  "engines": { "node": ">=22.13" },
24
24
  "publishConfig": { "access": "public" },
25
- "license": "MIT"
25
+ "license": "SEE LICENSE IN LICENSE"
26
26
  }
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { KeyObject } from 'node:crypto';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
- import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
3
+ import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
4
4
  import { createRequire } from 'node:module';
5
- import { hostname, platform } from 'node:os';
5
+ import { platform } from 'node:os';
6
6
  import { dirname, join, resolve } from 'node:path';
7
7
  import { compileFunction } from 'node:vm';
8
8
  import { decodeLease, decryptFeature, hashFingerprint, keySet, LeaseClaims, LeaseFailure, LeaseVerifyOptions, LeaseVerifyResult, verifyLease } from '@carchalabs/seal-core';
@@ -59,6 +59,7 @@ export interface SecureStore {
59
59
  }
60
60
 
61
61
  export interface SealOptions {
62
+ /** The license server: https://, or http:// on this computer only (localhost, 127.x.x.x, [::1]). */
62
63
  serverUrl: string;
63
64
  product: string;
64
65
  publicKey: string | string[];
@@ -138,6 +139,12 @@ const MAX_COMPONENTS = 32;
138
139
  * re-activate), so the key is kept and the next successful online check restores the license on its own. */
139
140
  const FORGET_KEY = new Set(['invalid_key', 'license_revoked']);
140
141
  const CLOCK_TOLERANCE_SECONDS = 24 * 3600;
142
+ /**
143
+ * A check-in answered 2xx whose lease fails for one of these reasons did not come from this app's license server for
144
+ * this device (a TLS-inspecting proxy's or captive portal's page, say): it is treated as no answer, and the saved lease
145
+ * is kept. A lease that fails only on time (not_yet_valid, expired, revalidation_required) is the server's, and is used.
146
+ */
147
+ const NOT_A_LEASE_FOR_THIS_DEVICE = new Set(['malformed', 'unsupported_algorithm', 'wrong_type', 'unknown_key', 'bad_signature', 'wrong_issuer', 'wrong_product', 'wrong_device']);
141
148
  const DEFAULT_GRACE_DAYS = 7;
142
149
  const CLOCK_MESSAGE = 'The date and time on this computer look wrong. Correct them, then connect to the internet.';
143
150
 
@@ -152,6 +159,24 @@ export class LicenseError extends Error {
152
159
  }
153
160
  }
154
161
 
162
+ /**
163
+ * Refuses a server address that would send requests in plain text (OWASP ASVS 4.1.2, 12.2.1): every request
164
+ * carries the license key and the device's fingerprint. http:// is accepted for this computer only, where a server
165
+ * under development runs; `localhost` and the loopback addresses do not leave the machine.
166
+ */
167
+ function checkServerUrl(serverUrl: string): void {
168
+ let url: URL;
169
+ try {
170
+ url = new URL(serverUrl);
171
+ } catch {
172
+ throw new LicenseError('invalid_server_url', 'serverUrl is not a valid URL.');
173
+ }
174
+ if (url.protocol === 'https:') return;
175
+ const loopback = url.hostname === 'localhost' || url.hostname === '[::1]' || /^127(\.\d{1,3}){3}$/.test(url.hostname);
176
+ if (url.protocol === 'http:' && loopback) return;
177
+ throw new LicenseError('insecure_server_url', 'serverUrl must start with https:// (http:// only for localhost).');
178
+ }
179
+
155
180
  const REASON_TEXT: Record<LeaseFailure, string> = {
156
181
  malformed: 'The saved license is damaged. Please activate again.',
157
182
  bad_signature: 'The saved license was modified. Please activate again.',
@@ -168,6 +193,21 @@ const REASON_TEXT: Record<LeaseFailure, string> = {
168
193
 
169
194
  const toIso = (seconds: number) => new Date(seconds * 1000).toISOString();
170
195
 
196
+ /** A saved record of the shape save() writes, keeping only its known fields; null for anything else. */
197
+ function parseStored(value: unknown): Stored | null {
198
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) return null;
199
+ const v = value as Record<string, unknown>;
200
+ if (typeof v.licenseKey !== 'string') return null;
201
+ const stored: Stored = { licenseKey: v.licenseKey };
202
+ if (typeof v.token === 'string') stored.token = v.token;
203
+ if (typeof v.lastSeen === 'number' && Number.isFinite(v.lastSeen)) stored.lastSeen = v.lastSeen;
204
+ const r = v.refused as Record<string, unknown> | undefined;
205
+ if (r && typeof r.code === 'string' && typeof r.message === 'string' && typeof r.at === 'number') stored.refused = { code: r.code, message: r.message, at: r.at };
206
+ if (Array.isArray(v.notices)) stored.notices = v.notices.filter((n): n is LicenseNotice => !!n && typeof n.code === 'string');
207
+ if (v.offline === true) stored.offline = true;
208
+ return stored;
209
+ }
210
+
171
211
  function noticesFrom(response: any): { notices?: LicenseNotice[] } {
172
212
  const list = Array.isArray(response?.notices) ? response.notices.filter((n: any) => n && typeof n.code === 'string') : [];
173
213
  return list.length ? { notices: list } : {};
@@ -183,6 +223,7 @@ export class Seal {
183
223
  private deviceKeyCache?: string | null;
184
224
 
185
225
  constructor(private readonly opts: SealOptions) {
226
+ checkServerUrl(opts.serverUrl);
186
227
  this.file = join(opts.storageDir, 'license.dat');
187
228
  this.keys = keySet(Array.isArray(opts.publicKey) ? opts.publicKey : [opts.publicKey]);
188
229
  }
@@ -234,20 +275,30 @@ export class Seal {
234
275
  );
235
276
  }
236
277
 
278
+ /** The saved record; null when there is none, or it cannot be read or is not a record (as no license). */
237
279
  private async load(): Promise<Stored | null> {
238
280
  try {
239
281
  const buf = await readFile(this.file);
240
282
  const text = this.opts.secureStore ? await this.opts.secureStore.decrypt(buf) : buf.toString('utf8');
241
- return JSON.parse(text);
283
+ return parseStored(JSON.parse(text));
242
284
  } catch {
243
285
  return null;
244
286
  }
245
287
  }
246
288
 
289
+ /** Replaces license.dat whole: written to license.dat.tmp, then renamed over it, so a crash or full disk mid-write
290
+ * leaves the previous record. */
247
291
  private async save(stored: Stored) {
248
292
  await mkdir(this.opts.storageDir, { recursive: true });
249
293
  const text = JSON.stringify(stored);
250
- await writeFile(this.file, this.opts.secureStore ? await this.opts.secureStore.encrypt(text) : text, { mode: 0o600 });
294
+ const temp = this.file + '.tmp';
295
+ try {
296
+ await writeFile(temp, this.opts.secureStore ? await this.opts.secureStore.encrypt(text) : text, { mode: 0o600, flush: true });
297
+ await rename(temp, this.file);
298
+ } catch (e) {
299
+ await rm(temp, { force: true }).catch(() => {});
300
+ throw e;
301
+ }
251
302
  }
252
303
 
253
304
  private async clear() {
@@ -261,6 +312,9 @@ export class Seal {
261
312
  method: 'POST',
262
313
  headers: { 'Content-Type': 'application/json' },
263
314
  body: JSON.stringify(body),
315
+ // A redirect is refused, not followed: it could take the request, license key included, to another
316
+ // address or to http:// (ASVS 4.1.2). The server answers its API at the configured address.
317
+ redirect: 'error',
264
318
  signal: AbortSignal.timeout(this.opts.requestTimeoutMs ?? 8000),
265
319
  });
266
320
  } catch {
@@ -376,14 +430,15 @@ export class Seal {
376
430
  return this.emptyState('invalid', offline, { reason: strict.reason, message: REASON_TEXT[strict.reason], keyHint });
377
431
  }
378
432
 
379
- async activate(licenseKey: string, machineName = hostname()): Promise<LicenseState> {
433
+ /** machineName: the name to show the vendor for this device. Nothing is sent when the app gives none (host names often hold a person's name). */
434
+ async activate(licenseKey: string, machineName?: string): Promise<LicenseState> {
380
435
  const fingerprint = await this.fingerprint();
381
436
  const key = licenseKey.trim().toUpperCase();
382
437
  const response = await this.post('/v1/activate', {
383
438
  licenseKey: key,
384
439
  product: this.opts.product,
385
440
  fingerprint,
386
- machineName: machineName.slice(0, 80),
441
+ machineName: machineName?.slice(0, 80),
387
442
  platform: platform(),
388
443
  appVersion: this.opts.appVersion,
389
444
  sdkVersion: SDK_VERSION,
@@ -415,8 +470,9 @@ export class Seal {
415
470
  }
416
471
  return state;
417
472
  }
473
+ let response: any;
418
474
  try {
419
- const response = await this.post('/v1/validate', {
475
+ response = await this.post('/v1/validate', {
420
476
  licenseKey: stored.licenseKey,
421
477
  product: this.opts.product,
422
478
  fingerprint: this.fingerprintCache,
@@ -425,27 +481,40 @@ export class Seal {
425
481
  ...(await this.hardware()),
426
482
  ...this.deviceKey(),
427
483
  });
428
- const fresh: Leased = { licenseKey: stored.licenseKey, token: response.token, lastSeen: this.nowSec(), ...noticesFrom(response) };
429
- await this.save(fresh);
430
- return this.stateFromLease(fresh, false);
431
484
  } catch (e) {
432
- const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
433
485
  if (e instanceof LicenseError && DEFINITIVE.has(e.code)) {
434
486
  // Persist the refusal: drop the signed lease so going offline cannot bring the license back.
435
487
  if (FORGET_KEY.has(e.code)) await this.clear();
436
488
  else await this.save({ licenseKey: stored.licenseKey, lastSeen: stored.lastSeen, refused: { code: e.code, message: e.message, at: this.nowSec() } });
489
+ const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
437
490
  return this.emptyState('invalid', false, { reason: e.code, message: e.message, keyHint });
438
491
  }
439
- if (!stored.token) {
440
- const refused = stored.refused ?? { code: 'not_activated', message: 'This device is not activated for this license' };
441
- return this.emptyState('invalid', true, { reason: refused.code, message: refused.message, keyHint });
442
- }
443
- const state = this.stateFromLease({ ...stored, token: stored.token }, true);
444
- if (state.status === 'valid' || state.status === 'grace') {
445
- await this.save({ ...stored, lastSeen: Math.max(stored.lastSeen ?? 0, this.nowSec()) });
492
+ return this.offlineCheck(stored);
493
+ }
494
+ if (typeof response?.token === 'string') {
495
+ const fresh: Leased = { licenseKey: stored.licenseKey, token: response.token, lastSeen: this.nowSec(), ...noticesFrom(response) };
496
+ const state = this.stateFromLease(fresh, false);
497
+ if (!(state.status === 'invalid' && NOT_A_LEASE_FOR_THIS_DEVICE.has(state.reason ?? ''))) {
498
+ await this.save(fresh);
499
+ return state;
446
500
  }
447
- return state;
448
501
  }
502
+ // A 2xx without a lease from this server for this device: as no answer.
503
+ return this.offlineCheck(stored);
504
+ }
505
+
506
+ /** The state from the saved record when the server gave no usable answer; a usable lease moves lastSeen forward. */
507
+ private async offlineCheck(stored: Stored): Promise<LicenseState> {
508
+ if (!stored.token) {
509
+ const keyHint = `${stored.licenseKey.slice(0, 7)}…${stored.licenseKey.slice(-4)}`;
510
+ const refused = stored.refused ?? { code: 'not_activated', message: 'This device is not activated for this license' };
511
+ return this.emptyState('invalid', true, { reason: refused.code, message: refused.message, keyHint });
512
+ }
513
+ const state = this.stateFromLease({ ...stored, token: stored.token }, true);
514
+ if (state.status === 'valid' || state.status === 'grace') {
515
+ await this.save({ ...stored, lastSeen: Math.max(stored.lastSeen ?? 0, this.nowSec()) });
516
+ }
517
+ return state;
449
518
  }
450
519
 
451
520
  /**
@@ -541,13 +610,13 @@ export class Seal {
541
610
  * POST /v1/offline/activate (or its offline activation page). It holds what activate() would send:
542
611
  * the license key, this device's fingerprint and hashed hardware parts, never raw serial numbers.
543
612
  */
544
- async offlineRequest(licenseKey: string, machineName = hostname()): Promise<string> {
613
+ async offlineRequest(licenseKey: string, machineName?: string): Promise<string> {
545
614
  const fingerprint = await this.fingerprint();
546
615
  const activation = {
547
616
  licenseKey: licenseKey.trim().toUpperCase(),
548
617
  product: this.opts.product,
549
618
  fingerprint,
550
- machineName: machineName.slice(0, 80),
619
+ machineName: machineName?.slice(0, 80),
551
620
  platform: platform(),
552
621
  appVersion: this.opts.appVersion,
553
622
  sdkVersion: SDK_VERSION,