@camstack/system 1.2.113 → 1.2.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon-runner.js +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.d.ts +1 -1
- package/dist/builtins/alerts/alerts.addon.js +6 -1
- package/dist/builtins/alerts/alerts.addon.mjs +6 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
- package/dist/builtins/local-network/local-network.addon.d.ts +33 -1
- package/dist/builtins/local-network/local-network.addon.js +87 -2
- package/dist/builtins/local-network/local-network.addon.mjs +87 -3
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-Duz_uJSQ.mjs → dist-Drb54SZD.mjs} +89 -5
- package/dist/{dist-B2CtwVW2.js → dist-iAwSA2_f.js} +89 -5
- package/dist/index.js +438 -47
- package/dist/index.mjs +435 -50
- package/dist/{retired-settings-keys-BtVT2f6O.mjs → retired-settings-keys-Dz5-7gjt.mjs} +1 -1
- package/dist/{retired-settings-keys-CYDGGkyM.js → retired-settings-keys-OfhqQio4.js} +1 -1
- package/dist/tls/cert-evaluation.d.ts +41 -0
- package/dist/tls/cert-identity.d.ts +37 -0
- package/dist/tls/cert-manager.d.ts +60 -6
- package/dist/tls/cert-openssl.d.ts +23 -0
- package/dist/tls/index.d.ts +3 -1
- package/package.json +1 -1
- package/dist/{manifest-python-deps-MA_BZGBz.js → manifest-python-deps-CwBbX4Ut.js} +1 -1
- package/dist/{manifest-python-deps-Cb1ANt3i.mjs → manifest-python-deps-SGdbr9D5.mjs} +1 -1
|
@@ -1,26 +1,80 @@
|
|
|
1
|
+
import { CertRegenerationReason, evaluateExistingCert, MAX_LEAF_VALIDITY_DAYS } from './cert-evaluation.js';
|
|
2
|
+
import { CertIdentity, collectCertIdentity } from './cert-identity.js';
|
|
1
3
|
export interface TlsCertPair {
|
|
2
4
|
readonly cert: Buffer;
|
|
3
5
|
readonly key: Buffer;
|
|
4
6
|
}
|
|
5
7
|
export interface EnsureTlsResult {
|
|
8
|
+
/** Full chain — leaf then CA. This is what the listener serves. */
|
|
6
9
|
readonly certPath: string;
|
|
10
|
+
/** The leaf's private key. */
|
|
7
11
|
readonly keyPath: string;
|
|
12
|
+
/** The local root. **This** is the file an operator installs as trusted. */
|
|
13
|
+
readonly caCertPath: string;
|
|
14
|
+
readonly caKeyPath: string;
|
|
8
15
|
readonly generated: boolean;
|
|
16
|
+
/** Why it was reissued — `null` when the existing material was kept. */
|
|
17
|
+
readonly reason: CertRegenerationReason | null;
|
|
18
|
+
/** True when the ROOT rotated, i.e. trust granted by hand is now void. */
|
|
19
|
+
readonly caRotated: boolean;
|
|
20
|
+
readonly fingerprintSha256: string;
|
|
21
|
+
readonly caFingerprintSha256: string;
|
|
22
|
+
/** Fingerprint of the leaf this one replaced — `null` on a fresh install. */
|
|
23
|
+
readonly previousFingerprintSha256: string | null;
|
|
24
|
+
/** ISO timestamp at which the leaf stops being valid. */
|
|
25
|
+
readonly validTo: string;
|
|
26
|
+
readonly sans: readonly string[];
|
|
9
27
|
}
|
|
10
28
|
export interface CertOptions {
|
|
11
|
-
/** Common Name for the
|
|
29
|
+
/** Common Name for the leaf (default: 'camstack.local') */
|
|
12
30
|
readonly commonName?: string;
|
|
13
|
-
/**
|
|
31
|
+
/** Leaf validity in days. Clamped to `MAX_LEAF_VALIDITY_DAYS`. */
|
|
14
32
|
readonly validDays?: number;
|
|
15
|
-
/** Additional SANs (DNS names or IPs) */
|
|
33
|
+
/** Additional SANs (DNS names or IPs). Required coverage by definition. */
|
|
16
34
|
readonly extraSans?: readonly string[];
|
|
17
35
|
}
|
|
18
36
|
/**
|
|
19
|
-
* Ensure a
|
|
20
|
-
*
|
|
37
|
+
* Ensure the hub has a usable TLS identity under `<dataDir>/tls`, made of
|
|
38
|
+
* a long-lived local **root** (`camstack-ca.crt`) and a short **leaf**
|
|
39
|
+
* chained to it (`camstack.crt` = leaf + root, `camstack.key`).
|
|
40
|
+
*
|
|
41
|
+
* ## The regeneration rule (D227)
|
|
42
|
+
*
|
|
43
|
+
* Reissue happens when, and only when, the material on disk **cannot do
|
|
44
|
+
* its job**:
|
|
45
|
+
*
|
|
46
|
+
* - it is absent, unreadable, or the key does not match the certificate;
|
|
47
|
+
* - the root is absent (every pre-2026-08 install: one self-signed
|
|
48
|
+
* `CA:TRUE` leaf and no root) or is inside its renewal window;
|
|
49
|
+
* - the leaf is inside its 30-day renewal window;
|
|
50
|
+
* - the leaf lacks `extendedKeyUsage = serverAuth` — Apple's trustd
|
|
51
|
+
* rejects an app-supplied anchor without it;
|
|
52
|
+
* - the leaf is not actually issued by the root on disk;
|
|
53
|
+
* - the leaf's validity span exceeds {@link MAX_LEAF_VALIDITY_DAYS};
|
|
54
|
+
* - **a name or address the hub must answer for is missing from the SAN
|
|
55
|
+
* list** — a DHCP move, a new interface or a new hostname.
|
|
56
|
+
*
|
|
57
|
+
* And explicitly NOT when: the certificate names an address the machine
|
|
58
|
+
* no longer has (a superset still works — the check is one-directional),
|
|
59
|
+
* a volatile interface (docker/VPN/mesh) or a global-scope IPv6 address
|
|
60
|
+
* changed (SLAAC privacy addresses rotate daily), or a new build shipped.
|
|
61
|
+
*
|
|
62
|
+
* Every trigger is derived from the files plus the machine, so once a
|
|
63
|
+
* reissue clears them it clears them for good: the next boot returns
|
|
64
|
+
* `generated: false`. A certificate that moved on every boot would
|
|
65
|
+
* invalidate every trust an operator granted by hand — worse than the
|
|
66
|
+
* bugs this rule fixes.
|
|
67
|
+
*
|
|
68
|
+
* **The root is rotated only for root-level reasons.** SAN drift rotates
|
|
69
|
+
* the leaf alone, so trust granted to `camstack-ca.crt` survives every
|
|
70
|
+
* address change the hub will ever see.
|
|
21
71
|
*/
|
|
22
72
|
export declare function ensureTlsCert(dataDir: string, options?: CertOptions): Promise<EnsureTlsResult>;
|
|
23
73
|
/**
|
|
24
|
-
* Load TLS cert+key from files. Returns Buffers suitable for Node.js TLS
|
|
74
|
+
* Load TLS cert+key from files. Returns Buffers suitable for Node.js TLS
|
|
75
|
+
* options. `certPath` is a full chain, so the listener presents the local
|
|
76
|
+
* root alongside the leaf.
|
|
25
77
|
*/
|
|
26
78
|
export declare function loadTlsCert(certPath: string, keyPath: string): TlsCertPair;
|
|
79
|
+
export type { CertIdentity, CertRegenerationReason };
|
|
80
|
+
export { collectCertIdentity, evaluateExistingCert, MAX_LEAF_VALIDITY_DAYS };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CertIdentity } from './cert-identity.js';
|
|
2
|
+
/** Subject of the local root. Distinct from the leaf's CN by construction. */
|
|
3
|
+
export declare const CA_COMMON_NAME = "CamStack Local CA";
|
|
4
|
+
export interface CaMaterialPaths {
|
|
5
|
+
readonly caCertPath: string;
|
|
6
|
+
readonly caKeyPath: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LeafMaterialPaths {
|
|
9
|
+
readonly certPath: string;
|
|
10
|
+
readonly keyPath: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A local root: 10 years, `pathlen:0` so it can sign leaves and nothing
|
|
14
|
+
* else, and **no EKU** — Apple rejects an anchor asserting
|
|
15
|
+
* `anyExtendedKeyUsage`, and a root with no EKU constrains nothing.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateCa(tmpDir: string): Promise<CaMaterialPaths>;
|
|
18
|
+
/**
|
|
19
|
+
* A server leaf signed by the local root: `CA:FALSE`, and
|
|
20
|
+
* `extendedKeyUsage=serverAuth` — not `anyExtendedKeyUsage`, which
|
|
21
|
+
* Apple's `testAppTrustRoot_AnyEKU_AfterJul2019` asserts must fail.
|
|
22
|
+
*/
|
|
23
|
+
export declare function issueLeaf(tmpDir: string, ca: CaMaterialPaths, identity: CertIdentity, commonName: string, validDays: number): Promise<LeafMaterialPaths>;
|
package/dist/tls/index.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { CA_VALIDITY_DAYS, type CertEvaluationInput, LEAF_RENEWAL_WINDOW_DAYS, SERVER_AUTH_OID, } from './cert-evaluation.js';
|
|
2
|
+
export { type CertIdentity, type CertOptions, type CertRegenerationReason, collectCertIdentity, type EnsureTlsResult, ensureTlsCert, evaluateExistingCert, loadTlsCert, MAX_LEAF_VALIDITY_DAYS, type TlsCertPair, } from './cert-manager.js';
|
|
3
|
+
export { CA_COMMON_NAME } from './cert-openssl.js';
|
package/package.json
CHANGED
|
@@ -17,8 +17,8 @@ node_v8 = require_chunk.__toESM(node_v8);
|
|
|
17
17
|
let node_vm = require("node:vm");
|
|
18
18
|
node_vm = require_chunk.__toESM(node_vm);
|
|
19
19
|
let _camstack_types_addon = require("@camstack/types/addon");
|
|
20
|
-
let _trpc_client = require("@trpc/client");
|
|
21
20
|
let node_net = require("node:net");
|
|
21
|
+
let _trpc_client = require("@trpc/client");
|
|
22
22
|
//#region src/kernel/heap-watch.ts
|
|
23
23
|
/**
|
|
24
24
|
* heap-watch — hub-main's own memory, on the record, and returned to the OS.
|
|
@@ -13,8 +13,8 @@ import { createServer } from "node:http";
|
|
|
13
13
|
import * as v8 from "node:v8";
|
|
14
14
|
import * as vm from "node:vm";
|
|
15
15
|
import { BOOT_RECOVERY_BACKOFF_MS, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, readNodePin, scopeKey, sleep, withCapInputDefaults } from "@camstack/types/addon";
|
|
16
|
-
import { TRPCClientError, createTRPCClient } from "@trpc/client";
|
|
17
16
|
import { connect, createServer as createServer$1 } from "node:net";
|
|
17
|
+
import { TRPCClientError, createTRPCClient } from "@trpc/client";
|
|
18
18
|
//#region src/kernel/heap-watch.ts
|
|
19
19
|
/**
|
|
20
20
|
* heap-watch — hub-main's own memory, on the record, and returned to the OS.
|