Appearance
Class: QysUKeySdk
SDK 类,通过 QysUKeySdk 进行 sdk 实例创建
Table of contents
Constructors
Properties
- bus
- config
- container
- localSigningClient
- mobileCertificateUseCase
- mobileFileOperations
- pcClient
- pcSigningSource
- store
- storeSnapShoot
- uiReady
- version
Accessors
Methods
- activatePCSigningSource
- addFile
- addStamper
- assertMobileCertificateSupported
- close
- doSwitchDocument
- downloadCurrentFile
- downloadFile
- execAfterUiReady
- getCurrentDocument
- getDocuments
- getLocalSigningClient
- getPCSigningClient
- getSigningIdentity
- getSigningSource
- getUI
- getVerifyResult
- hideThirdBtnFn
- isNeedSave
- isNoAp
- registerMobileFileOperations
- removeDocument
- render
- reportMobileCertificateError
- setConfig
- showSeal
- showThirdBtnFn
- showVerifyContent
- signMobilePdf
- signPdf
- unmount
- updateConfig
- useUKeySigning
Constructors
constructor
• new QysUKeySdk(params?)
Parameters
| Name | Type |
|---|---|
params | Partial<QysUKeySdkConfig> |
Properties
bus
• bus: Emitter<QYS_SDK_INNER_EVENTS>
事件总线:一般在应用内部使用,参考 QYS_SDK_INNER_EVENTS 事件列表,标为内部调用的不建议通过 SDK 进行调用
config
• config: UKeySDKConfig
QysUKeySdk 配置项
container
• container: null | Element = null
签章页面所挂载的根元素:可以用来判断当前页面是否挂载
localSigningClient
• Private localSigningClient: null | LocalSigningClient = null
SDK 持有的共享传输,移动证书可直接使用而无需创建硬件客户端。
mobileCertificateUseCase
• Private mobileCertificateUseCase: null | MobileCertificateSigningUseCase = null
仅负责授权、印章位置和签署的业务服务。
mobileFileOperations
• Private mobileFileOperations: null | MobileFileOperations = null
宿主集成仅在 SDK 查看器挂载期间有效。
pcClient
• Private pcClient: null | UKeyClient = null
延迟创建的硬件封装,仅负责 UKey 命令和设备发现。
pcSigningSource
• Private pcSigningSource: PcSigningSource
PC 端签署方式选择,独立于浏览器平台判断。
store
• Private store: null | RematchStore<RootModel, Record<string, never>> = null
签章页面 store, 内部使用
storeSnapShoot
• Private storeSnapShoot: null | RematchRootState<RootModel, Record<string, never>> = null
签章页面 store 快照, 用于一些数据对比,内部使用
uiReady
• Private uiReady: boolean = false
签章页面组件是否完成挂载
version
▪ Static version: string = version
当前版本号
Accessors
mobileCertificate
• get mobileCertificate(): MobileCertificateSigningUseCase
提供 PC 移动证书业务操作,供宿主和签章面板共用。
Returns
MobileCertificateSigningUseCase
Methods
activatePCSigningSource
▸ Private activatePCSigningSource(type): void
同步签署来源和硬件发现,仅在来源实际变化时通知界面。
Parameters
| Name | Type |
|---|---|
type | "UKEY" | "MOBILE_CERTIFICATE" |
Returns
void
addFile
▸ addFile(file): void
添加单个或多个文件
Parameters
| Name | Type |
|---|---|
file | undefined | CustomFileData | File | FileList | CustomFileData[] |
Returns
void
addStamper
▸ addStamper(type?): void
向当前PDF页面添加印章(仅H5生效)
Parameters
| Name | Type | Default value |
|---|---|---|
type | StamperType | 'SEAL_CORPORATE' |
Returns
void
assertMobileCertificateSupported
▸ Private assertMobileCertificateSupported(): void
将该功能限制在 PC 端,保留现有 H5、App 和蓝牙签署流程。
Returns
void
close
▸ close(): void
卸载页面,unmount 的别名
Returns
void
doSwitchDocument
▸ doSwitchDocument(docId): void
根据文件 id 切换文件
Parameters
| Name | Type | Description |
|---|---|---|
docId | string | 文件 id,一般通过 getDocuments() 获取到文件列表,选择切换的文件传入其 id |
Returns
void
downloadCurrentFile
▸ downloadCurrentFile(): void
如果当前文件存在,则下载当前文件
Returns
void
downloadFile
▸ downloadFile(file): void
指定下载文件
Parameters
| Name | Type | Description |
|---|---|---|
file | FileDescriptor | 参数 file 可以通过 getDocuments 获取到的结果指定 |
Returns
void
execAfterUiReady
▸ Private execAfterUiReady(cb, args?): void
在页面 React 组件挂载完成后进行执行,内部调用
Parameters
| Name | Type | Default value |
|---|---|---|
cb | (...args: any) => any | undefined |
args | any[] | [] |
Returns
void
getCurrentDocument
▸ getCurrentDocument(): null | FileDescriptor
返回当前文件描述信息对象
Returns
null | FileDescriptor
getDocuments
▸ getDocuments(): FileDescriptor[]
返回已添加的文件描述信息列表
Returns
getLocalSigningClient
▸ getLocalSigningClient(): LocalSigningClient
内部组装入口:提供独立于 UKey 的本地签署连接。
Returns
LocalSigningClient
getPCSigningClient
▸ getPCSigningClient(): UKeyClient
内部硬件组装入口:UKey 与移动证书只共享底层连接。
Returns
UKeyClient
getSigningIdentity
▸ Private getSigningIdentity(): null | SigningIdentity
仅从当前选择推导保存身份,不读取或创建另一种签署业务。
Returns
null | SigningIdentity
getSigningSource
▸ getSigningSource(): PcSigningSource
获取当前 PC 签署方式。
Returns
getUI
▸ getUI(style?): HTMLDivElement
渲染单体签章页面并返回应用挂载的 dom 容器
Parameters
| Name | Type | Description |
|---|---|---|
style | Partial<CSSStyleDeclaration> | 返回的 dom 容器的 css 样式 |
Returns
HTMLDivElement
getVerifyResult
▸ getVerifyResult(): Signature[]
获取当前文件的所有验签信息
Returns
hideThirdBtnFn
▸ hideThirdBtnFn(): void
Returns
void
isNeedSave
▸ isNeedSave(): boolean
当前是否需要进行保存签名
Returns
boolean
isNoAp
▸ isNoAp(): boolean
当前是否为无外观印章
Returns
boolean
registerMobileFileOperations
▸ registerMobileFileOperations(operations): void
内部组装入口:接入解析和存储操作。
Parameters
| Name | Type |
|---|---|
operations | MobileFileOperations |
Returns
void
removeDocument
▸ removeDocument(id): void
从当前文件列表中移除指定文件
Parameters
| Name | Type | Description |
|---|---|---|
id | string | id 为文件描述信息中的 id 字段 |
Returns
void
render
▸ render(container): void
将单体签章页面渲染到指定容器上
Parameters
| Name | Type |
|---|---|
container | Element |
Returns
void
reportMobileCertificateError
▸ Private reportMobileCertificateError(error): void
为原有无需等待返回值的 SDK 入口报告失败。
Parameters
| Name | Type |
|---|---|
error | unknown |
Returns
void
setConfig
▸ Private setConfig(config): void
设置当前 sdk 配置项,内部调用
Parameters
| Name | Type |
|---|---|
config | UKeySDKConfig |
Returns
void
showSeal
▸ showSeal(): void
控制左侧签章工具面版的展示
Returns
void
showThirdBtnFn
▸ showThirdBtnFn(): void
Returns
void
showVerifyContent
▸ showVerifyContent(): void
控制左侧验签工具栏展示
Returns
void
signMobilePdf
▸ signMobilePdf(): Promise<MobileSigningResult>
签署已挂载 SDK 中符合条件的文件,并返回可等待的批量结果。
Returns
Promise<MobileSigningResult>
signPdf
▸ signPdf(): undefined
签署需要保存的pdf文件
Returns
undefined
unmount
▸ unmount(): boolean
卸载单体签章页面
Returns
boolean
updateConfig
▸ updateConfig(config): void
更新当前配置信息
Parameters
| Name | Type |
|---|---|
config | Partial<UKeySDKConfig> |
Returns
void
useUKeySigning
▸ useUKeySigning(): Promise<void>
切换回硬件签署并恢复设备发现,保留移动授权与后台状态查询。
Returns
Promise<void>