homebridge-tuya-05teve
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -38,2 +38,17 @@ #!/usr/bin/env node | ||
const checkKey = key => { | ||
if (!key) return false; | ||
if (!/^[0-9a-f]+$/i.test(key)) { | ||
console.log('*** The key contains invalid characters; try again.'); | ||
return false; | ||
} | ||
if (!{16:1, 24:1, 32: 1}[key.length]) { | ||
console.log('*** The key contains the wrong number of characters; try again.'); | ||
return false; | ||
} | ||
return true; | ||
}; | ||
const decodeLine = (key, input, log = true) => { | ||
@@ -129,3 +144,3 @@ const encoding = (input.substr(0, 8) === '000055aa') ? 'hex' : 'base64'; | ||
Key: next => { | ||
if (program.key) return next(null, program.key); | ||
if (program.key && checkKey(program.key)) return next(null, program.key); | ||
@@ -143,3 +158,3 @@ const rl = readline.createInterface({ | ||
const input = line.trim(); | ||
if (!input) return rl.prompt(); | ||
if (!checkKey(input)) return rl.prompt(); | ||
@@ -146,0 +161,0 @@ rl.close(); |
{ | ||
"name": "homebridge-tuya-05teve", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
@@ -6,0 +6,0 @@ "description": "🏠 Offical Homebridge plugin for TuyAPI - Fork of iRayanKhan's plugin to test publishing steps.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
565879
5496