1.0.5 • Published 1 year ago

foxhat-anti-spam-node v1.0.5

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Getting Started with FoxHat JavaScript Library

This guide will help you get started with using the FoxHat library in your JavaScript projects.

Installation

First, you need to install the foxhat-anti-spam-node library. You can do this using npm:

npm i foxhat-anti-spam-node

Usage

Import the library into your JavaScript file:

// JavaScript
const {FoxtHatAntiSpam} =  require('foxhat-anti-spam-node');

// TypeScript
import FoxtHatAntiSpam from "foxhat-anti-spam-node";

Verifying solutions in Node.js

Create a new FoxHat instance with your secret token:

// JavaScript
const foxhat = new FoxtHatAntiSpam("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9........");

try {

    server.post('/message', async (req, res) => {
        const {message, _foxhat} = req.body;
        // 3. Verify the solution
        const verify = await foxhat.verify(_foxhat)
        if (!verify) {
            throw new Error('Invalid FoxHat solution')
        } else {
            // ...
        }
    })

} catch (error) {
    console.error("Error:", error);
}
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago