@lumiastream/tapo-cove 3.10.0 → 3.12.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/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.12.0](https://github.com/lumiastream/rgb/compare/v3.11.2...v3.12.0) (2023-10-25)
7
+
8
+ ### Bug Fixes
9
+
10
+ - tapo build error ([7dd7658](https://github.com/lumiastream/rgb/commit/7dd7658e391108e6aa6c2e4ec28aab47d183f4e5))
11
+
12
+ ### Features
13
+
14
+ - tapo new klap cipher implementation ([a82c8f8](https://github.com/lumiastream/rgb/commit/a82c8f8c300108e76494b0ba264a0710537dc386))
15
+
16
+ # [3.11.0](https://github.com/lumiastream/rgb/compare/v3.10.1...v3.11.0) (2023-08-15)
17
+
18
+ **Note:** Version bump only for package @lumiastream/tapo-cove
19
+
6
20
  # [3.10.0](https://github.com/lumiastream/rgb/compare/v3.9.0...v3.10.0) (2023-08-15)
7
21
 
8
22
  **Note:** Version bump only for package @lumiastream/tapo-cove
package/dist/index.d.mts CHANGED
@@ -1,132 +1,167 @@
1
1
  import { ILumiaDeviceType } from '@lumiastream/lumia-rgb-types';
2
2
 
3
- declare const discover: (config: {
4
- token?: string;
5
- email?: string;
6
- password?: string;
7
- types?: ILumiaDeviceType[];
3
+ declare const discover: (config: {
4
+ token?: string;
5
+ email?: string;
6
+ password?: string;
7
+ types?: ILumiaDeviceType[];
8
8
  }) => Promise<any>;
9
9
 
10
- declare class SuperState {
11
- protected _values: Record<string, boolean | string | number>;
12
- transition: (value: number) => this;
13
- duration: (value: number) => this;
14
- getValues: () => Record<string, string | number | boolean>;
15
- }
16
- declare class LightState extends SuperState {
17
- constructor(values?: {
18
- on: boolean;
19
- });
20
- create: (values?: {
21
- [x: string]: any;
22
- } | undefined) => this;
23
- on: (value?: boolean) => this;
24
- turnOn: (value?: boolean) => this;
25
- off: () => this;
26
- turnOff: () => this;
27
- mode: (value?: string) => this;
28
- hue: (value: number) => this;
29
- bri: (value: number) => this;
30
- brightness: (value: number) => this;
31
- sat: (value: number) => this;
32
- saturation: (value: number) => this;
33
- temp: (value: number) => this;
34
- colorTemperature: (value: number) => this;
35
- hsv: (value: [
36
- number,
37
- number,
38
- number
39
- ] | {
40
- h: number;
41
- s: number;
42
- v: number;
43
- }) => this;
44
- rgb: (value: [
45
- number,
46
- number,
47
- number
48
- ] | {
49
- r: number;
50
- g: number;
51
- b: number;
52
- }) => this;
53
- color: (value: {
54
- ct?: number;
55
- r?: number;
56
- g?: number;
57
- b?: number;
58
- }) => this;
10
+ declare class SuperState {
11
+ protected _values: Record<string, boolean | string | number>;
12
+ transition: (value: number) => this;
13
+ duration: (value: number) => this;
14
+ getValues: () => Record<string, string | number | boolean>;
15
+ }
16
+ declare class LightState extends SuperState {
17
+ constructor(values?: {
18
+ on: boolean;
19
+ });
20
+ create: (values?: {
21
+ [x: string]: any;
22
+ } | undefined) => this;
23
+ on: (value?: boolean) => this;
24
+ turnOn: (value?: boolean) => this;
25
+ off: () => this;
26
+ turnOff: () => this;
27
+ mode: (value?: string) => this;
28
+ hue: (value: number) => this;
29
+ bri: (value: number) => this;
30
+ brightness: (value: number) => this;
31
+ sat: (value: number) => this;
32
+ saturation: (value: number) => this;
33
+ temp: (value: number) => this;
34
+ colorTemperature: (value: number) => this;
35
+ hsv: (value: [
36
+ number,
37
+ number,
38
+ number
39
+ ] | {
40
+ h: number;
41
+ s: number;
42
+ v: number;
43
+ }) => this;
44
+ rgb: (value: [
45
+ number,
46
+ number,
47
+ number
48
+ ] | {
49
+ r: number;
50
+ g: number;
51
+ b: number;
52
+ }) => this;
53
+ color: (value: {
54
+ ct?: number;
55
+ r?: number;
56
+ g?: number;
57
+ b?: number;
58
+ }) => this;
59
59
  }
60
60
 
61
- type TapoDeviceKey = {
62
- key: string | Buffer;
63
- iv: string | Buffer;
64
- deviceIp: string;
65
- sessionCookie: string;
66
- token?: string;
67
- };
61
+ declare class KlapCipher {
62
+ private readonly key;
63
+ private readonly sig;
64
+ private readonly iv;
65
+ private seq;
66
+ constructor(localSeed: Buffer, remoteSeed: Buffer, authHash: Buffer);
67
+ encrypt(msg: Buffer | string): {
68
+ encrypted: Buffer;
69
+ seq: number;
70
+ };
71
+ decrypt(msg: Buffer): string;
72
+ private keyDerive;
73
+ private ivDerive;
74
+ private sigDerive;
75
+ private ivSeq;
76
+ }
68
77
 
69
- declare class TapoApi {
70
- _baseUrl: string;
71
- _baseTapoCareUrl: string;
72
- private axiosInstance;
73
- private _config;
74
- private _token;
75
- private _devices;
76
- constructor(config?: {
77
- token?: string;
78
- timeout?: number;
79
- httpTimeout?: number;
80
- });
81
- auth: ({ email, password }: {
82
- email: string;
83
- password: string;
84
- }) => Promise<string>;
85
- setup: ({ email, password, devices }: {
86
- email: string;
87
- password: string;
88
- devices: Array<{
89
- id: string;
90
- host: string;
91
- }>;
92
- }) => Promise<Map<string, TapoDeviceKey>>;
93
- sendState: (config: {
94
- device: {
95
- id: string;
96
- };
97
- state: LightState;
98
- fetchConfig?: {
99
- shouldWait: boolean;
100
- };
101
- }) => Promise<any>;
102
- sendPower: (config: {
103
- device: {
104
- id: string;
105
- };
106
- power: boolean;
107
- }) => void;
78
+ declare class TapoApi {
79
+ protected readonly terminalUUID: string;
80
+ protected loginToken?: string;
81
+ _baseUrl: string;
82
+ private static readonly TP_TEST_USER;
83
+ private static readonly TP_TEST_PASSWORD;
84
+ private session?;
85
+ private axiosInstance;
86
+ private _config;
87
+ private _token;
88
+ private _devices;
89
+ constructor(config?: {
90
+ email?: string;
91
+ password?: string;
92
+ token?: string;
93
+ timeout?: number;
94
+ httpTimeout?: number;
95
+ });
96
+ auth: ({ email, password }: {
97
+ email: string;
98
+ password: string;
99
+ }) => Promise<string>;
100
+ setup: ({ email, password, devices }: {
101
+ email: string;
102
+ password: string;
103
+ devices: Array<{
104
+ id: string;
105
+ host: string;
106
+ }>;
107
+ }) => Promise<Map<string, DeviceSession>>;
108
+ sendState: (config: {
109
+ device: {
110
+ id: string;
111
+ };
112
+ state: LightState;
113
+ fetchConfig?: {
114
+ shouldWait: boolean;
115
+ };
116
+ }) => Promise<any>;
117
+ sendPower: (config: {
118
+ device: {
119
+ id: string;
120
+ };
121
+ power: boolean;
122
+ }) => void;
123
+ private sessionPost;
124
+ needsNewHandshake(): boolean;
125
+ private handshake;
126
+ private firstHandshake;
127
+ private secondHandshake;
128
+ private sha256;
129
+ private sha1;
130
+ private hashAuth;
131
+ }
132
+ declare class DeviceSession {
133
+ ip: string;
134
+ private readonly cookie;
135
+ readonly cipher?: KlapCipher | undefined;
136
+ readonly handshakeCompleted: boolean;
137
+ private readonly expireAt;
138
+ private readonly rawTimeout;
139
+ constructor(timeout: string, ip: string, cookie: string, cipher?: KlapCipher | undefined);
140
+ get IsExpired(): boolean;
141
+ get Cookie(): string;
142
+ completeHandshake(ip: string, cipher: KlapCipher): DeviceSession;
108
143
  }
109
144
 
110
- declare const TapoDeviceTypes: {
111
- ALL: string;
112
- BULBS: string;
113
- LIGHTSTRIPS: string;
114
- PLUGS: string;
115
- };
116
- declare enum ETapoDeviceTypes {
117
- ALL = "all",
118
- BULBS = "bulb",
119
- LIGHTSTRIPS = "lightstrip",
120
- PLUGS = "plug"
121
- }
122
- declare const DeviceResTypes: {
123
- BULB: string;
124
- PLUG: string;
125
- };
126
- declare const DeviceSendValues: {
127
- BULB: string;
128
- LIGHTSTRIP: string;
129
- PLUG: string;
145
+ declare const TapoDeviceTypes: {
146
+ ALL: string;
147
+ BULBS: string;
148
+ LIGHTSTRIPS: string;
149
+ PLUGS: string;
150
+ };
151
+ declare enum ETapoDeviceTypes {
152
+ ALL = "all",
153
+ BULBS = "bulb",
154
+ LIGHTSTRIPS = "lightstrip",
155
+ PLUGS = "plug"
156
+ }
157
+ declare const DeviceResTypes: {
158
+ BULB: string;
159
+ PLUG: string;
160
+ };
161
+ declare const DeviceSendValues: {
162
+ BULB: string;
163
+ LIGHTSTRIP: string;
164
+ PLUG: string;
130
165
  };
131
166
 
132
167
  declare const tapo_constants_DeviceResTypes: typeof DeviceResTypes;
package/dist/index.d.ts CHANGED
@@ -1,132 +1,167 @@
1
1
  import { ILumiaDeviceType } from '@lumiastream/lumia-rgb-types';
2
2
 
3
- declare const discover: (config: {
4
- token?: string;
5
- email?: string;
6
- password?: string;
7
- types?: ILumiaDeviceType[];
3
+ declare const discover: (config: {
4
+ token?: string;
5
+ email?: string;
6
+ password?: string;
7
+ types?: ILumiaDeviceType[];
8
8
  }) => Promise<any>;
9
9
 
10
- declare class SuperState {
11
- protected _values: Record<string, boolean | string | number>;
12
- transition: (value: number) => this;
13
- duration: (value: number) => this;
14
- getValues: () => Record<string, string | number | boolean>;
15
- }
16
- declare class LightState extends SuperState {
17
- constructor(values?: {
18
- on: boolean;
19
- });
20
- create: (values?: {
21
- [x: string]: any;
22
- } | undefined) => this;
23
- on: (value?: boolean) => this;
24
- turnOn: (value?: boolean) => this;
25
- off: () => this;
26
- turnOff: () => this;
27
- mode: (value?: string) => this;
28
- hue: (value: number) => this;
29
- bri: (value: number) => this;
30
- brightness: (value: number) => this;
31
- sat: (value: number) => this;
32
- saturation: (value: number) => this;
33
- temp: (value: number) => this;
34
- colorTemperature: (value: number) => this;
35
- hsv: (value: [
36
- number,
37
- number,
38
- number
39
- ] | {
40
- h: number;
41
- s: number;
42
- v: number;
43
- }) => this;
44
- rgb: (value: [
45
- number,
46
- number,
47
- number
48
- ] | {
49
- r: number;
50
- g: number;
51
- b: number;
52
- }) => this;
53
- color: (value: {
54
- ct?: number;
55
- r?: number;
56
- g?: number;
57
- b?: number;
58
- }) => this;
10
+ declare class SuperState {
11
+ protected _values: Record<string, boolean | string | number>;
12
+ transition: (value: number) => this;
13
+ duration: (value: number) => this;
14
+ getValues: () => Record<string, string | number | boolean>;
15
+ }
16
+ declare class LightState extends SuperState {
17
+ constructor(values?: {
18
+ on: boolean;
19
+ });
20
+ create: (values?: {
21
+ [x: string]: any;
22
+ } | undefined) => this;
23
+ on: (value?: boolean) => this;
24
+ turnOn: (value?: boolean) => this;
25
+ off: () => this;
26
+ turnOff: () => this;
27
+ mode: (value?: string) => this;
28
+ hue: (value: number) => this;
29
+ bri: (value: number) => this;
30
+ brightness: (value: number) => this;
31
+ sat: (value: number) => this;
32
+ saturation: (value: number) => this;
33
+ temp: (value: number) => this;
34
+ colorTemperature: (value: number) => this;
35
+ hsv: (value: [
36
+ number,
37
+ number,
38
+ number
39
+ ] | {
40
+ h: number;
41
+ s: number;
42
+ v: number;
43
+ }) => this;
44
+ rgb: (value: [
45
+ number,
46
+ number,
47
+ number
48
+ ] | {
49
+ r: number;
50
+ g: number;
51
+ b: number;
52
+ }) => this;
53
+ color: (value: {
54
+ ct?: number;
55
+ r?: number;
56
+ g?: number;
57
+ b?: number;
58
+ }) => this;
59
59
  }
60
60
 
61
- type TapoDeviceKey = {
62
- key: string | Buffer;
63
- iv: string | Buffer;
64
- deviceIp: string;
65
- sessionCookie: string;
66
- token?: string;
67
- };
61
+ declare class KlapCipher {
62
+ private readonly key;
63
+ private readonly sig;
64
+ private readonly iv;
65
+ private seq;
66
+ constructor(localSeed: Buffer, remoteSeed: Buffer, authHash: Buffer);
67
+ encrypt(msg: Buffer | string): {
68
+ encrypted: Buffer;
69
+ seq: number;
70
+ };
71
+ decrypt(msg: Buffer): string;
72
+ private keyDerive;
73
+ private ivDerive;
74
+ private sigDerive;
75
+ private ivSeq;
76
+ }
68
77
 
69
- declare class TapoApi {
70
- _baseUrl: string;
71
- _baseTapoCareUrl: string;
72
- private axiosInstance;
73
- private _config;
74
- private _token;
75
- private _devices;
76
- constructor(config?: {
77
- token?: string;
78
- timeout?: number;
79
- httpTimeout?: number;
80
- });
81
- auth: ({ email, password }: {
82
- email: string;
83
- password: string;
84
- }) => Promise<string>;
85
- setup: ({ email, password, devices }: {
86
- email: string;
87
- password: string;
88
- devices: Array<{
89
- id: string;
90
- host: string;
91
- }>;
92
- }) => Promise<Map<string, TapoDeviceKey>>;
93
- sendState: (config: {
94
- device: {
95
- id: string;
96
- };
97
- state: LightState;
98
- fetchConfig?: {
99
- shouldWait: boolean;
100
- };
101
- }) => Promise<any>;
102
- sendPower: (config: {
103
- device: {
104
- id: string;
105
- };
106
- power: boolean;
107
- }) => void;
78
+ declare class TapoApi {
79
+ protected readonly terminalUUID: string;
80
+ protected loginToken?: string;
81
+ _baseUrl: string;
82
+ private static readonly TP_TEST_USER;
83
+ private static readonly TP_TEST_PASSWORD;
84
+ private session?;
85
+ private axiosInstance;
86
+ private _config;
87
+ private _token;
88
+ private _devices;
89
+ constructor(config?: {
90
+ email?: string;
91
+ password?: string;
92
+ token?: string;
93
+ timeout?: number;
94
+ httpTimeout?: number;
95
+ });
96
+ auth: ({ email, password }: {
97
+ email: string;
98
+ password: string;
99
+ }) => Promise<string>;
100
+ setup: ({ email, password, devices }: {
101
+ email: string;
102
+ password: string;
103
+ devices: Array<{
104
+ id: string;
105
+ host: string;
106
+ }>;
107
+ }) => Promise<Map<string, DeviceSession>>;
108
+ sendState: (config: {
109
+ device: {
110
+ id: string;
111
+ };
112
+ state: LightState;
113
+ fetchConfig?: {
114
+ shouldWait: boolean;
115
+ };
116
+ }) => Promise<any>;
117
+ sendPower: (config: {
118
+ device: {
119
+ id: string;
120
+ };
121
+ power: boolean;
122
+ }) => void;
123
+ private sessionPost;
124
+ needsNewHandshake(): boolean;
125
+ private handshake;
126
+ private firstHandshake;
127
+ private secondHandshake;
128
+ private sha256;
129
+ private sha1;
130
+ private hashAuth;
131
+ }
132
+ declare class DeviceSession {
133
+ ip: string;
134
+ private readonly cookie;
135
+ readonly cipher?: KlapCipher | undefined;
136
+ readonly handshakeCompleted: boolean;
137
+ private readonly expireAt;
138
+ private readonly rawTimeout;
139
+ constructor(timeout: string, ip: string, cookie: string, cipher?: KlapCipher | undefined);
140
+ get IsExpired(): boolean;
141
+ get Cookie(): string;
142
+ completeHandshake(ip: string, cipher: KlapCipher): DeviceSession;
108
143
  }
109
144
 
110
- declare const TapoDeviceTypes: {
111
- ALL: string;
112
- BULBS: string;
113
- LIGHTSTRIPS: string;
114
- PLUGS: string;
115
- };
116
- declare enum ETapoDeviceTypes {
117
- ALL = "all",
118
- BULBS = "bulb",
119
- LIGHTSTRIPS = "lightstrip",
120
- PLUGS = "plug"
121
- }
122
- declare const DeviceResTypes: {
123
- BULB: string;
124
- PLUG: string;
125
- };
126
- declare const DeviceSendValues: {
127
- BULB: string;
128
- LIGHTSTRIP: string;
129
- PLUG: string;
145
+ declare const TapoDeviceTypes: {
146
+ ALL: string;
147
+ BULBS: string;
148
+ LIGHTSTRIPS: string;
149
+ PLUGS: string;
150
+ };
151
+ declare enum ETapoDeviceTypes {
152
+ ALL = "all",
153
+ BULBS = "bulb",
154
+ LIGHTSTRIPS = "lightstrip",
155
+ PLUGS = "plug"
156
+ }
157
+ declare const DeviceResTypes: {
158
+ BULB: string;
159
+ PLUG: string;
160
+ };
161
+ declare const DeviceSendValues: {
162
+ BULB: string;
163
+ LIGHTSTRIP: string;
164
+ PLUG: string;
130
165
  };
131
166
 
132
167
  declare const tapo_constants_DeviceResTypes: typeof DeviceResTypes;