0.0.5 • Published 5 months ago
botpacktest v0.0.5
BotPackTest
A TypeScript utility package for secure API key encryption and management.
Installation
npm install botpacktest
Usage
import { saveEncryptedApiKey, retriveEncryptedApiKey } from 'botpacktest';
// Encrypt and save an API key
saveEncryptedApiKey('myKeyIdentifier', 'mySecretKey', 'api_key_to_encrypt');
// Retrieve and decrypt an API key
retriveEncryptedApiKey('myKeyIdentifier', 'mySecretKey');
Features
- Secure API key encryption using XOR cipher
- Base64 encoding for safe storage
- TypeScript support with type definitions
- Simple API for encryption and decryption
- Built-in error handling
API Reference
saveEncryptedApiKey(keyValue: string, secret: string, apikey: string): void
Encrypts and saves an API key.
Parameters:
keyValue
(string): Identifier for the API keysecret
(string): Secret key used for encryptionapikey
(string): The API key to encrypt
retriveEncryptedApiKey(keyValue: string, secret: string): void
Retrieves and decrypts an API key.
Parameters:
keyValue
(string): Identifier for the encrypted API keysecret
(string): Secret key used for decryption (must match encryption key)
Security Note
This package uses XOR cipher with Base64 encoding. While suitable for basic encryption needs, consider using more robust encryption methods for highly sensitive data.