@mega-yfue/eufy-sdk 0.0.4 → 0.1.0-beta.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.
- package/README.md +31 -12
- package/dist/client/device-registry.d.ts +343 -0
- package/dist/client/eufy-mega.d.ts +872 -0
- package/dist/client/index.d.ts +1 -6
- package/dist/client/map-channels.d.ts +22 -0
- package/dist/client/types.d.ts +383 -0
- package/dist/core/contracts.d.ts +898 -0
- package/dist/core/crypto.d.ts +98 -0
- package/dist/core/index.d.ts +9 -7
- package/dist/core/logger.d.ts +53 -0
- package/dist/core/lz4-block.d.ts +35 -0
- package/dist/core/raw-dp-hex.d.ts +32 -0
- package/dist/core/raw-dp-writer.d.ts +83 -0
- package/dist/core/store.d.ts +43 -0
- package/dist/core/types.d.ts +169 -0
- package/dist/core/util.d.ts +78 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.js +25526 -14
- package/dist/index.js.map +7 -1
- package/dist/model/capabilities/access.d.ts +127 -0
- package/dist/model/capabilities/arming.d.ts +201 -0
- package/dist/model/capabilities/audio.d.ts +154 -0
- package/dist/model/capabilities/battery.d.ts +363 -0
- package/dist/model/capabilities/camera.d.ts +564 -0
- package/dist/model/capabilities/co.d.ts +40 -0
- package/dist/model/capabilities/contact.d.ts +133 -0
- package/dist/model/capabilities/doorbell.d.ts +345 -0
- package/dist/model/capabilities/dp-catalog.d.ts +38 -0
- package/dist/model/capabilities/index.d.ts +561 -0
- package/dist/model/capabilities/info.d.ts +28 -0
- package/dist/model/capabilities/keypad.d.ts +61 -0
- package/dist/model/capabilities/leak.d.ts +43 -0
- package/dist/model/capabilities/light.d.ts +174 -0
- package/dist/model/capabilities/locate.d.ts +63 -0
- package/dist/model/capabilities/lock.d.ts +242 -0
- package/dist/model/capabilities/manifest.d.ts +107 -0
- package/dist/model/capabilities/members.d.ts +647 -0
- package/dist/model/capabilities/motion.d.ts +377 -0
- package/dist/model/capabilities/person-detection.d.ts +8 -0
- package/dist/model/capabilities/ptz.d.ts +289 -0
- package/dist/model/capabilities/rtsp.d.ts +221 -0
- package/dist/model/capabilities/siren.d.ts +218 -0
- package/dist/model/capabilities/smart-light.d.ts +172 -0
- package/dist/model/capabilities/smoke.d.ts +40 -0
- package/dist/model/capabilities/snapshot.d.ts +6 -0
- package/dist/model/capabilities/storage.d.ts +11 -0
- package/dist/model/capabilities/suction.d.ts +104 -0
- package/dist/model/capabilities/types.d.ts +484 -0
- package/dist/model/capabilities/vacuum-clean.d.ts +1946 -0
- package/dist/model/capabilities/vacuum-dock.d.ts +208 -0
- package/dist/model/capabilities/video.d.ts +6 -0
- package/dist/model/classify.d.ts +78 -0
- package/dist/model/clean-record-detail.d.ts +65 -0
- package/dist/model/clean-records.d.ts +69 -0
- package/dist/model/device-family.d.ts +73 -0
- package/dist/model/device-types.d.ts +123 -0
- package/dist/model/device.d.ts +265 -0
- package/dist/model/index.d.ts +29 -4
- package/dist/model/infer.d.ts +23 -0
- package/dist/model/inspect.d.ts +61 -0
- package/dist/model/life-params.d.ts +21 -0
- package/dist/model/map-pixels.d.ts +70 -0
- package/dist/model/param-dictionary.d.ts +28 -0
- package/dist/model/param-namespace.d.ts +21 -0
- package/dist/model/proto-read.d.ts +53 -0
- package/dist/model/push-events.d.ts +147 -0
- package/dist/model/registry.d.ts +54 -0
- package/dist/model/types.d.ts +301 -0
- package/dist/model/vacuum-map-store.d.ts +92 -0
- package/dist/model/vacuum-map.d.ts +286 -0
- package/dist/model/vacuum-scenes.d.ts +76 -0
- package/dist/model/vacuum-schedules.d.ts +85 -0
- package/dist/transport/dp-preset.d.ts +102 -0
- package/dist/transport/ff09.d.ts +444 -0
- package/dist/transport/ffmpeg.d.ts +86 -0
- package/dist/transport/http/decodeImageV1.d.ts +20 -0
- package/dist/transport/http/decodeImageV2.d.ts +19 -0
- package/dist/transport/http/index.d.ts +5 -0
- package/dist/transport/http/light-catalog.d.ts +62 -0
- package/dist/transport/http/media-download.d.ts +14 -0
- package/dist/transport/http/mega-client.d.ts +514 -0
- package/dist/transport/http/phone-model.d.ts +21 -0
- package/dist/transport/index.d.ts +10 -7
- package/dist/transport/mqtt/app-client-id.d.ts +16 -0
- package/dist/transport/mqtt/availability.d.ts +14 -0
- package/dist/transport/mqtt/bare-ip-tls.d.ts +46 -0
- package/dist/transport/mqtt/biz-stream.d.ts +98 -0
- package/dist/transport/mqtt/broker-discovery.d.ts +55 -0
- package/dist/transport/mqtt/clean-codec.d.ts +14 -0
- package/dist/transport/mqtt/command-router.d.ts +285 -0
- package/dist/transport/mqtt/dp-codec.d.ts +58 -0
- package/dist/transport/mqtt/dp-color.d.ts +14 -0
- package/dist/transport/mqtt/engine.d.ts +16 -0
- package/dist/transport/mqtt/index.d.ts +5 -0
- package/dist/transport/mqtt/secure-mqtt.d.ts +107 -0
- package/dist/transport/mqtt/topics.d.ts +80 -0
- package/dist/transport/p2p/adts.d.ts +91 -0
- package/dist/transport/p2p/annexb.d.ts +124 -0
- package/dist/transport/p2p/codec.d.ts +166 -0
- package/dist/transport/p2p/command-router.d.ts +655 -0
- package/dist/transport/p2p/commands.d.ts +550 -0
- package/dist/transport/p2p/envelope.d.ts +46 -0
- package/dist/transport/p2p/fmp4.d.ts +89 -0
- package/dist/transport/p2p/fragment-recording.d.ts +33 -0
- package/dist/transport/p2p/index.d.ts +13 -0
- package/dist/transport/p2p/lan-ip.d.ts +25 -0
- package/dist/transport/p2p/live-stream.d.ts +223 -0
- package/dist/transport/p2p/live-trace.d.ts +123 -0
- package/dist/transport/p2p/media.d.ts +105 -0
- package/dist/transport/p2p/p2p-session.d.ts +620 -0
- package/dist/transport/p2p/readable-egress.d.ts +27 -0
- package/dist/transport/p2p/session-manager.d.ts +154 -0
- package/dist/transport/p2p/shared-live-source.d.ts +431 -0
- package/dist/transport/p2p/talkback.d.ts +187 -0
- package/dist/transport/p2p/video.d.ts +150 -0
- package/dist/transport/p2p/write-commands.d.ts +21 -0
- package/dist/transport/protobuf.d.ts +5 -0
- package/dist/transport/push/fcm.d.ts +23 -0
- package/dist/transport/push/index.d.ts +6 -0
- package/dist/transport/push/message-tags.d.ts +26 -0
- package/dist/transport/push/parser.d.ts +27 -0
- package/dist/transport/push/proto.d.ts +11 -0
- package/dist/transport/push/push-client.d.ts +64 -0
- package/dist/transport/push/store.d.ts +23 -0
- package/dist/transport/push/types.d.ts +180 -0
- package/dist/transport/raw-dp.d.ts +6 -0
- package/dist/transport/stored-image-cache.d.ts +23 -0
- package/dist/transport/tuya/account.d.ts +44 -0
- package/dist/transport/tuya/client.d.ts +89 -0
- package/dist/transport/tuya/command-router.d.ts +79 -0
- package/dist/transport/tuya/dp-codec.d.ts +56 -0
- package/dist/transport/tuya/index.d.ts +28 -0
- package/dist/transport/tuya/request.d.ts +157 -0
- package/dist/transport/tuya/sign.d.ts +64 -0
- package/package.json +12 -13
- package/dist/client/index.js +0 -2
- package/dist/client/index.js.map +0 -1
- package/dist/core/index.js +0 -2
- package/dist/core/index.js.map +0 -1
- package/dist/model/index.js +0 -2
- package/dist/model/index.js.map +0 -1
- package/dist/transport/index.js +0 -2
- package/dist/transport/index.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keys that participate in the signature, in no particular order (the preimage builder sorts).
|
|
3
|
+
* Everything else in the request (bizData, sdkVersion, os-info fields, cp/channel/nd, …) is
|
|
4
|
+
* DELIBERATELY excluded from the sign. Verified against a live preimage (see the spec test).
|
|
5
|
+
*/
|
|
6
|
+
export declare const SIGN_ALLOWLIST: ReadonlySet<string>;
|
|
7
|
+
/**
|
|
8
|
+
* The `postData` sign transform: md5 the body to 32 hex chars, then rotate the four 8-char blocks
|
|
9
|
+
* `[b0 b1 b2 b3]` → `[b1 b0 b3 b2]`. This is the Thingclips SDK 7.5.0 transform; it is applied to
|
|
10
|
+
* the `postData` value before it is joined into the preimage.
|
|
11
|
+
*
|
|
12
|
+
* ✅ Confirmed: the `thing.m.user.uid.token.create` call carries a `postData`, and its
|
|
13
|
+
* sign (computed over this transform) was accepted by `a1.tuyaeu.com` with no SIGN_INVALID — so a
|
|
14
|
+
* postData-bearing preimage IS exercised end-to-end. (The static `smartlife.p.time.get` golden vector
|
|
15
|
+
* separately carries no postData; the two together cover both paths.)
|
|
16
|
+
*/
|
|
17
|
+
export declare function swapMd5(postData: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Build the exact sign **preimage** from a request param map. Keeps only allowlisted keys with a
|
|
20
|
+
* non-empty value, sorts them ascending, and joins `key=value` pairs with `||`. `postData` is
|
|
21
|
+
* folded via {@link swapMd5} before joining.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildSignPreimage(params: Readonly<Record<string, string | undefined>>): string;
|
|
24
|
+
/**
|
|
25
|
+
* The native signing seam. Given the {@link buildSignPreimage} output, return the final `sign`
|
|
26
|
+
* value (SHA-256-length hex). Implementations mix in the app secret natively.
|
|
27
|
+
*/
|
|
28
|
+
export interface TuyaSigner {
|
|
29
|
+
sign(preimage: string): string;
|
|
30
|
+
}
|
|
31
|
+
/** Test-only {@link TuyaSigner} that throws on every call. */
|
|
32
|
+
export declare class StubSigner implements TuyaSigner {
|
|
33
|
+
sign(_preimage: string): string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* App-wide HMAC-SHA256 signing key **K** (`package_cert_stego_appSecret`), assembled from four
|
|
37
|
+
* public per-build constants (wire-confirmed from the eufy Security/Mega app + native memory dump):
|
|
38
|
+
* - package name: `com.oceanwing.battery.cam`
|
|
39
|
+
* - developer signing-cert SHA-256 (colon-hex UPPER, verified from running app memory)
|
|
40
|
+
* - stego value: extracted from `libthing_security.so + 0x384f0` (keyed BMP steganography)
|
|
41
|
+
* - manifest app secret (also in {@link TUYA_APP_SECRET} in `request.ts`)
|
|
42
|
+
*
|
|
43
|
+
* All four components are public per-build constants.
|
|
44
|
+
* The env var `TUYA_SIGN_KEY` can override this for non-standard builds.
|
|
45
|
+
*/
|
|
46
|
+
export declare const TUYA_SIGN_K: string;
|
|
47
|
+
/**
|
|
48
|
+
* The real {@link TuyaSigner}: `sign = HMAC-SHA256(K, preimage)` as lowercase hex.
|
|
49
|
+
*
|
|
50
|
+
* Uses {@link TUYA_SIGN_K} by default — no configuration required. The env var `TUYA_SIGN_KEY`
|
|
51
|
+
* overrides the built-in key (for custom builds); an explicit constructor argument takes precedence
|
|
52
|
+
* over both. Verified: reproduces the captured `smartlife.p.time.get` sign `97a78b35…a7f8c84`.
|
|
53
|
+
*/
|
|
54
|
+
export declare class HmacSigner implements TuyaSigner {
|
|
55
|
+
private readonly key;
|
|
56
|
+
constructor(key?: string);
|
|
57
|
+
sign(preimage: string): string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Channel key sent on every request as `chKey`.
|
|
61
|
+
* Extracted from the eufy Security/Mega app (`com.oceanwing.battery.cam`); present in the sign
|
|
62
|
+
* preimage — confirmed from the live-captured golden vector (`smartlife.p.time.get`).
|
|
63
|
+
*/
|
|
64
|
+
export declare const TUYA_CHKEY = "7cbfe6d8";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "One typed TypeScript client for the eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
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",
|
|
7
7
|
"contributors": [
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"keywords": [
|
|
13
13
|
"eufy",
|
|
14
|
+
"anker-eufy",
|
|
14
15
|
"anker",
|
|
15
16
|
"eufy-security",
|
|
16
17
|
"smart-home",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
52
|
-
"build": "tsc -p tsconfig.build.json",
|
|
53
|
+
"build": "tsc -p tsconfig.build.json && node scripts/bundle.mjs",
|
|
53
54
|
"dev": "tsc -p tsconfig.build.json --watch",
|
|
54
55
|
"typecheck": "tsc --noEmit",
|
|
55
56
|
"typecheck:examples": "tsc -p examples/tsconfig.json",
|
|
@@ -57,30 +58,28 @@
|
|
|
57
58
|
"test:watch": "vitest",
|
|
58
59
|
"format": "prettier --write .",
|
|
59
60
|
"format:check": "prettier --check .",
|
|
61
|
+
"guard:capability-ownership": "bash scripts/ci/guard-capability-ownership.sh",
|
|
60
62
|
"guard:consumer-agnostic": "bash scripts/ci/guard-consumer-agnostic.sh",
|
|
61
63
|
"guard:decorrelation": "bash scripts/ci/guard-decorrelation.sh",
|
|
62
64
|
"guard:docrefs": "bash scripts/ci/guard-doc-refs.sh",
|
|
63
65
|
"guard:lines": "bash scripts/ci/guard-lines.sh",
|
|
64
|
-
"guard:seal": "bash scripts/ci/guard-seal.sh",
|
|
65
66
|
"check:esm": "node -e \"import('./dist/index.js').then(m=>console.log('ESM OK:',Object.keys(m).length,'exports'))\"",
|
|
66
|
-
"verify": "npm run format:check && npm run typecheck && npm run guard:decorrelation && npm run guard:lines && npm run guard:docrefs && npm run guard:consumer-agnostic && npm run
|
|
67
|
+
"verify": "npm run format:check && npm run typecheck && npm run guard:decorrelation && npm run guard:lines && npm run guard:docrefs && npm run guard:consumer-agnostic && npm run guard:capability-ownership && npm run build && npm run check:esm && npm run typecheck:examples && npm test",
|
|
68
|
+
"release": "bash scripts/release.sh"
|
|
67
69
|
},
|
|
68
70
|
"engines": {
|
|
69
71
|
"node": ">=24.5.0"
|
|
70
72
|
},
|
|
71
73
|
"dependencies": {
|
|
74
|
+
"jpeg-js": "^0.4.4",
|
|
72
75
|
"mqtt": "^5.15.2",
|
|
73
|
-
"protobufjs": "^8.
|
|
74
|
-
"werift": "^0.24.2"
|
|
76
|
+
"protobufjs": "^8.8.0"
|
|
75
77
|
},
|
|
76
78
|
"devDependencies": {
|
|
77
|
-
"@types/node": "^26.
|
|
79
|
+
"@types/node": "^26.5.0",
|
|
80
|
+
"esbuild": "^0.28.2",
|
|
78
81
|
"prettier": "^3.9.6",
|
|
79
82
|
"typescript": "^7.0.2",
|
|
80
|
-
"vitest": "^
|
|
81
|
-
},
|
|
82
|
-
"allowScripts": {
|
|
83
|
-
"esbuild@0.28.1": true,
|
|
84
|
-
"unrs-resolver@1.12.2": true
|
|
83
|
+
"vitest": "^5.0.0"
|
|
85
84
|
}
|
|
86
85
|
}
|
package/dist/client/index.js
DELETED
package/dist/client/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":""}
|
package/dist/core/index.js
DELETED
package/dist/core/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":""}
|
package/dist/model/index.js
DELETED
package/dist/model/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":""}
|
package/dist/transport/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":""}
|