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 🙏

© 2024 – Pkg Stats / Ryan Hefner

secure-bff

v1.0.7

Published

This package contains the secure functionality for authentication purposes.

Downloads

5

Readme

Secure-BFF

Introduction

Welcome to the "secure-bff" package! This module is designed for authentication and security-related tasks, including token validation and user information retrieval from JWT tokens. It can be used independently in your Node.js applications to enhance security and authentication.

Installation

To use the "secure-bff" package in your project, you can install it via npm:

npm install secure-bff

Required Environment Variables

To use the "secure-bff" package, you need to set the following environment variables:

  1. REDIS_DB_URL: The URL or host of your Redis database, including the port.
  2. REDIS_DB_USER: The username or access key for authentication.
  3. REDIS_DB_PASSWORD: The password or access key secret for authentication.

Make sure to set these environment variables with the appropriate values in your application's environment configuration. These variables are essential for connecting to your Redis database securely and reliably.

Sample Usage

const secure = require('secure-bff');

let token = 'YOUR_TOKEN';

const execute = async () => { console.log(await secure.validateToken(token)); } execute();

Success Response

Here is a sample success response when using the "secure-bff" package for authentication:

{ "success": true, "data": { "name": "Guest User", "email": "[email protected]", "tenantId": "tenant-2", "customerId": null } }

In the sample response:

"success" indicates the success of the operation.
"data" contains the user information, including name, email, tenant ID, and customer ID.

Error Response

In case of an error during token validation, you might receive an error response like this:

{ "success": false, "errorCode": "internal.server.error", "message": "jwt expired" }

In the error response:

"success" is set to false to indicate the failure.
"errorCode" provides a specific error code, in this case, "internal.server.error."
"message" describes the error in more detail, indicating that the JWT has expired.

Error Codes

Version History

1.0.0 (Release Date: 23 Oct 2023)
    Initial release of the "secure-bff" package.

License

This package is open-source and released under the MIT License. You are free to use, modify, and distribute it according to the terms of the license.

Contributing

Contributions are welcome! If you would like to improve this package, report issues, or suggest new features, please refer to our Contribution Guidelines. Contact

For questions, issues, or feedback, you can contact the maintainers at [email protected].

Contributors: Ankur Mittal Vishu Gupta