Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
InterFace Toolkit 接口工具集
by 鬼道(luics)
tnpm install -g ift
MAC 用户请使用sudo tnpm install -g ift
请使用
ift -h
查看所有命令
请在项目根目录下运行
ift -i
or
ift --init
会影响的文件结构为
demo/
--data/
----demo.js
----if-config.json
doc/
ift -i
生成的 demo.js 是一个 IF 数据文件,即可以作为调试数据使用(ift -e
),又能生成接口文档(ift -s
)。
下面显示了重要的配置信息:
exports.config = {
"name": "这是接口名",
"desc": "这是接口的详细描述",
// 线上地址
"url": "http://example.com/demo",
// 日常地址
"urlDaily": "http://daily.example.net/demo",
// 预发地址
"urlPrepub": "http://example.com/demo",
// 支持的 Method 集合
"method": ['GET', 'POST'],
// 响应与模板的映射关系
"template":{
"response": "tpl1.php",
"responseError": "tpl2.php"
}
};
用于将数据文件 demo.js 生成接口文档
请在项目根目录下运行(首次运行该命令前请先运行ift --init
)
ift -s
or
ift --sync
该命令默认读取的配置文件位于 demo/data/if-config.json
,所有数据文件均位于 demo/data/
默认生成的接口文档为 doc/api.md
(查看 api.md 文档)
doc/
--api.md
if-config.json 是接口文档配置文件
{
"title": "接口文档",
"extraHtml": "<h3>额外的html片段</h3>",
"savePath": "../../doc/api.md",
"files": [
"demo"
]
}
savePath
设置保存接口文档的相对路径files
指定接口文件,无需文件扩展名请在项目根目录下运行
ift -e -p 9999
or
ift --server --port 9999
浏览器中访问 http://localhost:9999/demo.js
,demo.js
可替换为合适的值
调用
require('ift').ifCheck({data-format:1}, {data:1});
返回
{
"pass": 1, // 1-校验通过 0-未通过
"defined": 4, // 校验的字段数
"undefined": 0, // 需要定义却未定义的字段数
"mismatch": 0, // 格式不匹配的字段数
"stack": [ // 校验堆栈,一般用不着
"{root}"
],
"log": [] // 出错日志
}
调用
window.ifCheck({data-format:1}, {data:1});
返回 同 node 版本
FAQs
InterFace Toolkit
The npm package ift receives a total of 1 weekly downloads. As such, ift popularity was classified as not popular.
We found that ift 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.