npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rba-widget

v1.2.6

Published

An embeddable Risk Based Authentication - Login & Transaction

Readme

version npm package minimized gzipped size (select exports) downloads jsdelivr NPM

Overview

The RBA-widget is designed to provide a secure and efficient way to handle user authentication and transaction verification using risk-based analysis. It supports login and transaction processes with detailed logging and error handling.

Features

  • Risk-Based Authentication: Dynamically adjusts security measures based on the assessed risk level.
  • Login and Transaction Support: Handles both user login and transaction verification.
  • Detailed Logging: Provides comprehensive logs for actions and errors.
  • Configurable: Easily integrate and configure with your existing systems.

Installation :-

i). Install at HTML pages

  • Step 1: Be ready with HTML form and import the package
<script type="module">
   // import rba package
   import RBAWidget from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm'
</script>

or use default type (umd file)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.min.js"></script>
  • Step 2: Call RBAWidget function to get the risk based authentication service
   // form submission with RBAWidget for validating user
   RBAWidget({
      baseUrl: string,
      ipInfoToken:  string,
      type: string,
      userDetails: {
        userId: string,
        secret: string,
        accountId: string | null,
      },
      pageLoadTime: number,
      onMessage: (arg) => { }
   });

Note: If RBAWidget function is called in form, make sure you prevent default value.

Example :-

document.addEventListener("DOMContentLoaded", function () {
   document.getElementById("myForm").addEventListener("submit", function (event) {
      // Prevent the default form submission behavior
      event.preventDefault();
      ...
      // call widget
      RBAWidget({
         ...
      });
   }
}

ii). Install at package.json

  • Step 1: Be ready with terminal and install the package
npm install rba-widget 

or

yarn add rba-widget
  • Step 2: import RBAWidget and its types from the rba-widget package
import RBAWidget, { RBAWidgetProps, UserDetails, LogMessage } from 'rba-widget';
  • Step 3: Call RBAWidget function to get the risk based authentication service
   // form submission with RBAWidget for validating user
   RBAWidget({
      baseUrl: string,
      ipInfoToken:  string,
      type: string, // login | transaction
      userDetails: {
        userId: string,
        secret: string,
        accountId: string | null,
      },
      pageLoadTime: number,
      onMessage: (arg) => { 
        if(arg.code === 1) {
          // alert success
        } else if (arg.code === 0) {
          // alert failed
        } else {
          // observe the log messages
        }
      }
   });

| Key | Required | value | Description | | ----------- | :-----------: | :-----------: | :----------- | | baseUrl | true | string | It is used call the back office server base URL. | | ipInfoToken | true | string | It is used to location details api at ipInfo. | | type | true | string | It is used send what type of method going to be used. only login or transaction is allowed | | userDetails | true | object | It is used to get the user details, given in the form and from axiom protect dashboard. |
| onMessage | true | function | It is used get the response with more details. | | pageLoadTime | false | number | It is used pass the page loaded time by Date.now(). If not provided widget will take its initialized time. |

Types

type RBAWidgetProps = {
    baseUrl: string;
    ipInfoToken: string;
    type: "login" | "transaction";
    userDetails: UserDetails;
    onMessage: (arg: LogMessage) => void;
	  pageLoadTime?: number;
}

type UserDetails = {
    userId: string;
  	secret: string;
    accountId?: string | null;
	  transactionId?: string | null;
    transaction_amount?: string | number | null;
    transaction_type?: string | null;
    recipient_details?: string | null;
    transaction_category?: string | null;
}

type LogMessage = {
    action: string;
    message: string;
    code: number;
    data?: unknown;
}

Logging

Use the onMessage callback to receive detailed logs about the operations. The logs include an action, message, code, and optional data.

Response Codes

The widget provides response codes to indicate the status of operations(check for code):

  • -1: Configuration error message
  • 0: Failed message
  • 1: Success message
  • 2: Information message

Authors