INNER CODE UNIT · TypeScript

profileCandidate

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

function profileCandidate(
  request: Request | RequestDescriptor,
  candidate: UntrustedSignatureCandidate
): UntrustedWebBotSignatureCandidate {
  const { algorithm, parameters, components } = candidate;
  if (algorithm !== "ed25519" && algorithm !== "rsa-pss-sha512") {
    return policyError("signed algorithm is missing or unsupported");
  }
  const keyid = parameters.keyid;
  if (typeof keyid !== "string" || keyid === "") {
    return policyError("keyid must be a non-empty string");
  }
  if (parameters.tag !== HTTP_MESSAGE_SIGNATURE_TAG) {
    return policyError(`tag must be '${HTTP_MESSAGE_SIGNATURE_TAG}'`);
  }
  const created = parameters.created;
  const expires = parameters.expires;
  if (typeof created !== "number" || typeof expires !== "number") {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…