ssr-web-avo-inspector
Version:
Avo Inspector for web with SSR and web workers support
32 lines (31 loc) • 1.17 kB
TypeScript
/**
* Generates a new ECC key pair for encryption/decryption.
* Uses P-256 (prime256v1 / NIST P-256) curve.
*
* @returns An object containing the private and public keys as hex strings
*/
export declare function generateKeyPair(): {
privateKey: string;
publicKey: string;
};
/**
* Encrypts a value using ECC public key encryption (ECIES).
*
* ECIES uses hybrid encryption (ECDH + AES-256-GCM).
*
* Wire format:
* [Version 0x00 (1B)] [EphemeralPubKey (65B)] [IV (16B)] [AuthTag (16B)] [Ciphertext]
*
* @param value - The value to encrypt (any type - will be JSON stringified)
* @param publicKey - The ECC public key in hex format
* @returns Promise resolving to base64-encoded encrypted string
*/
export declare function encryptValue(value: any, publicKey: string): Promise<string>;
/**
* Decrypts a value that was encrypted with encryptValue.
*
* @param encryptedValue - The base64-encoded encrypted string
* @param privateKey - The ECC private key in hex format
* @returns Promise resolving to the original decrypted value (parsed from JSON)
*/
export declare function decryptValue(encryptedValue: string, privateKey: string): Promise<any>;