UNPKG

node-red-contrib-tplink-tapo-connect-api

Version:

This unofficial node-RED node allows connection to TP-Link Tapo devices. This project has been enhanced with AI support to enable new features. Starting with v0.50, we have added support for the KLAP protocol. To prioritize the operation of this node, we

43 lines (42 loc) 1.13 kB
import { TapoCredentials, TapoApiRequest } from '../types'; export interface KlapSession { authenticated: boolean; timeout: number; deviceIp: string; sessionCookie: string; terminalUUID: string; key: Buffer; iv: Buffer; sig: Buffer; seq: Buffer; version: 'v1' | 'v2'; } export declare class KlapAuth { private deviceIp; private credentials; private session?; constructor(ip: string, credentials: TapoCredentials); authenticate(): Promise<KlapSession>; private authenticateV2; private authenticateV1; private shouldTryV1; secureRequest<T>(request: TapoApiRequest): Promise<T>; isAuthenticated(): boolean; clearSession(): void; getSessionVersion(): 'v1' | 'v2' | null; private encrypt; private decrypt; private encryptAndSign; private handshake1AuthHash; private handshake2AuthHash; private generateAuthHash; private deriveKey; private deriveIv; private deriveSig; private deriveSeqFromIv; private ivWithSeq; private incrementSeq; private sha256; private sha1; private compare; }