mp-front-cli 0.0.66 → 0.0.67

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.
@@ -1 +1 @@
1
- {"version":3,"file":"custom-encrypter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-encrypter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,YAAY,CAA8B;YAEpC,WAAW;cAgBT,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;cAgBrB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM;cAU5B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahD,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;CAIlC"}
1
+ {"version":3,"file":"custom-encrypter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-encrypter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,YAAY,CAA8B;YAEpC,WAAW;cAgBT,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;cAgBrB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM;cAU5B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahD,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;CAIlC"}
@@ -0,0 +1,2 @@
1
+ export declare const escapeUnicode: (value: string) => string;
2
+ //# sourceMappingURL=escape_unicode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape_unicode.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/func/escape_unicode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,UAAW,MAAM,WAI1C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./escape_unicode";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/func/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,54 +1,55 @@
1
1
  var o = Object.defineProperty;
2
- var s = (n, e, t) => e in n ? o(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var i = (n, e, t) => (s(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- import a from "node-jose";
5
- import { createHash as E } from "crypto";
6
- import { CustomEncoder as c } from "./mp-front-cli-encoder.es.js";
2
+ var c = (r, e, t) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var a = (r, e, t) => (c(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import i, { JWE as E } from "node-jose";
5
+ import { createHash as y } from "crypto";
6
+ import { CustomEncoder as p } from "./mp-front-cli-encoder.es.js";
7
7
  import "./mp-front-cli-logger.es.js";
8
- class f extends c {
8
+ const u = (r) => r.replace(/[\u00A0-\uffff]/gu, (e) => "\\u" + ("000" + e.charCodeAt(0).toString(16)).slice(-4));
9
+ class T extends p {
9
10
  constructor() {
10
11
  super(...arguments);
11
- i(this, "signatureKey");
12
+ a(this, "signatureKey");
12
13
  }
13
14
  async generateKey() {
14
15
  const t = process.env.SECRET_SIGNATURE;
15
16
  if (!t)
16
17
  throw new Error("Define a SECRET_SIGNATURE from `.env`");
17
- this.signatureKey = await a.JWK.asKey({
18
+ this.signatureKey = await i.JWK.asKey({
18
19
  kty: "oct",
19
- k: a.util.base64url.encode(t)
20
+ k: i.util.base64url.encode(t)
20
21
  });
21
22
  }
22
23
  async encrypt(t) {
23
24
  if (await this.generateKey(), !this.signatureKey)
24
25
  throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");
25
- const r = JSON.stringify(t).normalize("NFD").replace(/[\u0300-\u036f]/g, "");
26
- return await a.JWE.createEncrypt(
26
+ const n = JSON.stringify(t), s = u(n);
27
+ return await E.createEncrypt(
27
28
  { format: "compact" },
28
29
  this.signatureKey
29
- ).update(r).final();
30
+ ).update(s).final();
30
31
  }
31
32
  async decrypt(t) {
32
33
  if (await this.generateKey(), !this.signatureKey)
33
34
  throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");
34
- const { payload: r } = await a.JWE.createDecrypt(
35
+ const { payload: n } = await i.JWE.createDecrypt(
35
36
  this.signatureKey
36
37
  ).decrypt(t);
37
- return JSON.parse(r.toString());
38
+ return JSON.parse(n.toString());
38
39
  }
39
40
  async isEncrypted(t) {
40
41
  this.logInfo("EncryptionHandler", t);
41
42
  try {
42
43
  return await this.decrypt(t ?? ""), this.logInfo("EncryptionHandler", "IS ENCRYPTED 🥵"), !0;
43
- } catch (r) {
44
- return this.logWarn("EncryptionHandler", JSON.stringify(r)), this.logInfo("EncryptionHandler", "IS NOT ENCRYPTED 🙂"), !1;
44
+ } catch (n) {
45
+ return this.logWarn("EncryptionHandler", JSON.stringify(n)), this.logInfo("EncryptionHandler", "IS NOT ENCRYPTED 🙂"), !1;
45
46
  }
46
47
  }
47
48
  generateSHA(t) {
48
- const r = JSON.stringify(t);
49
- return E("sha256").update(r).digest("hex");
49
+ const n = JSON.stringify(t);
50
+ return y("sha256").update(n).digest("hex");
50
51
  }
51
52
  }
52
53
  export {
53
- f as CustomEncrypter
54
+ T as CustomEncrypter
54
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-front-cli",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -57,17 +57,17 @@
57
57
  }
58
58
  },
59
59
  "peerDependencies": {
60
+ "i18next": "23.10.0",
60
61
  "ioredis": "5.3.2",
61
- "rxjs": "7.8.1",
62
+ "next-auth": "4.24.6",
62
63
  "node-jose": "2.2.0",
63
- "i18next": "23.10.0",
64
- "next-auth": "4.24.6"
64
+ "rxjs": "7.8.1"
65
65
  },
66
66
  "dependencies": {
67
- "lodash": "4.17.21",
68
67
  "@types/node-jose": "1.1.13",
69
68
  "@types/uuid": "9.0.8",
70
69
  "husky": "^9.0.11",
70
+ "lodash": "4.17.21",
71
71
  "uuid": "9.0.1"
72
72
  },
73
73
  "devDependencies": {
@@ -78,7 +78,7 @@
78
78
  "eslint-config-prettier": "9.1.0",
79
79
  "eslint-plugin-prettier": "5.1.3",
80
80
  "typescript": "5.3.3",
81
- "vite": "4.5.2",
81
+ "vite": "^4.5.3",
82
82
  "vite-plugin-dts": "3.7.1",
83
83
  "vite-tsconfig-paths": "4.2.2"
84
84
  }