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

@ray-js/wechat-ms-password

v0.0.8

Published

Password SDK

Readme

@ray-js/wechat-ms-password 该 SDK 提供了设备生成临时密码的一些能力,包含动态、单次、限时、自定义以及清空密码。

安装

yarn add @ray-js/wechat-ms-password
// or
npm install @ray-js/wechat-ms-password

创建临时密码

createPassword

请求参数

| 参数名 | 类型 | 描述 | 是否必传 | | :------------- | :------------------------------------------------------------------------ | :----------------------------------------------------------------- | -------- | | device_id | string | 设备 ID | true | | pwd_type_code | 'dynamic' or 'temp' or 'once' or 'multiple' or 'clear_all' or 'clear_one' | 密码类型:动态、自定义、单次、限时、清空所有限时密码、清空单次密码 | true | | name | string | 密码名称,默认为空 | false | | password_id | string | 密码 id,默认为空,当 pwd_type_code 为 clear_one 时需要传入 | false | | effective_time | number | 生效时间,默认值为当前时间, 单位 ms | false | | invalid_time | number | 失效时间,默认值为当前时间的下一个小时,即单位 ms | false |

返回参数

| 参数名 | 类型 | 描述 | | :------------------------- | :----- | :------------ | | dynamic_password | string | 动态密码 | | temp_password | string | 自定义密码 | | effective_time | number | 生效时间 | | invalid_time | number | 失效时间 | | offline_temp_password | string | 生成的密码 | | offline_temp_password_id | string | 密码生成的 id | | offline_temp_password_name | number | 密码名称 |

请求示例

import MsPasswordApi from '@ray-js/wechat-ms-password';

MsPasswordApi.createPassword({
  device_id: 'vdevo172164201350692',
  effective_time: 1722397508,
  invalid_time: 1722401108,
  name: '',
  pwd_type_code: 'once',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => console.log(error));

返回示例

{
  effective_time: 1722394800,
  invalid_time: 1722416400,
  offline_temp_password: '4266733256',
  offline_temp_password_id: '697404212',
  offline_temp_password_name: '一次性密码',
}

保存临时密码

savePassword

请求参数

| 参数名 | 类型 | 描述 | 是否必传 | | :------------- | :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | -------- | | device_id | string | 设备 ID | true | | pwd_type_code | "multiple" or "once" or "clear_all" or "clear_one" or "temp" | 密码类型,限时multiple、单次once、清空所有限时密码clear_all、清空单次限时密码clear_one、自定义temp | true | | password_id | number | 密码 ID, pwd_type_code !== 'temp' 时使用 | true | | password_name | string | 密码名称, pwd_type_code !== 'temp' 时使用 | true | | password | string | 密码, pwd_type_code === 'temp' 时使用 | true | | effective_time | number | 开始时间,单位 s,如 new Date() /1000,pwd_type_code === 'temp' 时使用 | true | | invalid_time | number | 结束时间,pwd_type_code === 'temp' 时使用 | true | | name | string | 密码名称,pwd_type_code === 'temp' 时使用 | false |

返回参数

bool | string : 是否更新成功 | 密码 ID

请求示例

import MsPasswordApi from '@ray-js/wechat-ms-password';

MsPasswordApi.savePassword({
  device_id: 'vdevo172164201350692',
  password_id: 699103212,
  password_name: 'password',
  pwd_type_code: 'temp',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => console.log(error));

返回示例

true;

获取临时密码列表

getTempPwdList

请求参数

| 参数名 | 类型 | 描述 | 是否必传 | | :------------- | :----- | :-------------------------------------------------------------------------------------------------------------------- | -------- | | device_id | string | 设备 ID | true | | page_size | number | 密码列表长度,默认值为 200 | false | | pwd_type_codes | string | 密码类型,默认值为限时multiple、单次once、清空所有限时密码clear_all、清空单次限时密码clear_one、自定义temp | false | | query_id | string | 密码的查询 id,默认值为"",当密码长度过长时,即 has_more 为 true,需要上拉刷新时,query_id 为第 100 个密码的 query_id | false |

返回参数

| 参数名 | 类型 | 描述 | | :------- | :----------- | :----------- | | has_more | bool | 是否有下一页 | | records | recordItem[] | 密码记录 |

recordItem 说明

| 参数名 | 类型 | 描述 | | :------------------------- | :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | | auth_result | number | \ | | delivery_status | 'ONGOING' or 'SUCCESS' or 'FAILED' | 同步中、生效中、失败 | | effective_flag | 0、1、2 | 0 - 无效, 1- 生效中, 2- 待生效(由于时间未到) | | effective_time | number | 生效时间 | | expired_time | number | 过期时间 | | gmt_create | number | 创建时间 | | name | string | 名称 | | operate | string | 操作类型 | | password_id | string | 密码 id | | phone | string | 电话号码 | | pwd_type_code | "multiple" or "once" or "clear_all" or "clear_one" or "temp" | 密码类型,限时multiple、单次once、清空所有限时密码clear_all、清空单次限时密码clear_one、自定义temp | | query_id | number | 查询 id | | sn | number | \ | | has_clear_pwd | bool | 是否有清空码. 只有pwdTypeCode=multiple时,该字段才有可能为true | | revoked_pwd_name | string | 被清空的密码名称(只有pwdTypeCode=clear_one该字段才会有) | | revoked_pwd_effective_time | string | 被清空的密码生效时间(只有pwdTypeCode=clear_one该字段才会有) | | revoked_pwd_invalid_time | string | 被清空的密码失效时间(只有pwdTypeCode=clear_one该字段才会有) |

请求示例

import MsPasswordApi from '@ray-js/wechat-ms-password';

MsPasswordApi.getTempPwdList({
  device_id: 'vdevo172164201350692',
  page_size: 200,
  pwd_type_codes: 'multiple,once,clear_all,clear_one,temp',
  query_id: '',
  session_id: '1722411999842',
  target_status: '',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => console.log(error));

返回示例

{
  records: [
    {
      effective_flag: 1,
      effective_time: 1722409200000,
      expired_time: 1722430800000,
      gmt_create: 1722411994000,
      has_clear_pwd: false,
      name: "一次性密码",
      password_id: 697404512,
      phone: "",
      pwd_type_code: "once",
      query_id: 3652502812,
      revoked_pwd_name: "",
    },
     {
      effective_flag: 1,
      effective_time: 1722409200000,
      expired_time: 1722495600000,
      gmt_create: 1722411895000,
      has_clear_pwd: false,
      name: "清空码",
      password_id: 697404412,
      phone: "",
      pwd_type_code: "clear_all",
      query_id: 3652502812,
      revoked_pwd_name: "",
    }
  ],
  has_more: false,
}

更新有效临时密码名称

updatePasswordName

请求参数

| 参数名 | 类型 | 描述 | 是否必传 | | :------------ | :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | -------- | | device_id | string | 设备 ID | true | | password_id | number | 密码 ID | true | | password_name | string | 密码名称 | true | | pwd_type_code | "multiple" or "once" or "clear_all" or "clear_one" or "temp" | 密码类型,限时multiple、单次once、清空所有限时密码clear_all、清空单次限时密码clear_one、自定义temp | true |

返回参数

bool: 是否更新成功

请求示例

import MsPasswordApi from '@ray-js/wechat-ms-password';

MsPasswordApi.updatePasswordName({
  device_id: 'vdevo172164201350692',
  password_id: 699103212,
  password_name: 'password',
  pwd_type_code: 'temp',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => console.log(error));

返回示例

true;

删除临时密码

自定义密码(pwd_type_code === 'temp'),非自定义密码(pwd_type_code !== 'temp')只有无效的状态才可以删除)

deletePassword

请求参数

| 参数名 | 类型 | 描述 | 是否必传 | | :------------- | :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | -------- | | device_id | string | 设备 ID | true | | password_id | number | 密码 ID | true | | effective_flag | 0、1、2 | 0 - 无效, 1- 生效中, 2- 待生效(由于时间未到) | true | | pwd_type_code | "multiple" or "once" or "clear_all" or "clear_one" or "temp" | 密码类型,限时multiple、单次once、清空所有限时密码clear_all、清空单次限时密码clear_one、自定义temp | true |

返回参数

bool: 是否删除成功

请求示例

import MsPasswordApi from '@ray-js/wechat-ms-password';

MsPasswordApi.deletePassword({
  device_id: 'vdevo172164201350692',
  password_id: 699100912,
  effective_flag: 0,
  pwd_type_code: 'once',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => console.log(error));

返回示例

true;

获取有效限时密码列表,只有清空码选择单个限时密码时使用

listOfflinePassword

请求参数

| 参数名 | 类型 | 描述 | 是否必传 | | :-------- | :----- | :------------------------- | -------- | | device_id | string | 设备 ID | true | | page_no | number | 每一页的索引值,默认为1 | false | | page_size | number | 每一页面的个数,默认为 200 | false |

返回参数

| 参数名 | 类型 | 描述 | | :---------- | :----------- | :----------- | | records | recordItem[] | 限时密码记录 | | has_more | bool | 是否有下一页 | | total | number | 记录条数 | | total_pages | bool | 页码 |

recordItem 说明

| 参数名 | 类型 | 描述 | | :------------------------- | :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | | auth_result | number | \ | | delivery_status | 'ONGOING' or 'SUCCESS' or 'FAILED' | 同步中、生效中、失败 | | effective_flag | 0、1、2 | 0 - 无效, 1- 生效中, 2- 待生效(由于时间未到) | | effective_time | number | 生效时间 | | expired_time | number | 过期时间 | | gmt_create | number | 创建时间 | | name | string | 名称 | | operate | string | 操作类型 | | password_id | string | 密码 id | | phone | string | 电话号码 | | pwd_type_code | "multiple" or "once" or "clear_all" or "clear_one" or "temp" | 密码类型,限时multiple、单次once、清空所有限时密码clear_all、清空单次限时密码clear_one、自定义temp | | query_id | number | 查询 id | | sn | number | \ | | has_clear_pwd | bool | 是否有清空码. 只有pwdTypeCode=multiple时,该字段才有可能为true | | revoked_pwd_name | string | 被清空的密码名称(只有pwdTypeCode=clear_one该字段才会有) | | revoked_pwd_effective_time | string | 被清空的密码生效时间(只有pwdTypeCode=clear_one该字段才会有) | | revoked_pwd_invalid_time | string | 被清空的密码失效时间(只有pwdTypeCode=clear_one该字段才会有) |

请求示例

import MsPasswordApi from '@ray-js/wechat-ms-password';

MsPasswordApi.listOfflinePassword({
  device_id: 'vdevo172164201350692',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => console.log(error));

返回示例

{
  records: [
    {
      gmt_create: 1722844885,
      gmt_expired: "1722848400",
      gmt_start: "1722844800",
      has_clear_pwd: false,
      opt_uid: "ay1557901851281KP4Ug",
      pwd: "0000960001",
      pwd_id: "699104112",
      pwd_name: "离线不限次数密码",
      pwd_type_code: "multiple",
      revoked_pwd_name: "",
      status: 1,
    }
  ],
  has_more: false,
  total: 1,
  total_pages: 1,
}