Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (options.saveAPI) {
config.set('apiKey', options.apiKey);
config.set('apiSecret', options.apiSecret);
}
// Set API parameters
if (!options.apiKey) {
options.apiKey = config.get('apiKey');
}
if (!options.apiSecret) {
options.apiSecret = config.get('apiSecret');
}
// Start linking process
const link = new TuyaLink({apiKey: options.apiKey,
apiSecret: options.apiSecret,
email: 'johndoe@example.com',
password: 'examplepassword'});
const spinner = ora('Registering devices(s)...').start();
try {
await link.init();
const devices = await link.linkDevice({ssid: options.ssid, wifiPassword: options.password, devices: options.num});
spinner.succeed('Device(s) registered!');
// Save devices to config
if (options.save) {
for (const device of devices) {