@camstack/system 1.2.381 → 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.
Files changed (114) hide show
  1. package/dist/addon-runner.js +4 -2
  2. package/dist/addon-runner.mjs +4 -2
  3. package/dist/addon-utils.js +1 -1
  4. package/dist/addon-utils.mjs +1 -1
  5. package/dist/auth/admin-token-manager.d.ts +75 -0
  6. package/dist/auth/api-key-manager.d.ts +1 -14
  7. package/dist/auth/auth-audit-log.d.ts +59 -0
  8. package/dist/auth/auth-manager.d.ts +28 -16
  9. package/dist/auth/cidr.d.ts +22 -0
  10. package/dist/auth/login-session-manager.d.ts +158 -0
  11. package/dist/auth/user-management-internal.d.ts +69 -0
  12. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  13. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  14. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  15. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  16. package/dist/builtins/alerts/alerts.addon.js +1 -1
  17. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  18. package/dist/builtins/autotrack/index.js +1 -1
  19. package/dist/builtins/autotrack/index.mjs +1 -1
  20. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +14 -0
  21. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +291 -3631
  22. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +284 -3617
  23. package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +36 -0
  24. package/dist/builtins/backup-orchestrator/manifest-store.d.ts +19 -1
  25. package/dist/builtins/backup-orchestrator/restore-archive.d.ts +24 -0
  26. package/dist/builtins/calendars/calendars.addon.js +1 -1
  27. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  28. package/dist/builtins/camera-grid/index.js +1 -1
  29. package/dist/builtins/camera-grid/index.mjs +1 -1
  30. package/dist/builtins/composer/composer.addon.js +2 -2
  31. package/dist/builtins/composer/composer.addon.mjs +2 -2
  32. package/dist/builtins/console-logging/index.js +1 -1
  33. package/dist/builtins/console-logging/index.mjs +1 -1
  34. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  35. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  36. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  37. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  38. package/dist/builtins/hub-forwarder/index.js +1 -1
  39. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  40. package/dist/builtins/keychain/index.js +1108 -733
  41. package/dist/builtins/keychain/index.mjs +1108 -733
  42. package/dist/builtins/keychain/keychain-reset-trigger.d.ts +25 -0
  43. package/dist/builtins/keychain/keychain-service.d.ts +36 -3
  44. package/dist/builtins/keychain/keychain-store.d.ts +24 -1
  45. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  46. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  47. package/dist/builtins/local-auth/local-auth.addon.d.ts +16 -0
  48. package/dist/builtins/local-auth/local-auth.addon.js +1021 -118
  49. package/dist/builtins/local-auth/local-auth.addon.mjs +1034 -141
  50. package/dist/builtins/local-network/local-network.addon.js +3 -3
  51. package/dist/builtins/local-network/local-network.addon.mjs +3 -3
  52. package/dist/builtins/loki-logging/index.js +97 -29
  53. package/dist/builtins/loki-logging/index.mjs +97 -29
  54. package/dist/builtins/loki-logging/loki-logging.addon.d.ts +7 -23
  55. package/dist/builtins/loki-logging/retire-enabled-flag.d.ts +23 -0
  56. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  57. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  58. package/dist/builtins/platform-probe/index.js +1 -1
  59. package/dist/builtins/platform-probe/index.mjs +1 -1
  60. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  61. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  62. package/dist/builtins/snapshot/index.js +1 -1
  63. package/dist/builtins/snapshot/index.mjs +1 -1
  64. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  65. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  66. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  67. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  68. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +2 -2
  69. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +2 -2
  70. package/dist/builtins/system-backup/backup-encryption.d.ts +57 -0
  71. package/dist/builtins/system-backup/system-backup.service.d.ts +16 -1
  72. package/dist/builtins/system-config/cluster-secret-keeper.d.ts +7 -0
  73. package/dist/builtins/system-config/system-config.addon.d.ts +13 -3
  74. package/dist/builtins/system-config/system-config.addon.js +324 -38
  75. package/dist/builtins/system-config/system-config.addon.mjs +312 -39
  76. package/dist/builtins/winston-logging/index.js +1 -1
  77. package/dist/builtins/winston-logging/index.mjs +1 -1
  78. package/dist/{child-cap-dispatch-hf-Gce_4.js → child-cap-dispatch-BrMdKHfp.js} +6 -3
  79. package/dist/{child-cap-dispatch-BTe4eKep.mjs → child-cap-dispatch-WsYPNvnK.mjs} +10 -7
  80. package/dist/{cluster-secret-BUiG8DCo.js → cluster-secret-BEPLh3LL.js} +1 -1
  81. package/dist/{cluster-secret-DgJTZ4qY.mjs → cluster-secret-DhPdZ0VA.mjs} +1 -1
  82. package/dist/{composition-sources-4SmsP0O4.js → composition-sources-C6ZynCZ2.js} +1 -1
  83. package/dist/{composition-sources-CgOQVIwa.mjs → composition-sources-XqRX51db.mjs} +1 -1
  84. package/dist/{dist-BC0GnGeg.mjs → dist-CP5TTjwd.mjs} +1710 -158
  85. package/dist/{dist-BugrtARh.js → dist-tnAO12ak.js} +1721 -157
  86. package/dist/{event-loop-stall-monitor-CnQ-K6Gn.js → event-loop-stall-monitor-9kR0sAPS.js} +15 -15
  87. package/dist/{event-loop-stall-monitor-GgpnfAC0.mjs → event-loop-stall-monitor-WkssIXjq.mjs} +15 -15
  88. package/dist/{hub-cap-forward-CH6_VWVO.mjs → hub-cap-forward-CDiN1p98.mjs} +18 -2
  89. package/dist/{hub-cap-forward-COCmYaup.js → hub-cap-forward-W8oEm4ME.js} +23 -1
  90. package/dist/index.d.ts +16 -1
  91. package/dist/index.js +3341 -79
  92. package/dist/index.mjs +3567 -354
  93. package/dist/{jwt-signing-key-CsuVKA1W.mjs → jwt-signing-key-CAbozwvF.mjs} +1 -1
  94. package/dist/{jwt-signing-key-CjoZcol8.js → jwt-signing-key-Dgf8sIXY.js} +1 -1
  95. package/dist/kernel/index.d.ts +12 -0
  96. package/dist/kernel/moleculer/broker-factory.d.ts +8 -1
  97. package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +1 -0
  98. package/dist/kernel/moleculer/hub-service.d.ts +9 -0
  99. package/dist/kernel/moleculer/mesh-access-middleware.d.ts +28 -0
  100. package/dist/kernel/moleculer/mesh-auth-mode.d.ts +64 -0
  101. package/dist/kernel/moleculer/mesh-authenticator.d.ts +71 -0
  102. package/dist/kernel/moleculer/mesh-auto-enforce.d.ts +26 -0
  103. package/dist/kernel/moleculer/mesh-join-client.d.ts +51 -0
  104. package/dist/kernel/moleculer/mesh-join-proof.d.ts +39 -0
  105. package/dist/kernel/system-settings-policy.d.ts +4 -3
  106. package/dist/kernel/transport/hub-cap-forward.d.ts +14 -3
  107. package/dist/kernel/transport/index.d.ts +1 -1
  108. package/dist/restore-archive-BV39nY46.mjs +4045 -0
  109. package/dist/restore-archive-CbvrfPuB.js +4139 -0
  110. package/dist/{retired-settings-keys-DCuetwOt.js → retired-settings-keys-4bHpL-0m.js} +1 -1
  111. package/dist/{retired-settings-keys-MCVhxPkJ.mjs → retired-settings-keys-CzpIkwS-.mjs} +1 -1
  112. package/dist/{tls-CJHogwTl.mjs → tls-4cRH24Id.mjs} +3 -3
  113. package/package.json +1 -1
  114. package/dist/{tls-CCMX7MjX.js → tls-CljF057D.js} +1 -1
@@ -0,0 +1,25 @@
1
+ import { KeychainResetRecord } from '@camstack/types';
2
+ import { KeychainLogger, KeychainService } from './keychain-service.js';
3
+ /** The trigger's name, inside `<dataDir>/.keychain/`. */
4
+ export declare const KEYCHAIN_RESET_TRIGGER = "RESET_KEYCHAIN";
5
+ export declare function keychainResetTriggerPath(dataDir: string): string;
6
+ export type KeychainResetTriggerOutcome = {
7
+ readonly kind: 'absent';
8
+ } | {
9
+ readonly kind: 'ignored-unlocked';
10
+ } | {
11
+ readonly kind: 'deferred';
12
+ readonly reason: string;
13
+ } | {
14
+ readonly kind: 'refused';
15
+ readonly error: string;
16
+ } | {
17
+ readonly kind: 'reset';
18
+ readonly record: KeychainResetRecord;
19
+ };
20
+ export interface KeychainResetTriggerInput {
21
+ readonly service: Pick<KeychainService, 'getState' | 'resetAs' | 'resetReport'>;
22
+ readonly dataDir: string;
23
+ readonly logger: KeychainLogger;
24
+ }
25
+ export declare function applyKeychainResetTrigger(input: KeychainResetTriggerInput): Promise<KeychainResetTriggerOutcome>;
@@ -1,12 +1,16 @@
1
- import { EventCategory, KeychainAuditEntry, KeychainKeySource, KeychainResolveResult, KeychainSecretMeta, KeychainSecretUsage, KeychainState, KeychainStatus, KeychainUnavailableReason, SystemHeldSecretName } from '@camstack/types';
2
- import { KeychainRepository, KeychainSecretRow } from './keychain-store.js';
1
+ import { EventCategory, KeychainAuditEntry, KeychainKeySource, KeychainResetRecord, KeychainResolveResult, KeychainSecretMeta, KeychainSecretUsage, KeychainState, KeychainStatus, KeychainUnavailableReason, SystemHeldSecretName } from '@camstack/types';
3
2
  import { KeySourceCandidate } from './key-sources.js';
3
+ import { KeychainRepository, KeychainSecretRow } from './keychain-store.js';
4
4
  /** `lastReadAt` is written at most this often per ref (hub I/O is the bottleneck). */
5
5
  export declare const LAST_READ_GRANULARITY_MS: number;
6
6
  export declare class KeychainLockedError extends Error {
7
7
  readonly reason: KeychainUnavailableReason;
8
8
  constructor(reason: KeychainUnavailableReason);
9
9
  }
10
+ /** A reset that would archive the values and still end locked — refused before it starts. */
11
+ export declare class KeychainResetRefusedError extends Error {
12
+ constructor(reason: string);
13
+ }
10
14
  export declare class KeychainForbiddenError extends Error {
11
15
  readonly ref: string;
12
16
  constructor(ref: string, caller: string | null);
@@ -102,11 +106,40 @@ export declare class KeychainService {
102
106
  }>;
103
107
  /** Delete retired wraps, and the default file's previous copies with them. */
104
108
  purgeRetiredKeys(userId: string): Promise<number>;
105
- /** Lost-key recovery — see `keychain-admin.resetKeychain`. */
109
+ /** Lost-key recovery from System → Secrets — see `keychain-admin.resetKeychain`. */
106
110
  resetKeychain(userId: string): Promise<{
107
111
  archivedCollection: string | null;
108
112
  archived: number;
109
113
  }>;
114
+ /**
115
+ * Start over with a new master key and a new data key.
116
+ *
117
+ * 1. Refuse BEFORE touching anything when the configured primary source
118
+ * cannot give a key (a configured file that is missing or unreadable, a
119
+ * desktop key that did not arrive): archiving the values and then staying
120
+ * locked would lose them for nothing. The default file is always usable —
121
+ * the reset writes a new one (the old one is kept as `master.key.prev-*`).
122
+ * 2. Archive every value AND every wrapped data key — the archive stays
123
+ * openable if the lost master key turns up.
124
+ * 3. New data key under the new master key ({@link firstBoot}).
125
+ * 4. Clear the system-held markers (the cluster secret's): a marker pointing
126
+ * at an archived value would refuse every agent forever (D797). The
127
+ * session signing key has no marker; it now resolves `missing`, and
128
+ * `local-auth` generates a new one (everyone signs in again).
129
+ * 5. One `delete` event per archived ref, so every keeper reloads.
130
+ * 6. A reset record for the Secrets page, and an audit row.
131
+ */
132
+ resetAs(actor: string): Promise<KeychainResetRecord>;
133
+ /** Throws {@link KeychainResetRefusedError} when no new master key could be had. */
134
+ private assertResettable;
135
+ /** What the last reset left to re-enter (see `keychain-admin.resetReport`). */
136
+ resetReport(): Promise<{
137
+ reset: KeychainResetRecord | null;
138
+ pendingReentry: readonly KeychainSecretMeta[];
139
+ }>;
140
+ acknowledgeReset(userId: string): Promise<{
141
+ acknowledged: boolean;
142
+ }>;
110
143
  private audit;
111
144
  /** Daily ring prune, driven by the addon's timer. */
112
145
  pruneAudit(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { ISettingsStoreProvider, KeychainAuditAction } from '@camstack/types';
1
+ import { ISettingsStoreProvider, KeychainAuditAction, KeychainResetRecord } from '@camstack/types';
2
2
  /**
3
3
  * @durable class=config owner=keychain
4
4
  * write="`keychain.put` upserts one row per ref; `delete` removes it"
@@ -21,6 +21,14 @@ export declare const KEYCHAIN_KEYS_COLLECTION = "keychain:keys";
21
21
  * retention="90 days and at most 20 000 rows, pruned at boot and daily"
22
22
  */
23
23
  export declare const KEYCHAIN_AUDIT_COLLECTION = "keychain:audit";
24
+ /**
25
+ * @durable class=config owner=keychain
26
+ * write="one row per keychain reset (System → Secrets, or the RESET_KEYCHAIN
27
+ * trigger file); `acknowledgeReset` stamps `acknowledgedAt`"
28
+ * retention="none — a handful of rows over a hub's life; they name the
29
+ * archive tables a reset left behind"
30
+ */
31
+ export declare const KEYCHAIN_RESETS_COLLECTION = "keychain:resets";
24
32
  export declare const AUDIT_RETENTION_MS: number;
25
33
  export declare const AUDIT_MAX_ROWS = 20000;
26
34
  export interface KeychainSecretRow {
@@ -79,4 +87,19 @@ export declare class KeychainRepository {
79
87
  * so a key that turns up later can still recover it.
80
88
  */
81
89
  archiveAllSecrets(archive: string): Promise<number>;
90
+ /**
91
+ * Copy every wrapped data key into `archive` (the companion of
92
+ * {@link archiveAllSecrets}): without the wrap, an archived value could
93
+ * never be opened again even if the lost master key turned up.
94
+ */
95
+ archiveAllKeys(archive: string): Promise<number>;
96
+ /** Every secret row of an archive table (ciphertext — never decrypted here). */
97
+ listArchivedSecrets(archive: string): Promise<readonly KeychainSecretRow[]>;
98
+ /**
99
+ * Delete the `system-settings` rows among `keys` that exist; returns the
100
+ * keys it deleted. A read that fails throws — never "nothing was there".
101
+ */
102
+ clearSystemSettingsKeys(keys: readonly string[]): Promise<readonly string[]>;
103
+ putReset(record: KeychainResetRecord): Promise<void>;
104
+ latestReset(): Promise<KeychainResetRecord | null>;
82
105
  }
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-BugrtARh.js");
3
+ const require_dist = require("../../dist-tnAO12ak.js");
4
4
  //#region src/builtins/liveness-monitor/liveness-checks.ts
5
5
  var NO_DEVICES = "liveness:no-devices";
6
6
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -1,4 +1,4 @@
1
- import { F as RecordingStatusSchema, N as RECORDING_SOURCE_CAMSTACK_ADDON, Qr as EventCategory, cr as errMsg, lr as BaseAddon, wr as createEvent } from "../../dist-BC0GnGeg.mjs";
1
+ import { I as RecordingStatusSchema, P as RECORDING_SOURCE_CAMSTACK_ADDON, Tr as createEvent, ei as EventCategory, lr as errMsg, ur as BaseAddon } from "../../dist-CP5TTjwd.mjs";
2
2
  //#region src/builtins/liveness-monitor/liveness-checks.ts
3
3
  var NO_DEVICES = "liveness:no-devices";
4
4
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -9,8 +9,24 @@ export declare class LocalAuthAddon extends BaseAddon {
9
9
  private totpManager;
10
10
  private externalIdentities;
11
11
  private signingKeyKeeper;
12
+ private loginSessions;
13
+ private adminTokens;
14
+ private auditLog;
12
15
  constructor();
13
16
  protected onInitialize(): Promise<ProviderRegistration[]>;
17
+ /**
18
+ * The hub-internal surface (`user-management-internal.ts`): operations no
19
+ * wire may reach. Called only by hub code holding this provider object.
20
+ */
21
+ private buildInternal;
22
+ /**
23
+ * End every way `userId` could still get in: login sessions (and the
24
+ * pre-session tokens, via the cutoff), scoped tokens, OAuth account links,
25
+ * the TOTP row and the external sign-in links. Each step is attempted even
26
+ * if an earlier one fails, and a failure is logged — a half-cleaned user is
27
+ * worse than a loud one.
28
+ */
29
+ private endAllAccess;
14
30
  /**
15
31
  * Drop auth rows that are dead but were never removed: scoped tokens past
16
32
  * their expiry, and OAuth sessions revoked longer ago than