open-index/open-npm huggingface dataset:
npm package: @qazi9amaan/sudo-next
Description: Next JS Custom Authentication
Author: qazi9amaan
Latest version: 11.0.0-beta

Secure, Modular, and Scalable Authentication System
This repository contains the implementation of a secure, modular, and scalable authentication system designed to work seamlessly with Next.js (client and server) and Express.js. The system focuses on:

Authentication: Validating user credentials (e.g., via OTP) and generating secure session tokens.
Session Management: Centralized session storage using Redis with token-based stateless validation for Next.js and Redis-backed validation for Express.js.
Cookie Handling: Securely setting, updating, and deleting cookies containing session metadata and tokens.
Authorization: access control and session cookie validation.

Design Overview
Adapter: Acts as the source of truth for session data. Backend systems validate and update session data stored via adapter.
iron-session: Handles encrypted cookies for Next.js, providing session data directly from cookies for efficient client-side validation.
Integration: Synchronization between session cookies (iron-session) and Adapter ensures up-to-date data for every client and backend request.

System Flow

1. Login Flow:
   User logs in → Session is created via adapter → Encrypted session token is set in a cookie using iron-session.
2. Request Validation:
   Next.js Middleware: Decrypts and validates the session cookie directly.
   Express Middleware: Decrypts the session cookie and cross-validates it with Adapter.

3. Session Update Flow:
   When session data changes, Adapter updates the session.
   Updated session data is synchronized with the client cookie via iron-session.

4. Logout Flow:
   Session is deleted via Adapter.
   The session cookie is cleared via iron-session.
npm package: @qb-soft/useful
Description: A library containing useful functions to work with Object, Strings, Arrays and more.
Author: Qarun Qadir Bissoondial
Latest version: 0.2.8

# Useful

![npm](https://img.shields.io/npm/dm/@qb-soft/useful)
![NPM](https://img.shields.io/npm/l/@qb-soft/useful) ![Functions](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg)

A library containing useful functions to work with Object, Strings, Arrays and more

## Installation 

Run `npm install @qb-soft/useful@latest --save`

## Usage

There are currently 4 major categories of useful functions:

- Objects
- Arrays
- Strings
- Numbers

For a regular JavaScript project, simply require the functions you need directly.

```
const { selectRandomlyFromArray } = require('@qb-soft/useful/arrays'); // import array function
const { removeFalsyValues } = require('@qb-soft/useful/objects'); // import object function

const arrayFunctions = require('@qb-soft/useful/arrays'); // import all array functions
```

Imports for TypeScript projects work as they normally do as well.

```
import { selectRandomlyFromArray } from '@qb-soft/useful/arrays'; 
import * as arrayFunctions from '@qb-soft/useful/arrays';
```

You can find the full developer documentation <u> [here](https://qb-soft.github.io/useful/) </u>


## Testing

Tests are written in jest and can be found in the tests folder. Each category will have it's own testing file. 

Test files are named by their category. For example, all tests for array functions will go inside `arrays.spec.ts`. General structure for writing tests is: 

```
// Each function gets its own describe block
describe('Function name', () => {

    it('test scenario 1', () => {
        // test code goes here
    });

    it('test scenario 2', () => {
        // test code goes here
    });

    ...

})

```

Clone the repository and run `npm run test:local`. A coverage report is automatically generated.