Bot Prevention
Menu

Install

Install with the setup script

Build and review a release yourself, or attach World ID to a website that CloudFormation, CDK or Terraform manages.

When to use the setup script

Both paths deploy the same CloudFormation template, and neither needs CDK bootstrap.

PathUse it whenCode source
Launch from the setup pageYou manage your distribution and Web ACL in the console.World's published release, pinned by digest
Setup scriptYou want to build and review the code yourself, or infrastructure code owns the website.Your own build of a release checkout

You need a checkout of the World ID Bot Prevention release, the Node.js and pnpm versions that it names in .node-version and package.json, and AWS CLI v2 signed in to the subscribed account.

Install

  1. Prepare the signing key and World ID app

    Complete steps 1 to 5 of Subscribe and install.

  2. Keep your installation ID, app ID and RP ID

    The installation ID is in your registration email. The script passes all three to the same template that the setup page launches.

  3. Run the setup script

    From the root of the release checkout:

    Terminal

    pnpm install --frozen-lockfile
    pnpm customer:setup init --installation <installation ID> --app-id <app_…> --rp-id <rp_…> --out .wid/customer.json
    pnpm customer:setup plan --config .wid/customer.json
    pnpm customer:setup apply --config .wid/customer.json
    pnpm customer:setup check --config .wid/customer.json
CommandWhat it does
initAsks for the settings that CloudFormation asks for and saves a configuration file without secrets. It reads the Web ACL from the distribution.
planBuilds the release, uploads it to a private bucket in your account, checks the KMS key and creates a change set. It refuses changes that would replace your keys or replay state.
applyDeploys the change set and follows the stack events. On failure, it prints the first failing resource.
checkShows the stack, its version and recent failures, and probes the routes on every hostname.

Other settings start at their defaults. Edit them in .wid/customer.json before plan. See the settings reference.

Websites managed by infrastructure code

When CloudFormation, CDK or Terraform owns your distribution and Web ACL, keep them there. In init, choose the resources-only attachment mode. The stack then creates the World ID resources, but does not change CloudFront or AWS WAF. You cannot change the attachment mode of an existing installation.

  1. Deploy the resources

    Run plan, apply and check as above.

  2. Export the attachment

    Terminal

    pnpm customer:setup attachment --config .wid/customer.json --out .wid/attachment.json

    The export reads your AWS configuration and changes nothing. It contains resource identifiers, not keys.

  3. Merge it into your website stack

    Add the two origins and the two /__wid/* cache behaviors before your behaviors, the session check function association on every application behavior, and the two AWS WAF rules after the rules of your Web ACL. The fields use the shape of the CloudFormation AWS::CloudFront::Distribution and AWS::WAFv2::WebACL properties. Map them to CDK or Terraform the same way.

  4. Deploy and check

    Deploy your website stack through its normal pipeline, then run check. Your deployment diff must modify the existing distribution and Web ACL, not replace them.