agora-token 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/package.json +5 -3
- package/sample.js +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
To enhance communication security, Agora uses tokens to authenticate users before they access the Agora service, or joining an RTC channel.
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
8
|
+
[npm registry](https://www.npmjs.com/).
|
|
9
|
+
|
|
10
|
+
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
|
|
11
|
+
|
|
12
|
+
Installation is done using the
|
|
13
|
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
14
|
+
|
|
15
|
+
```console
|
|
16
|
+
$ npm install agora-token
|
|
17
|
+
```
|
|
18
|
+
|
|
5
19
|
## Code structure
|
|
6
20
|
|
|
7
21
|
Under the `nodejs` directory:
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-token",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/AgoraIO/Tools/tree/master/DynamicKey/AgoraDynamicKey/nodejs",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "
|
|
8
|
+
"test": "nodeunit test/*.js"
|
|
9
9
|
},
|
|
10
10
|
"types": "index.d.ts",
|
|
11
11
|
"author": "",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"crc-32": "^1.2.0",
|
|
15
15
|
"cuint": "0.2.2",
|
|
16
|
-
"md5": "^2.3.0"
|
|
16
|
+
"md5": "^2.3.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
17
19
|
"nodeunit": "^0.11.3"
|
|
18
20
|
}
|
|
19
21
|
}
|
package/sample.js
CHANGED
|
@@ -22,7 +22,7 @@ const generateRtcToken = () => {
|
|
|
22
22
|
console.log("Token With Integer Number Uid: " + tokenA);
|
|
23
23
|
|
|
24
24
|
// Build token with user account
|
|
25
|
-
const tokenB = RtcTokenBuilder.
|
|
25
|
+
const tokenB = RtcTokenBuilder.buildTokenWithUserAccount(appID, appCertificate, channelName, account, role, privilegeExpiredTs);
|
|
26
26
|
console.log("Token With UserAccount: " + tokenB);
|
|
27
27
|
}
|
|
28
28
|
|