Socket
Socket
Sign inDemoInstall

@cnhis-frontend/signature

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cnhis-frontend/signature

手写板签名对接 sdk


Version published
Maintainers
0
Created
Source

signature-sdk

手写板签名对接 sdk

厂商列表

  • 捷宇技术(默认)
  • 天谷信息
  • 河北腾翔

安装

yarn add @cnhis-frontend/signature

如何使用


import SignatureSDK from '@cnhis-frontend/signature'

// 创建签名实例,注意,重复创建也只会返回上一个实例对象

// 捷宇
const signatureSdk = SignatureSDK.create()
const { signImage, fingerImage, signXml, mixImage, signFileStr } =
	await signatureSdk.start(option)
/* option类型为undefined | {
	strokeWidth?: number; 签名线条粗细值,默认值 3
	pdfPath?: string; 预览目标pdf文件路径
	xmlPath?: string; xml文件生成路径,
	location?: string; 签名或者指纹的位置,一个签名或指纹标准格式为Type.Page.X.Y,默认值 '2.1.100.100'
						Type---------0为签名,1为指纹,2为指纹加签名
						Page---------表示页码
						X-------------坐标位置
						Y-------------坐标位置
						(比如只有一个签名时表示“0.1.100.100”)多个位置时用 “|”分隔符
	voiceStr?: string; 播放的提示语,默认值 '请签名'
	ifPreview?: number; 只签名或者签名 pdf 文件,2 为签名 pdf 文件, 1 为预览 pdf文件,0 为只签名或者只按指纹,此时 PDFPath 可以为空,默认值 0
}
signatureSdk.start方法返回值类型为 {
	signImage: string; 签名图片,base64
	fingerImage: string; 指纹图片,base64
	signXml: string; 签名轨迹 xmlbase64
	mixImage: string; 签名指纹合成图片 base64 [取值建议取这个]
	signFileStr: string; 成功后返回 pdf 的 base64 数据
}
*/

// 捷宇-四川CA
const signatureSdk = SignatureSDK.create({name: 'jieyu', version: 'sichuan'})
const { signImage, fingerImage, SignPdfBase64, XML } =
	await signatureSdk.start(option)
/* option类型为undefined | {
	SignWidth?: number; 签名图片宽度值,默认值 50
	PDFPath: string; 目标pdf文件路径
	XmlPath?: string; XML文件生成路径(为空时表示点击屏幕签名,传 xml 路径时表示指定位置签名),
	Location?: string; 签名或者指纹的位置,一个签名或指纹标准格式为Type,Page,X,Y,默认值 '2,1,450,500'
						Type---------0为签名,1为指纹,2为指纹加签名
						Page---------表示页码
						X-------------坐标位置
						Y-------------坐标位置
						(比如只有一个签名时表示“0,1,100,100”)多个位置时用 “|”分隔符
	Retain?: string; 预留项
	Timeout?: number; 超时时间,默认值 60s
}
signatureSdk.start方法返回值类型为 {
	signImage: string[]; 签名图片,base64, 由于可多次点击屏幕签名,所以可生成多个签名图 [如存在同时签名和指纹,则此值为签名+指纹合并图,否则仅为签名图,取值建议取这个]
	fingerImage: string[]; 指纹图片,base64, 由于可多次点击屏幕签名,所以可生成多个签名图
	SignPdfBase64: string; pdf 的 base64
	XML: string; 如果是点击屏幕签名返回 json 集合,json 说明(XMLCount---xml 个数,XML+序号-----xml 的数据)
}
*/

// 天谷
const signatureSdk = SignatureSDK.create({ name: 'tiangu' })
// 签名图片,base64
const { signImage } = await signatureSdk.start('sign')
// 指纹图片,base64
const { fingerImage } = await signatureSdk.start('finger')

// 河北腾翔(signImage包含了手写签名和指纹)
const signatureSdk = SignatureSDK.create({ name: 'tengxiang' })
// 签名图片,base64,signImage包含了手写签名和指纹
const { signImage } = await signatureSdk.start(option)
/* option类型为undefined | {
	content?: string; 签名原文,默认为空
	zoomSize?: number; (0 – 100)表示输入图案为原图的百分比,0表示不缩放,默认25
} */

// 河北腾翔3.0(signImage包含了手写签名和指纹)
const signatureSdk = SignatureSDK.create({ name: 'tengxiang'version: 3 })
// 签名图片,base64,signImage包含了手写签名和指纹
const { signImage } = await signatureSdk.start(option)
/* option类型为 {
	id?: string | number; 业务系统自定义字段,可以定义多个,证信签不对其进行处理,签字完成时一并返回
	reason: string; 签字确认文字
	title: string; 标题
	content: string; type为html时为网页源码(源码的双引号用单引号替换,其它不变),type为text的时候为string字符串(可传入有效url)
	source: string; 待签原文,PC传递给证信签,用于签名
	type?: 'text' | 'html' | 'htmlB64'; 默认值为text
} */

// 销毁实例,执行后可使用SignatureSDK.create()创建一个新实例
SignatureSDK.destroy()
/*
  1、关闭websocket连接
  2、销毁实例
  */

FAQs

Package last updated on 26 Aug 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc