@agentvalet/register 1.7.0 → 1.7.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/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -265,12 +265,13 @@ import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
|
265
265
|
|
|
266
266
|
// src/lib/jwt.ts
|
|
267
267
|
import { createSign, createPrivateKey } from "crypto";
|
|
268
|
+
var AGENT_JWT_LIFETIME_SECONDS = 240;
|
|
268
269
|
function signJwt(agentId, ownerId, privateKeyPem) {
|
|
269
270
|
const now = Math.floor(Date.now() / 1e3);
|
|
270
271
|
const b64 = (s) => Buffer.from(s).toString("base64url");
|
|
271
272
|
const header = b64(JSON.stringify({ alg: "RS256", typ: "JWT" }));
|
|
272
273
|
const payload = b64(
|
|
273
|
-
JSON.stringify({ agent_id: agentId, owner_id: ownerId, iat: now, exp: now +
|
|
274
|
+
JSON.stringify({ agent_id: agentId, owner_id: ownerId, iat: now, exp: now + AGENT_JWT_LIFETIME_SECONDS })
|
|
274
275
|
);
|
|
275
276
|
const signingInput = `${header}.${payload}`;
|
|
276
277
|
const sign = createSign("RSA-SHA256");
|