@hybrd/xmtp 1.3.0 → 1.3.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/.turbo/turbo-build.log +10 -10
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/jwt.ts +4 -4
package/package.json
CHANGED
package/src/lib/jwt.ts
CHANGED
|
@@ -65,17 +65,17 @@ export function getValidatedPayload(c: Context): XMTPToolsPayload | null {
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* JWT secret key used for signing and verifying tokens
|
|
68
|
-
*
|
|
68
|
+
* Uses XMTP_ENCRYPTION_KEY environment variable for consistency
|
|
69
69
|
* Only falls back to development secret in development/test environments
|
|
70
70
|
*/
|
|
71
71
|
const JWT_SECRET = (() => {
|
|
72
|
-
const secret = process.env.
|
|
72
|
+
const secret = process.env.XMTP_ENCRYPTION_KEY
|
|
73
73
|
const nodeEnv = process.env.NODE_ENV || "development"
|
|
74
74
|
|
|
75
75
|
// In production, require a real JWT secret
|
|
76
76
|
if (nodeEnv === "production" && !secret) {
|
|
77
77
|
throw new Error(
|
|
78
|
-
"
|
|
78
|
+
"XMTP_ENCRYPTION_KEY environment variable is required in production. " +
|
|
79
79
|
"Generate a secure random secret for JWT token signing."
|
|
80
80
|
)
|
|
81
81
|
}
|
|
@@ -84,7 +84,7 @@ const JWT_SECRET = (() => {
|
|
|
84
84
|
if (!secret) {
|
|
85
85
|
console.warn(
|
|
86
86
|
"⚠️ [SECURITY] Using fallback JWT secret for development. " +
|
|
87
|
-
"Set
|
|
87
|
+
"Set XMTP_ENCRYPTION_KEY environment variable for production."
|
|
88
88
|
)
|
|
89
89
|
return "fallback-secret-for-dev-only"
|
|
90
90
|
}
|