@gustavo-valsechi/utils 1.0.9 → 1.0.10

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
@@ -266,14 +266,20 @@ var Cryptor = {
266
266
  },
267
267
  decrypt: async (payload) => {
268
268
  if (!SECRET) throw new Error("AUTH_SECRET or NEXT_PUBLIC_AUTH_SECRET is required!");
269
+ console.log("SECRET", SECRET);
269
270
  const key = await Cryptor.deriveKey(SECRET);
271
+ console.log("key", key);
270
272
  const iv = Cryptor.fromBase64(payload.iv);
271
273
  const encrypted = Cryptor.fromBase64(payload.data);
274
+ console.log("iv", iv);
275
+ console.log("encrypted", encrypted);
272
276
  const decrypted = await crypto.subtle.decrypt(
273
277
  { name: "AES-GCM", iv },
274
278
  key,
275
279
  encrypted
276
280
  );
281
+ console.log("decrypted", decrypted);
282
+ console.log("return", JSON.parse(new TextDecoder().decode(decrypted)));
277
283
  return JSON.parse(new TextDecoder().decode(decrypted));
278
284
  }
279
285
  };
package/dist/index.mjs CHANGED
@@ -230,14 +230,20 @@ var Cryptor = {
230
230
  },
231
231
  decrypt: async (payload) => {
232
232
  if (!SECRET) throw new Error("AUTH_SECRET or NEXT_PUBLIC_AUTH_SECRET is required!");
233
+ console.log("SECRET", SECRET);
233
234
  const key = await Cryptor.deriveKey(SECRET);
235
+ console.log("key", key);
234
236
  const iv = Cryptor.fromBase64(payload.iv);
235
237
  const encrypted = Cryptor.fromBase64(payload.data);
238
+ console.log("iv", iv);
239
+ console.log("encrypted", encrypted);
236
240
  const decrypted = await crypto.subtle.decrypt(
237
241
  { name: "AES-GCM", iv },
238
242
  key,
239
243
  encrypted
240
244
  );
245
+ console.log("decrypted", decrypted);
246
+ console.log("return", JSON.parse(new TextDecoder().decode(decrypted)));
241
247
  return JSON.parse(new TextDecoder().decode(decrypted));
242
248
  }
243
249
  };
@@ -68,14 +68,20 @@ var Cryptor = {
68
68
  },
69
69
  decrypt: async (payload) => {
70
70
  if (!SECRET) throw new Error("AUTH_SECRET or NEXT_PUBLIC_AUTH_SECRET is required!");
71
+ console.log("SECRET", SECRET);
71
72
  const key = await Cryptor.deriveKey(SECRET);
73
+ console.log("key", key);
72
74
  const iv = Cryptor.fromBase64(payload.iv);
73
75
  const encrypted = Cryptor.fromBase64(payload.data);
76
+ console.log("iv", iv);
77
+ console.log("encrypted", encrypted);
74
78
  const decrypted = await crypto.subtle.decrypt(
75
79
  { name: "AES-GCM", iv },
76
80
  key,
77
81
  encrypted
78
82
  );
83
+ console.log("decrypted", decrypted);
84
+ console.log("return", JSON.parse(new TextDecoder().decode(decrypted)));
79
85
  return JSON.parse(new TextDecoder().decode(decrypted));
80
86
  }
81
87
  };
@@ -44,14 +44,20 @@ var Cryptor = {
44
44
  },
45
45
  decrypt: async (payload) => {
46
46
  if (!SECRET) throw new Error("AUTH_SECRET or NEXT_PUBLIC_AUTH_SECRET is required!");
47
+ console.log("SECRET", SECRET);
47
48
  const key = await Cryptor.deriveKey(SECRET);
49
+ console.log("key", key);
48
50
  const iv = Cryptor.fromBase64(payload.iv);
49
51
  const encrypted = Cryptor.fromBase64(payload.data);
52
+ console.log("iv", iv);
53
+ console.log("encrypted", encrypted);
50
54
  const decrypted = await crypto.subtle.decrypt(
51
55
  { name: "AES-GCM", iv },
52
56
  key,
53
57
  encrypted
54
58
  );
59
+ console.log("decrypted", decrypted);
60
+ console.log("return", JSON.parse(new TextDecoder().decode(decrypted)));
55
61
  return JSON.parse(new TextDecoder().decode(decrypted));
56
62
  }
57
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/utils",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",