EN

@core / jobs

1.1.3 ▾
verifiedMIT
GitHub

Background jobs on Postgres: durable queue, retries with backoff, cron schedules and a serverless cron endpoint

Code9 filesContext~696 tokensscan passed

The exact tree that will be injected, after .genpmignore. Pinned to

src/lib/jobs/cron-auth.tsread-only · 10f7c8e
// Protección del endpoint de cron: `Authorization: Bearer <CRON_SECRET>` comparado en tiempo constante.

export function isAuthorizedCron(authorization: string | null | undefined, secret = process.env.CRON_SECRET): boolean {
  if (!secret || secret.length < 32) throw new Error('CRON_SECRET must be set (>= 32 chars)');
  const given = new TextEncoder().encode(authorization ?? '');
  const expected = new TextEncoder().encode(`Bearer ${secret}`);
  let diff = given.length ^ expected.length;
  for (let i = 0; i < expected.length; i++) diff |= (given[i] ?? 0) ^ expected[i]!;
  return diff === 0;
}

Report @core/jobs

Sign in with GitHub to report a package.