open-index/open-npm huggingface dataset:
npm package: @nivas-inc/payload-encrypt-decrypt
Description: encrypt_decrypt_nivas is a Node.js library for encrypting and decrypting data using AES-128-GCM encryption method
Author: amar potdar
Latest version: 1.0.7

# **payload-encrypt-decrypt**

**payload-encrypt-decrypt** is a Node.js library for encrypting and decrypting data using AES-128-GCM encryption method.

## **Installation**
You can install **payload-encrypt-decrypt** via npm:

npm install payload-encrypt-decrypt

## **Usage**

**Initialization**
const { Encryptor } = require('payload-encrypt-decrypt');

const encryptor = new Encryptor();

**Setting Key**
Before encrypting or decrypting data, you need to set the encryption key using the setKey method:

encryptor.setKey('your_secret_key');

**Encrypting Data**
To encrypt data, use the encryptData method:

const encryptedData = encryptor.encryptData({ key: 'value' });
console.log(encryptedData);

**Decrypting Data**
To decrypt data, use the decryptData method:

const decryptedData = encryptor.decryptData(encryptedData.data);
console.log(decryptedData);

## **API**

- **setKey(key: string): void**: Sets the encryption key.
  - key (string): The encryption key.
- **encryptData(data: any): response**: Encrypts the provided data.
  - data (any): The data to be encrypted.
  - Returns:
    - response (object): An object containing the encrypted data, message, and time.
- **decryptData(data: string): response**: Decrypts the provided data.
  - data (string): The encrypted data to be decrypted.
  - Returns:
    - response (object): An object containing the decrypted data, message, and time.

## **Example**

const { Encryptor } = require('payload-encrypt-decrypt');

const encryptor = new Encryptor();
encryptor.setKey('your_secret_key');

const encryptedData = encryptor.encryptData({ key: 'value' });
console.log(encryptedData);

const decryptedData = encryptor.decryptData(encryptedData.data);
console.log(decryptedData);

## **License**
This project is licensed under the MIT License - see the LICENSE file for details.
npm package: @nivincp/dcli
Description: Simple CLI to query, get, delete, or truncate DynamoDB records using PK/SK.
Author: Nivin
Latest version: 1.0.8

# dcli - DynamoDB CLI Tool

A simple command-line tool to interact with DynamoDB tables.

You can use it to find, get, delete, or clear items from your tables. Useful for development and maintenance.

## Features

- Find all items by partition key
- Get a single item by partition and sort key
- Delete a single item by partition and sort key
- Delete all items with a specific partition key (truncate model)
- Output results as JSON

## Usage

```
Usage:
  dcli <tableName> <mode> <pk> [sk]
  dcli [--version | version]
  dcli [--help | help]

Modes:
  find       Query all items by partition key (optionally filter by sort key prefix)
  get        Fetch a single item by partition key and sort key
  delete     Remove a single item by partition key and sort key
  truncate   Delete all items under a given partition key (optionally filter by sort key prefix)

Arguments:
  tableName  DynamoDB table name (e.g. my-table)
  pk         Partition key (e.g. "users")
  sk         Sort key (required for get/delete; optional prefix for find)

Examples:
  dcli my-table find users
  dcli my-table find users user:
  dcli my-table get users user:01ABCD...
  dcli my-table delete users user:01XYZ...
  dcli my-table truncate users
  dcli --version
```

## Setup

This CLI uses your local AWS credentials. Make sure you have a valid AWS profile configured.

```
export AWS_PROFILE=your-profile-name
```

## Installation

```bash
npm install -g @nivincp/dcli
# or run directly without installing:
npx @nivincp/dcli
```
npm package: @nivinjoseph/kompression
Description: koa compression middleware
Author: Tuan Anh Tran
Latest version: 1.0.2

# Kompression

[![npm](https://img.shields.io/npm/v/kompression.svg)](https://npm.im/kompression)
[![Build Status](https://dev.azure.com/me0499/kompresssion/_apis/build/status/tuananh.kompression?branchName=develop)](https://dev.azure.com/me0499/kompresssion/_build/latest?definitionId=2&branchName=develop)

This is a fork of [koa-compress](https://github.com/koajs/compress) with support for brotli compression.

Because `zlib` and `iltorb` options doesn't have much in common so including support for brotli
would be a breaking change.

I'm trimming down the available options in this package down to just `filter` and `threshold`.

## Example

```js
const compress = require('kompression')
const Koa = require('koa')

const app = new Koa()
app.use(
    compress({
        filter: function(content_type) {
            return /text/i.test(content_type)
        },
        threshold: 2048
    })
)
```

## Options

### filter

An optional function that checks the response content type to decide whether to compress.
By default, it uses [compressible](https://github.com/expressjs/compressible).

### threshold

Minimum response size in bytes to compress.
Default `1024` bytes or `1kb`.

## Manually turning compression on and off

You can always enable compression by setting `this.compress = true`.
You can always disable compression by setting `this.compress = false`.
This bypasses the filter check.

```js
app.use((ctx, next) => {
    ctx.compress = true
    ctx.body = fs.createReadStream(file)
})
```
npm package: @nivinjoseph/n-exception
Description: Library of Exception classes
Author: NiviN
Latest version: 2.0.2

# n-exception

A TypeScript library providing a comprehensive set of exception classes for robust error handling in applications.

## Overview

n-exception is a TypeScript library that extends the standard JavaScript `Error` class to provide a more structured and type-safe way of handling exceptions in your applications. It includes a base `Exception` class and several specialized exception types for common error scenarios.

## Installation

```bash
npm install @nivinjoseph/n-exception
# or
yarn add @nivinjoseph/n-exception
```

## Features

- Base `Exception` class extending JavaScript's `Error`
- Support for inner exceptions (error chaining)
- Type-safe exception handling
- Comprehensive stack trace support
- Common exception types for various scenarios

## Available Exception Types

- `Exception` - Base exception class
- `ApplicationException` - For application-level errors
- `ArgumentException` - For invalid argument errors
- `ArgumentNullException` - For null argument errors
- `InvalidArgumentException` - For invalid argument values
- `InvalidOperationException` - For invalid operation attempts
- `NotImplementedException` - For unimplemented functionality
- `ObjectDisposedException` - For attempts to use disposed objects

## Usage

### Basic Usage

```typescript
import { Exception, ArgumentNullException } from "@nivinjoseph/n-exception";

// Creating a basic exception
const ex = new Exception("Something went wrong");

// Creating an exception with an inner exception
const innerEx = new Error("Original error");
const exWithInner = new Exception("Operation failed", innerEx);

// Using specialized exceptions
function processUser(user: any) {
    if (!user) {
        throw new ArgumentNullException("user");
    }
    // ... rest of the function
}
```

### Error Chaining

```typescript
try {
    // Some operation that might fail
} catch (error) {
    throw new ApplicationException("Failed to process data", error);
}
```

### Custom Exceptions

You can create your own exception types by extending the base `Exception` class:

```typescript
class CustomException extends Exception {
    constructor(message: string, innerException?: Error) {
        super(message, innerException);
    }
}
```

## API Reference

### Exception Class

The base `Exception` class provides the following properties and methods:

- `name`: The name of the exception type
- `message`: The error message
- `innerException`: The inner exception (if any)
- `stack`: The stack trace

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
npm package: @nivinjoseph/n-sec
Description: Security library
Author: NiviN
Latest version: 6.0.3

# n-sec

A comprehensive security library for Node.js applications providing cryptographic operations and API security features.

## Installation

```bash
npm install @nivinjoseph/n-sec
# or
yarn add @nivinjoseph/n-sec
```

## Features

### Cryptographic Operations

1. **Hash**
   - Secure hashing operations using SHA-512
   - Generate hash digests for data
   - Support for salted hashing

2. **HMAC (Hash-based Message Authentication Code)**
   - Generate HMAC signatures using SHA-256

3. **Symmetric Encryption**
   - AES-256-CBC encryption and decryption
   - Secure key generation
   - IV (Initialization Vector) handling

### API Security

1. **JSON Web Tokens (JWT)**
   - JWT creation and validation
   - Support for HMAC algorithm
   - Token expiration handling
   - Claims management

2. **Claims-based Identity**
   - Claims management
   - Identity verification
   - Custom claims support

3. **Security Tokens**
   - Token generation and validation
   - Token expiration handling
   - Invalid token detection

## Usage

### Cryptographic Operations

```typescript
import { Hash, Hmac, SymmetricEncryption } from '@nivinjoseph/n-sec';

// Hashing
const hash = Hash.create('your-data');
const saltedHash = Hash.createUsingSalt('your-data', 'your-salt');

// HMAC
const hmac = Hmac.create('your-secret-key', 'your-data');

// Symmetric Encryption
const key = await SymmetricEncryption.generateKey();
const encrypted = await SymmetricEncryption.encrypt(key, 'your-data');
const decrypted = SymmetricEncryption.decrypt(key, encrypted);
```

### API Security

```typescript
import { JsonWebToken, ClaimsIdentity, Claim, AlgType } from '@nivinjoseph/n-sec';

// Create a claims identity
const claims = [
    new Claim('sub', 'user123'),
    new Claim('role', 'admin')
];

// Create a JWT
const jwt = JsonWebToken.fromClaims(
    'your-issuer',
    AlgType.hmac,
    'your-secret-key',
    Date.now() + 3600000, // 1 hour expiry
    claims
);
const token = jwt.generateToken();

// Verify a JWT
const verifiedJwt = JsonWebToken.fromToken(
    'your-issuer',
    AlgType.hmac,
    'your-secret-key',
    token
);
const verifiedClaims = verifiedJwt.claims;
```

## Error Handling

The library provides specific exception types for error handling:

- `CryptoException`: Base exception for cryptographic operations
- `ExpiredTokenException`: Thrown when a token has expired
- `InvalidTokenException`: Thrown when a token is invalid

## Requirements

- Node.js >= 20.10
- TypeScript support

## Contributing

Feel free to submit issues and pull requests.
For Windows development:
- Build tools => Open PowerShell as admin and run => npm install -g windows-build-tools
- OpenSSL => Go to https://slproweb.com/products/Win32OpenSSL.html => Get version Win64 OpenSSL v1.0.2q

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
npm package: @nivinjoseph/n-task
Description: Task parallelization for frontend and backend using web workers and worker threads
Author: NiviN
Latest version: 2.0.3

# n-task

A TypeScript library for task parallelization in both frontend and backend environments using web workers and worker threads.

## Features

- **Cross-Platform Support**: Works in both frontend (browser) and backend (Node.js) environments
- **Task Parallelization**: Execute multiple tasks concurrently using worker threads
- **Task Pool Management**: Efficient management of worker pools with configurable worker count
- **TypeScript Support**: Full TypeScript support with type definitions
- **Modern JavaScript**: Built with modern JavaScript features and async/await support

## Installation

```bash
npm install @nivinjoseph/n-task
# or
yarn add @nivinjoseph/n-task
```

## Requirements

- Node.js >= 20.10
- TypeScript >= 5.3.3

## Usage

### Frontend (Browser)

```typescript
import { TaskPool } from '@nivinjoseph/n-task/frontend';

// Define your worker class
class MyWorker {
    public async processData(data: any): Promise<any> {
        // Your processing logic here
        return processedData;
    }
}

// Create a task pool with 4 workers
const taskPool = new TaskPool(MyWorker, 4);

// Initialize the workers
await taskPool.initializeWorkers();

// Execute tasks
const result = await taskPool.invoke('processData', { /* your data */ });

// Clean up when done
await taskPool.dispose();
```

### Backend (Node.js)

```typescript
import { TaskPool } from '@nivinjoseph/n-task/backend';

// Define your worker class
class MyWorker {
    public async processData(data: any): Promise<any> {
        // Your processing logic here
        return processedData;
    }
}

// Create a task pool with 4 workers
const taskPool = new TaskPool(MyWorker, 4);

// Initialize the workers
await taskPool.initializeWorkers();

// Execute tasks
const result = await taskPool.invoke('processData', { /* your data */ });

// Clean up when done
await taskPool.dispose();
```

## API Reference

### TaskPool

The main class for managing worker pools.

#### Constructor
```typescript
constructor(taskWorker: Function, count = 1)
```
- `taskWorker`: The worker class to be instantiated
- `count`: Number of workers to create (default: 1)

#### Methods

##### initializeWorkers
```typescript
async initializeWorkers(initializerMethod?: string, ...initializerParams: Array<any>): Promise<void>
```
Initializes the worker pool and optionally calls an initialization method on each worker.

##### invoke
```typescript
async invoke<T>(method: string, ...params: Array<any>): Promise<T>
```
Executes a method on an available worker and returns the result.

##### dispose
```typescript
async dispose(): Promise<void>
```
Cleans up resources and terminates all workers.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## Support

For support, please open an issue in the [GitHub repository](https://github.com/nivinjoseph/n-task/issues).

## License

MIT License - See [LICENSE](LICENSE) file for details.
npm package: @nivite/nelem
Description: Create your own online invitations, the nerdy way.
Author: RockzzA
Latest version: 1.0.45
Deprecated: Deprecated in favor of https://github.com/nesign/niview

# Nelem

`Nivite` - Online invitations, the nerdy way. https://nivite.jrvite.com

This is for non-angular projects, for Angular, use @nivite/nlib