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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@finsel-dgi/pasby-react

v0.1.4

Published

This is a javascript library for implementing authentication and authorization in react apps with pasby,

Readme

This documentation includes installation instructions, basic usage, and a brief overview of the main components and functions.

@finsel-dgi/pasby-react

@finsel-dgi/pasby-react is a React-focused software development kit (SDK) designed to facilitate authentication processes using the Pasby authorization server. This library provides tools to manage user authentication flows, handle tokens, and interact with the Pasby API.

Installation

To install @finsel-dgi/pasby-react, use npm or yarn:

npm install @finsel-dgi/pasby-react

or

yarn add @finsel-dgi/pasby-react

Usage

Importing the Library

To use the library, import the necessary functions and components into your React application:

import { handshake, User } from '@finsel-dgi/pasby-react';

Authentication Flow

The primary function of this library is to manage the authentication flow with the Pasby authorization server. Below is an example of how to initiate a handshake process:

import { handshake } from '@finsel-dgi/pasby-react';

async function initiateHandshake(flow, code, pkceVerifier) {
  try {
    const response = await handshake({ flow, code, pkceVerifier });
    console.log('Access Token:', response.access);
    console.log('Challenge:', response.challenge);
  } catch (error) {
    console.error('Error during handshake:', error);
  }
}

User Data

The library provides a User interface to define the structure of user data. This can be used to manage and type-check user information within your application:

import { User } from '@finsel-dgi/pasby-react';

const user: User = {
  national: '123456789',
  country: 'CountryName',
  claims: {
    contact: {
      email: '[email protected]',
      phone: '123-456-7890',
      emailVerified: true,
      phoneVerified: false,
    },
    address: {
      country: 'CountryName',
      city: 'CityName',
      countryCode: 'CN',
      formatted: '123 Main St, CityName, CountryName',
      postCode: '12345',
      place: 'PlaceName',
    },
    bio: {
      birthdate: '1990-01-01',
      gender: 'Non-binary',
      birthplace: 'CityName',
      birthnumber: 123456789,
      maritalStatus: 'Single',
      age: 34,
    },
    nationality: {
      pep: false,
      nationalities: ['CountryName'],
      residence: 'CityName',
      primary: 'CountryName',
    },
  },
};

API Reference

handshake(params: { flow: string, code: string, pkceVerifier: string }): Promise<{ exp: number, access: string, challenge: string }>

  • Description: Initiates a handshake process with the Pasby authorization server.
  • Parameters:
    • flow: The flow query value received by the redirect from the Pasby authorization server.
    • code: The handshake query value received by the redirect from the Pasby authorization server.
    • pkceVerifier: The PKCE verifier parsed to you when the login link was created.
  • Returns: A promise that resolves to an object containing the expiration time (exp), access token (access), and challenge (challenge).

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

This documentation provides a basic overview of how to use the @finsel-dgi/pasby-react library, including installation, usage examples, and API references. Adjust the content as necessary to fit any additional features or changes in your library.