@mega-yfue/eufy-sdk 0.4.0-beta.9 → 0.4.0

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.
@@ -0,0 +1,54 @@
1
+ import { type RecordingDownload } from "../../core/contracts.js";
2
+ import type { P2PSession } from "./p2p-session.js";
3
+ /** Data type a station sends a recording's frames on: the binary channel (`0xd1 0x03`), not live video's. */
4
+ export declare const RECORDING_DATA_TYPE = 3;
5
+ /**
6
+ * Most frame bytes a transfer holds. The station sends faster than real time, so the time bounds alone do
7
+ * not bound memory; an event recording is far below this.
8
+ */
9
+ export declare const MAX_TRANSFER_BYTES: number;
10
+ /** One recording frame as received, in arrival order. */
11
+ export interface RecordingFrame {
12
+ commandId: number;
13
+ signCode: number;
14
+ raw: Buffer;
15
+ }
16
+ /**
17
+ * The path a HomeBase 2 stores a camera's recording under: the camera's channel, two digits, and the
18
+ * recording name the event push carries. Answers `undefined` for a name that is not the station's
19
+ * fourteen-digit `yyyyMMddHHmmss` form. The name comes from a push, so the test stays anchored and
20
+ * digits-only: no `..`, slash or other character that could reach another path on the station gets through.
21
+ */
22
+ export declare function homeBase2RecordingPath(channel: number, recording: string): string | undefined;
23
+ /** One recording transfer on a station session. */
24
+ export interface RecordingTransfer {
25
+ /** The recording's frames, in arrival order. Rejects as {@link receiveRecording} describes. */
26
+ frames: Promise<RecordingFrame[]>;
27
+ /** Resolves once the station has stopped sending this recording, which can be after `frames` rejected. */
28
+ drained: Promise<void>;
29
+ }
30
+ /**
31
+ * Request one recording and collect its frames until `CMD_DOWNLOAD_FINISH`. Only frames on
32
+ * {@link RECORDING_DATA_TYPE} tagged with the camera's channel belong to it, so a live stream open on the same
33
+ * station is never mixed in. The finish frame is taken on the camera's channel or channel 0.
34
+ *
35
+ * `frames` rejects with {@link RecordingDownloadError}: `no-data` when nothing arrives within
36
+ * {@link FIRST_FRAME_WAIT_MS}, and `incomplete` when the transfer ends without its finish frame, on a
37
+ * {@link IDLE_END_MS} silence, on `timeoutMs` or on {@link MAX_TRANSFER_BYTES}. An abort rejects it at once
38
+ * with the signal's reason. After a time bound, the byte ceiling or an abort, the transfer stops collecting
39
+ * but keeps listening until the station finishes or goes quiet, and only then resolves `drained`.
40
+ */
41
+ export declare function receiveRecording(session: P2PSession, request: {
42
+ path: string;
43
+ accountId: string;
44
+ channel: number;
45
+ timeoutMs?: number;
46
+ signal?: AbortSignal;
47
+ }): RecordingTransfer;
48
+ /**
49
+ * Decode a recording's frames, in arrival order, into elementary streams. Keyframes go through one
50
+ * {@link VideoFrameDecoder}, whose media key then opens the audio; a keyframe that does not open under
51
+ * `eccPrivateKeyHex`, and every audio frame before the first media key, are dropped. Rejects with
52
+ * {@link RecordingDownloadError} `undecodable` when no video frame decodes.
53
+ */
54
+ export declare function decodeRecording(frames: readonly RecordingFrame[], eccPrivateKeyHex: string): RecordingDownload;
@@ -1,3 +1,5 @@
1
+ /** AAD used for the AES-256-GCM body cipher of every video frame, and of a recording's audio. */
2
+ export declare const VIDEO_GCM_AAD: Buffer<ArrayBuffer>;
1
3
  /** Parsed fields of a `CMD_VIDEO_FRAME` 22-byte header. */
2
4
  export interface VideoFrameHeader {
3
5
  /**
@@ -24,6 +24,8 @@ export declare class StoredImageCache {
24
24
  clear(): void;
25
25
  private pump;
26
26
  private complete;
27
+ /** Schedule the next attempt after a 404; answers whether one was scheduled. */
28
+ private retryLater;
27
29
  private isValidJpeg;
28
30
  private diagnose;
29
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.4.0-beta.9",
3
+ "version": "0.4.0",
4
4
  "description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
5
5
  "license": "Apache-2.0",
6
6
  "author": "mega-yfue",