UNPKG

@codai/cbd

Version:

Codai Better Database - High-Performance Vector Memory System with HPKV-inspired architecture and MCP server

84 lines 2.13 kB
/** * CBD Enterprise - Security Management * * TypeScript interface for the Rust-based CBD security system * Provides authentication, authorization, and encryption capabilities */ export interface SecurityConfig { jwtSecret: string; sessionTimeout: number; enableOAuth2: boolean; enableLDAP: boolean; encryptionKey: string; requireTLS: boolean; } export interface AuthToken { token: string; expiresAt: Date; userId: string; permissions: string[]; } export interface User { id: string; username: string; email: string; roles: string[]; permissions: string[]; createdAt: Date; lastLogin?: Date; } export interface SecurityContext { user?: User; token?: AuthToken; ipAddress: string; userAgent: string; timestamp: Date; } /** * CBD Security Manager * * Manages authentication, authorization, and encryption for CBD */ export declare class CBDSecurityManager { private config; private isInitialized; constructor(config: SecurityConfig); /** * Initialize the security manager */ initialize(): Promise<void>; /** * Authenticate user with username/password */ authenticate(username: string, password: string): Promise<AuthToken | null>; /** * Validate an authentication token */ validateToken(token: string): Promise<SecurityContext | null>; /** * Check if user has specific permission */ hasPermission(context: SecurityContext, permission: string): Promise<boolean>; /** * Encrypt sensitive data */ encrypt(data: string): Promise<string>; /** * Decrypt sensitive data */ decrypt(encryptedData: string): Promise<string>; /** * Generate JWT token (mock implementation) */ private generateJWT; /** * Decode JWT token (mock implementation) */ private decodeJWT; /** * Generate audit log entry */ auditLog(context: SecurityContext, action: string, resource: string, success: boolean): Promise<void>; } export default CBDSecurityManager; //# sourceMappingURL=security.d.ts.map