@camstack/types 1.2.364 → 1.2.365

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.
@@ -46,6 +46,8 @@ export { CustomModelDescriptorSchema, customModelRegistryCapability, ImportModel
46
46
  export { type DataStoreEngineInfo, dataStoreProviderCapability, EngineInfoSchema as DataStoreEngineInfoSchema, type IDataStoreProvider, } from './data-store-provider.cap.js';
47
47
  export { type ArchiveSqliteSnapshot, ArchiveSqliteSnapshotSchema, DATABASE_SNAPSHOT_PARTIAL_SUFFIX, DATABASE_SNAPSHOT_SUFFIX, DATABASE_SNAPSHOT_TIMEOUT_MS, type DatabaseSnapshotRequest, DatabaseSnapshotRequestSchema, type DatabaseSnapshotResult, DatabaseSnapshotResultSchema, type DatabaseSnapshotTable, DatabaseSnapshotTableSchema, type DatabaseSnapshotTargets, DatabaseSnapshotTargetsSchema, type DatabaseSnapshotWritten, DatabaseSnapshotWrittenSchema, databaseSnapshotCapability, type IDatabaseSnapshotProvider, } from './database-snapshot.cap.js';
48
48
  export { type IKeychainProvider, KEYCHAIN_MAX_REFS_PER_CALL, type KeychainResolveEntry, KeychainResolveEntrySchema, type KeychainResolveResult, KeychainResolveResultSchema, type KeychainSecretMeta, KeychainSecretMetaSchema, type KeychainState, KeychainStateSchema, type KeychainUnavailableReason, KeychainUnavailableReasonSchema, keychainCapability, } from './keychain.cap.js';
49
+ export { type DeviceCaStatus, DeviceCaStatusSchema, type DeviceCertificateSettings, DeviceCertificateSettingsSchema, deviceCredentialsCapability, type IDeviceCredentialsProvider, } from './device-credentials.cap.js';
50
+ export { type HttpsLeafInfo, HttpsLeafInfoSchema, type INodeCertificatesProvider, type MeshLeafInfo, MeshLeafInfoSchema, type NodeHttpsState, NodeHttpsStateSchema, nodeCertificatesCapability, } from './node-certificates.cap.js';
49
51
  export { type IKeychainAdminProvider, KEYCHAIN_RESET_CONFIRMATION, type KeychainAdminSecret, KeychainAdminSecretSchema, type KeychainAuditAction, KeychainAuditActionSchema, type KeychainAuditEntry, KeychainAuditEntrySchema, type KeychainKeySource, type KeychainKeySourceKind, KeychainKeySourceKindSchema, KeychainKeySourceSchema, KEYCHAIN_RESET_TRIGGER_ACTOR, type KeychainResetRecord, KeychainResetRecordSchema, type KeychainSecretUsage, KeychainSecretUsageSchema, type KeychainStatus, KeychainStatusSchema, keychainAdminCapability, type SystemHeldSecretName, SystemHeldSecretNameSchema, } from './keychain-admin.cap.js';
50
52
  export type { DecoderHwAccelConfig, HwAccelChoice, IDecoderCapProvider, } from './decoder.cap.js';
51
53
  export { DEFAULT_DECODER_HWACCEL_CONFIG, decoderCapability, HWACCEL_OPTIONS, } from './decoder.cap.js';
@@ -286,6 +288,8 @@ import type { dataStoreProviderCapability } from './data-store-provider.cap.js';
286
288
  import type { databaseSnapshotCapability } from './database-snapshot.cap.js';
287
289
  import type { keychainCapability } from './keychain.cap.js';
288
290
  import type { keychainAdminCapability } from './keychain-admin.cap.js';
291
+ import type { deviceCredentialsCapability } from './device-credentials.cap.js';
292
+ import type { nodeCertificatesCapability } from './node-certificates.cap.js';
289
293
  import type { dayNightCapability } from './day-night.cap.js';
290
294
  import type { decoderCapability } from './decoder.cap.js';
291
295
  import type { detectionPipelineCapability } from './detection-pipeline.cap.js';
@@ -409,6 +413,6 @@ import type { trainingProviderCapability } from './training-provider.cap.js';
409
413
  import type { zoneAnalyticsCapability } from './zone-analytics.cap.js';
410
414
  import type { zoneRulesCapability } from './zone-rules.cap.js';
411
415
  import type { zonesCapability } from './zones.cap.js';
412
- type AnyCapability = typeof streamSignalsCapability | typeof addonSettingsCapability | typeof alertsCapability | typeof storageCapability | typeof storageMigrationCapability | typeof storageProviderCapability | typeof storageEvictableCapability | typeof storageOccupancyCapability | typeof filesystemBrowseCapability | typeof backupCapability | typeof terminalSessionCapability | typeof settingsStoreCapability | typeof dataStoreProviderCapability | typeof databaseSnapshotCapability | typeof keychainCapability | typeof keychainAdminCapability | typeof logChannelsCapability | typeof logDestinationCapability | typeof loadContributionCapability | typeof failureContributionCapability | typeof adminUiCapability | typeof viewerUiCapability | typeof ssoBridgeCapability | typeof userPasskeysCapability | typeof smtpProviderCapability | typeof mqttBrokerCapability | typeof brokerCapability | typeof deviceAdoptionCapability | typeof deviceAdminLinkCapability | typeof deviceExportCapability | typeof addonPagesCapability | typeof addonPagesSourceCapability | typeof addonWidgetsCapability | typeof addonWidgetsSourceCapability | typeof customModelRegistryCapability | typeof modelDistributorCapability | typeof modelConvertCapability | typeof addonRoutesCapability | typeof streamBrokerCapability | typeof decoderCapability | typeof webrtcSessionCapability | typeof cameraStreamsCapability | typeof calendarSourceCapability | typeof calendarsCapability | typeof motionDetectionCapability | typeof pipelineExecutorCapability | typeof detectionPipelineCapability | typeof cameraPipelineConfigCapability | typeof pipelineRunnerCapability | typeof pipelineOrchestratorCapability | typeof audioAnalyzerCapability | typeof audioAnalysisCapability | typeof audioCodecCapability | typeof embeddingEncoderCapability | typeof vectorStoreCapability | typeof deviceProviderCapability | typeof deviceManagerCapability | typeof deviceStateCapability | typeof authProviderCapability | typeof loginMethodCapability | typeof networkAccessCapability | typeof turnProviderCapability | typeof snapshotCapability | typeof llmCapability | typeof llmRuntimeCapability | typeof notificationOutputCapability | typeof composerCapability | typeof coreBlocksCapability | typeof notificationRulesCapability | typeof pipelineAnalyticsCapability | typeof metricsProviderCapability | typeof ptzCapability | typeof ptzAutotrackCapability | typeof navigationCapability | typeof consumablesCapability | typeof connectionTestCapability | typeof rebootCapability | typeof deviceDiscoveryCapability | typeof brightnessCapability | typeof colorCapability | typeof climateControlCapability | typeof coverCapability | typeof valveCapability | typeof humidifierCapability | typeof waterHeaterCapability | typeof weatherCapability | typeof imageCapability | typeof lockControlCapability | typeof vacuumControlCapability | typeof petFeederCapability | typeof lawnMowerControlCapability | typeof fanControlCapability | typeof controlCapability | typeof notifierCapability | typeof mediaPlayerCapability | typeof alarmPanelCapability | typeof presenceCapability | typeof scriptRunnerCapability | typeof automationControlCapability | typeof motionTriggerCapability | typeof zonesCapability | typeof zoneRulesCapability | typeof trainingCapability | typeof trainingProviderCapability | typeof zoneAnalyticsCapability | typeof audioMetricsCapability | typeof motionCapability | typeof contactCapability | typeof floodCapability | typeof smokeCapability | typeof carbonMonoxideCapability | typeof gasCapability | typeof tamperCapability | typeof vibrationCapability | typeof connectivityCapability | typeof binaryCapability | typeof temperatureSensorCapability | typeof humiditySensorCapability | typeof ambientLightSensorCapability | typeof pressureSensorCapability | typeof powerMeterCapability | typeof airQualitySensorCapability | typeof numericSensorCapability | typeof enumSensorCapability | typeof recordingCapability | typeof recordingArchiveCapability | typeof recordingExportCapability | typeof recordingSignalCapability | typeof deviceOpsCapability | typeof platformProbeCapability | typeof localNetworkCapability | typeof meshNetworkCapability | typeof userManagementCapability | typeof systemCapability | typeof networkQualityCapability | typeof toastCapability | typeof nodesCapability | typeof serverManagementCapability | typeof integrationsCapability | typeof addonsCapability | typeof oauthIntegrationCapability | typeof oidcConnectionsCapability | typeof streamParamsCapability | typeof streamCatalogCapability | typeof motionZonesCapability | typeof cameraGridLayoutCapability | typeof sceneMonitorCapability | typeof privacyMaskCapability | typeof dayNightCapability | typeof recordingOnboardCapability | typeof imageSettingsCapability | typeof osdCapability | typeof osdManagerCapability | typeof accessoriesCapability | typeof batteryCapability | typeof networkLinkCapability | typeof buttonCapability | typeof cameraCredentialsCapability | typeof deviceStatusCapability | typeof doorbellCapability | typeof eventEmitterCapability | typeof faceGalleryCapability | typeof featureProbeCapability | typeof intercomCapability | typeof nativeObjectDetectionCapability | typeof plateGalleryCapability | typeof switchCapability | typeof updateCapability | typeof videoclipsCapability | typeof deviceExtensionCapability;
416
+ type AnyCapability = typeof streamSignalsCapability | typeof addonSettingsCapability | typeof alertsCapability | typeof storageCapability | typeof storageMigrationCapability | typeof storageProviderCapability | typeof storageEvictableCapability | typeof storageOccupancyCapability | typeof filesystemBrowseCapability | typeof backupCapability | typeof terminalSessionCapability | typeof settingsStoreCapability | typeof dataStoreProviderCapability | typeof databaseSnapshotCapability | typeof keychainCapability | typeof keychainAdminCapability | typeof deviceCredentialsCapability | typeof nodeCertificatesCapability | typeof logChannelsCapability | typeof logDestinationCapability | typeof loadContributionCapability | typeof failureContributionCapability | typeof adminUiCapability | typeof viewerUiCapability | typeof ssoBridgeCapability | typeof userPasskeysCapability | typeof smtpProviderCapability | typeof mqttBrokerCapability | typeof brokerCapability | typeof deviceAdoptionCapability | typeof deviceAdminLinkCapability | typeof deviceExportCapability | typeof addonPagesCapability | typeof addonPagesSourceCapability | typeof addonWidgetsCapability | typeof addonWidgetsSourceCapability | typeof customModelRegistryCapability | typeof modelDistributorCapability | typeof modelConvertCapability | typeof addonRoutesCapability | typeof streamBrokerCapability | typeof decoderCapability | typeof webrtcSessionCapability | typeof cameraStreamsCapability | typeof calendarSourceCapability | typeof calendarsCapability | typeof motionDetectionCapability | typeof pipelineExecutorCapability | typeof detectionPipelineCapability | typeof cameraPipelineConfigCapability | typeof pipelineRunnerCapability | typeof pipelineOrchestratorCapability | typeof audioAnalyzerCapability | typeof audioAnalysisCapability | typeof audioCodecCapability | typeof embeddingEncoderCapability | typeof vectorStoreCapability | typeof deviceProviderCapability | typeof deviceManagerCapability | typeof deviceStateCapability | typeof authProviderCapability | typeof loginMethodCapability | typeof networkAccessCapability | typeof turnProviderCapability | typeof snapshotCapability | typeof llmCapability | typeof llmRuntimeCapability | typeof notificationOutputCapability | typeof composerCapability | typeof coreBlocksCapability | typeof notificationRulesCapability | typeof pipelineAnalyticsCapability | typeof metricsProviderCapability | typeof ptzCapability | typeof ptzAutotrackCapability | typeof navigationCapability | typeof consumablesCapability | typeof connectionTestCapability | typeof rebootCapability | typeof deviceDiscoveryCapability | typeof brightnessCapability | typeof colorCapability | typeof climateControlCapability | typeof coverCapability | typeof valveCapability | typeof humidifierCapability | typeof waterHeaterCapability | typeof weatherCapability | typeof imageCapability | typeof lockControlCapability | typeof vacuumControlCapability | typeof petFeederCapability | typeof lawnMowerControlCapability | typeof fanControlCapability | typeof controlCapability | typeof notifierCapability | typeof mediaPlayerCapability | typeof alarmPanelCapability | typeof presenceCapability | typeof scriptRunnerCapability | typeof automationControlCapability | typeof motionTriggerCapability | typeof zonesCapability | typeof zoneRulesCapability | typeof trainingCapability | typeof trainingProviderCapability | typeof zoneAnalyticsCapability | typeof audioMetricsCapability | typeof motionCapability | typeof contactCapability | typeof floodCapability | typeof smokeCapability | typeof carbonMonoxideCapability | typeof gasCapability | typeof tamperCapability | typeof vibrationCapability | typeof connectivityCapability | typeof binaryCapability | typeof temperatureSensorCapability | typeof humiditySensorCapability | typeof ambientLightSensorCapability | typeof pressureSensorCapability | typeof powerMeterCapability | typeof airQualitySensorCapability | typeof numericSensorCapability | typeof enumSensorCapability | typeof recordingCapability | typeof recordingArchiveCapability | typeof recordingExportCapability | typeof recordingSignalCapability | typeof deviceOpsCapability | typeof platformProbeCapability | typeof localNetworkCapability | typeof meshNetworkCapability | typeof userManagementCapability | typeof systemCapability | typeof networkQualityCapability | typeof toastCapability | typeof nodesCapability | typeof serverManagementCapability | typeof integrationsCapability | typeof addonsCapability | typeof oauthIntegrationCapability | typeof oidcConnectionsCapability | typeof streamParamsCapability | typeof streamCatalogCapability | typeof motionZonesCapability | typeof cameraGridLayoutCapability | typeof sceneMonitorCapability | typeof privacyMaskCapability | typeof dayNightCapability | typeof recordingOnboardCapability | typeof imageSettingsCapability | typeof osdCapability | typeof osdManagerCapability | typeof accessoriesCapability | typeof batteryCapability | typeof networkLinkCapability | typeof buttonCapability | typeof cameraCredentialsCapability | typeof deviceStatusCapability | typeof doorbellCapability | typeof eventEmitterCapability | typeof faceGalleryCapability | typeof featureProbeCapability | typeof intercomCapability | typeof nativeObjectDetectionCapability | typeof plateGalleryCapability | typeof switchCapability | typeof updateCapability | typeof videoclipsCapability | typeof deviceExtensionCapability;
413
417
  export type CapabilityName = AnyCapability['name'];
414
418
  export type ITypedReadinessRegistry = IReadinessRegistry<CapabilityName>;
@@ -0,0 +1,128 @@
1
+ import { z } from 'zod';
2
+ import { type InferProvider } from './capability-definition.js';
3
+ /**
4
+ * `node-certificates` - what a node holds and the two renewals the hub drives
5
+ * (D856): the node's MESH leaf (mutual TLS to the hub) and its HTTPS leaf (issued
6
+ * from the hub's local CA so a device that trusts the hub root trusts the node).
7
+ *
8
+ * Provided by the AGENT RUNTIME (the synthetic `agent-runtime` addon id, like
9
+ * `server-management`): the hub reaches it through the ordinary node-pinned
10
+ * capability call - no new Moleculer action. The hub's own certificates are
11
+ * handled in-process by the hub (`certificates` router), so this cap has no hub
12
+ * provider.
13
+ *
14
+ * No private key ever crosses the mesh: the node generates its key pair, sends a
15
+ * CSR, and the hub returns only the signed certificate.
16
+ */
17
+ export declare const MeshLeafInfoSchema: z.ZodObject<{
18
+ cn: z.ZodString;
19
+ serial: z.ZodString;
20
+ fingerprintSha256: z.ZodString;
21
+ notBefore: z.ZodNumber;
22
+ notAfter: z.ZodNumber;
23
+ }, z.core.$strip>;
24
+ export type MeshLeafInfo = z.infer<typeof MeshLeafInfoSchema>;
25
+ export declare const HttpsLeafInfoSchema: z.ZodObject<{
26
+ fingerprintSha256: z.ZodString;
27
+ issuer: z.ZodString;
28
+ sans: z.ZodArray<z.ZodString>;
29
+ notBefore: z.ZodNumber;
30
+ notAfter: z.ZodNumber;
31
+ }, z.core.$strip>;
32
+ export type HttpsLeafInfo = z.infer<typeof HttpsLeafInfoSchema>;
33
+ export declare const NodeHttpsStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ state: z.ZodLiteral<"served">;
35
+ leaf: z.ZodObject<{
36
+ fingerprintSha256: z.ZodString;
37
+ issuer: z.ZodString;
38
+ sans: z.ZodArray<z.ZodString>;
39
+ notBefore: z.ZodNumber;
40
+ notAfter: z.ZodNumber;
41
+ }, z.core.$strip>;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ state: z.ZodLiteral<"not-issued">;
44
+ reason: z.ZodString;
45
+ }, z.core.$strip>], "state">;
46
+ export type NodeHttpsState = z.infer<typeof NodeHttpsStateSchema>;
47
+ export declare const nodeCertificatesCapability: {
48
+ readonly name: 'node-certificates';
49
+ readonly scope: 'system';
50
+ readonly mode: 'singleton';
51
+ readonly internal: true;
52
+ readonly methods: {
53
+ /** The node's current mesh leaf (`null` when it is not enrolled on mTLS) and HTTPS state. */
54
+ readonly getCertificates: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
55
+ nodeId: z.ZodString;
56
+ mesh: z.ZodNullable<z.ZodObject<{
57
+ cn: z.ZodString;
58
+ serial: z.ZodString;
59
+ fingerprintSha256: z.ZodString;
60
+ notBefore: z.ZodNumber;
61
+ notAfter: z.ZodNumber;
62
+ }, z.core.$strip>>;
63
+ https: z.ZodDiscriminatedUnion<[z.ZodObject<{
64
+ state: z.ZodLiteral<"served">;
65
+ leaf: z.ZodObject<{
66
+ fingerprintSha256: z.ZodString;
67
+ issuer: z.ZodString;
68
+ sans: z.ZodArray<z.ZodString>;
69
+ notBefore: z.ZodNumber;
70
+ notAfter: z.ZodNumber;
71
+ }, z.core.$strip>;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ state: z.ZodLiteral<"not-issued">;
74
+ reason: z.ZodString;
75
+ }, z.core.$strip>], "state">;
76
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
77
+ /** Generate a NEW mesh key pair on the node; return the CSR (CN = node id). The key stays here. */
78
+ readonly prepareMeshRenewal: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
79
+ csrPem: z.ZodString;
80
+ }, z.core.$strip>, "mutation">;
81
+ /**
82
+ * Install the hub-signed leaf for the key made by `prepareMeshRenewal`: persist it
83
+ * (keeping the previous one), then reconnect to the hub with it. The node reverts to
84
+ * the previous leaf by itself unless `confirmMeshLeaf` arrives within `confirmWithinMs`.
85
+ */
86
+ readonly installMeshLeaf: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
87
+ certPem: z.ZodString;
88
+ caCertPem: z.ZodString;
89
+ confirmWithinMs: z.ZodNumber;
90
+ }, z.core.$strip>, z.ZodObject<{
91
+ fingerprintSha256: z.ZodString;
92
+ serial: z.ZodString;
93
+ }, z.core.$strip>, "mutation">;
94
+ /** The hub saw the node reconnect with the new leaf: keep it, forget the previous one. */
95
+ readonly confirmMeshLeaf: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
96
+ fingerprintSha256: z.ZodString;
97
+ }, z.core.$strip>, z.ZodObject<{
98
+ confirmed: z.ZodBoolean;
99
+ }, z.core.$strip>, "mutation">;
100
+ /** Go back to the previous leaf now. `false` when there is none to go back to. */
101
+ readonly rollbackMeshLeaf: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
102
+ rolledBack: z.ZodBoolean;
103
+ }, z.core.$strip>, "mutation">;
104
+ /** A key pair + CSR for the node's HTTPS leaf, and the names the node reports for itself. */
105
+ readonly prepareHttpsCertificate: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
106
+ csrPem: z.ZodString;
107
+ hostnames: z.ZodArray<z.ZodString>;
108
+ addresses: z.ZodArray<z.ZodString>;
109
+ pinnedCaFingerprintSha256: z.ZodNullable<z.ZodString>;
110
+ }, z.core.$strip>, "mutation">;
111
+ /** Install the hub-signed HTTPS leaf and hot-swap the serving context (no restart). */
112
+ readonly installHttpsCertificate: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
113
+ certPem: z.ZodString;
114
+ caCertPem: z.ZodString;
115
+ caRotation: z.ZodOptional<z.ZodBoolean>;
116
+ }, z.core.$strip>, z.ZodObject<{
117
+ fingerprintSha256: z.ZodString;
118
+ issuer: z.ZodString;
119
+ sans: z.ZodArray<z.ZodString>;
120
+ notBefore: z.ZodNumber;
121
+ notAfter: z.ZodNumber;
122
+ }, z.core.$strip>, "mutation">;
123
+ };
124
+ readonly mount: {
125
+ readonly kind: 'skip';
126
+ };
127
+ };
128
+ export type INodeCertificatesProvider = InferProvider<typeof nodeCertificatesCapability>;
package/dist/client.d.ts CHANGED
@@ -14,4 +14,4 @@
14
14
  * value this entry does not export — a missing name here is `undefined` at
15
15
  * runtime, not a build error.
16
16
  */
17
- export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, droppedConditionsForKind, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, isHeldBackTemplateVar, isSystemRuleKind, kindsForDiscriminator, locationIconKey, knownValues, nodePickerItems, packagePickerItems, pickerForCondition, pickerForRuleClasses, parseRetrainRevisionConflict, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, summarizeReview, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, } from './index.js';
17
+ export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_CERT_SIGNATURE, DEVICE_SIGNATURE_MESSAGE_VERSION, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, canonicalIconKey, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, deviceRefusalFromMessage, isDefinitiveDeviceRefusal, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, droppedConditionsForKind, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, isHeldBackTemplateVar, isSystemRuleKind, kindsForDiscriminator, locationIconKey, knownValues, nodePickerItems, parseDeviceEnrollmentLink, packagePickerItems, pickerForCondition, pickerForRuleClasses, parseRetrainRevisionConflict, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, summarizeReview, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, } from './index.js';
package/dist/client.js CHANGED
@@ -559,6 +559,240 @@ zod.z.object({
559
559
  resolution: CamStreamResolutionSchema.optional()
560
560
  });
561
561
  //#endregion
562
+ //#region src/auth/device-certificate.ts
563
+ /**
564
+ * Device certificates (D855) — the wire contract shared by the hub, the admin
565
+ * UI and the native viewer.
566
+ *
567
+ * A device (a phone) generates its OWN P-256 key pair in hardware (Secure
568
+ * Enclave / Android Keystore / a non-extractable WebCrypto key). The private
569
+ * key never travels. The hub signs the PUBLIC key into an X.509 leaf under a
570
+ * dedicated device CA; the device later proves possession of the key by
571
+ * signing a hub-issued nonce, and the hub answers with the same session a
572
+ * password login opens.
573
+ *
574
+ * Everything on the wire is a small string (a PEM, a base64url signature):
575
+ * D613 is about bulk bytes, and a certificate is ~600 bytes.
576
+ */
577
+ /** Signature algorithm of every device credential: ECDSA, curve P-256, SHA-256. */
578
+ var DEVICE_CERT_SIGNATURE = "ecdsa-p256-sha256";
579
+ /** First line of every signed message; a change of format bumps the version. */
580
+ var DEVICE_SIGNATURE_MESSAGE_VERSION = "camstack-device-cert-v1";
581
+ zod.z.enum([
582
+ "login",
583
+ "renew",
584
+ "revoke"
585
+ ]);
586
+ var DEVICE_CERT_RENEW_WINDOW_DAYS = 30;
587
+ /**
588
+ * The exact bytes a device signs (UTF-8, `\n` separators, no trailing newline):
589
+ *
590
+ * camstack-device-cert-v1
591
+ * <login|renew>
592
+ * <origin> the hub origin returned by `getDeviceChallenge`
593
+ * <nonce>
594
+ *
595
+ * The origin is part of the message so a signature collected by a look-alike
596
+ * hub is worthless on the real one; the hub additionally binds the nonce to
597
+ * the origin it issued it for and refuses any other.
598
+ */
599
+ function buildDeviceSignatureMessage(input) {
600
+ return [
601
+ DEVICE_SIGNATURE_MESSAGE_VERSION,
602
+ input.purpose,
603
+ input.origin,
604
+ input.nonce
605
+ ].join("\n");
606
+ }
607
+ /** The deep link a QR carries: `camstack://enroll?hub=<origin>&code=<code>`. */
608
+ function buildDeviceEnrollmentLink(input) {
609
+ const query = new URLSearchParams();
610
+ if (input.hub !== void 0) query.set("hub", input.hub);
611
+ query.set("code", input.code);
612
+ return `${input.scheme ?? "camstack"}://enroll?${query.toString()}`;
613
+ }
614
+ /** Parse an enrollment deep link; `null` when it is not one. `hub` is absent when the link names none. */
615
+ function parseDeviceEnrollmentLink(raw) {
616
+ let url;
617
+ try {
618
+ url = new URL(raw);
619
+ } catch {
620
+ return null;
621
+ }
622
+ if (url.protocol !== "camstack:" && url.protocol !== "camstack.dev:") return null;
623
+ if (url.hostname !== "enroll") return null;
624
+ const code = url.searchParams.get("code");
625
+ if (code === null || code === "") return null;
626
+ const hub = url.searchParams.get("hub");
627
+ return {
628
+ hub: hub === null || hub === "" ? null : hub,
629
+ code
630
+ };
631
+ }
632
+ var DevicePlatformSchema = zod.z.enum([
633
+ "ios",
634
+ "android",
635
+ "web",
636
+ "other"
637
+ ]);
638
+ var Base64UrlSchema = zod.z.string().min(1).max(4096).regex(/^[A-Za-z0-9_-]+$/);
639
+ var PemSchema = zod.z.string().min(1).max(16384);
640
+ /**
641
+ * Why a device-certificate endpoint said no. Distinct from a transport / 5xx
642
+ * failure: those carry no reason and mean "try again", never "the credential is
643
+ * dead". The viewer switches on this exhaustively.
644
+ */
645
+ var DeviceRefusalReasonSchema = zod.z.enum([
646
+ "revoked",
647
+ "unknown-credential",
648
+ "expired",
649
+ "bad-signature",
650
+ "nonce-invalid",
651
+ "rate-limited",
652
+ "invalid-certificate",
653
+ "superseded",
654
+ "user-gone",
655
+ "unavailable",
656
+ "code-invalid",
657
+ "self-enrollment-disabled",
658
+ "step-up-required",
659
+ "bad-public-key"
660
+ ]);
661
+ /** The only answers after which the app may count towards deleting its credential. */
662
+ var DEFINITIVE_DEVICE_REFUSALS = [
663
+ "revoked",
664
+ "unknown-credential",
665
+ "user-gone"
666
+ ];
667
+ /** Consecutive DEFINITIVE answers before the app deletes its key and certificate. */
668
+ var DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE = 3;
669
+ function isDefinitiveDeviceRefusal(reason) {
670
+ return DEFINITIVE_DEVICE_REFUSALS.includes(reason);
671
+ }
672
+ var DeviceRefusalSchema = zod.z.object({
673
+ ok: zod.z.literal(false),
674
+ reason: DeviceRefusalReasonSchema,
675
+ definitive: zod.z.boolean(),
676
+ retryAfterSeconds: zod.z.number().optional()
677
+ });
678
+ /**
679
+ * A credential-bound session that can no longer refresh answers
680
+ * `auth.refreshSession` with UNAUTHORIZED whose message is this prefix + the
681
+ * reason; {@link deviceRefusalFromMessage} reads it back.
682
+ */
683
+ var DEVICE_REFRESH_REFUSAL_PREFIX = "device-credential:";
684
+ function deviceRefusalFromMessage(message) {
685
+ if (!message.startsWith("device-credential:")) return null;
686
+ const parsed = DeviceRefusalReasonSchema.safeParse(message.slice(18));
687
+ return parsed.success ? parsed.data : null;
688
+ }
689
+ zod.z.object({
690
+ code: zod.z.string().min(1).max(256),
691
+ /** SubjectPublicKeyInfo DER of the device's P-256 public key, base64url. */
692
+ publicKeySpki: Base64UrlSchema,
693
+ deviceName: zod.z.string().min(1).max(80).optional(),
694
+ platform: DevicePlatformSchema
695
+ });
696
+ var CompleteEnrollmentOutputSchema = zod.z.object({
697
+ credentialId: zod.z.string(),
698
+ certPem: PemSchema,
699
+ /** The device CA certificate the leaf chains to. */
700
+ chainPem: PemSchema,
701
+ notAfter: zod.z.number(),
702
+ user: zod.z.object({
703
+ id: zod.z.string(),
704
+ username: zod.z.string()
705
+ })
706
+ });
707
+ zod.z.discriminatedUnion("ok", [CompleteEnrollmentOutputSchema.extend({ ok: zod.z.literal(true) }), DeviceRefusalSchema]);
708
+ zod.z.object({
709
+ /** The single-use step-up proof (`auth.deviceEnrollProofFrom…`). */
710
+ proof: zod.z.string().min(1).max(512),
711
+ publicKeySpki: Base64UrlSchema,
712
+ deviceName: zod.z.string().min(1).max(80),
713
+ platform: DevicePlatformSchema
714
+ });
715
+ zod.z.object({
716
+ proof: zod.z.string(),
717
+ expiresAt: zod.z.number()
718
+ });
719
+ var DeviceChallengeSchema = zod.z.object({
720
+ nonce: zod.z.string(),
721
+ /** The origin to put in the signed message. The app compares it to the hub it dialled. */
722
+ origin: zod.z.string(),
723
+ expiresAt: zod.z.number(),
724
+ signature: zod.z.literal(DEVICE_CERT_SIGNATURE)
725
+ });
726
+ zod.z.discriminatedUnion("ok", [DeviceChallengeSchema.extend({ ok: zod.z.literal(true) }), DeviceRefusalSchema]);
727
+ zod.z.object({
728
+ certPem: PemSchema,
729
+ nonce: zod.z.string().min(1).max(256),
730
+ /** ECDSA P-256 SHA-256 over {@link buildDeviceSignatureMessage}; raw r||s or DER, base64url. */
731
+ signature: Base64UrlSchema
732
+ });
733
+ var RenewDeviceCertificateOutputSchema = zod.z.object({
734
+ credentialId: zod.z.string(),
735
+ certPem: PemSchema,
736
+ chainPem: PemSchema,
737
+ notAfter: zod.z.number()
738
+ });
739
+ zod.z.discriminatedUnion("ok", [RenewDeviceCertificateOutputSchema.extend({ ok: zod.z.literal(true) }), DeviceRefusalSchema]);
740
+ zod.z.discriminatedUnion("ok", [zod.z.object({
741
+ ok: zod.z.literal(true),
742
+ credentialId: zod.z.string(),
743
+ sessionsEnded: zod.z.number().int()
744
+ }), DeviceRefusalSchema]);
745
+ var DeviceCredentialStatusSchema = zod.z.enum([
746
+ "active",
747
+ "expired",
748
+ "revoked"
749
+ ]);
750
+ zod.z.object({
751
+ id: zod.z.string(),
752
+ userId: zod.z.string(),
753
+ username: zod.z.string().nullable(),
754
+ deviceName: zod.z.string(),
755
+ platform: DevicePlatformSchema,
756
+ enrolledVia: zod.z.enum(["qr", "self"]),
757
+ /** SHA-256 of the leaf certificate DER, colon-hex. */
758
+ fingerprint: zod.z.string(),
759
+ issuedAt: zod.z.number(),
760
+ expiresAt: zod.z.number(),
761
+ lastUsedAt: zod.z.number().nullable(),
762
+ lastUsedFrom: zod.z.string().nullable(),
763
+ revokedAt: zod.z.number().nullable(),
764
+ /** `admin:<userId>` | `user:<userId>` | `device` | `user-deleted`. */
765
+ revokedBy: zod.z.string().nullable(),
766
+ status: DeviceCredentialStatusSchema
767
+ });
768
+ zod.z.object({
769
+ /** Shown once; only its hash is kept. */
770
+ code: zod.z.string(),
771
+ expiresAt: zod.z.number(),
772
+ /** `camstack://enroll?hub=…&code=…` — what the QR encodes. */
773
+ enrollUrl: zod.z.string(),
774
+ /** The hub origin in the link, or `null` when the hub could not name one (the link then has no `hub`). */
775
+ hubOrigin: zod.z.string().nullable(),
776
+ /** Every origin the apps may try (role `appConnections`). */
777
+ hubOrigins: zod.z.array(zod.z.string())
778
+ });
779
+ zod.z.object({
780
+ kind: zod.z.literal("device-certificate"),
781
+ id: zod.z.literal("device-certificate"),
782
+ label: zod.z.string(),
783
+ stage: zod.z.literal("primary"),
784
+ /** tRPC paths under the hub's `auth` router, so a client names no literal. */
785
+ challengePath: zod.z.literal("auth.getDeviceChallenge"),
786
+ revokePath: zod.z.literal("auth.revokeOwnDeviceCertificate"),
787
+ enrollSelfPath: zod.z.literal("auth.enrollSelf"),
788
+ loginPath: zod.z.literal("auth.loginWithDeviceCertificate"),
789
+ renewPath: zod.z.literal("auth.renewDeviceCertificate"),
790
+ signature: zod.z.literal(DEVICE_CERT_SIGNATURE),
791
+ messageVersion: zod.z.literal(DEVICE_SIGNATURE_MESSAGE_VERSION),
792
+ /** Which clients can execute it: a native app silently, a browser with a non-extractable WebCrypto key. */
793
+ clients: zod.z.array(zod.z.enum(["native", "web"]))
794
+ });
795
+ //#endregion
562
796
  //#region src/catalogs/sensor-active-state.ts
563
797
  /**
564
798
  * THE table "which boolean of this device type counts as HIGH", and the
@@ -27412,6 +27646,16 @@ function createSystemProxy(api) {
27412
27646
  release: (input) => dispatch("deviceAdoption", "release", "mutation", input),
27413
27647
  resync: (input) => dispatch("deviceAdoption", "resync", "mutation", input)
27414
27648
  },
27649
+ deviceCredentials: {
27650
+ listDeviceCredentials: (input) => dispatch("deviceCredentials", "listDeviceCredentials", "query", input),
27651
+ startEnrollment: (input) => dispatch("deviceCredentials", "startEnrollment", "mutation", input),
27652
+ revokeDeviceCredential: (input) => dispatch("deviceCredentials", "revokeDeviceCredential", "mutation", input),
27653
+ getDeviceCertificateSettings: (input) => dispatch("deviceCredentials", "getDeviceCertificateSettings", "query", input),
27654
+ setDeviceCertificateSettings: (input) => dispatch("deviceCredentials", "setDeviceCertificateSettings", "mutation", input),
27655
+ deleteDeviceCredential: (input) => dispatch("deviceCredentials", "deleteDeviceCredential", "mutation", input),
27656
+ getDeviceCaStatus: (input) => dispatch("deviceCredentials", "getDeviceCaStatus", "query", input),
27657
+ renameDeviceCredential: (input) => dispatch("deviceCredentials", "renameDeviceCredential", "mutation", input)
27658
+ },
27415
27659
  deviceExport: {
27416
27660
  getStatus: (input) => dispatch("deviceExport", "getStatus", "query", input),
27417
27661
  listSupportedDeviceKinds: (input) => dispatch("deviceExport", "listSupportedDeviceKinds", "query", input),
@@ -30881,6 +31125,12 @@ exports.CLIP_BROKER_PACED_RATES = CLIP_BROKER_PACED_RATES;
30881
31125
  exports.COCO_TO_MACRO = COCO_TO_MACRO;
30882
31126
  exports.CamProfileSchema = CamProfileSchema;
30883
31127
  exports.DEFAULT_TIMELAPSE_PREVIEW_TEXT = DEFAULT_TIMELAPSE_PREVIEW_TEXT;
31128
+ exports.DEFINITIVE_DEVICE_REFUSALS = DEFINITIVE_DEVICE_REFUSALS;
31129
+ exports.DEVICE_CERT_RENEW_WINDOW_DAYS = DEVICE_CERT_RENEW_WINDOW_DAYS;
31130
+ exports.DEVICE_CERT_SIGNATURE = DEVICE_CERT_SIGNATURE;
31131
+ exports.DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE = DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE;
31132
+ exports.DEVICE_REFRESH_REFUSAL_PREFIX = DEVICE_REFRESH_REFUSAL_PREFIX;
31133
+ exports.DEVICE_SIGNATURE_MESSAGE_VERSION = DEVICE_SIGNATURE_MESSAGE_VERSION;
30884
31134
  exports.DeviceType = DeviceType;
30885
31135
  exports.EVENTFUL_CAP_NAMES = EVENTFUL_CAP_NAMES;
30886
31136
  exports.EVENT_KIND_BY_CAP = EVENT_KIND_BY_CAP;
@@ -30929,14 +31179,18 @@ exports.YAMNET_TO_MACRO = YAMNET_TO_MACRO;
30929
31179
  exports.alarmDeviceBlocksArming = alarmDeviceBlocksArming;
30930
31180
  exports.alarmDeviceSecureOnArm = alarmDeviceSecureOnArm;
30931
31181
  exports.alarmPatchLanded = alarmPatchLanded;
31182
+ exports.buildDeviceEnrollmentLink = buildDeviceEnrollmentLink;
31183
+ exports.buildDeviceSignatureMessage = buildDeviceSignatureMessage;
30932
31184
  exports.canonicalIconKey = canonicalIconKey;
30933
31185
  exports.classifyRetrainReview = classifyRetrainReview;
30934
31186
  exports.conditionVisibleForKind = conditionVisibleForKind;
30935
31187
  exports.createSystemProxy = createSystemProxy;
31188
+ exports.deviceRefusalFromMessage = deviceRefusalFromMessage;
30936
31189
  exports.droppedConditionsForKind = droppedConditionsForKind;
30937
31190
  exports.iconCategoryLabel = iconCategoryLabel;
30938
31191
  exports.iconEntry = iconEntry;
30939
31192
  exports.iconsInCategory = iconsInCategory;
31193
+ exports.isDefinitiveDeviceRefusal = isDefinitiveDeviceRefusal;
30940
31194
  exports.isHeldBackTemplateVar = isHeldBackTemplateVar;
30941
31195
  exports.isIconKey = isIconKey;
30942
31196
  exports.isSystemRuleKind = isSystemRuleKind;
@@ -30945,6 +31199,7 @@ exports.knownValues = knownValues;
30945
31199
  exports.locationIconKey = locationIconKey;
30946
31200
  exports.nodePickerItems = nodePickerItems;
30947
31201
  exports.packagePickerItems = packagePickerItems;
31202
+ exports.parseDeviceEnrollmentLink = parseDeviceEnrollmentLink;
30948
31203
  exports.parseRetrainRevisionConflict = parseRetrainRevisionConflict;
30949
31204
  exports.pickerForCondition = pickerForCondition;
30950
31205
  exports.pickerForRuleClasses = pickerForRuleClasses;