@camstack/server 1.2.928 → 1.2.930
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/CHANGELOG.md +12 -0
- package/package.json +10 -10
- package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
- package/system/dist/addon-id-Di0lNJ89.js +50 -0
- package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
- package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
- package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
- package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
- package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
- package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
- package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
- package/system/dist/base-device-2sL1DMm1.js +1103 -0
- package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +6 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +7 -5
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +60 -3
- package/system/dist/builtins/autotrack/index.js +21 -17
- package/system/dist/builtins/autotrack/index.mjs +5 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +8 -5
- package/system/dist/builtins/calendars/calendars.addon.js +8 -6
- package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
- package/system/dist/builtins/camera-grid/index.js +615 -58
- package/system/dist/builtins/camera-grid/index.mjs +558 -1
- package/system/dist/builtins/composer/composer.addon.js +788 -209
- package/system/dist/builtins/composer/composer.addon.mjs +583 -4
- package/system/dist/builtins/console-logging/index.js +4 -3
- package/system/dist/builtins/console-logging/index.mjs +2 -1
- package/system/dist/builtins/core-blocks/actions-service.d.ts +18 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +8670 -386
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +8294 -11
- package/system/dist/builtins/core-blocks/tcp-connect.d.ts +3 -0
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +250 -21
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +230 -1
- package/system/dist/builtins/device-history/device-history.addon.js +110 -31
- package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
- package/system/dist/builtins/hub-forwarder/index.js +4 -3
- package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
- package/system/dist/builtins/keychain/index.js +31 -28
- package/system/dist/builtins/keychain/index.mjs +7 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
- package/system/dist/builtins/local-network/local-network.addon.js +43 -39
- package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
- package/system/dist/builtins/loki-logging/index.js +23 -17
- package/system/dist/builtins/loki-logging/index.mjs +7 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +12 -10
- package/system/dist/builtins/record-entries/index.js +9 -7
- package/system/dist/builtins/record-entries/index.mjs +3 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +97 -44
- package/system/dist/builtins/snapshot/index.mjs +54 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
- package/system/dist/builtins/system-config/system-config.addon.js +17 -14
- package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
- package/system/dist/builtins/winston-logging/index.js +7 -5
- package/system/dist/builtins/winston-logging/index.mjs +3 -1
- package/system/dist/calendars.cap-CaFlShS9.js +155 -0
- package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
- package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
- package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
- package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
- package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
- package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
- package/system/dist/capability-definition-HCmTem8c.js +242 -0
- package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
- package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
- package/system/dist/command-origin-claim-Cief660O.js +35 -0
- package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
- package/system/dist/composition-sources-BEUWn2s_.mjs +391 -0
- package/system/dist/composition-sources-acfR4hDq.js +408 -0
- package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
- package/system/dist/constants-C860Y6U4.js +26 -0
- package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
- package/system/dist/constants-DCLpoF4L.mjs +21 -0
- package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
- package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
- package/system/dist/core-blocks.cap-BMeMCBrx.js +18733 -0
- package/system/dist/core-blocks.cap-BRPsLAij.mjs +18008 -0
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
- package/system/dist/custom-actions-D92NRi2c.js +36 -0
- package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
- package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
- package/system/dist/declared-device-BWphj9WE.js +303 -0
- package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
- package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
- package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
- package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
- package/system/dist/device-certificate-CguVACQO.js +162 -0
- package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
- package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
- package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
- package/system/dist/device-kind-CsSiv_YF.js +101 -0
- package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
- package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
- package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
- package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
- package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
- package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
- package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
- package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
- package/system/dist/device-type-CbQsnFdC.js +477 -0
- package/system/dist/device-type-DgEvK3ch.mjs +454 -0
- package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
- package/system/dist/entry-kind-cq90c--V.js +55 -0
- package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
- package/system/dist/error.cap-DBhgPeWK.js +3848 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/history-catalog-BKRarIL_.js +831 -0
- package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
- package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
- package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +832 -220
- package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
- package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
- package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
- package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
- package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
- package/system/dist/l10n-CGMvp7NF.js +15 -0
- package/system/dist/labels-DX5S8deC.js +81 -0
- package/system/dist/labels-DsBcU7md.mjs +64 -0
- package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
- package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
- package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
- package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
- package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
- package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
- package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
- package/system/dist/mask-shape-CmPA2fst.js +92 -0
- package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
- package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
- package/system/dist/migration-BMjgkyG2.js +380 -0
- package/system/dist/migration-DRJAtdy7.mjs +321 -0
- package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
- package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
- package/system/dist/notification-rules.cap-BDh0LDhV.js +3428 -0
- package/system/dist/notification-rules.cap-DUmiMBQB.mjs +3357 -0
- package/system/dist/notification-targets-CRH-9Dy5.js +509 -0
- package/system/dist/notification-targets-DaNE-pIt.mjs +486 -0
- package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
- package/system/dist/ops-log-pxt9176Z.js +81 -0
- package/system/dist/pinned-binary-BOhOSNff.js +28 -0
- package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
- package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
- package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
- package/system/dist/prefix-walk-BkMxoXpL.js +843 -0
- package/system/dist/prefix-walk-ifwg_ukx.mjs +790 -0
- package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
- package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
- package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
- package/system/dist/quantity-lY1KiTSZ.js +143 -0
- package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
- package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
- package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
- package/system/dist/record-entries.cap-ti1C046R.js +80 -0
- package/system/dist/record-kind-DoBfYHCs.js +203 -0
- package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
- package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
- package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
- package/system/dist/records.cap-ClcWV64i.js +329 -0
- package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
- package/system/dist/relocate-CdVQAk-w.js +804 -0
- package/system/dist/relocate-CoZZTui1.mjs +661 -0
- package/system/dist/rename-composition-block-BJsL58Ih.js +34798 -0
- package/system/dist/rename-composition-block-OAtErZgq.mjs +33631 -0
- package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
- package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
- package/system/dist/scoped-settings-CylSSq_8.js +955 -0
- package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
- package/system/dist/server-name-BIhLuHvX.mjs +35 -0
- package/system/dist/server-name-OALNvpqC.js +52 -0
- package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
- package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
- package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
- package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
- package/system/dist/source-info-DGB7SdB_.mjs +190 -0
- package/system/dist/source-info-DtWf4k2j.js +225 -0
- package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
- package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
- package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
- package/system/dist/storage-location-CTweDMZf.js +198 -0
- package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
- package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
- package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
- package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
- package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
- package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
- package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
- package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
- package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
- package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
- package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
- package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
- package/system/dist/system-reasons-Be_k1W8g.js +25 -0
- package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
- package/system/dist/tag-BxLazvVb.js +2138 -0
- package/system/dist/tag-uZBAq6ox.mjs +2073 -0
- package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
- package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
- package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
- package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
- package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
- package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
- package/system/dist/zod-secret-DS7mj1bk.js +78 -0
- package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
- package/system/package.json +1 -1
- package/system/dist/composition-sources-BI614LJx.mjs +0 -141
- package/system/dist/composition-sources-v_kkb8A9.js +0 -152
- package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
- package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
- package/system/dist/dist-BCHMSqzc.mjs +0 -143467
- package/system/dist/dist-BZfvhfS1.js +0 -146970
- package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
- package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
- package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
- package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
|
@@ -3,10 +3,15 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const
|
|
6
|
+
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
7
|
+
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
|
+
const require_camstack_error = require("../../camstack-error-DJ-TUAi1.js");
|
|
9
|
+
const require_record_kind = require("../../record-kind-DoBfYHCs.js");
|
|
10
|
+
const require_user_management_cap = require("../../user-management.cap-B9QDu8NE.js");
|
|
11
|
+
const require_device_certificate = require("../../device-certificate-CguVACQO.js");
|
|
7
12
|
const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
|
|
8
13
|
const require_ms$1 = require("../../ms-LB3giGoU.js");
|
|
9
|
-
const require_device_ca = require("../../device-ca-
|
|
14
|
+
const require_device_ca = require("../../device-ca-C5kJE6mL.js");
|
|
10
15
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
11
16
|
let zod = require("zod");
|
|
12
17
|
let node_crypto = require("node:crypto");
|
|
@@ -17,6 +22,101 @@ let node_fs = require("node:fs");
|
|
|
17
22
|
node_fs = require_chunk.__toESM(node_fs);
|
|
18
23
|
let node_path = require("node:path");
|
|
19
24
|
node_path = require_chunk.__toESM(node_path);
|
|
25
|
+
//#region ../types/dist/esm/interfaces/addon-data-plane.mjs
|
|
26
|
+
/**
|
|
27
|
+
* Per-listener shared-secret header the hub injects on every reverse-proxied
|
|
28
|
+
* data-plane request and the addon's framework wrapper validates — so only the
|
|
29
|
+
* hub can reach the addon's `127.0.0.1` listener. Defined here (shared by the
|
|
30
|
+
* core proxy and the kernel listener) to keep both off a kernel↔core import.
|
|
31
|
+
*/
|
|
32
|
+
var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ../types/dist/esm/auth/credential-scope.mjs
|
|
35
|
+
/** What a share-view grant lets its holder see. */
|
|
36
|
+
var ShareViewGrantSchema = /* @__PURE__ */ zod.z.object({
|
|
37
|
+
kind: /* @__PURE__ */ zod.z.enum(["grid-view", "events-view"]),
|
|
38
|
+
deviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int().nonnegative()).min(1).max(64),
|
|
39
|
+
/** Talk-back, opt-in at mint time; absent means off. */
|
|
40
|
+
talk: /* @__PURE__ */ zod.z.boolean().optional()
|
|
41
|
+
});
|
|
42
|
+
var ShareViewScopeSchema = /* @__PURE__ */ zod.z.object({
|
|
43
|
+
type: /* @__PURE__ */ zod.z.literal("share-view"),
|
|
44
|
+
grant: ShareViewGrantSchema
|
|
45
|
+
});
|
|
46
|
+
var AddonRoutesScopeSchema = /* @__PURE__ */ zod.z.object({
|
|
47
|
+
type: /* @__PURE__ */ zod.z.literal("addon-routes"),
|
|
48
|
+
access: /* @__PURE__ */ zod.z.array(require_user_management_cap.MethodAccessSchema).min(1)
|
|
49
|
+
});
|
|
50
|
+
var PreferencesSelfScopeSchema = /* @__PURE__ */ zod.z.object({ type: /* @__PURE__ */ zod.z.literal("preferences-self") });
|
|
51
|
+
var CredentialScopeSchema = /* @__PURE__ */ zod.z.union([
|
|
52
|
+
/* @__PURE__ */ zod.z.literal("*"),
|
|
53
|
+
ShareViewScopeSchema,
|
|
54
|
+
AddonRoutesScopeSchema,
|
|
55
|
+
PreferencesSelfScopeSchema,
|
|
56
|
+
require_user_management_cap.ViewerTokenScopeSchema,
|
|
57
|
+
require_user_management_cap.TokenScopeSchema
|
|
58
|
+
]);
|
|
59
|
+
/**
|
|
60
|
+
* The `kind` claim of a unified token. It names the TOKEN FAMILY (so every
|
|
61
|
+
* older gate that classifies a hub JWT refuses it — `classifyBearerPrincipal`
|
|
62
|
+
* treats any `kind` it does not know as not-a-credential), never what the
|
|
63
|
+
* token may do: that is its `scopes`, and only its `scopes`.
|
|
64
|
+
*/
|
|
65
|
+
var CREDENTIAL_TOKEN_KIND = "credential";
|
|
66
|
+
/**
|
|
67
|
+
* The `aud` claim every minted token is signed with (D895). The hub's raw JWT
|
|
68
|
+
* verify (`AuthManager.verifyToken`, used by every surface that wants a LOGIN
|
|
69
|
+
* session — the OAuth consent page, the session cookie, health, backups)
|
|
70
|
+
* refuses a token carrying it, so a minted token — a share link above all —
|
|
71
|
+
* can never be replayed as a person's session. Only the credential verifier's
|
|
72
|
+
* own door (`verifyCredentialToken`) accepts it.
|
|
73
|
+
*/
|
|
74
|
+
var CREDENTIAL_TOKEN_AUDIENCE = "camstack:credential";
|
|
75
|
+
/** Does a verified JWT payload belong to the minted-token family? */
|
|
76
|
+
function isCredentialTokenPayload(payload) {
|
|
77
|
+
if (payload === null || typeof payload !== "object") return false;
|
|
78
|
+
const kind = Reflect.get(payload, "kind");
|
|
79
|
+
const aud = Reflect.get(payload, "aud");
|
|
80
|
+
return kind === "credential" || aud === "camstack:credential" || Array.isArray(aud) && aud.includes("camstack:credential");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The claims of a unified token (`auth.mintToken`). It carries no `exp`: its
|
|
84
|
+
* row (looked up by `jti` on every verify, for revocation) holds the ONE
|
|
85
|
+
* expiry, so a share link can be extended and a JWT clock can never disagree
|
|
86
|
+
* with the row.
|
|
87
|
+
*/
|
|
88
|
+
var CredentialTokenClaimsSchema = /* @__PURE__ */ zod.z.object({
|
|
89
|
+
kind: /* @__PURE__ */ zod.z.literal(CREDENTIAL_TOKEN_KIND),
|
|
90
|
+
sub: /* @__PURE__ */ zod.z.string().min(1),
|
|
91
|
+
jti: /* @__PURE__ */ zod.z.string().min(16),
|
|
92
|
+
scopes: /* @__PURE__ */ zod.z.array(CredentialScopeSchema).min(1)
|
|
93
|
+
});
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../types/dist/esm/schemas/user-preferences.mjs
|
|
96
|
+
/**
|
|
97
|
+
* Per-user ACCOUNT preferences (D894): the hub-side half of the viewer's two
|
|
98
|
+
* settings levels.
|
|
99
|
+
*
|
|
100
|
+
* - DEVICE settings never leave the phone.
|
|
101
|
+
* - ACCOUNT settings live here: one row per `(user, namespace)`, private to
|
|
102
|
+
* that user, synced across every device signed in as them, last write wins
|
|
103
|
+
* unless the writer sends the revision it based its edit on.
|
|
104
|
+
*
|
|
105
|
+
* A setting lives in exactly ONE level; there are no overrides. The caller
|
|
106
|
+
* never names a user: the hub stamps the principal's own id, admin included.
|
|
107
|
+
*
|
|
108
|
+
* The contract the client codes against is the `preferences.*` tRPC router
|
|
109
|
+
* (`server/backend/src/api/core/preferences.router.ts`).
|
|
110
|
+
*/
|
|
111
|
+
/** `viewer.app`, `viewer.cameras`, `viewer.grids` … — lowercase, dot/dash separated. */
|
|
112
|
+
var PREFERENCES_NAMESPACE_PATTERN = /^[a-z][a-z0-9.-]{0,63}$/;
|
|
113
|
+
/** One row's value, measured as UTF-8 JSON. */
|
|
114
|
+
var PREFERENCES_MAX_VALUE_BYTES = 256 * 1024;
|
|
115
|
+
var PreferenceNamespaceSchema = /* @__PURE__ */ zod.z.string().regex(PREFERENCES_NAMESPACE_PATTERN);
|
|
116
|
+
/** A namespace's value: a JSON object, opaque to the hub. */
|
|
117
|
+
var PreferenceValueSchema = /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown());
|
|
118
|
+
var PreferenceDeviceIdSchema = /* @__PURE__ */ zod.z.string().min(1).max(64);
|
|
119
|
+
//#endregion
|
|
20
120
|
//#region ../../node_modules/bcryptjs/index.js
|
|
21
121
|
/**
|
|
22
122
|
* The random implementation to use as a fallback.
|
|
@@ -6036,7 +6136,7 @@ var AuthManager = class {
|
|
|
6036
6136
|
* before signing, so nothing outside the schema is ever signed.
|
|
6037
6137
|
*/
|
|
6038
6138
|
signCredentialToken(claims) {
|
|
6039
|
-
return import_jsonwebtoken.sign(
|
|
6139
|
+
return import_jsonwebtoken.sign(CredentialTokenClaimsSchema.parse(claims), this.jwtSecret, { audience: CREDENTIAL_TOKEN_AUDIENCE });
|
|
6040
6140
|
}
|
|
6041
6141
|
/**
|
|
6042
6142
|
* Verify a session-family JWT: a login session, an account link, a bridge or
|
|
@@ -6047,13 +6147,13 @@ var AuthManager = class {
|
|
|
6047
6147
|
*/
|
|
6048
6148
|
verifyToken(token) {
|
|
6049
6149
|
const payload = import_jsonwebtoken.verify(token, this.jwtSecret);
|
|
6050
|
-
if (
|
|
6150
|
+
if (isCredentialTokenPayload(payload)) throw new Error("A minted token is not a session credential");
|
|
6051
6151
|
return payload;
|
|
6052
6152
|
}
|
|
6053
6153
|
/** Verify a minted token (`auth.mintToken`): its signature AND its audience. Throws when invalid. */
|
|
6054
6154
|
verifyCredentialToken(token) {
|
|
6055
|
-
const payload = import_jsonwebtoken.verify(token, this.jwtSecret, { audience:
|
|
6056
|
-
const claims =
|
|
6155
|
+
const payload = import_jsonwebtoken.verify(token, this.jwtSecret, { audience: CREDENTIAL_TOKEN_AUDIENCE });
|
|
6156
|
+
const claims = CredentialTokenClaimsSchema.safeParse(payload);
|
|
6057
6157
|
if (!claims.success) throw new Error("Not a minted token");
|
|
6058
6158
|
return claims.data;
|
|
6059
6159
|
}
|
|
@@ -6144,7 +6244,7 @@ var AuthManager = class {
|
|
|
6144
6244
|
const linkIntent = typeof decoded["linkIntent"] === "string" ? decoded["linkIntent"] : void 0;
|
|
6145
6245
|
const issuer = typeof decoded["issuer"] === "string" ? decoded["issuer"] : void 0;
|
|
6146
6246
|
const browserBinding = typeof decoded["browserBinding"] === "string" ? decoded["browserBinding"] : void 0;
|
|
6147
|
-
const appParsed =
|
|
6247
|
+
const appParsed = require_user_management_cap.SsoBridgeClaimsSchema.shape.app.safeParse(decoded["app"]);
|
|
6148
6248
|
if (!appParsed.success) return null;
|
|
6149
6249
|
const app = appParsed.data;
|
|
6150
6250
|
const rawRefreshTtl = decoded["refreshTtl"];
|
|
@@ -6724,9 +6824,9 @@ var DeviceCredentialManager = class {
|
|
|
6724
6824
|
/** A one-shot code for `userId` (admin path). Returned once; only its hash is kept. */
|
|
6725
6825
|
startEnrollment(input) {
|
|
6726
6826
|
this.prune();
|
|
6727
|
-
if (this.pendingEnrollments.size >= MAX_PENDING) throw
|
|
6827
|
+
if (this.pendingEnrollments.size >= MAX_PENDING) throw require_camstack_error.userError("system.device-enrollment-busy", void 0, "Too many pending device enrollments — try again shortly");
|
|
6728
6828
|
const code = node_crypto.randomBytes(24).toString("base64url");
|
|
6729
|
-
const expiresAt = this.now() +
|
|
6829
|
+
const expiresAt = this.now() + require_device_certificate.DEVICE_ENROLLMENT_TTL_MS;
|
|
6730
6830
|
this.pendingEnrollments.set(hash(code), {
|
|
6731
6831
|
userId: input.userId,
|
|
6732
6832
|
deviceName: input.deviceName,
|
|
@@ -6847,7 +6947,7 @@ var DeviceCredentialManager = class {
|
|
|
6847
6947
|
if (oldest.done !== true) this.nonces.delete(oldest.value);
|
|
6848
6948
|
}
|
|
6849
6949
|
const nonce = node_crypto.randomBytes(32).toString("base64url");
|
|
6850
|
-
const expiresAt = this.now() +
|
|
6950
|
+
const expiresAt = this.now() + require_device_certificate.DEVICE_NONCE_TTL_MS;
|
|
6851
6951
|
this.nonces.set(nonce, {
|
|
6852
6952
|
origin,
|
|
6853
6953
|
expiresAt,
|
|
@@ -6871,7 +6971,7 @@ var DeviceCredentialManager = class {
|
|
|
6871
6971
|
if (caState.state !== "ready") return this.refuse(input.purpose, "no-device-ca", {});
|
|
6872
6972
|
const verdict = await require_device_ca.verifyDeviceLeaf(caState.ca.certPem, input.certPem, new Date(this.now()));
|
|
6873
6973
|
if (!verdict.ok) return this.refuse(input.purpose, verdict.reason, {});
|
|
6874
|
-
const message =
|
|
6974
|
+
const message = require_device_certificate.buildDeviceSignatureMessage({
|
|
6875
6975
|
purpose: input.purpose,
|
|
6876
6976
|
origin: bound.origin,
|
|
6877
6977
|
nonce: input.nonce
|
|
@@ -7415,8 +7515,8 @@ async function declareAuthSchema(store, options) {
|
|
|
7415
7515
|
* D895; they stay declared so the layout is unchanged.
|
|
7416
7516
|
*/
|
|
7417
7517
|
var DAY_MS = 864e5;
|
|
7418
|
-
var UserBodySchema =
|
|
7419
|
-
var ScopedTokenBodySchema =
|
|
7518
|
+
var UserBodySchema = require_user_management_cap.UserRecordSchema.omit({ id: true });
|
|
7519
|
+
var ScopedTokenBodySchema = require_user_management_cap.ScopedTokenSchema.omit({ id: true });
|
|
7420
7520
|
var AdminTokenBodySchema = zod.z.object({
|
|
7421
7521
|
createdBy: zod.z.string(),
|
|
7422
7522
|
name: zod.z.string(),
|
|
@@ -7449,7 +7549,7 @@ var OauthSessionBodySchema = zod.z.object({
|
|
|
7449
7549
|
username: zod.z.string(),
|
|
7450
7550
|
integrationId: zod.z.string(),
|
|
7451
7551
|
instanceId: zod.z.string().optional(),
|
|
7452
|
-
scopes: zod.z.array(
|
|
7552
|
+
scopes: zod.z.array(require_user_management_cap.TokenScopeSchema),
|
|
7453
7553
|
createdAt: zod.z.number(),
|
|
7454
7554
|
lastUsedAt: zod.z.number(),
|
|
7455
7555
|
revokedAt: zod.z.number().nullish()
|
|
@@ -7490,7 +7590,7 @@ var AuthAuditBodySchema = zod.z.object({
|
|
|
7490
7590
|
ip: zod.z.string().nullish(),
|
|
7491
7591
|
detail: zod.z.string().nullish()
|
|
7492
7592
|
});
|
|
7493
|
-
var _localAuthRecordKinds =
|
|
7593
|
+
var _localAuthRecordKinds = require_record_kind.defineRecordKinds({
|
|
7494
7594
|
users: {
|
|
7495
7595
|
schema: UserBodySchema,
|
|
7496
7596
|
class: "config",
|
|
@@ -8359,13 +8459,13 @@ var DeviceCaStore = class {
|
|
|
8359
8459
|
};
|
|
8360
8460
|
var UserPreferenceBodySchema = zod.z.object({
|
|
8361
8461
|
userId: zod.z.string().min(1),
|
|
8362
|
-
namespace:
|
|
8363
|
-
value:
|
|
8462
|
+
namespace: PreferenceNamespaceSchema,
|
|
8463
|
+
value: PreferenceValueSchema,
|
|
8364
8464
|
revision: zod.z.number().int().positive(),
|
|
8365
8465
|
updatedAt: zod.z.number().int(),
|
|
8366
|
-
updatedByDevice:
|
|
8466
|
+
updatedByDevice: PreferenceDeviceIdSchema.nullable()
|
|
8367
8467
|
});
|
|
8368
|
-
var localAuthPreferencesRecordKinds =
|
|
8468
|
+
var localAuthPreferencesRecordKinds = require_record_kind.defineRecordKinds({ "user-preferences": {
|
|
8369
8469
|
schema: UserPreferenceBodySchema,
|
|
8370
8470
|
class: "config",
|
|
8371
8471
|
writeTrigger: "a signed-in user saves one of their account preference namespaces (preferences.put) or deletes it",
|
|
@@ -8376,7 +8476,7 @@ var localAuthPreferencesRecordKinds = require_dist.defineRecordKinds({ "user-pre
|
|
|
8376
8476
|
fields: ["userId"]
|
|
8377
8477
|
}],
|
|
8378
8478
|
retention: { none: "a row goes when its user deletes the namespace, or with the user (deleteUser wipes every row of theirs)" },
|
|
8379
|
-
maxDataBytes:
|
|
8479
|
+
maxDataBytes: PREFERENCES_MAX_VALUE_BYTES + 4 * 1024
|
|
8380
8480
|
} });
|
|
8381
8481
|
/** Namespaces cannot hold `:`, so the id splits unambiguously. */
|
|
8382
8482
|
function userPreferenceRecordId(userId, namespace) {
|
|
@@ -8449,7 +8549,7 @@ var UserPreferencesStore = class {
|
|
|
8449
8549
|
}
|
|
8450
8550
|
async put(userId, input) {
|
|
8451
8551
|
const bytes = Buffer.byteLength(JSON.stringify(input.value), "utf8");
|
|
8452
|
-
if (bytes > 262144) throw new PreferencesLimitError("value-too-large", `preferences: ${input.namespace} is ${bytes} bytes, the limit is ${
|
|
8552
|
+
if (bytes > 262144) throw new PreferencesLimitError("value-too-large", `preferences: ${input.namespace} is ${bytes} bytes, the limit is ${PREFERENCES_MAX_VALUE_BYTES}`);
|
|
8453
8553
|
return this.serialized(userId, async () => {
|
|
8454
8554
|
const mirror = await this.mirrorOf(userId);
|
|
8455
8555
|
const id = userPreferenceRecordId(userId, input.namespace);
|
|
@@ -8608,7 +8708,7 @@ var USERS_COLLECTION = "users";
|
|
|
8608
8708
|
var FIRST_BOOT_ADMIN_USERNAME = "admin";
|
|
8609
8709
|
var FIRST_BOOT_ADMIN_PASSWORD = "changeme";
|
|
8610
8710
|
function parseUser(data) {
|
|
8611
|
-
return parseRecord("user",
|
|
8711
|
+
return parseRecord("user", require_user_management_cap.UserRecordSchema, data);
|
|
8612
8712
|
}
|
|
8613
8713
|
function userToBody(user) {
|
|
8614
8714
|
const { id: _id, ...body } = user;
|
|
@@ -8642,7 +8742,7 @@ var UserManager = class {
|
|
|
8642
8742
|
return this.legacyStore;
|
|
8643
8743
|
}
|
|
8644
8744
|
async create(input) {
|
|
8645
|
-
if (await this.findByUsername(input.username)) throw
|
|
8745
|
+
if (await this.findByUsername(input.username)) throw require_camstack_error.userError("system.user-exists", { username: String(input.username) }, `User with username "${input.username}" already exists`);
|
|
8646
8746
|
const passwordHash = await this.auth.hashPassword(input.password);
|
|
8647
8747
|
const now = Date.now();
|
|
8648
8748
|
const record = {
|
|
@@ -8724,7 +8824,7 @@ var UserManager = class {
|
|
|
8724
8824
|
}
|
|
8725
8825
|
async update(id, data) {
|
|
8726
8826
|
const existing = await this.findById(id);
|
|
8727
|
-
if (!existing) throw
|
|
8827
|
+
if (!existing) throw require_camstack_error.userError("system.user-not-found", { id: String(id) }, `User with id "${id}" not found`);
|
|
8728
8828
|
const next = {
|
|
8729
8829
|
...existing,
|
|
8730
8830
|
...data,
|
|
@@ -8760,7 +8860,7 @@ var UserManager = class {
|
|
|
8760
8860
|
}
|
|
8761
8861
|
async resetPassword(id, newPassword) {
|
|
8762
8862
|
const existing = await this.findById(id);
|
|
8763
|
-
if (!existing) throw
|
|
8863
|
+
if (!existing) throw require_camstack_error.userError("system.user-not-found", { id: String(id) }, `User with id "${id}" not found`);
|
|
8764
8864
|
const passwordHash = await this.auth.hashPassword(newPassword);
|
|
8765
8865
|
const next = {
|
|
8766
8866
|
...existing,
|
|
@@ -8851,7 +8951,7 @@ function assertPersonScopes(scopes) {
|
|
|
8851
8951
|
if (scopes.length === 0) return;
|
|
8852
8952
|
const only = scopes[0];
|
|
8853
8953
|
if (scopes.length === 1 && only !== void 0 && only.type === "viewer") return;
|
|
8854
|
-
throw
|
|
8954
|
+
throw require_camstack_error.userError("auth.person-scopes-refused", void 0, "A person is an admin, with no scope rows, or holds exactly one viewer grant");
|
|
8855
8955
|
}
|
|
8856
8956
|
var JwtSigningKeyKeeper = class {
|
|
8857
8957
|
deps;
|
|
@@ -11115,7 +11215,7 @@ function classify(column) {
|
|
|
11115
11215
|
if (!column.startsWith("{")) return { kind: "inline" };
|
|
11116
11216
|
try {
|
|
11117
11217
|
const parsed = JSON.parse(column);
|
|
11118
|
-
return
|
|
11218
|
+
return require_scoped_settings.isSecretMarker(parsed) ? {
|
|
11119
11219
|
kind: "marker",
|
|
11120
11220
|
ref: parsed.$secret
|
|
11121
11221
|
} : { kind: "invalid" };
|
|
@@ -11192,7 +11292,7 @@ var TotpManager = class {
|
|
|
11192
11292
|
}
|
|
11193
11293
|
const row = {
|
|
11194
11294
|
userId,
|
|
11195
|
-
secret: onRecords ? secret : JSON.stringify(
|
|
11295
|
+
secret: onRecords ? secret : JSON.stringify(require_scoped_settings.makeSecretMarker(ref)),
|
|
11196
11296
|
confirmedAt: null,
|
|
11197
11297
|
createdAt: Date.now()
|
|
11198
11298
|
};
|
|
@@ -11383,7 +11483,7 @@ var TotpManager = class {
|
|
|
11383
11483
|
if (back?.kind !== "value" || back.value !== planned.secret) return false;
|
|
11384
11484
|
const next = {
|
|
11385
11485
|
...current,
|
|
11386
|
-
secret: JSON.stringify(
|
|
11486
|
+
secret: JSON.stringify(require_scoped_settings.makeSecretMarker(ref))
|
|
11387
11487
|
};
|
|
11388
11488
|
await this.writeRow(next);
|
|
11389
11489
|
return true;
|
|
@@ -11851,7 +11951,7 @@ function toAuthResult(user) {
|
|
|
11851
11951
|
isAdmin: user.isAdmin
|
|
11852
11952
|
};
|
|
11853
11953
|
}
|
|
11854
|
-
var LocalAuthAddon = class extends
|
|
11954
|
+
var LocalAuthAddon = class extends require_base_addon.BaseAddon {
|
|
11855
11955
|
authManager = null;
|
|
11856
11956
|
userManager = null;
|
|
11857
11957
|
oauthSessionManager = null;
|
|
@@ -12112,7 +12212,7 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12112
12212
|
},
|
|
12113
12213
|
confirmTotp: async (input) => {
|
|
12114
12214
|
if (!this.totpManager) throw new Error("TOTP management not available");
|
|
12115
|
-
if (!await this.totpManager.confirm(input.userId, input.code)) throw
|
|
12215
|
+
if (!await this.totpManager.confirm(input.userId, input.code)) throw require_camstack_error.userError("auth.totp-confirm-failed", void 0, "TOTP confirmation failed — code did not match");
|
|
12116
12216
|
return { success: true };
|
|
12117
12217
|
},
|
|
12118
12218
|
disableTotp: async (input) => {
|
|
@@ -12140,15 +12240,15 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12140
12240
|
attachUserManagementInternal(userMgmt, this.buildInternal());
|
|
12141
12241
|
return [
|
|
12142
12242
|
{
|
|
12143
|
-
capability:
|
|
12243
|
+
capability: require_user_management_cap.authProviderCapability,
|
|
12144
12244
|
provider: authProvider
|
|
12145
12245
|
},
|
|
12146
12246
|
{
|
|
12147
|
-
capability:
|
|
12247
|
+
capability: require_user_management_cap.userManagementCapability,
|
|
12148
12248
|
provider: userMgmt
|
|
12149
12249
|
},
|
|
12150
12250
|
{
|
|
12151
|
-
capability:
|
|
12251
|
+
capability: require_user_management_cap.deviceCredentialsCapability,
|
|
12152
12252
|
provider: this.buildDeviceCredentialsProvider()
|
|
12153
12253
|
}
|
|
12154
12254
|
];
|
|
@@ -12174,7 +12274,7 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12174
12274
|
/** The admin cap (`device-credentials`): list, enroll-by-QR, revoke, rename, settings. */
|
|
12175
12275
|
buildDeviceCredentialsProvider() {
|
|
12176
12276
|
const manager = () => {
|
|
12177
|
-
if (this.deviceCredentials === null) throw
|
|
12277
|
+
if (this.deviceCredentials === null) throw require_camstack_error.userError("device.credentials-unavailable", void 0, "Device credentials not available");
|
|
12178
12278
|
return this.deviceCredentials;
|
|
12179
12279
|
};
|
|
12180
12280
|
const hubOrigins = async () => {
|
|
@@ -12216,7 +12316,7 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12216
12316
|
return {
|
|
12217
12317
|
code: started.code,
|
|
12218
12318
|
expiresAt: started.expiresAt,
|
|
12219
|
-
enrollUrl:
|
|
12319
|
+
enrollUrl: require_device_certificate.buildDeviceEnrollmentLink({
|
|
12220
12320
|
...hub !== void 0 ? { hub } : {},
|
|
12221
12321
|
code: started.code
|
|
12222
12322
|
}),
|
|
@@ -12226,8 +12326,8 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12226
12326
|
},
|
|
12227
12327
|
revokeDeviceCredential: async (input) => {
|
|
12228
12328
|
const record = manager().get(input.id);
|
|
12229
|
-
if (record === void 0) throw
|
|
12230
|
-
const revoked = await manager().revoke(input.id,
|
|
12329
|
+
if (record === void 0) throw require_camstack_error.userError("device.credential-not-found", { id: input.id }, `Device credential not found: ${input.id}`);
|
|
12330
|
+
const revoked = await manager().revoke(input.id, require_device_certificate.formatDeviceRevoker({
|
|
12231
12331
|
kind: "admin",
|
|
12232
12332
|
userId: input.caller.userId
|
|
12233
12333
|
}));
|
|
@@ -12297,7 +12397,7 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12297
12397
|
return this.loginSessions;
|
|
12298
12398
|
};
|
|
12299
12399
|
const devices = () => {
|
|
12300
|
-
if (this.deviceCredentials === null) throw
|
|
12400
|
+
if (this.deviceCredentials === null) throw require_camstack_error.userError("device.credentials-unavailable", void 0, "Device credentials not available");
|
|
12301
12401
|
return this.deviceCredentials;
|
|
12302
12402
|
};
|
|
12303
12403
|
const preferences = this.preferences;
|
|
@@ -12430,6 +12530,7 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
|
|
|
12430
12530
|
//#endregion
|
|
12431
12531
|
exports.AuthAuditLog = AuthAuditLog;
|
|
12432
12532
|
exports.AuthManager = AuthManager;
|
|
12533
|
+
exports.DATAPLANE_SECRET_HEADER = DATAPLANE_SECRET_HEADER;
|
|
12433
12534
|
exports.DeviceCaStore = DeviceCaStore;
|
|
12434
12535
|
exports.DeviceCredentialManager = DeviceCredentialManager;
|
|
12435
12536
|
exports.FIRST_BOOT_ADMIN_PASSWORD = FIRST_BOOT_ADMIN_PASSWORD;
|
|
@@ -1,15 +1,115 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
|
|
3
|
+
import { K as makeSecretMarker, W as isSecretMarker } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
4
|
+
import { t as userError } from "../../camstack-error-viZYfcj9.mjs";
|
|
5
|
+
import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
|
|
6
|
+
import { a as authProviderCapability, c as TokenScopeSchema, i as deviceCredentialsCapability, l as UserRecordSchema, n as SsoBridgeClaimsSchema, o as MethodAccessSchema, s as ScopedTokenSchema, t as userManagementCapability, u as ViewerTokenScopeSchema } from "../../user-management.cap-DBIi77sB.mjs";
|
|
7
|
+
import { c as buildDeviceEnrollmentLink, l as buildDeviceSignatureMessage, n as DEVICE_NONCE_TTL_MS, t as DEVICE_ENROLLMENT_TTL_MS, u as formatDeviceRevoker } from "../../device-certificate-Cddm4Idn.mjs";
|
|
3
8
|
import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
|
|
4
9
|
import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
|
|
5
|
-
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-
|
|
10
|
+
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-BLM6fccc.mjs";
|
|
6
11
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
7
12
|
import { z } from "zod";
|
|
8
13
|
import * as crypto$1 from "node:crypto";
|
|
9
14
|
import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
10
15
|
import nodeCrypto from "crypto";
|
|
11
|
-
import * as fs from "node:fs";
|
|
16
|
+
import * as fs$1 from "node:fs";
|
|
12
17
|
import * as path$1 from "node:path";
|
|
18
|
+
//#region ../types/dist/esm/interfaces/addon-data-plane.mjs
|
|
19
|
+
/**
|
|
20
|
+
* Per-listener shared-secret header the hub injects on every reverse-proxied
|
|
21
|
+
* data-plane request and the addon's framework wrapper validates — so only the
|
|
22
|
+
* hub can reach the addon's `127.0.0.1` listener. Defined here (shared by the
|
|
23
|
+
* core proxy and the kernel listener) to keep both off a kernel↔core import.
|
|
24
|
+
*/
|
|
25
|
+
var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../types/dist/esm/auth/credential-scope.mjs
|
|
28
|
+
/** What a share-view grant lets its holder see. */
|
|
29
|
+
var ShareViewGrantSchema = /* @__PURE__ */ z.object({
|
|
30
|
+
kind: /* @__PURE__ */ z.enum(["grid-view", "events-view"]),
|
|
31
|
+
deviceIds: /* @__PURE__ */ z.array(/* @__PURE__ */ z.number().int().nonnegative()).min(1).max(64),
|
|
32
|
+
/** Talk-back, opt-in at mint time; absent means off. */
|
|
33
|
+
talk: /* @__PURE__ */ z.boolean().optional()
|
|
34
|
+
});
|
|
35
|
+
var ShareViewScopeSchema = /* @__PURE__ */ z.object({
|
|
36
|
+
type: /* @__PURE__ */ z.literal("share-view"),
|
|
37
|
+
grant: ShareViewGrantSchema
|
|
38
|
+
});
|
|
39
|
+
var AddonRoutesScopeSchema = /* @__PURE__ */ z.object({
|
|
40
|
+
type: /* @__PURE__ */ z.literal("addon-routes"),
|
|
41
|
+
access: /* @__PURE__ */ z.array(MethodAccessSchema).min(1)
|
|
42
|
+
});
|
|
43
|
+
var PreferencesSelfScopeSchema = /* @__PURE__ */ z.object({ type: /* @__PURE__ */ z.literal("preferences-self") });
|
|
44
|
+
var CredentialScopeSchema = /* @__PURE__ */ z.union([
|
|
45
|
+
/* @__PURE__ */ z.literal("*"),
|
|
46
|
+
ShareViewScopeSchema,
|
|
47
|
+
AddonRoutesScopeSchema,
|
|
48
|
+
PreferencesSelfScopeSchema,
|
|
49
|
+
ViewerTokenScopeSchema,
|
|
50
|
+
TokenScopeSchema
|
|
51
|
+
]);
|
|
52
|
+
/**
|
|
53
|
+
* The `kind` claim of a unified token. It names the TOKEN FAMILY (so every
|
|
54
|
+
* older gate that classifies a hub JWT refuses it — `classifyBearerPrincipal`
|
|
55
|
+
* treats any `kind` it does not know as not-a-credential), never what the
|
|
56
|
+
* token may do: that is its `scopes`, and only its `scopes`.
|
|
57
|
+
*/
|
|
58
|
+
var CREDENTIAL_TOKEN_KIND = "credential";
|
|
59
|
+
/**
|
|
60
|
+
* The `aud` claim every minted token is signed with (D895). The hub's raw JWT
|
|
61
|
+
* verify (`AuthManager.verifyToken`, used by every surface that wants a LOGIN
|
|
62
|
+
* session — the OAuth consent page, the session cookie, health, backups)
|
|
63
|
+
* refuses a token carrying it, so a minted token — a share link above all —
|
|
64
|
+
* can never be replayed as a person's session. Only the credential verifier's
|
|
65
|
+
* own door (`verifyCredentialToken`) accepts it.
|
|
66
|
+
*/
|
|
67
|
+
var CREDENTIAL_TOKEN_AUDIENCE = "camstack:credential";
|
|
68
|
+
/** Does a verified JWT payload belong to the minted-token family? */
|
|
69
|
+
function isCredentialTokenPayload(payload) {
|
|
70
|
+
if (payload === null || typeof payload !== "object") return false;
|
|
71
|
+
const kind = Reflect.get(payload, "kind");
|
|
72
|
+
const aud = Reflect.get(payload, "aud");
|
|
73
|
+
return kind === "credential" || aud === "camstack:credential" || Array.isArray(aud) && aud.includes("camstack:credential");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The claims of a unified token (`auth.mintToken`). It carries no `exp`: its
|
|
77
|
+
* row (looked up by `jti` on every verify, for revocation) holds the ONE
|
|
78
|
+
* expiry, so a share link can be extended and a JWT clock can never disagree
|
|
79
|
+
* with the row.
|
|
80
|
+
*/
|
|
81
|
+
var CredentialTokenClaimsSchema = /* @__PURE__ */ z.object({
|
|
82
|
+
kind: /* @__PURE__ */ z.literal(CREDENTIAL_TOKEN_KIND),
|
|
83
|
+
sub: /* @__PURE__ */ z.string().min(1),
|
|
84
|
+
jti: /* @__PURE__ */ z.string().min(16),
|
|
85
|
+
scopes: /* @__PURE__ */ z.array(CredentialScopeSchema).min(1)
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../types/dist/esm/schemas/user-preferences.mjs
|
|
89
|
+
/**
|
|
90
|
+
* Per-user ACCOUNT preferences (D894): the hub-side half of the viewer's two
|
|
91
|
+
* settings levels.
|
|
92
|
+
*
|
|
93
|
+
* - DEVICE settings never leave the phone.
|
|
94
|
+
* - ACCOUNT settings live here: one row per `(user, namespace)`, private to
|
|
95
|
+
* that user, synced across every device signed in as them, last write wins
|
|
96
|
+
* unless the writer sends the revision it based its edit on.
|
|
97
|
+
*
|
|
98
|
+
* A setting lives in exactly ONE level; there are no overrides. The caller
|
|
99
|
+
* never names a user: the hub stamps the principal's own id, admin included.
|
|
100
|
+
*
|
|
101
|
+
* The contract the client codes against is the `preferences.*` tRPC router
|
|
102
|
+
* (`server/backend/src/api/core/preferences.router.ts`).
|
|
103
|
+
*/
|
|
104
|
+
/** `viewer.app`, `viewer.cameras`, `viewer.grids` … — lowercase, dot/dash separated. */
|
|
105
|
+
var PREFERENCES_NAMESPACE_PATTERN = /^[a-z][a-z0-9.-]{0,63}$/;
|
|
106
|
+
/** One row's value, measured as UTF-8 JSON. */
|
|
107
|
+
var PREFERENCES_MAX_VALUE_BYTES = 256 * 1024;
|
|
108
|
+
var PreferenceNamespaceSchema = /* @__PURE__ */ z.string().regex(PREFERENCES_NAMESPACE_PATTERN);
|
|
109
|
+
/** A namespace's value: a JSON object, opaque to the hub. */
|
|
110
|
+
var PreferenceValueSchema = /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown());
|
|
111
|
+
var PreferenceDeviceIdSchema = /* @__PURE__ */ z.string().min(1).max(64);
|
|
112
|
+
//#endregion
|
|
13
113
|
//#region ../../node_modules/bcryptjs/index.js
|
|
14
114
|
/**
|
|
15
115
|
* The random implementation to use as a fallback.
|
|
@@ -11925,8 +12025,8 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
11925
12025
|
users: this.userManager,
|
|
11926
12026
|
dataDir: this.ctx.nodeDataDir,
|
|
11927
12027
|
fs: {
|
|
11928
|
-
exists: (filePath) => fs.existsSync(filePath),
|
|
11929
|
-
remove: (filePath) => fs.rmSync(filePath, { force: true })
|
|
12028
|
+
exists: (filePath) => fs$1.existsSync(filePath),
|
|
12029
|
+
remove: (filePath) => fs$1.rmSync(filePath, { force: true })
|
|
11930
12030
|
},
|
|
11931
12031
|
logger: this.ctx.logger
|
|
11932
12032
|
});
|
|
@@ -12417,4 +12517,4 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
12417
12517
|
}
|
|
12418
12518
|
};
|
|
12419
12519
|
//#endregion
|
|
12420
|
-
export { LocalAuthAddon, LocalAuthAddon as default, SettingsReadUnavailableError as _, attachUserManagementInternal as a, DeviceCaStore as c, onSessionsRevoked as d, DeviceCredentialManager as f, parseTokenExpiry as g, AuthManager as h, USER_MANAGEMENT_INTERNAL as i, LoginSessionManager as l, AuthAuditLog as m, FIRST_BOOT_ADMIN_USERNAME as n, getUserManagementInternal as o, PREVIOUS_LEAF_GRACE_MS as p, UserManager as r, preferencesLimitReasonOf as s, FIRST_BOOT_ADMIN_PASSWORD as t, REFRESH_TOKEN_PREFIX as u, isSettingsReadUnavailable as v };
|
|
12520
|
+
export { LocalAuthAddon, LocalAuthAddon as default, SettingsReadUnavailableError as _, attachUserManagementInternal as a, DeviceCaStore as c, onSessionsRevoked as d, DeviceCredentialManager as f, parseTokenExpiry as g, AuthManager as h, USER_MANAGEMENT_INTERNAL as i, LoginSessionManager as l, AuthAuditLog as m, FIRST_BOOT_ADMIN_USERNAME as n, getUserManagementInternal as o, PREVIOUS_LEAF_GRACE_MS as p, UserManager as r, preferencesLimitReasonOf as s, FIRST_BOOT_ADMIN_PASSWORD as t, REFRESH_TOKEN_PREFIX as u, isSettingsReadUnavailable as v, DATAPLANE_SECRET_HEADER as y };
|