@camstack/system 1.2.380 → 1.2.382
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 +4 -2
- package/dist/addon-runner.mjs +4 -2
- package/dist/addon-utils.js +1 -1
- package/dist/addon-utils.mjs +1 -1
- package/dist/auth/admin-token-manager.d.ts +75 -0
- package/dist/auth/api-key-manager.d.ts +1 -14
- package/dist/auth/auth-audit-log.d.ts +59 -0
- package/dist/auth/auth-manager.d.ts +28 -16
- package/dist/auth/cidr.d.ts +22 -0
- package/dist/auth/login-session-manager.d.ts +158 -0
- package/dist/auth/user-management-internal.d.ts +69 -0
- 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.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +14 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +291 -3631
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +284 -3617
- package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +36 -0
- package/dist/builtins/backup-orchestrator/manifest-store.d.ts +19 -1
- package/dist/builtins/backup-orchestrator/restore-archive.d.ts +24 -0
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- 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 +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-manager/device-aggregation.d.ts +12 -0
- package/dist/builtins/device-manager/device-form-secrets.d.ts +25 -0
- package/dist/builtins/device-manager/device-manager.addon.d.ts +2 -0
- package/dist/builtins/device-manager/device-manager.addon.js +165 -26
- package/dist/builtins/device-manager/device-manager.addon.mjs +165 -26
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +1108 -733
- package/dist/builtins/keychain/index.mjs +1108 -733
- package/dist/builtins/keychain/keychain-reset-trigger.d.ts +25 -0
- package/dist/builtins/keychain/keychain-service.d.ts +36 -3
- package/dist/builtins/keychain/keychain-store.d.ts +24 -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.d.ts +16 -0
- package/dist/builtins/local-auth/local-auth.addon.js +1021 -118
- package/dist/builtins/local-auth/local-auth.addon.mjs +1034 -141
- package/dist/builtins/local-network/local-network.addon.js +3 -3
- package/dist/builtins/local-network/local-network.addon.mjs +3 -3
- package/dist/builtins/loki-logging/index.js +97 -29
- package/dist/builtins/loki-logging/index.mjs +97 -29
- package/dist/builtins/loki-logging/loki-logging.addon.d.ts +7 -23
- package/dist/builtins/loki-logging/retire-enabled-flag.d.ts +23 -0
- 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 +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +2 -2
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +2 -2
- package/dist/builtins/system-backup/backup-encryption.d.ts +57 -0
- package/dist/builtins/system-backup/system-backup.service.d.ts +16 -1
- package/dist/builtins/system-config/cluster-secret-keeper.d.ts +7 -0
- package/dist/builtins/system-config/system-config.addon.d.ts +13 -3
- package/dist/builtins/system-config/system-config.addon.js +324 -38
- package/dist/builtins/system-config/system-config.addon.mjs +312 -39
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{child-cap-dispatch-CZeRUgYF.js → child-cap-dispatch-BrMdKHfp.js} +6 -3
- package/dist/{child-cap-dispatch-CpjohToR.mjs → child-cap-dispatch-WsYPNvnK.mjs} +10 -7
- package/dist/{cluster-secret-Dg0OOOSr.js → cluster-secret-BEPLh3LL.js} +1 -1
- package/dist/{cluster-secret-BDue-uJj.mjs → cluster-secret-DhPdZ0VA.mjs} +1 -1
- package/dist/{composition-sources-CHvLMrFI.js → composition-sources-C6ZynCZ2.js} +1 -1
- package/dist/{composition-sources-DT_uJwI3.mjs → composition-sources-XqRX51db.mjs} +1 -1
- package/dist/{dist-B9oFw2jh.mjs → dist-CP5TTjwd.mjs} +1713 -157
- package/dist/{dist-Cc6KOdY-.js → dist-tnAO12ak.js} +1754 -156
- package/dist/{event-loop-stall-monitor-mk6WGxir.js → event-loop-stall-monitor-9kR0sAPS.js} +15 -15
- package/dist/{event-loop-stall-monitor-anUH2IE1.mjs → event-loop-stall-monitor-WkssIXjq.mjs} +15 -15
- package/dist/{hub-cap-forward-CH6_VWVO.mjs → hub-cap-forward-CDiN1p98.mjs} +18 -2
- package/dist/{hub-cap-forward-COCmYaup.js → hub-cap-forward-W8oEm4ME.js} +23 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +3341 -79
- package/dist/index.mjs +3567 -354
- package/dist/{jwt-signing-key-Qhde8r82.mjs → jwt-signing-key-CAbozwvF.mjs} +1 -1
- package/dist/{jwt-signing-key-C2rE3wH6.js → jwt-signing-key-Dgf8sIXY.js} +1 -1
- package/dist/kernel/index.d.ts +12 -0
- package/dist/kernel/moleculer/broker-factory.d.ts +8 -1
- package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +1 -0
- package/dist/kernel/moleculer/hub-service.d.ts +9 -0
- package/dist/kernel/moleculer/mesh-access-middleware.d.ts +28 -0
- package/dist/kernel/moleculer/mesh-auth-mode.d.ts +64 -0
- package/dist/kernel/moleculer/mesh-authenticator.d.ts +71 -0
- package/dist/kernel/moleculer/mesh-auto-enforce.d.ts +26 -0
- package/dist/kernel/moleculer/mesh-join-client.d.ts +51 -0
- package/dist/kernel/moleculer/mesh-join-proof.d.ts +39 -0
- package/dist/kernel/system-settings-policy.d.ts +4 -3
- package/dist/kernel/transport/hub-cap-forward.d.ts +14 -3
- package/dist/kernel/transport/index.d.ts +1 -1
- package/dist/restore-archive-BV39nY46.mjs +4045 -0
- package/dist/restore-archive-CbvrfPuB.js +4139 -0
- package/dist/{retired-settings-keys-YOOKLA3v.js → retired-settings-keys-4bHpL-0m.js} +1 -1
- package/dist/{retired-settings-keys-DlZ3VV6x.mjs → retired-settings-keys-CzpIkwS-.mjs} +1 -1
- package/dist/{tls-CJHogwTl.mjs → tls-4cRH24Id.mjs} +3 -3
- package/package.json +1 -1
- package/dist/{tls-CCMX7MjX.js → tls-CljF057D.js} +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ISettingsStoreProvider } from '@camstack/types';
|
|
2
|
+
/**
|
|
3
|
+
* @durable class=config owner=backup-orchestrator
|
|
4
|
+
* write="`setupEncryption` inserts one row per generated key and retires the
|
|
5
|
+
* previous active row; `disableEncryption` retires the active row"
|
|
6
|
+
* retention="none — one small row per key ever generated; a retired row
|
|
7
|
+
* names the key older archives need"
|
|
8
|
+
*/
|
|
9
|
+
export declare const BACKUP_ENCRYPTION_KEYS_COLLECTION = "backup_encryption_keys";
|
|
10
|
+
export interface BackupEncryptionKeyRecord {
|
|
11
|
+
readonly keyId: string;
|
|
12
|
+
readonly publicKey: string;
|
|
13
|
+
readonly createdAt: number;
|
|
14
|
+
readonly retiredAt: number | null;
|
|
15
|
+
}
|
|
16
|
+
type Store = Pick<ISettingsStoreProvider, 'declareCollection' | 'query' | 'insert' | 'deleteWhere'>;
|
|
17
|
+
export declare class BackupEncryptionKeyStore {
|
|
18
|
+
private readonly store;
|
|
19
|
+
private readonly now;
|
|
20
|
+
private declared;
|
|
21
|
+
constructor(store: Store, now?: () => number);
|
|
22
|
+
private ensureDeclared;
|
|
23
|
+
/** Every key, newest first. */
|
|
24
|
+
list(): Promise<readonly BackupEncryptionKeyRecord[]>;
|
|
25
|
+
/** The key new archives are encrypted to; `null` = encryption off. */
|
|
26
|
+
active(): Promise<BackupEncryptionKeyRecord | null>;
|
|
27
|
+
/** Make `publicKey` the active key; the previous one is retired, kept listed. */
|
|
28
|
+
activate(input: {
|
|
29
|
+
readonly publicKey: string;
|
|
30
|
+
}): Promise<BackupEncryptionKeyRecord>;
|
|
31
|
+
/** Encryption off: the active key is retired. Archives already made keep needing it. */
|
|
32
|
+
disable(): Promise<void>;
|
|
33
|
+
private retireActive;
|
|
34
|
+
private write;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -9,8 +9,19 @@ export interface ManifestArchiveEntry {
|
|
|
9
9
|
readonly createdAt: number;
|
|
10
10
|
readonly sizeBytes: number;
|
|
11
11
|
readonly label?: string;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Snapshot of the embedded `.camstack-backup-manifest.json`. For an
|
|
14
|
+
* ENCRYPTED archive only its outline (locations, totals, no file list): the
|
|
15
|
+
* destination holds this index in clear, and the file list stays inside the
|
|
16
|
+
* ciphertext.
|
|
17
|
+
*/
|
|
13
18
|
readonly manifest: ArchiveManifest;
|
|
19
|
+
/** Present when the archive is encrypted to a backup key. */
|
|
20
|
+
readonly encryption?: ManifestArchiveEncryption;
|
|
21
|
+
}
|
|
22
|
+
export interface ManifestArchiveEncryption {
|
|
23
|
+
readonly scheme: string;
|
|
24
|
+
readonly keyId: string;
|
|
14
25
|
}
|
|
15
26
|
export interface LocationBackupManifest {
|
|
16
27
|
readonly version: 1;
|
|
@@ -38,6 +49,12 @@ export declare function writeLocationManifest(api: ManifestStorageApi, locationI
|
|
|
38
49
|
* stance as the legacy `LocalBackupService.ensureManifestsLoaded`.
|
|
39
50
|
*/
|
|
40
51
|
export declare function parseManifestBytes(bytes: Uint8Array): LocationBackupManifest;
|
|
52
|
+
/**
|
|
53
|
+
* What the destination's clear-text index may say about an encrypted archive:
|
|
54
|
+
* the outline a restore needs (locations, sizes, the snapshot promise) — not
|
|
55
|
+
* the list of files, which stays inside the ciphertext.
|
|
56
|
+
*/
|
|
57
|
+
export declare function outlineOfManifest(manifest: ArchiveManifest): ArchiveManifest;
|
|
41
58
|
/**
|
|
42
59
|
* Build a `ManifestArchiveEntry` from the raw inputs collected during
|
|
43
60
|
* a successful upload. Pure transform — no I/O — kept here so the
|
|
@@ -50,6 +67,7 @@ export declare function buildArchiveEntry(input: {
|
|
|
50
67
|
sizeBytes: number;
|
|
51
68
|
label?: string;
|
|
52
69
|
manifest: ArchiveManifest;
|
|
70
|
+
encryption?: ManifestArchiveEncryption;
|
|
53
71
|
}): ManifestArchiveEntry;
|
|
54
72
|
/**
|
|
55
73
|
* Pure retention split: given an archive list and the operator's
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** An encrypted backup was asked to restore without its key. */
|
|
2
|
+
export declare class BackupKeyRequiredError extends Error {
|
|
3
|
+
readonly keyId: string;
|
|
4
|
+
constructor(keyId: string);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Before downloading gigabytes: does the operator's key fit what the
|
|
8
|
+
* destination's manifest says the archive needs? `archiveKeyId` undefined =
|
|
9
|
+
* the manifest records no encryption (the header check after the download
|
|
10
|
+
* remains the authority).
|
|
11
|
+
*/
|
|
12
|
+
export declare function precheckRestoreKey(archiveKeyId: string | undefined, secretKey: string | undefined): void;
|
|
13
|
+
export interface PrepareRestoreInput {
|
|
14
|
+
/** The archive as downloaded from the destination. Consumed (deleted or renamed). */
|
|
15
|
+
readonly downloaded: string;
|
|
16
|
+
/** Where the restore marker will point: a plain `.tar.gz`. */
|
|
17
|
+
readonly target: string;
|
|
18
|
+
readonly secretKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PreparedRestore {
|
|
21
|
+
readonly encrypted: boolean;
|
|
22
|
+
readonly keyId?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function prepareRestoreArchive(input: PrepareRestoreInput): Promise<PreparedRestore>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-tnAO12ak.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as CalendarPreferencesSchema, tt as calendarsCapability, ur as BaseAddon } from "../../dist-CP5TTjwd.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-tnAO12ak.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let _camstack_types_node = require("@camstack/types/node");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ar as hydrateSchema, N as MOTION_CLOSE_AFTER_MS, Pn as snapshotCapability, Tr as createEvent, Yn as buildFfmpegArgs, b as DeclaredDevices, cr as DeviceType, ei as EventCategory, ht as declarationOwnerNodeId, i as BaseDevice, in as memoizePinnedFfmpeg, lr as errMsg, nt as cameraGridLayoutCapability, or as DeviceFeature, sn as motionCapability, ur as BaseAddon, y as DERIVED_CAMERA_SILENCED_CAP_NAMES, zn as streamCatalogCapability } from "../../dist-CP5TTjwd.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { FfmpegProcess } from "@camstack/types/node";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_composition_sources = require("../../composition-sources-
|
|
6
|
+
const require_dist = require("../../dist-tnAO12ak.js");
|
|
7
|
+
const require_composition_sources = require("../../composition-sources-C6ZynCZ2.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/shared/device-state-changed.ts
|
|
10
10
|
/** Structural narrowing helper for untrusted bus payloads. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import { n as normalizedNativeOwner } from "../../composition-sources-
|
|
1
|
+
import { $ as buildCapabilityLookup, $n as compositionFeatureEnabled, At as expressionContainsBuiltinCall, Dt as evaluateCompositionField, Jn as COMPOSER_ADDON_ID, Qn as composedDeviceStableId, Tr as createEvent, Xn as cloneStatefulExpressionMemory, Zn as composedDeviceRef, ar as toExpressionValue, at as compositionFieldKey, b as DeclaredDevices, cr as DeviceType, ei as EventCategory, er as compositionItemFieldPath, i as BaseDevice, ir as disarmRoseMemory, it as composerCapability, l as COMPOSED_ITEM_FIXED_FIELDS, lr as errMsg, mn as planComposition, nr as compositionSourceKey, rr as createStatefulExpressionMemory, t as ALL_CAPABILITY_DEFINITIONS, tr as compositionSliceKey, ur as BaseAddon } from "../../dist-CP5TTjwd.mjs";
|
|
2
|
+
import { n as normalizedNativeOwner } from "../../composition-sources-XqRX51db.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/shared/device-state-changed.ts
|
|
5
5
|
/** Structural narrowing helper for untrusted bus payloads. */
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-tnAO12ak.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Qt as logDestinationCapability, ur as BaseAddon } from "../../dist-CP5TTjwd.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
4
|
-
const require_composition_sources = require("../../composition-sources-
|
|
3
|
+
const require_dist = require("../../dist-tnAO12ak.js");
|
|
4
|
+
const require_composition_sources = require("../../composition-sources-C6ZynCZ2.js");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
6
|
let _camstack_types_node = require("@camstack/types/node");
|
|
7
7
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as describeCompositionSources } from "../../composition-sources-
|
|
1
|
+
import { $ as buildCapabilityLookup, Ar as hydrateSchema, Cn as resolveCoreBlockFiles, Hn as validateComposition, Sn as resolveCoreBlockEntry, Zn as composedDeviceRef, b as DeclaredDevices, cn as normalizeCoreBlockWrite, ct as coreBlockComposition, d as CORE_BLOCKS_ADDON_ID, dt as coreBlocksCapability, f as CORE_BLOCK_ADDON_PREFIX, lr as errMsg, lt as coreBlockIdFromAddonId, m as CoreBlockSchema, mn as planComposition, nr as compositionSourceKey, ot as compositionSourceRefs, st as coreBlockAddonId, t as ALL_CAPABILITY_DEFINITIONS, u as COMPOSER_RUNNER_ID, ur as BaseAddon, ut as coreBlockSourceKind, yn as replacedFieldKeys, yt as describeComposableCaps } from "../../dist-CP5TTjwd.mjs";
|
|
2
|
+
import { t as describeCompositionSources } from "../../composition-sources-XqRX51db.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { customizationBlockName } from "@camstack/types/node";
|
|
@@ -12,6 +12,18 @@ export interface AggregationDeps {
|
|
|
12
12
|
readonly capabilityRegistry: ICapabilityRegistry | undefined;
|
|
13
13
|
readonly remoteNativeCaps: RemoteNativeCaps;
|
|
14
14
|
readonly bindingsDeps: BindingsDeps;
|
|
15
|
+
/**
|
|
16
|
+
* The keychain side of a driver's device form (D789): the STORED blob (its
|
|
17
|
+
* markers, never resolved), the device's declared secret paths, and the
|
|
18
|
+
* door's explicit clear. Without it a driver form carries what the driver
|
|
19
|
+
* hydrated and a clear cannot be applied.
|
|
20
|
+
*/
|
|
21
|
+
readonly deviceFormSecrets?: DeviceFormSecretsDeps;
|
|
22
|
+
}
|
|
23
|
+
export interface DeviceFormSecretsDeps {
|
|
24
|
+
readonly readStored: (deviceId: number) => Promise<Record<string, unknown>>;
|
|
25
|
+
readonly declaredPaths: (deviceId: number) => readonly string[];
|
|
26
|
+
readonly clear: (deviceId: number, keys: readonly string[]) => Promise<void>;
|
|
15
27
|
}
|
|
16
28
|
type IDeviceManagerProvider = InferProvider<typeof deviceManagerCapability>;
|
|
17
29
|
export declare function getDeviceAggregate(deps: AggregationDeps, deviceId: number, kind: 'settings' | 'live'): Promise<ContributionShape | null>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ContributionShape } from './device-meta-types.js';
|
|
2
|
+
type Sections = ContributionShape['sections'];
|
|
3
|
+
/**
|
|
4
|
+
* The driver's hydrated sections with every keychain-stored secret replaced
|
|
5
|
+
* by its view. Returns the input unchanged when the blob holds no marker.
|
|
6
|
+
*/
|
|
7
|
+
export declare function viewStoredSecrets(sections: Sections, stored: Record<string, unknown>, declaredPaths: readonly string[]): Sections;
|
|
8
|
+
/** A form patch split into what the driver applies and what the door clears. */
|
|
9
|
+
export interface DriverFormPatch {
|
|
10
|
+
readonly driverPatch: Record<string, unknown>;
|
|
11
|
+
readonly clearKeys: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
/** Split a device-settings form patch (see the module doc). */
|
|
14
|
+
export declare function splitDriverFormPatch(patch: Record<string, unknown>): DriverFormPatch;
|
|
15
|
+
/**
|
|
16
|
+
* Apply a device-settings form patch: the driver gets plain values only, then
|
|
17
|
+
* an explicit clear removes the stored secret at the keychain door (after the
|
|
18
|
+
* driver's own persist, whose `''` the door reads as KEEP).
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyDriverFormPatch(input: {
|
|
21
|
+
readonly patch: Record<string, unknown>;
|
|
22
|
+
readonly applyToDriver: (driverPatch: Record<string, unknown>) => Promise<void>;
|
|
23
|
+
readonly clearSecrets: (keys: readonly string[]) => Promise<void>;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
export {};
|
|
@@ -71,6 +71,8 @@ export declare class DeviceManagerAddon extends BaseAddon {
|
|
|
71
71
|
private readonly removalFence;
|
|
72
72
|
/** Declared secret config paths per device, as last registered (D783). */
|
|
73
73
|
private readonly secretConfigPaths;
|
|
74
|
+
/** The keychain side of driver device forms (D789), wired in onInitialize. */
|
|
75
|
+
private deviceFormSecrets;
|
|
74
76
|
/** The runtime-state mirror, asserted present (constructed in onInitialize). */
|
|
75
77
|
private get stateMirror();
|
|
76
78
|
/**
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_retired_settings_keys = require("../../retired-settings-keys-
|
|
6
|
+
const require_dist = require("../../dist-tnAO12ak.js");
|
|
7
|
+
const require_retired_settings_keys = require("../../retired-settings-keys-4bHpL-0m.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1033,6 +1033,105 @@ function mergeAggregates(parts) {
|
|
|
1033
1033
|
return out;
|
|
1034
1034
|
}
|
|
1035
1035
|
//#endregion
|
|
1036
|
+
//#region src/builtins/device-manager/device-form-secrets.ts
|
|
1037
|
+
/**
|
|
1038
|
+
* A driver's device-settings form, kept on the keychain side of the wire
|
|
1039
|
+
* (D787 / D789 for device forms).
|
|
1040
|
+
*
|
|
1041
|
+
* A driver hydrates its own form from the config `loadConfig` RESOLVED for it,
|
|
1042
|
+
* so a camera password reaches the form as plaintext even though the stored
|
|
1043
|
+
* blob holds a keychain marker. This module closes that in ONE place — the
|
|
1044
|
+
* device-manager aggregate every device form goes through — for every driver:
|
|
1045
|
+
*
|
|
1046
|
+
* - READ ({@link viewStoredSecrets}): a form field whose key names a stored
|
|
1047
|
+
* MARKER (a declared `secretConfigPaths` entry, or a field secret by type)
|
|
1048
|
+
* is handed the marker's VIEW instead of the driver's plaintext. A value
|
|
1049
|
+
* that is still inline plaintext in the blob (not migrated) is left as the
|
|
1050
|
+
* driver hydrated it: there is nothing to reveal it by.
|
|
1051
|
+
* - WRITE ({@link applyDriverFormPatch}): the form sends the view back for an
|
|
1052
|
+
* untouched field and `{ $secretClear: true }` for an explicit clear. The
|
|
1053
|
+
* driver understands neither (its schema wants a string), so a view is
|
|
1054
|
+
* dropped from the driver's patch (KEEP — the driver still holds the
|
|
1055
|
+
* resolved value) and a clear reaches the driver as `''` while the stored
|
|
1056
|
+
* marker is removed at the keychain door. A typed value passes through and
|
|
1057
|
+
* the driver's own persist stores it in the keychain.
|
|
1058
|
+
*
|
|
1059
|
+
* Top-level keys only: a driver form's field key is its config key for every
|
|
1060
|
+
* declared device secret today (`password`, `apiKey`, `localKey`). A nested or
|
|
1061
|
+
* per-row path (`connection.password`, `rows[].pin`) is not mapped onto a form
|
|
1062
|
+
* field and keeps the driver's hydration.
|
|
1063
|
+
*/
|
|
1064
|
+
function isRecord$2(value) {
|
|
1065
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1066
|
+
}
|
|
1067
|
+
/** The declared paths that name a top-level config key. */
|
|
1068
|
+
function topLevelKeys(paths) {
|
|
1069
|
+
return new Set(paths.filter((p) => p.length > 0 && !p.includes(".") && !p.includes("[")));
|
|
1070
|
+
}
|
|
1071
|
+
function viewField(field, stored, declared) {
|
|
1072
|
+
if (!isRecord$2(field)) return field;
|
|
1073
|
+
const nested = field["fields"];
|
|
1074
|
+
if (Array.isArray(nested)) return {
|
|
1075
|
+
...field,
|
|
1076
|
+
fields: nested.map((f) => viewField(f, stored, declared))
|
|
1077
|
+
};
|
|
1078
|
+
const tabs = field["tabs"];
|
|
1079
|
+
if (Array.isArray(tabs)) return {
|
|
1080
|
+
...field,
|
|
1081
|
+
tabs: tabs.map((tab) => isRecord$2(tab) && Array.isArray(tab["fields"]) ? {
|
|
1082
|
+
...tab,
|
|
1083
|
+
fields: tab["fields"].map((f) => viewField(f, stored, declared))
|
|
1084
|
+
} : tab)
|
|
1085
|
+
};
|
|
1086
|
+
const key = field["key"];
|
|
1087
|
+
if (typeof key !== "string" || !("value" in field)) return field;
|
|
1088
|
+
const marker = stored[key];
|
|
1089
|
+
if (!require_dist.isSecretMarker(marker)) return field;
|
|
1090
|
+
const secretByType = require_dist.isKeychainStoredField(field);
|
|
1091
|
+
if (!secretByType && !declared.has(key)) return field;
|
|
1092
|
+
const type = secretByType ? field["type"] : "password";
|
|
1093
|
+
return {
|
|
1094
|
+
...field,
|
|
1095
|
+
type,
|
|
1096
|
+
value: require_dist.toSecretFieldView(marker)
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* The driver's hydrated sections with every keychain-stored secret replaced
|
|
1101
|
+
* by its view. Returns the input unchanged when the blob holds no marker.
|
|
1102
|
+
*/
|
|
1103
|
+
function viewStoredSecrets(sections, stored, declaredPaths) {
|
|
1104
|
+
if (!Object.values(stored).some(require_dist.isSecretMarker)) return sections;
|
|
1105
|
+
const declared = topLevelKeys(declaredPaths);
|
|
1106
|
+
return sections.map((section) => ({
|
|
1107
|
+
...section,
|
|
1108
|
+
fields: section.fields.map((f) => viewField(f, stored, declared))
|
|
1109
|
+
}));
|
|
1110
|
+
}
|
|
1111
|
+
/** Split a device-settings form patch (see the module doc). */
|
|
1112
|
+
function splitDriverFormPatch(patch) {
|
|
1113
|
+
const driverPatch = {};
|
|
1114
|
+
const clearKeys = [];
|
|
1115
|
+
for (const [key, value] of Object.entries(patch)) if (require_dist.isSecretClear(value)) {
|
|
1116
|
+
driverPatch[key] = "";
|
|
1117
|
+
clearKeys.push(key);
|
|
1118
|
+
} else if (!require_dist.isSecretMarkerLike(value)) driverPatch[key] = value;
|
|
1119
|
+
return {
|
|
1120
|
+
driverPatch,
|
|
1121
|
+
clearKeys
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Apply a device-settings form patch: the driver gets plain values only, then
|
|
1126
|
+
* an explicit clear removes the stored secret at the keychain door (after the
|
|
1127
|
+
* driver's own persist, whose `''` the door reads as KEEP).
|
|
1128
|
+
*/
|
|
1129
|
+
async function applyDriverFormPatch(input) {
|
|
1130
|
+
const { driverPatch, clearKeys } = splitDriverFormPatch(input.patch);
|
|
1131
|
+
if (Object.keys(driverPatch).length > 0) await input.applyToDriver(driverPatch);
|
|
1132
|
+
if (clearKeys.length > 0) await input.clearSecrets(clearKeys);
|
|
1133
|
+
}
|
|
1134
|
+
//#endregion
|
|
1036
1135
|
//#region src/builtins/device-manager/stale-wrapper-activations.ts
|
|
1037
1136
|
/**
|
|
1038
1137
|
* A stored wrapper activation that names a cap with NO wrapper any more.
|
|
@@ -3451,6 +3550,25 @@ function refusedLinkedPicks(params) {
|
|
|
3451
3550
|
//#endregion
|
|
3452
3551
|
//#region src/builtins/device-manager/device-aggregation.ts
|
|
3453
3552
|
/**
|
|
3553
|
+
* A driver's hydrated sections as the browser may see them: every secret the
|
|
3554
|
+
* keychain stores is its VIEW, never the plaintext the driver was handed by
|
|
3555
|
+
* `loadConfig`. An unreadable blob withholds nothing new — the non-admin
|
|
3556
|
+
* redaction still runs at the transport — but it is logged.
|
|
3557
|
+
*/
|
|
3558
|
+
async function driverSectionsWithSecretViews(deps, deviceId, sections) {
|
|
3559
|
+
const door = deps.deviceFormSecrets;
|
|
3560
|
+
if (!door) return sections;
|
|
3561
|
+
try {
|
|
3562
|
+
return viewStoredSecrets(sections, await door.readStored(deviceId), door.declaredPaths(deviceId));
|
|
3563
|
+
} catch (err) {
|
|
3564
|
+
deps.ctx.logger.warn("device form: stored config unreadable — secret views not applied", {
|
|
3565
|
+
tags: { deviceId },
|
|
3566
|
+
meta: { error: require_dist.errMsg(err) }
|
|
3567
|
+
});
|
|
3568
|
+
return sections;
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3454
3572
|
* One process-wide cache behind every device-details fan-out.
|
|
3455
3573
|
*
|
|
3456
3574
|
* Module-level on purpose: the page re-polls every 2.5 s and a per-call cache
|
|
@@ -3676,16 +3794,18 @@ async function buildBaseDeviceSection(deps, deviceId) {
|
|
|
3676
3794
|
if (!hubLocal && !nativeOwner) return null;
|
|
3677
3795
|
const sections = [];
|
|
3678
3796
|
const driverResult = await resolveDriverConfigSchema(deps, deviceId, hubLocal);
|
|
3679
|
-
if (driverResult.status === "ok")
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3797
|
+
if (driverResult.status === "ok") {
|
|
3798
|
+
const driverSections = await driverSectionsWithSecretViews(deps, deviceId, driverResult.schema.sections);
|
|
3799
|
+
for (const section of driverSections) sections.push({
|
|
3800
|
+
id: section.id,
|
|
3801
|
+
title: section.title,
|
|
3802
|
+
tab: section.tab ?? "general",
|
|
3803
|
+
order: section.order ?? 1,
|
|
3804
|
+
fields: [...section.fields],
|
|
3805
|
+
...section.description !== void 0 ? { description: section.description } : {},
|
|
3806
|
+
...section.columns !== void 0 ? { columns: section.columns } : {}
|
|
3807
|
+
});
|
|
3808
|
+
} else if (driverResult.status === "unavailable") sections.push({
|
|
3689
3809
|
id: "driver-settings-unavailable",
|
|
3690
3810
|
title: "Driver Settings",
|
|
3691
3811
|
tab: "general",
|
|
@@ -4079,19 +4199,26 @@ async function applyGroupPatch(deps, deviceId, group) {
|
|
|
4079
4199
|
});
|
|
4080
4200
|
throw new Error(`[device-manager] ${retired.join(", ")} can no longer be saved from the settings section — reload the page and use the Extensions section`);
|
|
4081
4201
|
}
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4202
|
+
await applyDriverFormPatch({
|
|
4203
|
+
patch: group.patch,
|
|
4204
|
+
applyToDriver: async (driverPatch) => {
|
|
4205
|
+
const hubRegistry = deps.ctx.kernel?.deviceRegistry;
|
|
4206
|
+
const found = hubRegistry ? resolveDeviceById(hubRegistry, deviceId) : null;
|
|
4207
|
+
if (found) {
|
|
4208
|
+
await found.device.applySettingsPatch(driverPatch);
|
|
4209
|
+
return;
|
|
4210
|
+
}
|
|
4211
|
+
const ops = deps.capabilityRegistry?.getNativeProvider("device-ops", deviceId);
|
|
4212
|
+
if (!ops) throw new Error(`[device-manager] device "${deviceId}" not found (no hub-local entry, no device-ops native provider)`);
|
|
4213
|
+
await ops.setConfig({
|
|
4214
|
+
deviceId,
|
|
4215
|
+
values: driverPatch
|
|
4216
|
+
});
|
|
4217
|
+
},
|
|
4218
|
+
clearSecrets: async (keys) => {
|
|
4219
|
+
if (!deps.deviceFormSecrets) throw new Error(`[device-manager] cannot clear ${keys.join(", ")}: no keychain door`);
|
|
4220
|
+
await deps.deviceFormSecrets.clear(deviceId, keys);
|
|
4221
|
+
}
|
|
4095
4222
|
});
|
|
4096
4223
|
return;
|
|
4097
4224
|
}
|
|
@@ -9717,6 +9844,8 @@ var DeviceManagerAddon = class extends require_dist.BaseAddon {
|
|
|
9717
9844
|
removalFence = createRemovalFence();
|
|
9718
9845
|
/** Declared secret config paths per device, as last registered (D783). */
|
|
9719
9846
|
secretConfigPaths = createSecretConfigPathRegistry();
|
|
9847
|
+
/** The keychain side of driver device forms (D789), wired in onInitialize. */
|
|
9848
|
+
deviceFormSecrets;
|
|
9720
9849
|
/** The runtime-state mirror, asserted present (constructed in onInitialize). */
|
|
9721
9850
|
get stateMirror() {
|
|
9722
9851
|
if (!this.stateMirrorImpl) throw new Error("DeviceManagerAddon: state mirror accessed before onInitialize");
|
|
@@ -9869,7 +9998,8 @@ var DeviceManagerAddon = class extends require_dist.BaseAddon {
|
|
|
9869
9998
|
ctx: this.ctx,
|
|
9870
9999
|
capabilityRegistry: this.capabilityRegistry,
|
|
9871
10000
|
remoteNativeCaps: this.remoteNativeCaps,
|
|
9872
|
-
bindingsDeps: this.bindingsDeps
|
|
10001
|
+
bindingsDeps: this.bindingsDeps,
|
|
10002
|
+
...this.deviceFormSecrets ? { deviceFormSecrets: this.deviceFormSecrets } : {}
|
|
9873
10003
|
};
|
|
9874
10004
|
}
|
|
9875
10005
|
async getDeviceAggregate(deviceId, kind) {
|
|
@@ -9965,6 +10095,15 @@ var DeviceManagerAddon = class extends require_dist.BaseAddon {
|
|
|
9965
10095
|
return provider;
|
|
9966
10096
|
}
|
|
9967
10097
|
};
|
|
10098
|
+
this.deviceFormSecrets = {
|
|
10099
|
+
readStored: (deviceId) => settings.readDeviceStore(deviceId),
|
|
10100
|
+
declaredPaths: (deviceId) => this.secretConfigPaths.get(deviceId) ?? [],
|
|
10101
|
+
clear: (deviceId, keys) => persistConfig(pctx, {
|
|
10102
|
+
deviceId,
|
|
10103
|
+
data: Object.fromEntries(keys.map((key) => [key, require_dist.SECRET_CLEAR])),
|
|
10104
|
+
secretConfigPaths: [...new Set([...this.secretConfigPaths.get(deviceId) ?? [], ...keys])]
|
|
10105
|
+
})
|
|
10106
|
+
};
|
|
9968
10107
|
try {
|
|
9969
10108
|
await runLocationBackfillAtBoot(pctx, bootRows);
|
|
9970
10109
|
} catch (err) {
|