elysiajs / elysia-jwt

Plugin for Elysia for using JWT Authentication
MIT License
41 stars 16 forks source link

Support `Cloudflare` #33

Open bogeychan opened 5 months ago

bogeychan commented 5 months ago

The following code doesn't work on Cloudflare because dynamic is false

const jwtType = t.Object({
  id: t.Number(),
});

export const authPlugin = new Elysia({ name: "authPlugin" }).use(
  jwt({
    secret: "yay",
    name: "jwt",
    exp: "20m",
    schema: jwtType,
  })
);

This function call missing dynamic parameter:

https://github.com/elysiajs/elysia-jwt/blob/67078d5ab037dc4ab23b07dd01547934460ff712/src/index.ts#L100

Cloudflare error:

EvalError: Code generation from strings disallowed for this context

reported on discord