{"id":23977984,"url":"https://github.com/beary/wx-ding-aes","last_synced_at":"2025-06-11T01:34:08.413Z","repository":{"id":57400400,"uuid":"93419700","full_name":"beary/wx-ding-aes","owner":"beary","description":"Node.js 微信开放平台、企业微信、钉钉第三方回调接口 AES 解密库","archived":false,"fork":false,"pushed_at":"2020-09-17T07:51:49.000Z","size":16,"stargazers_count":48,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-05T08:16:29.600Z","etag":null,"topics":["aes","typescript","wechat","weixin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/wx-ding-aes","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/beary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-05T15:40:01.000Z","updated_at":"2024-10-09T09:11:17.000Z","dependencies_parsed_at":"2022-09-05T03:01:27.285Z","dependency_job_id":null,"html_url":"https://github.com/beary/wx-ding-aes","commit_stats":null,"previous_names":["ecfexorg/wx-ding-aes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beary%2Fwx-ding-aes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beary%2Fwx-ding-aes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beary%2Fwx-ding-aes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beary%2Fwx-ding-aes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beary","download_url":"https://codeload.github.com/beary/wx-ding-aes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beary%2Fwx-ding-aes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259181463,"owners_count":22817956,"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":["aes","typescript","wechat","weixin"],"created_at":"2025-01-07T08:15:59.793Z","updated_at":"2025-06-11T01:34:08.356Z","avatar_url":"https://github.com/beary.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wx-ding-aes\n\n微信开放平台、企业微信、钉钉第三方回调接口 AES 加密解密库\n\n## Usage\n\n```shell\nnpm install wx-ding-aes --save\n```\n\n```javascript\n/* javascript */\nconst aes = require('wx-ding-aes')\n\n/* typescript */\nimport * as aes from 'wx-ding-aes'\n```\n\n## API\n\n### decode\\(text, encodingAESKey\\): string\n\n\u003e `text`: 微信/钉钉发送给回调接口的密文\n\u003e\n\u003e `encodingAESKey`: 创建套件时的 encodingAESKey\n\n\u003e `return`: 对于钉钉，返回值为一个 JSON 字符串，使用 `JSON.parse` 即可拿到 JSON 对象。\n\u003e\n\u003e 对于企业微信和微信开发平台，返回值为被加密的 xml 字符串，可以使用 xml 解析的库来进行处理。\n\n\n\n```javascript\nconst text = 'xxx'\nconst encodingAESKey = 'xxx'\nconst res = aes.decode(text, encodingAESKey)\n```\n\n### encode\\(text, encodingAESKey, key\\): string\n\n\u003e `text`: 需要加密的内容\n\u003e\n\u003e `encodingAESKey`: 创建套件时的 encodingAESKey\n\u003e\n\u003e `key`: \n\u003e    - 对于钉钉参考[官方文档](https://ding-doc.dingtalk.com/doc#/faquestions/ltr370)中的 `$key` \n\u003e    - 对于企业微信参考[官方文档](https://work.weixin.qq.com/api/doc/90000/90139/90968)中的 `CorpID` \n\u003e    - 对于微信开放平台参考[官方文档](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Message_Encryption/Technical_Plan.html)中的 _消息体加密_ 中的描述则是 appid 。\n\n\u003e `return`: 加密后的密文\n\n```javascript\nconst text = 'xxx'\nconst encodingAESKey = 'xxx'\nconst key = 'xxx'\nconst res = aes.encode(text, encodingAESKey, key)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeary%2Fwx-ding-aes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeary%2Fwx-ding-aes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeary%2Fwx-ding-aes/lists"}