API

createEnforcedRequestHandler()

A function that returns a default request handler with built-in HUMAN enforcement. Useful if there is little request/response manipulation in your Edgio Edge Function.

1createEnforcedRequestHandler(
2 config: HumanSecurityConfiguration,
3 onPass: (request: Request) => Response | Promise<Response>,
4 onResponse?: (response: Response) => Response | Promise<Response>,
5) => ((request: Request, context: Context) => Promise<Response>)

HumanSecurity

constructor

Creates a new instance of the HumanSecurity class from a HumanSecurityConfiguration object (see the configuration section for more information).

1constructor(params: HumanSecurityConfiguration) => HumanSecurity
  • Parameters
    • params: ConfigurationParams
  • Returns a new instance of the HumanSecurity class

createEnforcer()

Creates a new Enforcer instance.

1createEnforcer() => Enforcer
  • Returns a new Enforcer instance with the configurations provided to the HumanSecurity instance

Enforcer

The entity responsible for performing HUMAN enforcement.

enforce()

Executes the enforcement functionality, returning either a response or null depending on which action should be taken.

1enforce(request: Request, context: Context) => Promise<Response | null>

postEnforce()

Performs any post-enforcement processing actions and final modifications to (i.e., setting cookies or headers on) the response if needed.

1postEnforce(response: Response) => Promise<void>
  • Parameters
  • Returns a Promise resolving to void