{"id":20875913,"url":"https://github.com/saqqdy/node-wxcrypto","last_synced_at":"2025-05-12T15:31:51.233Z","repository":{"id":65303023,"uuid":"566271309","full_name":"saqqdy/node-wxcrypto","owner":"saqqdy","description":"微信消息加解密nodejs版本","archived":false,"fork":false,"pushed_at":"2024-03-05T02:24:29.000Z","size":1014,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T16:51:57.251Z","etag":null,"topics":["aes256","crypto","decrypt","encrypt","node-crypto","node-wxcrypto","pkcs7","sha1","wxcrypto","xml"],"latest_commit_sha":null,"homepage":"https://www.saqqdy.com/node-wxcrypto","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saqqdy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["saqqdy"]}},"created_at":"2022-11-15T10:20:34.000Z","updated_at":"2024-08-08T07:15:28.000Z","dependencies_parsed_at":"2024-11-18T06:49:17.247Z","dependency_job_id":"76e86cc9-8329-4771-9030-e902dc2f4405","html_url":"https://github.com/saqqdy/node-wxcrypto","commit_stats":{"total_commits":38,"total_committers":3,"mean_commits":"12.666666666666666","dds":"0.21052631578947367","last_synced_commit":"cda9ed985131d06bf947805c895f13c922beabf3"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fnode-wxcrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fnode-wxcrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fnode-wxcrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fnode-wxcrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saqqdy","download_url":"https://codeload.github.com/saqqdy/node-wxcrypto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253765923,"owners_count":21960819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes256","crypto","decrypt","encrypt","node-crypto","node-wxcrypto","pkcs7","sha1","wxcrypto","xml"],"created_at":"2024-11-18T06:49:04.733Z","updated_at":"2025-05-12T15:31:50.931Z","avatar_url":"https://github.com/saqqdy.png","language":"TypeScript","readme":"\u003cdiv style=\"text-align: center;\" align=\"center\"\u003e\n\n# node-wxcrypto\n\n微信消息加解密 nodejs 版本\n\n[![NPM version][npm-image]][npm-url]\n[![Codacy Badge][codacy-image]][codacy-url]\n![typescript][typescript-url]\n[![npm download][download-image]][download-url]\n[![License][license-image]][license-url]\n\n\u003c!-- [![Test coverage][codecov-image]][codecov-url] --\u003e\n\n\u003c!-- [![Sonar][sonar-image]][sonar-url] --\u003e\n\n\u003c/div\u003e\n\n\u003cdiv style=\"text-align: center; margin-bottom: 20px;\" align=\"center\"\u003e\n\n### **[Documentation](https://www.saqqdy.com/node-wxcrypto)** • **[Change Log](./CHANGELOG.md)**\n\n\u003c/div\u003e\n\n## 安装\n\n```bash\n# 使用pnpm\n$ pnpm i node-wxcrypto\n\n# 使用yarn\n$ yarn add node-wxcrypto\n```\n\n## 使用\n\n### 引入和使用\n\n1. require 引入\n\n```js\nconst { WxCrypto } = require('node-wxcrypto')\n\nconst wxCrypto = new WxCrypto(token, aesKey, appID, options)\nconst data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)\n```\n\n2. import 引入\n\n```js\nimport { WxCrypto } from 'node-wxcrypto'\n\nconst wxCrypto = new WxCrypto(token, aesKey, appID, options)\nconst data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)\n```\n\n### 使用配置\n\n\u003e 在实例化和加解密方法均支持传入 options: `normalizeTags`, `buildXmlOptions`, `xmlOptions`，加解密方法里面传入的 options 优先级更高。\n\n\u003e `normalizeTags` 支持将 xml 属性由驼峰转下划线分隔的小写形式；`buildXmlOptions` 透传用于生成 xml 字符串的配置；`xmlOptions` 透传用于解析 xml 字符串的配置。\n\n\u003e 注意：`normalizeTags` 会全量覆盖 `xmlOptions` 里面的 `tagNameProcessors` 方法，如果想要自定义 `tagNameProcessors`，请不要传入 `normalizeTags`\n\n持将 xml 属性由驼峰转下划线分隔的小写形式：`ComponentVerifyTicket =\u003e component_verify_ticket`\n\n```js\n// normalizeTags可传入布尔值或者字符串，传入字符串时使用该字符串分隔，例如：normalizeTags = \"__\"，得到：`ComponentVerifyTicket =\u003e component__verify__ticket`\nconst wxCrypto = new WxCrypto(token, aesKey, appID, {\n  normalizeTags: true,\n  buildXmlOptions: {}, // 透传用于生成 xml 字符串的配置\n  xmlOptions: {} // 透传用于解析 xml 字符串的配置\n})\nconst data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)\n```\n\n## API\n\n详见：[API说明文档](API.md)\n\n## 类型\n\n1. [Interface Options](https://www.saqqdy.com/node-wxcrypto/interfaces/Options.html)\n2. [Interface BuildXMLOptions](https://www.saqqdy.com/node-wxcrypto/interfaces/BuildXMLOptions.html)\n3. [Class WxCrypto](https://www.saqqdy.com/node-wxcrypto/classes/WxCrypto.html)\n4. [Variable default](https://www.saqqdy.com/node-wxcrypto/variables/default.html)\n\n## 问题和支持\n\nPlease open an issue [here](https://github.com/saqqdy/node-wxcrypto/issues).\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/node-wxcrypto.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/node-wxcrypto\n[codacy-image]: https://app.codacy.com/project/badge/Grade/f70d4880e4ad4f40aa970eb9ee9d0696\n[codacy-url]: https://www.codacy.com/gh/saqqdy/node-wxcrypto/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=saqqdy/node-wxcrypto\u0026utm_campaign=Badge_Grade\n[typescript-url]: https://badgen.net/badge/icon/typescript?icon=typescript\u0026label\n[codecov-image]: https://img.shields.io/codecov/c/github/saqqdy/node-wxcrypto.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/saqqdy/node-wxcrypto?branch=master\n[download-image]: https://img.shields.io/npm/dm/node-wxcrypto.svg?style=flat-square\n[download-url]: https://npmjs.org/package/node-wxcrypto\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg\n[license-url]: LICENSE\n[sonar-image]: https://sonarcloud.io/api/project_badges/quality_gate?project=saqqdy_node-wxcrypto\n[sonar-url]: https://sonarcloud.io/dashboard?id=saqqdy_node-wxcrypto\n","funding_links":["https://github.com/sponsors/saqqdy"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaqqdy%2Fnode-wxcrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaqqdy%2Fnode-wxcrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaqqdy%2Fnode-wxcrypto/lists"}