@rpcbase/server 0.383.0 → 0.385.0
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/package.json +1 -1
- package/src/getDerivedKey.ts +1 -1
- package/src/initServer.ts +2 -6
package/package.json
CHANGED
package/src/getDerivedKey.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const getDerivedKey = (
|
|
|
8
8
|
length: number = 32, // Default to 256-bit keys
|
|
9
9
|
salt: string = "",
|
|
10
10
|
): string => {
|
|
11
|
-
assert(masterKey?.length
|
|
11
|
+
assert(masterKey?.length >= 32, "MASTER_KEY must be 32 chars or longer.")
|
|
12
12
|
|
|
13
13
|
return Buffer.from(hkdfSync(
|
|
14
14
|
"sha256",
|
package/src/initServer.ts
CHANGED
|
@@ -5,14 +5,11 @@ import {createClient} from "redis"
|
|
|
5
5
|
|
|
6
6
|
import { getDerivedKey } from "./getDerivedKey"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
const SESSION_STORE_HOST = "localhost"
|
|
10
|
-
const SESSION_STORE_PORT = "6379"
|
|
11
|
-
|
|
12
8
|
const isProduction = process.env.NODE_ENV === "production"
|
|
13
9
|
|
|
14
10
|
|
|
15
11
|
export const initServer = async (app: Application, serverEnv: { [key: string]: string | undefined }) => {
|
|
12
|
+
app.disable("x-powered-by")
|
|
16
13
|
|
|
17
14
|
const sessionSecret = getDerivedKey(serverEnv.MASTER_KEY!, "express_session_key")
|
|
18
15
|
|
|
@@ -27,9 +24,8 @@ export const initServer = async (app: Application, serverEnv: { [key: string]:
|
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
const redisClient = createClient({
|
|
27
|
+
url: process.env.REDIS_URL,
|
|
30
28
|
socket: {
|
|
31
|
-
host: SESSION_STORE_HOST,
|
|
32
|
-
port: Number(SESSION_STORE_PORT),
|
|
33
29
|
reconnectStrategy,
|
|
34
30
|
connectTimeout: 10000,
|
|
35
31
|
keepAlive: 0,
|