jsonauthtoken 3.0.0 → 3.0.1
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/dist/index.js +3 -3
- package/dist/{crypto/node.crypto.d.ts → runtime/node.runtime.d.ts} +1 -0
- package/dist/{crypto/node.crypto.js → runtime/node.runtime.js} +2 -0
- package/dist/{crypto/crypto.d.ts → runtime/runtime.d.ts} +1 -1
- package/dist/{crypto/crypto.js → runtime/runtime.js} +6 -6
- package/package.json +1 -1
- /package/dist/{crypto/web.crypto.d.ts → runtime/web.runtime.d.ts} +0 -0
- /package/dist/{crypto/web.crypto.js → runtime/web.runtime.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -6,11 +6,11 @@ const runtime_config_1 = require("./config/runtime.config");
|
|
|
6
6
|
const algo_config_1 = require("./config/algo.config");
|
|
7
7
|
const functions_lib_1 = require("./lib/functions.lib");
|
|
8
8
|
const timeformat_1 = require("./lib/timeformat");
|
|
9
|
-
const
|
|
9
|
+
const runtime_1 = require("./runtime/runtime");
|
|
10
10
|
class JATClass {
|
|
11
11
|
runtime;
|
|
12
12
|
dev = false;
|
|
13
|
-
crypto = new
|
|
13
|
+
crypto = new runtime_1.RuntimeCrypto();
|
|
14
14
|
constructor(config) {
|
|
15
15
|
try {
|
|
16
16
|
if (config && config.dev == true)
|
|
@@ -67,7 +67,7 @@ class JATClass {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
class PrivatePublicKeyGeneration {
|
|
70
|
-
crypto = new
|
|
70
|
+
crypto = new runtime_1.RuntimeCrypto();
|
|
71
71
|
async generateKeyPair(runtime, dev) {
|
|
72
72
|
let finalRuntime = (0, runtime_config_1.detectRuntime)();
|
|
73
73
|
const development = dev === true ? true : false;
|
|
@@ -7,6 +7,8 @@ exports.NodeCrypto = void 0;
|
|
|
7
7
|
const crypto_1 = __importDefault(require("crypto"));
|
|
8
8
|
const functions_lib_1 = require("../lib/functions.lib");
|
|
9
9
|
class NodeCrypto {
|
|
10
|
+
constructor() {
|
|
11
|
+
}
|
|
10
12
|
_encrypt(algorithm, key, payload) {
|
|
11
13
|
const iv = crypto_1.default.randomBytes(12);
|
|
12
14
|
const cipher = crypto_1.default.createCipheriv(algorithm, key, iv);
|
|
@@ -33,23 +33,23 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.RuntimeCrypto = void 0;
|
|
37
37
|
const algo_config_1 = require("../config/algo.config");
|
|
38
38
|
const functions_lib_1 = require("../lib/functions.lib");
|
|
39
|
-
class
|
|
39
|
+
class RuntimeCrypto {
|
|
40
40
|
node;
|
|
41
41
|
web;
|
|
42
42
|
async getModule(runtime) {
|
|
43
43
|
if (runtime === 'node' && this.node === undefined) {
|
|
44
|
-
const { NodeCrypto } = await Promise.resolve().then(() => __importStar(require('./node.
|
|
44
|
+
const { NodeCrypto } = await Promise.resolve().then(() => __importStar(require('./node.runtime')));
|
|
45
45
|
this.node = new NodeCrypto();
|
|
46
46
|
}
|
|
47
47
|
else if (runtime === 'web' && this.web === undefined) {
|
|
48
|
-
const { WebCrypto } = await Promise.resolve().then(() => __importStar(require('./web.
|
|
48
|
+
const { WebCrypto } = await Promise.resolve().then(() => __importStar(require('./web.runtime')));
|
|
49
49
|
this.web = new WebCrypto();
|
|
50
50
|
}
|
|
51
51
|
else if (runtime === 'edge' && this.web === undefined) {
|
|
52
|
-
const { WebCrypto } = await Promise.resolve().then(() => __importStar(require('./web.
|
|
52
|
+
const { WebCrypto } = await Promise.resolve().then(() => __importStar(require('./web.runtime')));
|
|
53
53
|
this.web = new WebCrypto();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -149,4 +149,4 @@ class Crypto {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
exports.
|
|
152
|
+
exports.RuntimeCrypto = RuntimeCrypto;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|