Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@castleio/castle-js

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@castleio/castle-js

Castle Fingerprinting Script

  • 2.0.2
  • npm
  • Socket score

Version published
Weekly downloads
67K
decreased by-15.93%
Maintainers
4
Weekly downloads
 
Created
Source

Castle Fingerprinting Script

Packaged version of Castle fingerprinting script.

Introduction

The Castle JavaScript automatically captures every user action in your web application, including clicks, taps, swipes, form submissions, and page views. We use this data to build profiles of good user behavior in order to detect the bad.

Installation

npm install --save @castleio/castle-js

yarn add @castleio/castle-js

Configuration

Basic configuration of the app

import * as Castle from '@castleio/castle-js'

Castle.configure(YOUR_CASTLE_APP_ID);

Advanced configuration of the app

// @param appId [string] castle app id.
// @option options [object] :window (default `window`) eg JSDOM.window
// @option options [boolean] :avoidCookies (default `false`) when true cookie storage will be avoided
// @option options [string] :cookieDomain (default topLevel domain) cookies domain scope

import * as Castle from '@castleio/castle-js'

Castle.configure(appId, options);

Usage

Getting castle request token

import * as Castle from '@castleio/castle-js'

Castle.createRequestToken().then( (requestToken) => {
  ....
});

// or
const requestToken = await Castle.createRequestToken();

See Castle Docs for more information and how to pass the token further.

browser version

If your environment does not support modules you can use the browser version

import '@castleio/castle-js/dist/castle.browser.js'

_castle('setAppId', YOUR_CASTLE_APP_ID);
_castle('createRequestToken').then( (requestToken) => {
  ....
});

Upgrade from 1.x script

Before

_castle('getClientId')

After

Castle.createRequestToken().then( (requestToken) => {
});
// or
const token = await Castle.createRequestToken();

No longer available commands for _castle(...) :

`autoForwardClientId`, 'autoTrack', `catchHistoryErrors`, `identify`, `setUserId`, `setAccount`, `setKey`, `setAccount`, `sessionId`, `reset`, `page`, `trackPageView`, `setTrackerUrl`

Request Token is now required to be passed in the request params and it is no longer available in the cookie. Check the docs

Changelog

  • 2.0.2 – bug fixes
  • 2.0.1 – internal enhancements
  • 2.0.0 – migration from 1.x, modularization, updated DSL

Minimal Requirements:

ES3+ version supported browsers eg:

  • Chrome 5+

  • Firefox 3+

  • IE 6+

  • Safari 4+

  • All modern browsers (desktop and mobile)

License

MIT

FAQs

Package last updated on 31 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc