
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
tuya_cloud_sdk_nodejs
Advanced tools
确认nodejs版本在7.10.1及以上
在涂鸦云平台注册开发者账号,确定AccessID、AccessKey、Endpoint
(调用地址)这些值
在你运行本sdk前,显式初始化一次开发者信息:
Config.init(accessID, accessKey, Region.URL_CN);
以获取设备信息接口为例,直接调用device.GetDevice()即可:
let deviceId = 'xxxx';
let callback = function(err, data) {
if (err) {
console.log(err);
return;
}
console.log(data);
};
// 获取设备信息
DeviceClient.getDevice(deviceId, callback);
模块 | 请求类 |
---|---|
token相关 | TokenClient |
用户管理 | UserClient |
设备管理 | DeviceClient |
设备控制 | DeviceControlClient |
设备群组 | DeviceGroupClient |
设备成员管理 | DeviceMemberClient |
数据统计 | DataClient |
家庭管理 | HomeClient |
自动化 | AutomationClient |
场景 | SceneClient |
配网管理 | PairTokenClient |
定时管理 | TimeClient |
天气管理 | WeatherClient |
注意: refreshToken接口会返回一个新的access_token,即使旧的token还未过期。
这个逻辑在GetToken方法中已经做了,用户一般不需要调用refresh接口。
不需要,这层逻辑已经在api方法中实现了。token信息会缓存到内存中。
不需要,在GetToken()方法实现中,会检查token是否过期。如果过期会去重新拉取。
涂鸦的云token,只保证面向的用户级别刷新不会有问题,但是一个用户的token在多个节点并发刷新,就会导致一个节点是成功的,
其他都是失败;
因为 获取token
接口会返回一个access_token、refresh_token,但是 刷新token
接口 会把当前的refresh_token 刷掉,会产生一个新的,旧的失效;
接口如果返回error,一般可以为url错误或者json解析出错,可联系涂鸦相关人员帮忙修改
如果error为空,但是response的success字段为false,开发者可以根据Msg字段的详细错误信息进行排查
多个deviceID,以英文逗号分割拼接
创建APP-SDK后,详情页面的渠道标识符就是schema
pair_token是指app下的某个用户的配网token,可以从v1.0/devices/token获取。
有三种方法:
一、自定义类实现
如果请求不需要传递body参数,通过创建请求类继承com.tuya.api.common.ApiRequest, 并完善其中getRequestMethod和getRequestUrl两个方法即可, 如果接口需要传递body参数,应继承com.tuya.api.common.ApiRequestBody, 完善getRequestMethod、getRequestUrl和getRequestBody方法;
通过client类暴露请求方法。
具体可以参考example.user/example.device目录下相关示例;
二、使用提供的通用接口 直接调用CommonClient, 传入相应的参数即可。
具体可以参考example.common目录下相关示例;
三、提个issue,我们会及时更新 ^_^
FAQs
涂鸦云 API NODEJS SDK
We found that tuya_cloud_sdk_nodejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.