for those who might look into ‘jose’ to use in wit...
# cloud
l
for those who might look into ‘jose’ to use in with Cloudflare …. this code might help u to get started:
Copy code
interface payload {
  apiKey: string
  secretKey: string
  roomName: string
  participantId: string
}

const alg = "HS256"
const secret = new TextEncoder().encode(payload.secretKey)

const jwt = await new jose.SignJWT({
  video: {
    roomJoin: true,
    room: payload.roomName,
    canPublish: true,
    canSubscribe: true,
  },
})
  .setProtectedHeader({ alg })
  .setIssuedAt()
  .setNotBefore(0)
  .setExpirationTime("2h")
  .setIssuer(payload.apiKey)
  .setSubject(payload.participantId)
  .setJti(payload.participantId)
  .sign(secret)
👍 1