open-index/open-npm huggingface dataset:
npm package: @pitech-lib/cipher-kit
Description: An encryption decryption tool-kit
Author: PiTech
Latest version: 1.0.3

# 🔐 @pitech-lib/cipher-kit

A secure and reusable encryption module for NestJS microservices, using **AES-256-GCM**. Can be used as a **global module** or as a **direct service provider**.

---

## 📦 Installation

```bash
npm install @pitech-lib/cipher-kit
```
---

## Setup
### Option 1: Use as a Global Module (recommended)
Since `CipherModule` is marked with `@Global()`, importing it once in your root module makes it available app-wide:

```ts
// app.module.ts
import { Module } from '@nestjs/common';
import { CipherModule } from '@pitech-lib/cipher-kit';

@Module({
  imports: [CipherModule],
})
export class AppModule {}
```

### Option 2: Use as a Provider Manually (optional)
```ts
// your.module.ts
import { Module } from '@nestjs/common';
import { CipherService } from '@pitech-lib/cipher-kit';

@Module({
  providers: [CipherService],
})
export class YourModule {}
```

and in your service:
```ts
@Injectable()
export class TenantService {
  constructor(private readonly cipherService: CipherService) {}

  handleEncryption() {
    const key = this.configService.get<string>('CIPHER_KEY');
    const plain = 'sk_live_123abc';

    const encrypted = this.cipherService.encrypt(plain, key);
    const decrypted = this.cipherService.decrypt(encrypted, key);

  }
}
```