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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yidun/quickpass-sdk-miniprogram

v1.1.0

Published

网易易盾本机校验小程序 SDK

Readme

网易易盾本机校验小程序版

接入手册

安装

在项目目录下安装 @yidun/quickpass-sdk-miniprogram 包:

npm install @yidun/quickpass-sdk-miniprogram

在代码中引入该包:

import NEQuickPass from '@yidun/quickpass-sdk-miniprogram';

域名白名单

在使用本机校验功能前,需要将以下域名添加到小程序的白名单中:

https://ye.dun.163.com
https://ye.dun.163yun.com
https://verify.cmpassport.com
https://id6.me
https://hs.wosms.cn
https://nisah1.10010.com:38750
https://nisah2.10010.com:38750
https://nisbj1.10010.com:38750
https://nisbj2.10010.com:38750
https://nisbj3.10010.com:38750
https://niscq1.10010.com:38750
https://nisfj1.10010.com:38750
https://nisgd1.10010.com:38750
https://nisgd2.10010.com:38750
https://nisgd3.10010.com:38750
https://nisgd4.10010.com:38750
https://nisgs1.10010.com:38750
https://nisgx1.10010.com:38750
https://nisgz1.10010.com:38750
https://nisgz2.10010.com:38750
https://nishan1.10010.com:38750
https://nisheb1.10010.com:38750
https://nisheb2.10010.com:38750
https://nisheb3.10010.com:38750
https://nishen1.10010.com:38750
https://nishen2.10010.com:38750
https://nishlj1.10010.com:38750
https://nishub1.10010.com:38750
https://nishub2.10010.com:38750
https://nishun1.10010.com:38750
https://nishun2.10010.com:38750
https://nishun3.10010.com:38750
https://nisjl1.10010.com:38750
https://nisjs1.10010.com:38750
https://nisjx1.10010.com:38750
https://nisjx2.10010.com:38750
https://nisln1.10010.com:38750
https://nisnmg1.10010.com:38750
https://nisnmg2.10010.com:38750
https://nisnx1.10010.com:38750
https://nisportal.10010.com:9001
https://nisqh1.10010.com:38750
https://nissc1.10010.com:38750
https://nissd1.10010.com:38750
https://nissd2.10010.com:38750
https://nissd3.10010.com:38750
https://nissh1x1.10010.com:38750
https://nissh3x1.10010.com:38750
https://nisshh1.10010.com:38750
https://nistj1.10010.com:38750
https://nisxj1.10010.com:38750
https://nisxj3.10010.com:38750
https://nisxz1.10010.com:38750
https://nisyn1.10010.com:38750
https://niszhj1.10010.com:38750
https://niszhj2.10010.com:38750

API 文档

构造函数参数

| 参数 | 类型 | 默认值 | 说明 | |---------|--------|--------|------------------------------| | appId | String | 无 | 从易盾申请到的 appId | | timeout | Number | 120000 | 设置 getToken 流程的超时时间 |

示例

const quickPass = new NEQuickPass('你的appId', {
  timeout: 12000
});

获取秘钥

调用实例的 getToken 方法可获取验证秘钥。getToken 方法返回 Promise。

mobile 参数为非必填项,但一般建议提供。

返回类型

getToken 方法返回一个的 Promise 包含 accessTokentoken 的对象。

| 字段 | 类型 | 说明 | |--------------|--------|-------------------| | accessToken | String | 访问令牌 | | token | String | 验证令牌 |

示例

quickPass.getToken(mobile)
  .then(res => {
    // res: { accessToken, token }
    const { accessToken, token } = res;
    console.log('Access Token:', accessToken);
    console.log('Token:', token);
  })
  .catch(err => {
    // 错误处理
    console.error('Error:', err);
  });

上传秘钥

将获取到的 accessTokentoken 上传至业务服务器,由服务器调用本机校验服务提供的相应接口。

示例

const uploadToken = async (accessToken, token) => {
  // 发送请求到你的服务器
  const response = await fetch('你的服务器地址', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ accessToken, token })
  });
  return response.json();
};

错误码

在调用 getToken 方法时,可能会遇到以下错误类型和错误码:

| 错误码 | 说明 | |--------------------|----------------------------------| | 100001 | 联通应用鉴权错误 | | 200001 | 获取联通配置接口错误等 | | 300001 | 网关鉴权失败 | | 300002 | 鉴权码获取失败 | | 300003 | 联通sdk-server预取号失败 | | 100001 | 联通获取token失败 | | -8001 | 网络请求错误 | | 504 | 网络请求超时 | | 505 | 仅支持纯4G网络验证,不支持“4G+WIFI”或“仅开启WIFI” | | 506 | 暂不支持的浏览器环境或平台 | | 200 | 业务错误 | | 100 | 脚本错误 | | 1000 | 未知错误 |

catch 语句中,可以根据错误码进行相应的错误处理:

示例

quickPass.getToken(mobile)
  .then(res => {
    // res: { accessToken, token }
  })
  .catch(err => {
    const { code, message } = err;
    switch (code) {
      case 100001:
        console.error('联通应用鉴权错误');
        break;
      case 200001:
        console.error('获取联通配置接口错误等');
        break;
      case -8001:
        console.error('网络请求错误');
        break;
      // 处理其他错误码
      default:
        console.error('未知错误');
    }
  });