@hybrd/xmtp 1.3.1 → 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.
- package/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/jwt.ts +11 -11
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @hybrd/xmtp@1.3.
|
|
3
|
+
> @hybrd/xmtp@1.3.2 build /Users/ian/Projects/01/hybrid/packages/xmtp
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: {"index":"src/index.ts"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
|
|
15
|
-
[90m[[
|
|
15
|
+
[90m[[90m5:19:03 PM[90m][39m [43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta]
|
|
16
16
|
|
|
17
17
|
scripts/revoke-installations.ts:89:4:
|
|
18
18
|
[37m 89 │ if ([32mimport.meta[37m.url === [36mfile://${process.argv[1]}[39m) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
[90m[[
|
|
26
|
+
[90m[[90m5:19:03 PM[90m][39m [43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta]
|
|
27
27
|
|
|
28
28
|
src/client.ts:21:33:
|
|
29
29
|
[37m 21 │ const __filename = fileURLToPath([32mimport.meta[37m.url)
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
[32mESM[39m [1mdist/index.js [22m[32m114.
|
|
37
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m218.
|
|
38
|
-
[32mESM[39m ⚡️ Build success in
|
|
39
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m119.
|
|
40
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m219.
|
|
41
|
-
[32mCJS[39m ⚡️ Build success in
|
|
36
|
+
[32mESM[39m [1mdist/index.js [22m[32m114.52 KB[39m
|
|
37
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m218.83 KB[39m
|
|
38
|
+
[32mESM[39m ⚡️ Build success in 126ms
|
|
39
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m119.83 KB[39m
|
|
40
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m219.34 KB[39m
|
|
41
|
+
[32mCJS[39m ⚡️ Build success in 126ms
|
|
42
42
|
DTS Build start
|
|
43
|
-
DTS ⚡️ Build success in
|
|
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
|
package/dist/index.cjs
CHANGED
|
@@ -3349,7 +3349,7 @@ function getValidatedPayload(c) {
|
|
|
3349
3349
|
}
|
|
3350
3350
|
return validateXMTPToolsToken(token);
|
|
3351
3351
|
}
|
|
3352
|
-
|
|
3352
|
+
function getJwtSecret() {
|
|
3353
3353
|
const secret = process.env.XMTP_ENCRYPTION_KEY;
|
|
3354
3354
|
const nodeEnv = process.env.NODE_ENV || "development";
|
|
3355
3355
|
if (nodeEnv === "production" && !secret) {
|
|
@@ -3364,8 +3364,8 @@ var JWT_SECRET = (() => {
|
|
|
3364
3364
|
return "fallback-secret-for-dev-only";
|
|
3365
3365
|
}
|
|
3366
3366
|
return secret;
|
|
3367
|
-
}
|
|
3368
|
-
|
|
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,
|
|
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 ===
|
|
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,
|
|
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) {
|