UNPKG

actor-kit

Version:

Actor Kit is a library for running state machines in Cloudflare Workers, leveraging XState for robust state management. It provides a framework for managing the logic, lifecycle, persistence, synchronization, and access control of actors in a distributed

12 lines (11 loc) 613 B
import { a as CallerStringSchema } from "./schemas-DTUwr6Qg.mjs"; import { SignJWT } from "jose"; //#region src/createAccessToken.ts const createAccessToken = async ({ signingKey, actorId, actorType, callerId, callerType }) => { const subject = `${callerType}-${callerId}`; CallerStringSchema.parse(subject); return await new SignJWT({}).setProtectedHeader({ alg: "HS256" }).setJti(actorId).setSubject(subject).setAudience(actorType).setExpirationTime("30d").sign(new TextEncoder().encode(signingKey)); }; //#endregion export { createAccessToken as t }; //# sourceMappingURL=createAccessToken-zuXaUS00.mjs.map