Socket
Socket
Sign inDemoInstall

@tuyapi/link

Package Overview
Dependencies
21
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.4 to 0.4.0

6

index.js

@@ -28,3 +28,3 @@ const {TuyaContext} = require('@tuya/tuya-connector-nodejs');

class TuyaLinkWizard {
constructor({email, password, region = 'us', timezone = 'America/Chicago', apiKey, apiSecret, schema} = {}) {
constructor({email, password, region = 'us', timezone = 'America/Chicago', apiKey, apiSecret, schema, bindAddr} = {}) {
if (!email || !password) {

@@ -38,2 +38,3 @@ throw new Error('Both email and password must be provided');

this.timezone = timezone;
this.bindAddr = bindAddr;

@@ -128,3 +129,4 @@ this.api = new TuyaContext({

ssid,
wifiPassword});
wifiPassword,
bindAddr: this.bindAddr});

@@ -131,0 +133,0 @@ // While UDP packets are being sent, start polling for device

const dgram = require('dgram');
const delay = require('delay');
const debug = require('debug')('@tuyapi/link:manual');
const os = require('os');

@@ -17,2 +18,3 @@ /**

this.abortBroadcasting = false;
this.bindAddr = undefined;
}

@@ -70,2 +72,17 @@

if (options.bindAddr !== undefined) {
if (typeof options.bindAddr !== 'string') {
throw new TypeError('Invalid binding address');
}
const interfaces = os.networkInterfaces();
if (!Object.keys(interfaces).some(name =>
!interfaces[name].some(assigned => assigned.address.toLowerCase() === options.bindAddr.toLowerCase())
)) {
throw new Error('Invalid binding address');
}
this.bindAddr = options.bindAddr;
}
debug('Sending SmartLink initialization packets');

@@ -340,3 +357,3 @@

});
this.udpClient.bind(0);
this.udpClient.bind(0, this.bindAddr);
}

@@ -343,0 +360,0 @@

{
"name": "@tuyapi/link",
"version": "0.3.4",
"version": "0.4.0",
"description": "📡 Effortlessly connect devices to WiFi and the cloud",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc