npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fddnpm/fasc-openapi-node-sdk

v5.4.5

Published

法大大 FASC-OPENAPI NODEJS SDK

Downloads

14

Readme

FASC OpenApi Node SDK v5.1说明

简介

欢迎使用法大大开发者工具套件(SDK),NODEJS SDK 是法大大电子合同和电子签云服务开放平台(FASC OPEN API)的配套工具。

版本说明

FASC.openAPI 产品目前存在两个子版本号:v5.0、v5.1, 均在持续迭代维护。

当前页面SDK基于FASC.openAPI v5.1子版本开发,如需使用FASC.openAPI v5.0版本SDK,请访问:

https://gitee.com/fadada-cloud/fasc-openapi-node-sdk/tree/v5.0

目录结构

  • SDK项目层级
fascapi
	- services  // client客户端。
	- common // 包含了http,hash工具类方法 和全局常量等。
	- events // 回调事件模型定义。
  - typings // 类型定义
  - utils // 工具类方法,提供如回调事件的验签等功能。
  • SDK 目前支持以下模块,对应 client 可支持具体的业务方法:

| 模块 | 模块中文名 | 模块说明 | | -------------- | ---------------- |------------------------------------------------------------------| | ServiceClient | 服务访问凭证 | 获取服务访问凭证 | | UserClient | 个人用户管理 | 包含应用的个人用户信息查询、禁用、恢复、解绑等 | | CorpClient | 企业用户账号管理 | 包含应用的企业用户信息查询、禁用、恢复、解绑等 | | OrgClient | 组织管理 | 包含企业成员查询 | | SealClient | 印章管理 | 包含印章查询、用印员查询 | | DocClient | 文件管理 | 包含网络文件上传、获取文件上传地址、文件处理 | | TemplateClient | 文档模板管理 | 包含文档模板查询、签署模板查询 | | SignTaskClient | 签署任务管理 | 包含签署任务的创建、维护、各个流程节点的流转操作,以及签署任务查询、文件下载链接等 | | EUIClient | EUI页面链接管理 | 对EUI页面链接进行管理操作,如获取个人授权链接、获取企业授权链接、获取计费链接、获取签署任务编辑链接、印章管理、组织管理链接等 | | ApprovalClient | 审批管理 | 包含审批相关接口 | | CallbackClient | 回调管理 | 包含回调相关接口 | | OcrClient | OCR识别 | 包含OCR相关接口 | | ToolClient | 工具能力服务 | 包含身份校验和智审对比的相关接口 | | VoucherClient | 单据类接口 | 包含单据签署相关的接口 |

实例化 client 的入参支持 clientConfig 数据结构和说明 详见 ClientConfig

依赖环境

  1. NODEJS 12 版本及以上
  2. 在法大大平台开通相应应用
  3. 获取 appId、appSecret 及服务请求地址(serverUrl)

获取安装

通过 npm 安装:

npm i @fddnpm/fasc-openapi-node-sdk

通过 yarn 安装:

yarn add @fddnpm/fasc-openapi-node-sdk

示例

调用接口

// 导入sdk
const fascOpenApi = require('@fddnpm/fasc-openapi-node-sdk');

// 导入对应模块的client
const UserClient = fascOpenApi.userClient.Client;

// 配置信息
const clientConfig = {
  // 认证信息
  credential: {
    appId: 'appId值',
    appSecret: 'appSecret值',
    accessToken: 'accessToken值'
  },
  // 服务请求地址
  serverUrl: '服务请求地址'
}

// 实例化模块的client对象
const client = new UserClient(clientConfig)
// 通过client对象调用想要访问的接口,传入请求对象以及响应回调函数
client.getUserInfo({openUserId: 'openUserId'}).then(
  res => {
    console.log(res)
  },
  err => {
    console.error('error: ', err)
  }
)

回调事件验签

const fascOpenApi = require('@fddnpm/fasc-openapi-node-sdk');
<!-- 从回调的请求头部获取以下信息 -->
const params = {
  "X-FASC-App-Id": headers['X-FASC-App-Id'],
  "X-FASC-Sign-Type": headers['X-FASC-Sign-Type'],
  "X-FASC-Timestamp": headers['X-FASC-Timestamp'],
  "X-FASC-Nonce": headers['X-FASC-Nonce'],
  "X-FASC-Event": headers['X-FASC-Event'],
  bizContent: headers['bizContent'],
  appSecret: 您的appSecret
}
const sign = fascOpenApi.utils.sign(params);

if (sign === headers['X-FASC-Sign']) {
  // 验签通过
} else {
  // 验签失败
}

更多示例

更丰富的示例请前往 demo 中查看

版本更新日志

5.1.0 - 2022-07-28 基于FASC OpenAPI 5.1.0版本开发,初始版本。 5.2.5 - 2023-06-15 SDK 更新,打包支持cjs和esm 5.3.7 - 2023-12-27 SDK 更新,新增回调事件签名验签功能

参考

FASC OpenAPI (服务端) 接口文档 v5.1

https://dev.fadada.com/api-doc/ALGPB7Z1FD/TA0WHTSXQYL0NQRB/5-1