wechat-enterprise-cypher
v0.0.1
Published
tool to encrypt/decrypt the communicating message for wechat enterprise account
Downloads
4
Maintainers
Readme
A super simple cypher that is used to help connect to a weixin/wechat enterprise social account
==>>To install:
var cypher = require('wechat-enterprise-cypher');
==>>To initializing
var davonki = cypher.davonki("your Token","your Corp Id","your encoding AES Key");
==>>To decypher an enterprised wechat message:
davonki.decrypt(encrypted_message);
==>>To cypher a common message
davonki.encrypt(message);
For exmaple, please run test.js in the ./test foler, you will get:
qMo/O8Pco4U3rxUyVF56bXuIqMByU5Q3tIUGJHSfdCJrQBJZd8mEuEuwQP6koREy3NlRrO88+lhkAqKeYCzdUGe68VdHa7QW+LW1k8PYj2Dg0Og3E2eoFvRBXh3NsiWWj4+4msyTRZiv53EOJaoYw2 2ksgkZtsl39akyhplhME8FyeQWOjDsHrmS+PHXF8TfQaUY1ISTwXDp+vNweiaOLF8Davlx1pyUieRl3FNVxgs5pEiokUpb0UJrhbmCEoOG8G2MGy7677tvzid79nIf48+7OFvl4TtaVPOSoQo4T0FE /cIZcdN+dGyckTT9TyG5UGMgsVA7m8T71RPyEZROkDGFSQP6y2X4UGFo6ADDLmGFX+RaCD3SQCEQkPrxguG1reC+0L1ELfK/CznKnKKVyqRKb+j1iSZNNB285ApU19NrZTz50hqDq2e1/CkKbst0Ce aMdH0fk4JUv8AAM3VR+TrmoPOe5nXAcifsyfbph75YIRgh8OIMk+IENvGYqSSB3vnOehNZwiWzfQh5FBk0aLQXBNE3vOjqo90CltC5iAwbWw77ZQDY+08mL+GHXThjdjJ+ENkXlWsijy2SARcXnlL6 TLpgLXBWnosKUxOV4j+5kXwrWKEOMOyLaOmUDFHo4Yu0nLZkzRWa9gi9iPzlVRPBVTIPDEWYJ0IGxyzm80mUyLvF+AZ1ROsPYBnyU/Yq1kqhRlKe5Rg6XTnNE01SUH5eMTGT/hOEl8ROGu1zV/jZQj 4DR136QGQOULCBGTEsjh6w+hH2Imst+vE4Z2E408VenY9PX7DoboIufd790FgKAC4HTDX88AeVZWoKDmEb29aA2ULdyIMtjjQaTxonmJXUmbIZheQ1o6eaVGZUl4oMenT+IfJRREoY0EShvKqr8+kZ tA0n99xkkU383/3twu8ES9M9K5yAFUU7H3vBxkipEdhfRErGOWAAM1ZBH7lVl/EAUybQHaL5dRnbkXmDBmpPb3vygpMBBdOB7suBOhsWLtQ+qK7MZzD26qj/PvgxdQSYk3+bVCJbCSuRxFu24iH+qn voq9OnecACcvCGo4IhMHiJnRRwFxx8h343Zpv4xrxA/6rzsfBTamK0eRr2eOrzSoKsLU80ldsngPEtgmEGgkXsN6g4T7PMHIGEZBoRy/0N9kn/gXPJ8VlRgW5bTOj9NCG0fus0rY9oS+bJ9Tw79zzg bjB1qMlqkY1csff1ARpex3RgLYFG9Vf5bbv0SRKS3rs8Wfo+hwjwtemXiKx1uvbaT2MlYugCLD6xPMrqoQEQhR6YMxQ8lTmqGEFenZ5ZhnCWI6g7csysZASsIT2mjMx4NwpC+UxiXFtRR3PtZoZZLN 9Z7Re7hhjORrBqa8GH9gvGGaY2jKqdC37nSK2Otmfvi9ROaIu79MRAZWabX9uGQUeTlUmTgpz41CSmUKkdHKx9NcjoFwrLkFIXZI5pPdm/JysikYI9xeMWDe3Mimcg6w9oVmx6F+oXL90W00Hs3LWH WaX8hRbv3NjEw9Orm9631j/JlJqYO7J18+yym64f0+TZ2IyYbqk+EQRiV1qeRuB/W4UMX8XV4cPAU7+bWBnlI++LrPkYEp7J4WdBpq98Q4nIluYBP1JWJvn9dw==
14143791963853
There's some chinese words so you see some unmotivativated words
==>>To get the signature of a message
davonki.getSignature(timestamp, nonce, message);
==>>To verify the host, useful for connecting, function strictly follow the instruction from wechat encrypt/decrypt guide, please check that for param information
davonki.verifyURL(msg_signature, timestamp, nonce, echostr);
==>>To decrypt the message from the xml.Encrypt field, function strictly follow the instruction from wechat encrypt/decrypt guide, please check that for param information param 'jsonFromXML' is the json object that converted from the posted xml body, use some xml parser here before using this function param 'next' here stand for a call back function
davonki.decryptMsg(msg_signature, timestamp, nonce, jsonFromXML, next);
==>>To encrypt the unencrypted reply into the encrypted message, building the xml.Encrypt field, xml.timestampe, xml.nonce, xml.signature and xml itself, function strictly follow the instruction from wechat encrypt/decrypt guide, please check that for param information param 'replyMsg' is the xml formatted message that is common used amount other types of wechat social account
davonki.encryptMsg(replyMsg);