diff --git a/app/root.test.ts b/app/root.test.ts index 96e868fa..edeb0169 100644 --- a/app/root.test.ts +++ b/app/root.test.ts @@ -37,7 +37,7 @@ describe('root loader', () => { { ...payload, exp: Math.round(inFiveMinutes.getTime() / 1000) }, signature, ] - .map((s) => btoa(JSON.stringify(s))) + .map((s) => Buffer.from(JSON.stringify(s)).toString('base64')) .join('.')}` const url = new URL('https://orange.cloudflare.dev/') diff --git a/app/root.tsx b/app/root.tsx index e8bbe34a..b87e6343 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -56,7 +56,7 @@ export const loader = async ({ request, context }: LoaderFunctionArgs) => { if (!CF_Authorization) return defaultResponse const [, payload] = CF_Authorization.split('.') - const data = JSON.parse(atob(payload)) + const data = JSON.parse(Buffer.from(payload, 'base64').toString()) const expires = new Date(data.exp * 1000) const now = new Date() if (addOneDay(now) > expires) {