tplink-smarthome-crypto
Version:
TP-Link Smarthome Crypto
42 lines • 1.5 kB
TypeScript
/**
* TP-Link Smarthome Crypto
*
* TCP communication includes a 4 byte header, UDP does not.
* @packageDocumentation
*/
/// <reference types="node" />
/**
* Encrypts input where each byte is XOR'd with the previous encrypted byte.
*
* @param input - Data to encrypt
* @param firstKey - Value to XOR first byte of input
* @returns encrypted buffer
*/
export declare function encrypt(input: Buffer | string, firstKey?: number): Buffer;
/**
* Encrypts input that has a 4 byte big-endian length header;
* each byte is XOR'd with the previous encrypted byte.
*
* @param input - Data to encrypt
* @param firstKey - Value to XOR first byte of input
* @returns encrypted buffer with header
*/
export declare function encryptWithHeader(input: Buffer | string, firstKey?: number): Buffer;
/**
* Decrypts input where each byte is XOR'd with the previous encrypted byte.
*
* @param input - Encrypted Buffer
* @param firstKey - Value to XOR first byte of input
* @returns decrypted buffer
*/
export declare function decrypt(input: Buffer | string | Array<any>, firstKey?: number): Buffer;
/**
* Decrypts input that has a 4 byte big-endian length header;
* each byte is XOR'd with the previous encrypted byte
*
* @param input - Encrypted Buffer with header
* @param firstKey - Value to XOR first byte of input
* @returns decrypted buffer
*/
export declare function decryptWithHeader(input: Buffer | string | Array<any>, firstKey?: number): Buffer;
//# sourceMappingURL=index.d.ts.map