tplink-smarthome-crypto

TP-Link Smarthome Crypto


Keywords
tplink, kasa, hs100, hs105, hs107, hs110, hs200, hs220, hs300, lb100, lb110, lb120, lb130, lb200, lb230, smartplug, smartswitch, smartbulb, smarthome
License
MIT
Install
npm install tplink-smarthome-crypto@2.0.0

Documentation

tplink-smarthome-crypto

NPM Version Build Status codecov js-semistandard-style

TP-Link Smarthome Crypto

Supported Devices

Model Type
HS100, HS105, HS107, HS110,
HS200, HS210, HS220, HS300
Plug
LB100, LB110, LB120, LB130, LB200, LB230 Bulb

Related Projects

API

tplink-smarthome-crypto

TP-Link Smarthome Crypto

TCP communication includes a 4 byte header, UDP does not.

tplink-smarthome-crypto.encrypt(input, [firstKey]) ⇒ Buffer

Encrypts input where each byte is XOR'd with the previous encrypted byte.

Kind: static method of tplink-smarthome-crypto
Returns: Buffer - encrypted buffer

Param Type Default Description
input Buffer | string Buffer/string to encrypt
[firstKey] number 0xAB

tplink-smarthome-crypto.encryptWithHeader(input, [firstKey]) ⇒ Buffer

Encrypts input that has a 4 byte big-endian length header; each byte is XOR'd with the previous encrypted byte.

Kind: static method of tplink-smarthome-crypto
Returns: Buffer - encrypted buffer with header

Param Type Default Description
input Buffer | string Buffer/string to encrypt
[firstKey] number 0xAB

tplink-smarthome-crypto.decrypt(input, [firstKey]) ⇒ Buffer

Decrypts input where each byte is XOR'd with the previous encrypted byte.

Kind: static method of tplink-smarthome-crypto
Returns: Buffer - decrypted buffer

Param Type Default Description
input Buffer encrypted Buffer
[firstKey] number 0xAB

tplink-smarthome-crypto.decryptWithHeader(input, [firstKey]) ⇒ Buffer

Decrypts input that has a 4 bype big-endian length header; each byte is XOR'd with the previous encrypted byte

Kind: static method of tplink-smarthome-crypto
Returns: Buffer - decrypted buffer

Param Type Default Description
input Buffer encrypted Buffer with header
[firstKey] number 0xAB

Credits

Thanks to George Georgovassilis and Thomas Baust for figuring out the HS1XX encryption.