CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB Recovery Status: - Successfully recovered brainy.ts from compiled JavaScript - All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.) - Neural subsystem intact (562KB embedded patterns, NLP working) - Augmentation pipeline operational (20+ augmentations) - HNSW clustering system complete - Triple Intelligence compiled (needs constructor fix) - Test suite validates functionality Changes preserved: - 898 files with changes from last 3 days - 144,475 insertions - All augmentation improvements - All test coverage enhancements - Complete v3.0 feature set This is a LOCAL checkpoint only - contains recovered work after corruption incident. Created backup in .backups/brainy-full-20250910-151314.tar.gz Branch: recovery-checkpoint-20250910-151433 Date: Wed Sep 10 03:18:04 PM PDT 2025
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
/**
|
|
* Security API for Brainy 3.0
|
|
* Provides encryption, decryption, hashing, and secure storage
|
|
*/
|
|
export declare class SecurityAPI {
|
|
private config?;
|
|
private encryptionKey?;
|
|
constructor(config?: {
|
|
encryptionKey?: string;
|
|
} | undefined);
|
|
/**
|
|
* Encrypt data using AES-256-CBC
|
|
*/
|
|
encrypt(data: string): Promise<string>;
|
|
/**
|
|
* Decrypt data encrypted with encrypt()
|
|
*/
|
|
decrypt(encryptedData: string): Promise<string>;
|
|
/**
|
|
* Create a one-way hash of data (for passwords, etc)
|
|
*/
|
|
hash(data: string, algorithm?: 'sha256' | 'sha512'): Promise<string>;
|
|
/**
|
|
* Compare data with a hash (for password verification)
|
|
*/
|
|
compare(data: string, hash: string, algorithm?: 'sha256' | 'sha512'): Promise<boolean>;
|
|
/**
|
|
* Generate a secure random token
|
|
*/
|
|
generateToken(bytes?: number): Promise<string>;
|
|
/**
|
|
* Derive a key from a password using PBKDF2
|
|
* Note: Simplified version using hash instead of PBKDF2 which may not be available
|
|
*/
|
|
deriveKey(password: string, salt?: string, iterations?: number): Promise<{
|
|
key: string;
|
|
salt: string;
|
|
}>;
|
|
/**
|
|
* Sign data with HMAC
|
|
*/
|
|
sign(data: string, secret?: string): Promise<string>;
|
|
/**
|
|
* Verify HMAC signature
|
|
*/
|
|
verify(data: string, signature: string, secret: string): Promise<boolean>;
|
|
private hexToBytes;
|
|
private bytesToHex;
|
|
private constantTimeCompare;
|
|
}
|