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 🙏

© 2025 – Pkg Stats / Ryan Hefner

id-auth-sdk

v0.1.3

Published

Multi-factor authentication SDK including fingerprint recognition

Downloads

16

Readme

ID Auth SDK

一个用于多因子认证的 JavaScript SDK,目前包含通过 WebSocket 连接到本地设备代理的指纹识别支持。

安装

npm install id-auth-sdk
# 或者
yarn add id-auth-sdk

快速入门示例 (基于 simple-demo.html)

此示例演示了初始化 SDK、连接到 WebSocket 以及通过 IFrame 触发指纹录入或验证。

主要 API 方法

以下是 SDK 提供的主要方法:

1. AuthSDK.loadAndConfigFingerprintModule(configOptions, initCallback)

  • 功能: 加载指纹识别模块(如果尚未加载),配置 SDK 并根据选项决定是否自动连接 WebSocket。
  • 参数:
    • configOptions (Object): 配置对象。
      • wsUrl (String): WebSocket 服务地址。默认为 ws://127.0.0.1:38280
      • isAutoConnect (Boolean): 是否在配置后自动连接 WebSocket。默认为 true
    • initCallback (Function): 模块加载和配置/连接尝试完成后的回调函数。回调参数为一个包含结果信息的对象 (例如 { success: boolean, message: string, type: string, action: string, event?: Event })。
  • 说明: 这是推荐的初始化方法,它处理了模块加载、配置和可选的自动连接。

2. AuthSDK.openFingerprintEnroll(url, userData, options, onResult)

  • 功能: 打开一个用于指纹录入的 IFrame 弹窗。
  • 参数:
    • url (String): IFrame 页面的基础 URL (SDK 会自动附加路径和查询参数)。
    • userData (Object): 包含用户信息。
      • userId (String): 用户 ID (必填)。
      • tenantId (String): 租户 ID (必填)。
      • devType (Number): 设备类型 (必填,通常为 0)。
    • options (Object, 可选): 样式或其他选项 (例如 { width: Number, height: Number })。
    • onResult (Function): 操作结果的回调函数。回调参数为一个包含结果信息的对象 (例如 { success: boolean, message: string, action: string })。
  • 说明: 调用前需确保 WebSocket 已连接。onResult 会在尝试打开 IFrame (检查参数、连接状态) 或 IFrame 内部操作(如注册、删除)完成时被调用。

3. AuthSDK.openFingerprintVerify(url, verifyData, options, onResult)

  • 功能: 打开一个用于指纹验证的 IFrame 弹窗。
  • 参数:
    • url (String): IFrame 页面的基础 URL (SDK 会自动附加路径和查询参数)。
    • verifyData (Object): 包含验证所需信息。
      • userId (String, 可选): 进行 1v1 验证时的用户 ID。
      • tenantId (String): 租户 ID (必填)。
      • devType (Number): 设备类型 (通常为 0)。
      • verifyType (Number): 验证类型 (1: 针对 userId 的 1v1(二次验证、增强验证) 验证; 2: 1vN 全库验证)。默认为 1。
    • options (Object, 可选): 样式或其他选项。
    • onResult (Function): 操作结果的回调函数。回调参数为一个包含结果信息的对象。
  • 说明: 调用前需确保 WebSocket 已连接。onResult 会在尝试打开 IFrame 或 IFrame 内部验证操作完成时被调用。

4. AuthSDK.disconnectFingerprint()

  • 功能: 断开当前的 WebSocket 连接。
  • 参数: 无。
  • 说明: 调用此方法会主动关闭与指纹设备的 WebSocket 连接。

5. AuthSDK.fingerprintCloseIframe()

  • 功能: 关闭指纹Iframe。
  • 参数: 无。
  • 说明: 调用此方法会关闭指纹Iframe。