{"id":20875870,"url":"https://github.com/saqqdy/egg-wxcrypto","last_synced_at":"2026-04-26T14:31:29.499Z","repository":{"id":176472159,"uuid":"658278707","full_name":"saqqdy/egg-wxcrypto","owner":"saqqdy","description":"扩展支持微信消息加解密nodejs版本的egg插件","archived":false,"fork":false,"pushed_at":"2023-09-25T15:22:43.000Z","size":556,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-20T20:17:46.134Z","etag":null,"topics":["egg-plugin","egg-wxcrypto","eggjs","eggplugin","node-wxcrypto","wxcrypto"],"latest_commit_sha":null,"homepage":"","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":"2023-06-25T09:43:42.000Z","updated_at":"2023-06-26T03:21:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"84899b07-7650-400f-a690-f657c9b31746","html_url":"https://github.com/saqqdy/egg-wxcrypto","commit_stats":null,"previous_names":["saqqdy/egg-wxcrypto"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fegg-wxcrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fegg-wxcrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fegg-wxcrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Fegg-wxcrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saqqdy","download_url":"https://codeload.github.com/saqqdy/egg-wxcrypto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243249011,"owners_count":20260768,"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":["egg-plugin","egg-wxcrypto","eggjs","eggplugin","node-wxcrypto","wxcrypto"],"created_at":"2024-11-18T06:48:53.779Z","updated_at":"2025-12-25T14:38:20.958Z","avatar_url":"https://github.com/saqqdy.png","language":"TypeScript","funding_links":["https://github.com/sponsors/saqqdy"],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"text-align: center;\" align=\"center\"\u003e\n\n# egg-wxcrypto\n\n扩展支持微信消息加解密 nodejs 版本的 egg 插件\n\n[![NPM version][npm-image]][npm-url]\n[![Codacy Badge][codacy-image]][codacy-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![License][license-image]][license-url]\n\n[![Sonar][sonar-image]][sonar-url]\n\n\u003c/div\u003e\n\n\u003cdiv style=\"text-align: center; margin-bottom: 20px;\" align=\"center\"\u003e\n\n\u003c/div\u003e\n\n## Install\n\n```bash\n# use pnpm\n$ pnpm install egg-wxcrypto\n\n# use yarn\n$ yarn add egg-wxcrypto\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.wxcrypto = {\n  enable: true,\n  package: 'egg-wxcrypto'\n}\n```\n\n## Configurations\n\negg-wxcrypto support all node-wxcrypto's configurations, check [node-wxcrypto documents](https://github.com/saqqdy/node-wxcrypto) to get more information.\n\n```js\n// {app_root}/config/config.default.js\nexports.wxcrypto = {\n  // token: '',\n  // aesKey: '',\n  // appId: '',\n  // options: {\n  //   normalizeTags: true,\n  //   buildXmlOptions: {}, // 透传用于生成 xml 字符串的配置\n  //   xmlOptions: {} // 透传用于解析 xml 字符串的配置\n  // }\n}\n```\n\n### Use in service\n\n```js\n// {app_root}/app/service/home.js\nconst { Service } = require('egg')\n\nclass HomeService extends Service {\n  async index() {\n    const { ctx, app } = this\n    const data = {\n      // ...\n    }\n    await ctx.decryptWxMsg(this.request.body, options) // decrypt\n    await ctx.encryptWxMsg(data, options) // encrypt\n    // or\n    await app.wxcrypto.decrypt(encrypt, timestamp, nonce, options) // decrypt\n    await app.wxcrypto.encrypt(data, options) // encrypt\n  }\n}\n\nmodule.exports = HomeService\n```\n\n### Extended Context Methods\n\n```js\n// {app_root}/app/service/home.js\nconst { ctx } = this\n\nctx.buildXML(data, options) // data =\u003e xmlString\nctx.parseXML(xmlString, options) // xmlString =\u003e data\n```\n\n## Change logs\n\n[Change logs](./CHANGELOG.md)\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/saqqdy/egg-wxcrypto/issues).\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/egg-wxcrypto.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-wxcrypto\n[codacy-image]: https://app.codacy.com/project/badge/Grade/f70d4880e4ad4f40aa970eb9ee9d0696\n[codacy-url]: https://www.codacy.com/gh/saqqdy/egg-wxcrypto/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=saqqdy/egg-wxcrypto\u0026utm_campaign=Badge_Grade\n[snyk-image]: https://snyk.io/test/npm/egg-wxcrypto/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-wxcrypto\n[download-image]: https://img.shields.io/npm/dm/egg-wxcrypto.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-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_egg-wxcrypto\n[sonar-url]: https://sonarcloud.io/dashboard?id=saqqdy_egg-wxcrypto\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaqqdy%2Fegg-wxcrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaqqdy%2Fegg-wxcrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaqqdy%2Fegg-wxcrypto/lists"}