@bee.js/node 0.0.45 → 0.0.46
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/lib/JWT/beeJWT.js +2 -2
- package/package.json +1 -1
- package/tools/hash.js +3 -4
package/lib/JWT/beeJWT.js
CHANGED
|
@@ -26,7 +26,7 @@ module.exports = function token(_payload = null, header = {}) {
|
|
|
26
26
|
payload = JSON.stringify(payload);
|
|
27
27
|
payload = new Buffer.from(payload).toString("base64");
|
|
28
28
|
|
|
29
|
-
const signature = HMACSHA256(`${header}.${payload}`, secret);
|
|
29
|
+
const signature = HMACSHA256(`${header}.${payload}`, secret).toString();
|
|
30
30
|
const token = new Buffer.from(`${header}.${payload}.${signature}`).toString(
|
|
31
31
|
"base64"
|
|
32
32
|
);
|
|
@@ -53,7 +53,7 @@ module.exports = function token(_payload = null, header = {}) {
|
|
|
53
53
|
const header = array[0];
|
|
54
54
|
const payload = array[1];
|
|
55
55
|
|
|
56
|
-
const signature = HMACSHA256(`${header}.${payload}`, secret);
|
|
56
|
+
const signature = HMACSHA256(`${header}.${payload}`, secret).toString();
|
|
57
57
|
|
|
58
58
|
return token === `${header}.${payload}.${signature}`
|
|
59
59
|
? new Buffer.from(payload, "base64").toString("ascii")
|
package/package.json
CHANGED
package/tools/hash.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const md5 = require("crypto-js/md5");
|
|
1
|
+
const cryptoJS = require("crypto-js");
|
|
3
2
|
|
|
4
3
|
module.exports = {
|
|
5
|
-
md5,
|
|
6
|
-
|
|
4
|
+
md5: (string) => cryptoJS.MD5(string).toString(),
|
|
5
|
+
HmacMD5: (string, key = "") => CryptoJS.HmacMD5(string, key).toString(),
|
|
7
6
|
};
|