Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@xizhibei/getui-rest-sdk
Advanced tools
详细原接口文档:http://docs.getui.com/server/rest/start/
除了原文档中的接口,其中另外还提供了
pushMessageByTag
方法,可以用来发送按 tag 或者说按 topic 方式推送数据。
npm i @xizhibei/getui-rest-sdk --save
建议使用 vscode 开发,typing 代码提示更加完善
以下样例均使用 TypeScript 展示,可轻易修改为 ES6
const option: GetuiOption = {
appId: APP_ID,
appSecret: APP_SECRET,
appKey: APP_KEY,
masterSecret: MASTER_SECRET,
};
const gt = new Getui(option);
const alert = new Alert();
alert.title = 'Title: push test';
alert.body = `Body: push test`;
const payload = JSON.stringify({
message: `Payload message: push message test`,
});
const apnsInfo = new ApnsInfo();
apnsInfo.alert = alert;
apnsInfo.customMsg = { payload };
const template = new TransmissionTemplate();
template.transmissionContent = payload;
const message = new SingleMessage();
message.template = template;
message.apnsInfo = apnsInfo;
const target = <Target>{
cid: GETUI_CID,
};
const ret = await gt.pushMessageToSingle(message, target);
const message = new AppMessage();
message.template = template;
message.apnsInfo = apnsInfo;
message.conditions = [
new Condition(ConditionKey.TAG, [testTag], CondOptType.OR),
new Condition(ConditionKey.Region, [Region.北京市], CondOptType.OR),
new Condition(ConditionKey.PHONE_TYPE, [PhoneType.IOS], CondOptType.OR),
];
const ret = await gt.pushMessageToApp(message)
const message = new TagMessage();
message.template = template;
message.apnsInfo = apnsInfo;
message.tag = testTag;
const ret = await gt.pushMessageByTag(message);
更多样例,请见测试代码
测试基于 nock 来模拟服务器,但是你可以设置环境变量与真实个推服务器测试进行交互,以下测试账号数据需要用你自己的
export GETUI_APP_ID=<app id>
export GETUI_APP_SECRET=<app secret>
export GETUI_APP_KEY=<app key>
export GETUI_MASTER_SECRET=<master secret>
export GETUI_CID=<cid>
export GETUI_TEST_TAG=<tag>
export GETUI_TEST_USE_REAL_CONNECTION=true
export DEBUG=getui
npm test
This project is licensed under the MIT License - see the LICENSE file for details
FAQs
Getui rest api for node.js, in TypeScript
The npm package @xizhibei/getui-rest-sdk receives a total of 1 weekly downloads. As such, @xizhibei/getui-rest-sdk popularity was classified as not popular.
We found that @xizhibei/getui-rest-sdk 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.