Comparing version 0.2.2 to 0.2.3
@@ -1,5 +0,7 @@ | ||
interface WeWorkChatInit { | ||
corpid: string; | ||
secret: string; | ||
private_key: string; | ||
declare namespace WeWorkChat { | ||
interface WeWorkChatInit { | ||
corpid: string; | ||
secret: string; | ||
private_key: string; | ||
} | ||
} | ||
@@ -10,3 +12,3 @@ declare class WeWorkChat { | ||
private private_key; | ||
constructor(options: WeWorkChatInit); | ||
constructor(options: WeWorkChat.WeWorkChatInit); | ||
/** | ||
@@ -62,2 +64,3 @@ * init | ||
} | ||
export default WeWorkChat; | ||
export = WeWorkChat; |
@@ -6,3 +6,3 @@ "use strict"; | ||
* @Last Modified by: YoneyY (YuTianyuan) | ||
* @Last Modified time: 2022-02-09 00:21:36 | ||
* @Last Modified time: 2022-02-22 02:03:25 | ||
*/ | ||
@@ -9,0 +9,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "bf-wchat", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Enterprise WeWork chat archive.", | ||
"main": "dist/index.js", | ||
"main": "index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"typings": "dist/index.d.ts", | ||
"author": "YoneyY <yoneyy@163.com>", | ||
@@ -18,3 +17,3 @@ "license": "MIT", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
"require": "./index.js" | ||
}, | ||
@@ -39,3 +38,3 @@ "./package.json": "./package.json" | ||
"rebuild": "node-gyp rebuild", | ||
"tsbuild": "tsc -p tsconfig.json", | ||
"tsbuild": "node scripts/build.js", | ||
"postbuild": "yarn tsbuild", | ||
@@ -42,0 +41,0 @@ "postrebuild": "yarn tsbuild", |
@@ -17,4 +17,6 @@ # BF-WCHAT | ||
### CommonJS | ||
```js | ||
const BFWchat = require('bf-wchat').default; | ||
const BFWchat = require('bf-wchat'); | ||
@@ -71,3 +73,56 @@ // your RSA private key | ||
``` | ||
### ESM | ||
```js | ||
import BFWchat from 'bf-wchat'; | ||
// your RSA private key | ||
const private_key = ` | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpAIBAAKCAQEAvsFopMih+xeS6v1FMIM4i0g4KAByrVGVFWaK4gWW+tzyAslh | ||
EfAvhcUURjYuF3M5OhoLEiOnK+Am7DzQzynq641PAl70912vR7/RRNPwwuOQR1g4 | ||
mOnX4Y2xkrh+nN3zEwVPDS5g32XG4Qlo+T2+6psLuCpaBM+B+YDzeOOxlygsb3Pb | ||
3cT9o57yZEZIs3AZDEQLZrGhO0Y1TJRaaHWLPJxGrtc3FhBibxbOkIaY3Gl5zAJv | ||
aVorSJeauMIjbSD0n+zFXo92YcLmuchRtQJCfumOD1jvgXkK3cvKb5TWyeoSSx18 | ||
5uaNXmymH/4AymP+rY0rg+H6YjHE7z8cjMj3DQIDAQABAoIBABXS9u/zbGTX2507 | ||
ANF+EdgNmS8qbfRaYx4hrz4QuadV4/Jhq9NrkWRSmfE2fat9KUz2cdHPdm7UpF9e | ||
zd0FxLTSY/m3d3tdopIo5f5j6SXC91zSQRdtmZ9aoLhSl1nHIupILzUo2zhz4n8Y | ||
noP1hoQ83OhjIA1w2EP9dt2b31OVuCmXPyAtUZwSNtcef6/LFyiFC2p+13ZgfTyj | ||
BTlc2hlVqYZCafZbxYGHUFIpEH2B9EHHphW2iXf7kNLBxKKfm0AEUfJIIsI9ktUa | ||
Z7DC1+NA773aeM6Q/D4R0wKBgQCB732GK/Qk9upOFrtqDHr/bpHcn5GnPZgyUTgv | ||
O5trbwIfd57Yy9nY0knEa1W90Du57Mamn+c2NplhKKTnh1jDVsm8op7IeUy+PpJ4 | ||
u4J8Igr9xGju6QQO8+lCyx9HxTREHpq7eIUdEb7Z6o3w4mwr/CBTg9j5MvZUgqib | ||
8ZC1RwKBgQDOyxG7BF47AO0UeJqobBoruvWzG8Aa8dAlifAm3IWglljWxbU2xZYI | ||
tXlupHg1TZkWWQU3M3GPySCZCkJJdxLPyMdx/qPzlfr4TU2eJ0secxDgnp+n+L+Y | ||
fOFkJ6nhtLm61i3vgrX8yQh+sVzv8jzqzpYGUbz7AjcTInYF2h0N/Q== | ||
-----END RSA PRIVATE KEY----- | ||
`; | ||
// Initialize WeWork Chat SDK | ||
const bf_wchat = new BFWchat({ | ||
corpid: 'your corpid of Wework', | ||
secret: 'your secret of Wework', | ||
private_key | ||
}); | ||
async function main() { | ||
// Get chat data list | ||
const chat_list = await bf_wchat.getChatData({ | ||
seq: 839, | ||
limit: 2, | ||
timeout: 5 | ||
}); | ||
console.log(chat_list); | ||
// Obtain the encrypt_key through RSA decryption | ||
const encrypt_key = await bf_wchat.deRSAcryptChatData(chat_list['chatdata'][1]['encrypt_random_key']); | ||
console.log(encrypt_key); | ||
// Decrypt the chat content by the obtained encrypt_key | ||
const content = await bf_wchat.deCryptDatas(encrypt_key, chat_list['chatdata'][1]['encrypt_chat_msg']); | ||
console.log(content); | ||
} | ||
main().catch(console.log); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16430260
57
153
127