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 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 crypto_1 = require("./crypto/crypto");
9
+ const runtime_1 = require("./runtime/runtime");
10
10
  class JATClass {
11
11
  runtime;
12
12
  dev = false;
13
- crypto = new crypto_1.Crypto();
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 crypto_1.Crypto();
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;
@@ -1,4 +1,5 @@
1
1
  export declare class NodeCrypto {
2
+ constructor();
2
3
  private _encrypt;
3
4
  private _decrypt;
4
5
  private _rsaPublicKeyGeneration;
@@ -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);
@@ -1,4 +1,4 @@
1
- export declare class Crypto {
1
+ export declare class RuntimeCrypto {
2
2
  private node;
3
3
  private web;
4
4
  private getModule;
@@ -33,23 +33,23 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Crypto = void 0;
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 Crypto {
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.crypto')));
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.crypto')));
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.crypto')));
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.Crypto = Crypto;
152
+ exports.RuntimeCrypto = RuntimeCrypto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonauthtoken",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "jsonauthtoken is a JavaScript/TypeScript library to secure authentication.",
5
5
  "main": "dist/index.js",
6
6
  "repository": {