INNER CODE UNIT · TypeScript

policyError

cloudflare/web-bot-auth · packages/web-bot-auth/src/index.ts:114

function policyError(message: string): never {
  throw new SignatureError(SignatureErrorCode.PolicyViolation, message);
}

function seconds(date: Date, name: string): number {
  const milliseconds = date.getTime();
  if (!Number.isFinite(milliseconds)) {
    return policyError(`${name} must be a valid date`);
  }
  return Math.floor(milliseconds / 1000);
}

function base64(bytes: Uint8Array): string {
  return btoa(String.fromCharCode(...bytes));
}

function base64Url(bytes: Uint8Array): string {
  return base64(bytes)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…