@arcjet/analyze
v1.0.0
Published
Arcjet local analysis engine
Downloads
102,893
Readme
@arcjet/analyze
Arcjet helps developers protect their apps in just a few lines of code. Implement rate limiting, bot protection, email verification, and defense against common attacks.
This is the Arcjet local analysis engine.
What is this?
This package provides functionality to analyze requests.
The work is done in WebAssembly but is called here from JavaScript.
The functionality is wrapped up into rules in our core package
(arcjet),
in turn exposed from our SDKs (such as @arcjet/next).
The WebAssembly files are in
@arcjet/analyze-wasm.
They are separate because we need to change the import structure for each
runtime that we support in the bindings.
Separate packages lets us not duplicate code while providing a combined
higher-level API for calling our core functionality.
When should I use this?
This is an internal Arcjet package not designed for public use. See our Get started guide for how to use Arcjet in your application.
Install
This package is ESM only. Install with npm in Node.js:
npm install @arcjet/analyzeUse
import { generateFingerprint, isValidEmail } from "@arcjet/analyze";
const fingerprint = await generateFingerprint(
{ characteristics: [] },
{ ip: "127.0.0.1" },
);
console.log(fingerprint);
// => "fp::2::0d219da6100b99f95cf639b77e088c6df3c096aa5fd61dec5287c5cf94d5e545"
const result = await isValidEmail({}, "[email protected]", {
tag: "allow-email-validation-config",
val: {
allowDomainLiteral: false,
allow: [],
requireTopLevelDomain: true,
},
});
console.log(result);
// => { blocked: [], validity: "valid" }