shora-ai-payment-sdk
Version:
The first open-source payment SDK designed specifically for AI agents and chatbots - ACP Compatible
79 lines • 2.5 kB
TypeScript
/**
* Security Enhancement Module for Shora AI Payment SDK
* AES-256 encryption, audit logging, and tenant security
*/
export interface AuditLogEntry {
timestamp: string;
tenantId: string;
transactionId?: string;
action: string;
userId?: string;
agentId?: string;
amount?: number;
currency?: string;
status: 'success' | 'failed' | 'pending';
metadata?: Record<string, any>;
ipAddress?: string;
userAgent?: string;
}
export interface EncryptedToken {
encrypted: string;
iv: string;
salt: string;
timestamp: number;
}
export interface SecurityConfig {
encryptionKey: string;
auditLogEndpoint?: string;
enableAuditLogging?: boolean;
tenantId: string;
}
export declare class SecurityEnhancement {
private config;
private auditLogs;
constructor(config: SecurityConfig);
/**
* Encrypt sensitive token using AES-256
* Production-tested for enterprise security requirements
*/
encryptToken(token: string, additionalData?: string): EncryptedToken;
/**
* Decrypt token with tenant validation
* Ensures tenant isolation for multi-tenant security
*/
decryptToken(encryptedToken: EncryptedToken): string | null;
/**
* Log audit entry with tenant isolation
* JSON format for compliance and monitoring
*/
logAudit(action: string, details: string, transactionId?: string, userId?: string, agentId?: string, amount?: number, currency?: string, status?: 'success' | 'failed' | 'pending', metadata?: Record<string, any>): void;
/**
* Get all audit logs for tenant
* Filtered by tenant ID for security
*/
getAuditLogs(startDate?: string, endDate?: string, action?: string): AuditLogEntry[];
/**
* Generate secure payment token
* Combines encryption with audit logging
*/
generateSecurePaymentToken(paymentData: {
amount: number;
currency: string;
userId: string;
agentId?: string;
}): EncryptedToken;
/**
* Validate payment token with audit trail
*/
validatePaymentToken(encryptedToken: EncryptedToken): {
valid: boolean;
data?: any;
error?: string;
};
private sendAuditLog;
private getClientIP;
private getUserAgent;
}
export declare function createSecurityEnhancement(config: SecurityConfig): SecurityEnhancement;
export declare function generateEncryptionKey(): string;
//# sourceMappingURL=security_enhance.d.ts.map