open-index/open-npm huggingface dataset:
npm package: @sudharshan98/auth
Description: This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0.
Latest version: 0.0.2

# Auth

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0.

## Code scaffolding

Run `ng generate component component-name --project auth` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project auth`.
> Note: Don't forget to add `--project auth` or else it will be added to the default project in your `angular.json` file. 

## Build

Run `ng build auth` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build auth`, go to the dist folder `cd dist/auth` and run `npm publish`.

## Running unit tests

Run `ng test auth` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
npm package: @sudharshan98/login
Description: This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0.
Latest version: 0.0.2

# Login

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0.

## Code scaffolding

Run `ng generate component component-name --project login` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project login`.
> Note: Don't forget to add `--project login` or else it will be added to the default project in your `angular.json` file. 

## Build

Run `ng build login` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build login`, go to the dist folder `cd dist/login` and run `npm publish`.

## Running unit tests

Run `ng test login` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
npm package: @sudhi_s_developer_123/communicate-server
Description: Official SDK for communicating with Our API
Latest version: 0.0.1

# @sudhi_s_developer_123/communicate-server

Official SDK for communicating with Our API. Modern, lightweight, and zero-dependency, featuring a **Secret Hashing** architecture for enhanced security.

## Installation

```bash
npm install @sudhi_s_developer_123/communicate-server
```

## Key Management

The SDK provides a utility to generate secure API credentials. In this model, the **Server** only needs to store a **hash** of the secret, while the **Client** uses the **raw** secret.

```typescript
import { generateKeyPair } from "@sudhi_s_developer_123/communicate-server";

const { apiKey, apiSecret, secretHash } = generateKeyPair();

console.log(`API Key (Public): ${apiKey}`); // e.g. sk_...
console.log(`API Secret (Client-side usage): ${apiSecret}`); // e.g. ss_...
console.log(`Secret Hash (Server-side storage): ${secretHash}`);
```

---

## Client Usage

The `ApiClient` is used to make secure, signed requests. It uses the raw `apiSecret` and automatically derives the HMAC key for signing.

### Initializing the Client

```typescript
import { 
  ApiClient, 
  asApiKey, 
  asApiSecret, 
  asBaseURL 
} from "@sudhi_s_developer_123/communicate-server";

const client = new ApiClient({
  apiKey: asApiKey("sk_your-api-key"),
  apiSecret: asApiSecret("ss_your-raw-api-secret"),
  baseURL: asBaseURL("https://api.yourcompany.com"),
  serverSecret: asServerSecret("optional-server-side-secret"),
  timeout: 5000,
});
```

### Making Requests

```typescript
// GET Request
const user = await client.get("/users/me");

// POST Request
const newItem = await client.post("/items", { name: "New Product" });
```

---

## Server Usage

The `ApiServer` is used to verify incoming requests. For maximum security, the server initialized with the **Secret Hash**, never needing to know the original raw secret.

### Initializing the Server

```typescript
import { ApiServer, asSecretHash } from "@sudhi_s_developer_123/communicate-server";

const server = new ApiServer({
  serverSecret: asServerSecret("optional-server-side-secret"),
  tolerance: 300000, // 5 minutes drift allowed (default)
});
```

### Verifying a Request

```typescript
const verification = server.verifyRequest({
  signature: req.headers["x-signature"],
  timestamp: req.headers["x-timestamp"],
  requestId: req.headers["x-request-id"],
  body: JSON.stringify(req.body),
  secretHash: asSecretHash("your-stored-secret-hash"),
});

if (verification.isValid) {
  console.log("Request verified! Securely authenticated.");
} else {
  console.error(`Verification failed: ${verification.error}`);
}
```

## Features

- **🛡️ Secret Hashing**: Server-side storage of secrets is limited to SHA-256 hashes.
- **🛡️ Type-Safe**: Branded types prevent mixing up sensitive strings like keys and secrets.
- **🚀 Lightweight**: Zero runtime dependencies, utilizing native `fetch` and `crypto`.
- **💻 Modern**: Built with TypeScript and supports ESM and CJS.