mpesalib
Version:
A robust Node.js library for Safaricom's Daraja API with complete TypeScript support and modern async/await patterns
44 lines • 1.39 kB
TypeScript
import { MpesaConfig } from '../types';
export declare class MpesaUtils {
/**
* Generate timestamp in the format YYYYMMDDHHMMSS
*/
static generateTimestamp(): string;
/**
* Generate password for STK Push
*/
static generatePassword(shortCode: string, passkey: string, timestamp: string): string;
/**
* Generate security credential by encrypting the initiator password with the certificate
*/
static generateSecurityCredential(initiatorPassword: string, certificatePath: string): string;
/**
* Format phone number to international format (254XXXXXXXX)
*/
static formatPhoneNumber(phoneNumber: string): string;
/**
* Get base URL for the environment
*/
static getBaseUrl(environment: 'sandbox' | 'production'): string;
/**
* Validate configuration
*/
static validateConfig(config: MpesaConfig): void;
/**
* Generate transaction reference
*/
static generateTransactionRef(prefix?: string): string;
/**
* Sanitize callback data
*/
static sanitizeCallbackData(data: any): any;
/**
* Mask phone number for logging
*/
private static maskPhoneNumber;
/**
* Retry mechanism for API calls
*/
static retry<T>(operation: () => Promise<T>, maxRetries?: number, delay?: number): Promise<T>;
}
//# sourceMappingURL=index.d.ts.map