@appconda/nextjs 1.0.88 → 1.0.90

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.
@@ -4,7 +4,6 @@ import { getEnv } from "./env";
4
4
  const ALGORITHM = "aes256";
5
5
  const INPUT_ENCODING = "utf8";
6
6
  const OUTPUT_ENCODING = "hex";
7
- const BUFFER_ENCODING = getEnv().ENCRYPTION_KEY.length === 32 ? "latin1" : "hex";
8
7
  const IV_LENGTH = 16; // AES blocksize
9
8
  /**
10
9
  *
@@ -14,6 +13,7 @@ const IV_LENGTH = 16; // AES blocksize
14
13
  * @returns Encrypted value using key
15
14
  */
16
15
  export const symmetricEncrypt = (text, key) => {
16
+ const BUFFER_ENCODING = getEnv().ENCRYPTION_KEY.length === 32 ? "latin1" : "hex";
17
17
  const _key = Buffer.from(key, BUFFER_ENCODING);
18
18
  const iv = crypto.randomBytes(IV_LENGTH);
19
19
  // @ts-ignore -- the package needs to be built
@@ -29,6 +29,7 @@ export const symmetricEncrypt = (text, key) => {
29
29
  * @param key Key used to decrypt value must be 32 bytes for AES256 encryption algorithm
30
30
  */
31
31
  export const symmetricDecrypt = (text, key) => {
32
+ const BUFFER_ENCODING = getEnv().ENCRYPTION_KEY.length === 32 ? "latin1" : "hex";
32
33
  const _key = Buffer.from(key, BUFFER_ENCODING);
33
34
  const components = text.split(":");
34
35
  const iv_from_ciphertext = Buffer.from(components.shift() || "", OUTPUT_ENCODING);
package/dist/lib/env.js CHANGED
@@ -16,6 +16,8 @@ export const getEnv = (() => {
16
16
  ENTERPRISE_LICENSE_KEY: z.string(),
17
17
  NEXTAUTH_SECRET: z.string().min(1),
18
18
  ENCRYPTION_KEY: z.string().length(64).or(z.string().length(32)),
19
+ CRON_SECRET: z.string().min(10),
20
+ _ADMIN_DOMAIN: z.string().optional(),
19
21
  /* AI_AZURE_LLM_API_KEY: z.string().optional(),
20
22
  AI_AZURE_EMBEDDINGS_DEPLOYMENT_ID: z.string().optional(),
21
23
  AI_AZURE_LLM_DEPLOYMENT_ID: z.string().optional(),
@@ -103,7 +105,7 @@ export const getEnv = (() => {
103
105
  TURNSTILE_SECRET_KEY: z.string().optional(),
104
106
  UPLOADS_DIR: z.string().min(1).optional(),
105
107
  VERCEL_URL: z.string().optional(),
106
- _ADMIN_DOMAIN: z.string().optional(),
108
+
107
109
  ADMIN_URL: z.string().url().optional(),
108
110
  UNSPLASH_ACCESS_KEY: z.string().optional(),
109
111
  LANGFUSE_SECRET_KEY: z.string().optional(),
@@ -123,6 +125,8 @@ export const getEnv = (() => {
123
125
  ENTERPRISE_LICENSE_KEY: process.env.ENTERPRISE_LICENSE_KEY,
124
126
  NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
125
127
  ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,
128
+ CRON_SECRET: process.env.CRON_SECRET,
129
+ _ADMIN_DOMAIN: process.env._ADMIN_DOMAIN,
126
130
  },
127
131
  });
128
132
  console.log(env);
@@ -1 +1,2 @@
1
1
  export * from "./jwt";
2
+ export * from "./env";
package/dist/lib/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./jwt";
2
+ export * from "./env";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@appconda/nextjs",
3
3
  "homepage": "https://appconda.io/support",
4
4
  "description": "Appconda is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "1.0.88",
5
+ "version": "1.0.90",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
package/src/lib/crypto.ts CHANGED
@@ -6,7 +6,7 @@ import { getEnv } from "./env";
6
6
  const ALGORITHM = "aes256";
7
7
  const INPUT_ENCODING = "utf8";
8
8
  const OUTPUT_ENCODING = "hex";
9
- const BUFFER_ENCODING = getEnv().ENCRYPTION_KEY!.length === 32 ? "latin1" : "hex";
9
+
10
10
  const IV_LENGTH = 16; // AES blocksize
11
11
 
12
12
  /**
@@ -17,6 +17,7 @@ const IV_LENGTH = 16; // AES blocksize
17
17
  * @returns Encrypted value using key
18
18
  */
19
19
  export const symmetricEncrypt = (text: string, key: string) => {
20
+ const BUFFER_ENCODING = getEnv().ENCRYPTION_KEY!.length === 32 ? "latin1" : "hex";
20
21
  const _key = Buffer.from(key, BUFFER_ENCODING);
21
22
  const iv = crypto.randomBytes(IV_LENGTH);
22
23
 
@@ -35,6 +36,7 @@ export const symmetricEncrypt = (text: string, key: string) => {
35
36
  * @param key Key used to decrypt value must be 32 bytes for AES256 encryption algorithm
36
37
  */
37
38
  export const symmetricDecrypt = (text: string, key: string) => {
39
+ const BUFFER_ENCODING = getEnv().ENCRYPTION_KEY!.length === 32 ? "latin1" : "hex";
38
40
  const _key = Buffer.from(key, BUFFER_ENCODING);
39
41
 
40
42
  const components = text.split(":");
package/src/lib/env.ts CHANGED
@@ -18,6 +18,8 @@ export const getEnv = (() => {
18
18
  ENTERPRISE_LICENSE_KEY: z.string(),
19
19
  NEXTAUTH_SECRET: z.string().min(1),
20
20
  ENCRYPTION_KEY: z.string().length(64).or(z.string().length(32)),
21
+ CRON_SECRET: z.string().min(10),
22
+ _ADMIN_DOMAIN: z.string().optional(),
21
23
  /* AI_AZURE_LLM_API_KEY: z.string().optional(),
22
24
  AI_AZURE_EMBEDDINGS_DEPLOYMENT_ID: z.string().optional(),
23
25
  AI_AZURE_LLM_DEPLOYMENT_ID: z.string().optional(),
@@ -105,7 +107,7 @@ export const getEnv = (() => {
105
107
  TURNSTILE_SECRET_KEY: z.string().optional(),
106
108
  UPLOADS_DIR: z.string().min(1).optional(),
107
109
  VERCEL_URL: z.string().optional(),
108
- _ADMIN_DOMAIN: z.string().optional(),
110
+
109
111
  ADMIN_URL: z.string().url().optional(),
110
112
  UNSPLASH_ACCESS_KEY: z.string().optional(),
111
113
  LANGFUSE_SECRET_KEY: z.string().optional(),
@@ -126,6 +128,8 @@ export const getEnv = (() => {
126
128
  ENTERPRISE_LICENSE_KEY: process.env.ENTERPRISE_LICENSE_KEY,
127
129
  NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
128
130
  ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,
131
+ CRON_SECRET: process.env.CRON_SECRET,
132
+ _ADMIN_DOMAIN: process.env._ADMIN_DOMAIN,
129
133
  },
130
134
  });
131
135
  console.log(env);
package/src/lib/index.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./jwt";
1
+ export * from "./jwt";
2
+ export * from "./env";