Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: RangeError: Invalid key length #356

Open
kvanbiesen opened this issue Aug 27, 2024 · 10 comments
Open

[Bug]: RangeError: Invalid key length #356

kvanbiesen opened this issue Aug 27, 2024 · 10 comments
Labels
bug Something isn't working work in progress

Comments

@kvanbiesen
Copy link

Version

1.9.0

Node version

Node.js v20.15.1

Operating System type

Other

Operating system version

HAOS

Describe the bug

When starting addon, and the first dive who connect to it, it makes the server crash

To reproduce

Start plugin. Wait. crashes. Think its when a device connect to it.

Screenshots & Logfiles

2024-08-27 18:39:53.373 INFO eufy-security-ws:eufy-security-client [http] [Station.onConnect] Connected to station T8010P2322044049 on host 192.168.20.147 and port 14677
node:internal/crypto/cipher:121
this[kHandle].initiv(cipher, credential, iv, authTagLength);
^

RangeError: Invalid key length
at Cipheriv.createCipherBase (node:internal/crypto/cipher:121:19)
at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:140:3)
at new Cipheriv (node:internal/crypto/cipher:243:3)
at createCipheriv (node:crypto:147:10)
at encryptP2PData (/usr/src/app/node_modules/eufy-security-client/build/p2p/utils.js:90:48)
at buildCommandWithStringTypePayload (/usr/src/app/node_modules/eufy-security-client/build/p2p/utils.js:298:48)
at P2PClientProtocol._sendCommand (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:633:81)
at P2PClientProtocol.sendQueuedMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:566:30)
at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:974:34)
at Socket. (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:124:56) {
code: 'ERR_CRYPTO_INVALID_KEYLEN'
}

Additional context

No response

@kvanbiesen kvanbiesen added the bug Something isn't working label Aug 27, 2024
@bropat
Copy link
Owner

bropat commented Sep 15, 2024

@kvanbiesen

I need more debug information (debug logs) to identify the problem.

@kvanbiesen
Copy link
Author

kvanbiesen commented Sep 15, 2024

darn, thought i added them.

Created some new one, hope this helps, currently rolled back to previous version

Sorry:/

judging by the serial, i think its the eufy floodlight

402f1039_eufy_security_ws_2024-09-15T10-48-24.780Z.log

@bropat
Copy link
Owner

bropat commented Sep 17, 2024

judging by the serial, i think its the eufy floodlight

Yes, it is:

2024-09-15 10:49:30.749	DEBUG	eufy-security-ws:eufy-security-client	[http] [Station.getCameraInfo] Station send get camera info command {
  stationSN: 'T8424N1021291061'
}
node:internal/crypto/cipher:121
    this[kHandle].initiv(cipher, credential, iv, authTagLength);
                  ^

RangeError: Invalid key length
    at Cipheriv.createCipherBase (node:internal/crypto/cipher:121:19)
    at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:140:3)
    at new Cipheriv (node:internal/crypto/cipher:243:3)
    at createCipheriv (node:crypto:147:10)
    at encryptP2PData (/usr/src/app/node_modules/eufy-security-client/build/p2p/utils.js:90:48)
    at buildIntStringCommandPayload (/usr/src/app/node_modules/eufy-security-client/build/p2p/utils.js:244:48)
    at P2PClientProtocol._sendCommand (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:623:76)
    at P2PClientProtocol.sendQueuedMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:566:30)
    at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:974:34)
    at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:124:56) {
  code: 'ERR_CRYPTO_INVALID_KEYLEN'
}

I think I have found the reason.

@bropat bropat changed the title [Bug]: [Bug]: RangeError: Invalid key length Sep 17, 2024
@kvanbiesen
Copy link
Author

kvanbiesen commented Sep 17, 2024 via email

@bropat
Copy link
Owner

bropat commented Sep 28, 2024

@kvanbiesen

I cannot reproduce this error... :(

@kvanbiesen
Copy link
Author

kvanbiesen commented Sep 28, 2024 via email

@bropat
Copy link
Owner

bropat commented Sep 28, 2024

@kvanbiesen

What if you completely uninstall version 1.8.0 and then install version 1.9.0?

@kvanbiesen
Copy link
Author

kvanbiesen commented Sep 28, 2024 via email

@bropat
Copy link
Owner

bropat commented Sep 29, 2024

@kvanbiesen

Can you try version 1.9.1?

@kvanbiesen
Copy link
Author

yup, doesnt crash at startup. Seems to be fixed. have to test the rest of the deviced but i assume if it starts. They should be working

Thanks @bropat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working work in progress
Projects
None yet
Development

No branches or pull requests

2 participants