Repository navigation
feat(camera): add the modern iOS 27 camera features: tiered live views, views from away and camera-uploaded recordings - #1154
Merged
Merged
Conversation
…ich keep a control point's values from lingering and a key's value out of the debug log
… it lacks as globals
…ng the data stream's resources from disposable stacks
…ered streams, WebRTC views and buffered recording
…service a hub commands shares, each controller handed its accessory's context
…perating modes, video sensors and capabilities, motion attribution and motion zones
… writer, the RTP clock, the frame cutter and SRTP
…each clip a hub commands, packaged over CMAF and sealed under the Camera Key
… frames from its camera buffer and keeping the tiers a camera holds itself running
…ulti-tier RTP stream management, with its talkback
… WebRTC stream management, on a WebRTC engine over werift
…controller, recording from the camera buffer, with the suites that drive it
…h the guides to the iOS 27 camera features
Coverage Report for CI Build 46195537695Warning No base build found for commit Coverage: 94.453%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
use() incorrectly handles disposal members, rejecting valid async disposables with throwing sync getters and accepting non-callable async members when a callable sync fallback exists.
1 open issue
What changed in this PR
Adds an opt-in modern camera path to HAP-NodeJS for tiered live views, remote WebRTC sessions, and camera-uploaded recordings, alongside the legacy camera configuration.
Changes:
- Adds camera services, capability codecs, session helpers, media security primitives, and plugin-facing APIs.
- Strengthens resource cleanup, connection context, diagnostics, and integer precision.
- Adds supporting tests and fixtures, updates runtime requirements, and links the camera guides and example.
| File | Description |
|---|---|
tsconfig.json |
Adds disposable types and skips declaration-file checking. |
src/test-utils/talkbackSink.ts |
Provides reusable talkback capture fixtures. |
src/test-utils/settle.ts |
Shares asynchronous waiting and timeout helpers. |
src/test-utils/reporterFixtures.ts |
Provides camera reporters and problem capture fixtures. |
src/test-utils/openingStamp.ts |
Shares expected opening-frame timestamp calculations. |
src/test-utils/ingest/stranger.pem |
Adds an untrusted client certificate fixture. |
src/test-utils/ingest/stranger.key |
Adds its test private key. |
src/test-utils/ingest/stranger-ca.pem |
Adds an untrusted certificate authority fixture. |
src/test-utils/ingest/server.pem |
Adds a localhost ingest server certificate. |
src/test-utils/ingest/server.key |
Adds the ingest server’s test key. |
src/test-utils/ingest/server-ca.pem |
Adds the ingest server’s test authority. |
src/test-utils/ingest/hub-ca.pem |
Adds a trusted test hub authority. |
src/test-utils/ingest/client.pem |
Adds a trusted client certificate fixture. |
src/test-utils/ingest/client.key |
Adds the trusted client’s test key. |
src/test-utils/engineDebug.ts |
Captures camera debug events in tests. |
src/test-utils/connectionFixtures.ts |
Models connection addresses and closure in tests. |
src/test-utils/certificateAuthority.ts |
Issues runtime certificates for provisioning tests. |
src/lib/util/valueGuard.ts |
Adds internal characteristic value guards. |
src/lib/util/tlv.ts |
Adds precise bigint integer codecs. |
src/lib/util/tlv.spec.ts |
Tests bigint precision, widths, and bounds. |
src/lib/util/promise-utils.ts |
Adds guarded delegate calls and failure rendering. |
src/lib/util/promise-utils.spec.ts |
Tests delegate failures and rejection handling. |
src/lib/util/ntp.ts |
Converts wall-clock time to precise NTP values. |
src/lib/util/ntp.spec.ts |
Tests NTP fractions and era rollover. |
src/lib/util/libraryVersion.ts |
Centralizes cached package-version lookup. |
src/lib/util/eventedhttp.spec.ts |
Adjusts mock and timer cleanup order. |
src/lib/util/der.ts |
Adds DER encoding for signing requests. |
src/lib/util/der.spec.ts |
Tests DER encodings and validation. |
src/lib/util/counted.ts |
Adds count-aware diagnostic wording helpers. |
src/lib/util/counted.spec.ts |
Tests singular and plural formatting. |
src/lib/util/asyncDisposableStack.ts |
Adds an internal asynchronous disposal stack. |
src/lib/Service.ts |
Declares camera services and clarifies a timeout comment. |
src/lib/HAPServer.ts |
Passes connection context to resource handlers. |
src/lib/HAPServer.spec.ts |
Tests resource-request connection forwarding. |
src/lib/definitions/ServiceDefinitions.ts |
Defines modern camera services and motion characteristics. |
src/lib/datastream/DataStreamManagement.ts |
Moves teardown into a disposal stack. |
src/lib/datastream/DataStreamManagement.spec.ts |
Tests setup validation, responses, and teardown. |
src/lib/controller/eventDispatch.ts |
Guards camera event listeners against failures. |
src/lib/controller/DoorbellController.ts |
Preserves reconfiguration options and permits motionless modern doorbells. |
src/lib/controller/DoorbellController.spec.ts |
Tests validation and doorbell reconfiguration. |
src/lib/controller/Controller.ts |
Adds accessory context to serializable controllers. |
src/lib/camera/webrtc/werift.ts |
Loads werift lazily with explicit debug gating. |
src/lib/camera/webrtc/voice/ReceiveKeys.ts |
Bounds receive-key storage and zeroes removed keys. |
src/lib/camera/webrtc/voice/ReceiveKeys.spec.ts |
Tests key replacement, eviction, and disposal. |
src/lib/camera/webrtc/sessionDescription.ts |
Adds tier restrictions and session-description helpers. |
src/lib/camera/webrtc/EngineSession.spec.ts |
Tests teardown bounds and RTP packet sequencing. |
src/lib/camera/srtp/keystream.ts |
Adds SRTP counter-mode encryption primitives. |
src/lib/camera/srtp/keystream.spec.ts |
Checks keystream and key-derivation reference vectors. |
src/lib/camera/session/StreamingEnabledSwitch.ts |
Tracks streaming changes, restoration, and persistence. |
src/lib/camera/session/settleWithin.ts |
Adds abortable, bounded delegate waits. |
src/lib/camera/session/settleWithin.spec.ts |
Tests settlement, cancellation, and timeout behavior. |
src/lib/camera/session/HandleScope.ts |
Manages plugin cleanup registrations per handle. |
src/lib/camera/session/controlPoint.ts |
Wires queued control-point writes and answer release. |
src/lib/camera/session/CommandQueue.ts |
Serializes service commands across asynchronous work. |
src/lib/camera/session/CommandQueue.spec.ts |
Tests command ordering and failure isolation. |
src/lib/camera/SensorRegistry.ts |
Validates sensors and advertises ordered capabilities. |
src/lib/camera/rtp/packetRules.ts |
Shares RTP sequence, timestamp, and marker rules. |
src/lib/camera/rtp/packetRules.spec.ts |
Tests RTP header-field rules and rollover. |
src/lib/camera/recording/signingRequest.ts |
Creates camera signing requests and nonce signatures. |
src/lib/camera/recording/signingRequest.spec.ts |
Tests request structure and signature verification. |
src/lib/camera/recording/clipSealing.ts |
Derives recording keys and encrypts media segments. |
src/lib/camera/recording/clipSealing.spec.ts |
Tests key derivation and authenticated encryption. |
src/lib/camera/recording/CameraEventQueue.spec.ts |
Tests event numbering, acknowledgements, and overflow. |
src/lib/camera/MotionAttribution.ts |
Associates detected motion with contributing video sensors. |
src/lib/camera/index.ts |
Exports modern camera types and diagnostics. |
src/lib/camera/GlobalOperatingMode.ts |
Projects camera-wide policy onto its service. |
src/lib/camera/diagnostics/problems.spec.ts |
Tests problem delivery and subscriber isolation. |
src/lib/camera/diagnostics/debugChannels.ts |
Adds structured camera debug channels and printers. |
src/lib/camera/diagnostics/debugChannels.spec.ts |
Tests debug selection and duplicate-printer prevention. |
src/lib/camera/capabilityKeys.ts |
Shares service-map keys and sensor reconciliation. |
src/lib/camera/capabilities/zones.ts |
Encodes and decodes motion-zone payloads. |
src/lib/camera/capabilities/zones.spec.ts |
Tests zone vectors and malformed payloads. |
src/lib/camera/capabilities/supportedRtpConfiguration.ts |
Shares supported SRTP-suite encoding and decoding. |
src/lib/camera/capabilities/supportedRtpConfiguration.spec.ts |
Tests suite encoding parity and validation. |
src/lib/camera/capabilities/streamTiers.spec.ts |
Tests tier payload vectors and integer widths. |
src/lib/camera/capabilities/rtpStreaming.ts |
Adds tiered RTP command and response codecs. |
src/lib/camera/capabilities/rtpStreaming.spec.ts |
Tests RTP commands, responses, and hub payloads. |
src/lib/camera/capabilities/provisioning.spec.ts |
Tests key and certificate provisioning codecs. |
src/lib/camera/capabilities/index.ts |
Exposes plugin-facing capability types and constants. |
src/hap.ts |
Reuses version lookup and explicitly lists public TLV exports. |
README.md |
Updates Node requirements and links camera documentation. |
package.json |
Raises the runtime floor, pins werift, and adjusts packaging scripts. |
eslint.config.mjs |
Adds disposal, precision, guide, and packaging lint rules. |
Review effort: Balanced
hjdhjd
force-pushed
the
feat/hjd-hksv3
branch
from
November 28, 2026 22:13
99cc2d2 to
cbbfeff
Compare
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this adds
HAP-NodeJS gains the camera features Apple introduced with iOS 27, which Apple calls HKSV3 internally:
werift.A camera takes these by stating one new block of options,
cameraCapabilities. This pull request calls that the modern form. A camera set up as it always has been, the legacy form, keeps working as it does today, and nothing about it is deprecated. A camera is one form or the other, never both.What a plugin provides, and what it stops writing
In the modern form a plugin describes each video sensor and its tiers, writes each tier's video to the library as fragmented MP4, answers a snapshot, and reports motion. The library runs every session at home and from away, shares one stream among all of a tier's viewers, applies mute, builds and uploads every recording, and releases what a plugin registers on a stream when it is no longer needed.
src/accessories/ModernCamera_example.tsis a complete camera in the modern form, fed by ffmpeg's test pattern and tone. It can be added to a home on iOS 27 as it stands.How to read the commits
The sixteen commits tell the change in the order a reader learns it. The first five make the library ready and stand alone. The rest build the camera from its catalog up to the controller that composes it, and the last adds the example camera and the two guides.
bigint.transientandsensitivecharacteristic props: a control point's values never linger, and a key's value never reaches the debug log.The two guides
guides/UpgradingCameraPlugins.mdis for plugin authors: what changed in the library, and how a camera takes the modern form.guides/HKSV3Protocol.mddescribes the features themselves and how a home hub behaves around them.Both are linked from the readme.
Compatibility with 2.3.1
No name the library exported in 2.3.1 is removed or renamed. These are the changes a plugin can meet, each stated in full in the upgrade guide:
^22.20.0 || ^24 || ^26. The floor was^22.12.0.werift, at one exact version. It is loaded only when a camera in the modern form is built.CameraControllerOptionsis a union ofCameraControllerLegacyOptionsandCameraControllerCapabilitiesOptions. An object literal compiles as before. An interface that extends it, a class that implements it, or a member read through a value typed as the union stops compiling.RTPStreamManagement.setupEndpointsResponseis gone. The answer to Setup Endpoints is served to the connection that asked and is never stored.RecordingManagement.optionsis optional, as are five fields ofRecordingManagementState.CameraRecordingDelegate.handleRecordingStreamRequestreturnsAsyncIterable<RecordingPacket>, where it returnedAsyncGenerator<RecordingPacket>.CameraController,CameraControllerEvents,CharacteristicPropsandCharacteristichave new members. A subclass that declares one of the new names stops compiling.delegateor nostreamingOptionsthrows at construction; the two mute events reach listeners through a guarded dispatch and no longer throughemit; a recording delegate can hearupdateRecordingActiveat more moments; Setup Endpoints keeps no value; and a snapshot handler whose promise rejects fails its snapshot at once.DataStreamServerstays destroyed, wherever a HomeKit Data Stream is used.By the letter of semantic versioning the removed public field would make this a major version. No plugin we could find reads it, and we propose 2.4.0, with test versions numbered 2.4.0-beta. The number is the maintainers' to set.
A convention this starts
A set of named constants first released in 2.4 or later is a constant object with a type of the same name, as
CameraSensorIntentandCameraVideoQualityare here. The enums the library has already released stay enums through 2.x, because changing their kind would break the plugins that use them. The project intends to move them to this form in the next major version.How it was tested