@courierx/shared
v2.0.0
Published
Shared utilities and types for CourierX
Maintainers
Readme
@courierx/shared
Shared utilities and types for CourierX email delivery platform
Installation
npm install @courierx/sharedWhat's Included
- Zod Schemas - Type-safe validation for email requests/responses
- Crypto Utils - Secure hashing and encryption functions
- PII Handling - Email normalization and privacy protection
- Constants - Shared enums and configuration
Quick Usage
import { SendRequest, hashApiKey, normalizeEmail } from '@courierx/shared';
// Type-safe email request
const request: SendRequest = {
to: ['[email protected]'],
from: '[email protected]',
subject: 'Hello World',
html: '<p>Hello from CourierX!</p>'
};
// Hash API key for storage
const hashedKey = hashApiKey('your-api-key');
// Normalize email addresses
const normalized = normalizeEmail('[email protected]');
// → '[email protected]'API Reference
Types
SendRequest- Email request schemaSendResponse- Email response schemaWebhookEvent- Webhook event schema
Functions
hashApiKey(key: string): Buffer- Hash API keysencryptData(data: string, key: string): string- Encrypt datanormalizeEmail(email: string): string- Normalize emailshashEmail(email: string): string- Hash emails for privacy
License
MIT