All Projects → elixirChain → dingtalk-encrypt

elixirChain / dingtalk-encrypt

Licence: Apache-2.0 license
dingTalk encrypt Node Version. 钉钉的非官方nodejs版AES加解密库 sdk

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to dingtalk-encrypt

Swcrypt
RSA public/private key generation, RSA, AES encryption/decryption, RSA sign/verify in Swift with CommonCrypto in iOS and OS X
Stars: ✭ 632 (+3850%)
Mutual labels:  aes, encrypt
Encrypt Body Spring Boot Starter
(停止维护,替代品搜索:https://github.com/search?l=Java&q=encrypt&type=Repositories )SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA
Stars: ✭ 198 (+1137.5%)
Mutual labels:  aes, encrypt
Netcore.encrypt
NETCore encrypt and decrpty tool,Include aes,des,rsa,md5,sha1,sha256,sha384,sha512
Stars: ✭ 339 (+2018.75%)
Mutual labels:  aes, encrypt
golang-zabbix-alter-to-dingding
zabbix报警到钉钉
Stars: ✭ 59 (+268.75%)
Mutual labels:  dingding, dingtalk
django-mirage-field
Django model field encrypt/decrypt your data, keep secret in database.
Stars: ✭ 86 (+437.5%)
Mutual labels:  aes, encrypt
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (+1387.5%)
Mutual labels:  aes, encrypt
Hybrid Crypto Js
RSA+AES hybrid encryption implementation for JavaScript. Works with Node.js, React Native and modern browsers.
Stars: ✭ 87 (+443.75%)
Mutual labels:  aes, encrypt
yii2-dingtalk
yii2钉钉接口
Stars: ✭ 23 (+43.75%)
Mutual labels:  dingding, dingtalk
dingtalk
DingTalk(dingding) 是钉钉机器人的 go 实现。支持 Docker、Jenkinsfile、命令行模式,module 模式,加签安全设置,支持链式语法创建消息,支持文本、链接、Markdown、ActionCard、FeedCard消息类型; DingTalk (dingding) is the go implementation of the DingTalk robot. Support Docker, Jenkinsfile, command line mode, module mode, signature security settings, chain syntax to create messages, support text, link, markd…
Stars: ✭ 187 (+1068.75%)
Mutual labels:  dingding, dingtalk
PSImageEditors
一个简而至美的图片编辑器 (仿钉钉与微信的图片编辑组件)
Stars: ✭ 32 (+100%)
Mutual labels:  dingding, dingtalk
autojs-dingtalk
利用autojs进行钉钉自动打卡的脚本
Stars: ✭ 37 (+131.25%)
Mutual labels:  dingding, dingtalk
common-secure
提供一些加密算法java代码封装 包括 RSA/AES/DES/3DES/MD5/SHA/HmacSHA256
Stars: ✭ 37 (+131.25%)
Mutual labels:  aes, encrypt
jscrypto
Crypto library for Node/ES6/Typescript/Browser.
Stars: ✭ 20 (+25%)
Mutual labels:  aes
EasyEncryption
No description or website provided.
Stars: ✭ 16 (+0%)
Mutual labels:  aes
padre
Blazing fast, advanced Padding Oracle exploit
Stars: ✭ 35 (+118.75%)
Mutual labels:  aes
typeorm-encrypted
Encrypted field for typeorm.
Stars: ✭ 50 (+212.5%)
Mutual labels:  encrypt
notify
推送通知 sdk(Bark、Chanify、钉钉群机器人、Discord、邮件、飞书群机器人、Gitter、Google Chat、iGot、Logger、Mattermost、Now Push、PushBack、Push、PushDeer、PushPlus、QQ 频道机器人、Rocket Chat、Server 酱、Showdoc Push、Slack、Telegram、Webhook、企业微信群机器人、息知、Zulip)。
Stars: ✭ 335 (+1993.75%)
Mutual labels:  dingtalk
osx-callhistory-decryptor
macOS (incl big sur) call history decryptor/converter to CSV format.
Stars: ✭ 19 (+18.75%)
Mutual labels:  aes
abrute
Multi-threaded AES Brute Force File Decryption
Stars: ✭ 22 (+37.5%)
Mutual labels:  aes
ad-password-self-service
基于Python 3.8 + Django 3.2的密码自助平台,AD用户自助修改密码,结合<钉钉>/<企业微信>扫码验证信息后用户可自行重置密码、解锁自己的账号。
Stars: ✭ 76 (+375%)
Mutual labels:  dingding

dingtalk-encrypt

Nodejs Version Message Encryption & Decryption of DingTalk..
Refer to Java version:

Issues: It's your turn!

Usage

this repository

  • git clone
  • npm install
  • run 'EncryptTest.js' for main APIs and Utils.

npm module

  • npm install --save dingtalk-encrypt
  • use APIs as follows API Doc.

API Doc

  • Need constants:

TOKEN - Random string for signature, unrestricted, such as "123456".
ENCODING_AES_KEY - Secret key for callback data, random 43 characters of [a-z, A-Z, 0-9].
CORP_ID - DingTalk corpId from the Official OA.

  • Main APIs(Usage Example):

    • getEncryptedMap
    • getDecryptMsg
    • getSignature
    • encrypt
    • decrypt
  • Utils [dingtalk-encrypt/Utils]:

    • getRandomStr
    • getRandomEncodingAesKey
  • Example

    • 处理钉钉回调
    // 参考:钉钉开发文档-业务事件回调 
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    const DingTalkEncryptor = require('dingtalk-encrypt');
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    const utils = require('dingtalk-encrypt/Utils');
    /** 加解密需要,可以随机填写。如 "12345" */
    const TOKEN = utils.getRandomStr(6);
    /** 加密密钥,用于回调数据的加密,固定为43个字符,从[a-z, A-Z, 0-9]共62个字符中随机生成, 见 getRandomEncodingAesKey */
    const ENCODING_AES_KEY = utils.getRandomEncodingAesKey();
    console.log('ENCODING_AES_KEY: \n', ENCODING_AES_KEY);
    /** 企业corpid, 可以在钉钉企业管理后台查看(https://oa.dingtalk.com/) */
    const CORP_ID = 'ding1234567890';
    /** 实例化加密类 */
    console.log('\nEncryptor Test:');
    const encryptor = new DingTalkEncryptor(TOKEN, ENCODING_AES_KEY, CORP_ID);
    
    // 解密钉钉回调数据 
    const plainText = encryptor.getDecryptMsg(signature, timestamp, nonce, encryptMsg);
    console.log('DEBUG plainText: ' + plainText);
    const obj = JSON.parse(plainText);
    // 回调事件类型,根据事件类型和业务数据处理相应业务
    const eventType = obj.EventType;
    // 响应数据:加密'success',签名等等
    encryptor.getEncryptedMap('success', timestamp, utils.getRandomStr(8));
    
    • 单独使用加/解密
    /** 测试加解密响应报文或者字符串 */
    const testJson = {
      EventType: 'bpms_instance_change',
      processInstanceId: 'ad253df6-e175caf-68085c60ba8a',
      corpId: 'ding2c4d8175651',
      createTime: 1495592259000,
      title: '自测-1016',
      type: 'start',
      staffId: 'er5875',
      url: 'https://aflow.dingtalk.com/dingtalk/mobile/homepage.htm',
      processCode: 'xxx',
    };
    // console.log(JSON.parse(JSON.stringify(testJson)));
    // const unencryptedJson = 'success';
    const unencryptedJson = JSON.stringify(testJson);
    console.log(`  node unencryptedJson:\n ${unencryptedJson}`);
    const encryptedJson = encryptor.encrypt(ENCRYPT_RANDOM_16, unencryptedJson);
    console.log(`  \nnode encryptedJson:\n ${encryptedJson}`);
    const decryptedJson = encryptor.decrypt(encryptedJson);
    console.log(`  \nnode decryptedJson:\n ${decryptedJson}, (${decryptedJson.length})`);
    console.log('  \nnode sign:\n ' + encryptor.getSignature(TOKEN, timeStamp, nonce, encryptedJson));
    
    

Thanks To

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].