@hybrd/xmtp 1.3.0 → 1.3.2

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,6 +1,6 @@
1
1
 
2
2
  
3
- > @hybrd/xmtp@1.3.0 build /Users/ian/Projects/01/hybrid/packages/xmtp
3
+ > @hybrd/xmtp@1.3.2 build /Users/ian/Projects/01/hybrid/packages/xmtp
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: {"index":"src/index.ts"}
@@ -12,7 +12,7 @@
12
12
  CJS Build start
13
13
  ESM Build start
14
14
 
15
- [1:37:26 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
15
+ [5:19:03 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
16
16
 
17
17
  scripts/revoke-installations.ts:89:4:
18
18
   89 │ if (import.meta.url === file://${process.argv[1]}) {
@@ -23,7 +23,7 @@
23
23
 
24
24
 
25
25
 
26
- [1:37:26 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
26
+ [5:19:03 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
27
27
 
28
28
  src/client.ts:21:33:
29
29
   21 │ const __filename = fileURLToPath(import.meta.url)
@@ -33,13 +33,13 @@
33
33
 
34
34
 
35
35
 
36
- CJS dist/index.cjs 119.81 KB
37
- CJS dist/index.cjs.map 219.24 KB
38
- CJS ⚡️ Build success in 37ms
39
- ESM dist/index.js 114.50 KB
40
- ESM dist/index.js.map 218.73 KB
41
- ESM ⚡️ Build success in 38ms
36
+ ESM dist/index.js 114.52 KB
37
+ ESM dist/index.js.map 218.83 KB
38
+ ESM ⚡️ Build success in 126ms
39
+ CJS dist/index.cjs 119.83 KB
40
+ CJS dist/index.cjs.map 219.34 KB
41
+ CJS ⚡️ Build success in 126ms
42
42
  DTS Build start
43
- DTS ⚡️ Build success in 3824ms
43
+ DTS ⚡️ Build success in 3917ms
44
44
  DTS dist/index.d.cts 29.23 KB
45
45
  DTS dist/index.d.ts 29.23 KB
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @hybrd/xmtp@1.2.8 typecheck /Users/ian/Projects/01/hybrid/packages/xmtp
3
+ > @hybrd/xmtp@1.3.1 typecheck /Users/ian/Projects/01/hybrid/packages/xmtp
4
4
  > tsc --noEmit
5
5
 
package/dist/index.cjs CHANGED
@@ -3349,23 +3349,23 @@ function getValidatedPayload(c) {
3349
3349
  }
3350
3350
  return validateXMTPToolsToken(token);
3351
3351
  }
3352
- var JWT_SECRET = (() => {
3353
- const secret = process.env.XMTP_JWT_SECRET;
3352
+ function getJwtSecret() {
3353
+ const secret = process.env.XMTP_ENCRYPTION_KEY;
3354
3354
  const nodeEnv = process.env.NODE_ENV || "development";
3355
3355
  if (nodeEnv === "production" && !secret) {
3356
3356
  throw new Error(
3357
- "XMTP_JWT_SECRET environment variable is required in production. Generate a secure random secret for JWT token signing."
3357
+ "XMTP_ENCRYPTION_KEY environment variable is required in production. Generate a secure random secret for JWT token signing."
3358
3358
  );
3359
3359
  }
3360
3360
  if (!secret) {
3361
3361
  console.warn(
3362
- "\u26A0\uFE0F [SECURITY] Using fallback JWT secret for development. Set XMTP_JWT_SECRET environment variable for production."
3362
+ "\u26A0\uFE0F [SECURITY] Using fallback JWT secret for development. Set XMTP_ENCRYPTION_KEY environment variable for production."
3363
3363
  );
3364
3364
  return "fallback-secret-for-dev-only";
3365
3365
  }
3366
3366
  return secret;
3367
- })();
3368
- var API_KEY = (() => {
3367
+ }
3368
+ function getApiKey() {
3369
3369
  const apiKey = process.env.XMTP_API_KEY;
3370
3370
  const nodeEnv = process.env.NODE_ENV || "development";
3371
3371
  if (nodeEnv === "production" && !apiKey) {
@@ -3380,7 +3380,7 @@ var API_KEY = (() => {
3380
3380
  return "fallback-api-key-for-dev-only";
3381
3381
  }
3382
3382
  return apiKey;
3383
- })();
3383
+ }
3384
3384
  var JWT_EXPIRY = 5 * 60;
3385
3385
  function generateXMTPToolsToken(payload) {
3386
3386
  const now = Math.floor(Date.now() / 1e3);
@@ -3389,12 +3389,12 @@ function generateXMTPToolsToken(payload) {
3389
3389
  issued: now,
3390
3390
  expires: now + JWT_EXPIRY
3391
3391
  };
3392
- return import_jsonwebtoken.default.sign(fullPayload, JWT_SECRET, {
3392
+ return import_jsonwebtoken.default.sign(fullPayload, getJwtSecret(), {
3393
3393
  expiresIn: JWT_EXPIRY
3394
3394
  });
3395
3395
  }
3396
3396
  function validateXMTPToolsToken(token) {
3397
- if (token === API_KEY) {
3397
+ if (token === getApiKey()) {
3398
3398
  console.log("\u{1F511} [Auth] Using API key authentication");
3399
3399
  const now = Math.floor(Date.now() / 1e3);
3400
3400
  return {
@@ -3408,7 +3408,7 @@ function validateXMTPToolsToken(token) {
3408
3408
  };
3409
3409
  }
3410
3410
  try {
3411
- const decoded = import_jsonwebtoken.default.verify(token, JWT_SECRET);
3411
+ const decoded = import_jsonwebtoken.default.verify(token, getJwtSecret());
3412
3412
  console.log("\u{1F511} [Auth] Using JWT token authentication");
3413
3413
  const now = Math.floor(Date.now() / 1e3);
3414
3414
  if (decoded.expires < now) {