averox-sdk-secure
Version:
Real-time SDK for key monitoring, secure messaging, and A/V streaming with encryption
78 lines (77 loc) • 2.54 kB
TypeScript
/**
* Encryption class providing end-to-end encryption (E2EE) operations
* Implements AES-256-GCM with proper IV handling, key derivation, and perfect forward secrecy
*/
export declare class Encryption {
private readonly ec;
private readonly SALT_LENGTH;
private readonly IV_LENGTH;
private readonly KEY_LENGTH;
private readonly TAG_LENGTH;
private readonly ITERATIONS;
/**
* Creates a new instance of the Encryption class
*/
constructor();
/**
* Derives a secure encryption key using PBKDF2
* @param password - The password to derive the key from
* @param salt - The salt to use for key derivation
* @returns The derived key
*/
private deriveKey;
/**
* Encrypts data using AES-256-GCM with proper IV handling
* @param data - The data to encrypt
* @param key - The encryption key
* @returns Object containing encrypted data, IV, and salt
*/
encryptData(data: string, key: string): {
encrypted: string;
iv: string;
salt: string;
tag: string;
};
/**
* Decrypts data using AES-256-GCM
* @param encryptedData - The encrypted data object
* @param key - The decryption key
* @returns The decrypted data
*/
decryptData(encryptedData: {
encrypted: string;
iv: string;
salt: string;
tag: string;
}, key: string): string;
/**
* Generates a secure ECDSA key pair with perfect forward secrecy
* @returns Object containing public and private keys
*/
generateECDSAKeyPair(): {
publicKey: string;
privateKey: string;
};
/**
* Signs data using ECDSA with deterministic k-value
* @param data - The data to sign
* @param privateKey - The private key to use for signing
* @returns The signature
*/
signData(data: string, privateKey: string): string;
/**
* Verifies an ECDSA signature
* @param data - The original data
* @param signature - The signature to verify
* @param publicKey - The public key to use for verification
* @returns Whether the signature is valid
*/
verifySignature(data: string, signature: string, publicKey: string): boolean;
/**
* Implements quantum-resistant encryption using CRYSTALS-Kyber
* @param data - The data to encrypt
* @param publicKey - The recipient's public key
* @returns The encrypted data
*/
quantumResistantEncrypt(data: string, publicKey: string): string;
}