//#region src/cipher.d.ts interface CipherOptions { randomBytes?: (size: number) => Uint8Array; } declare class Cipher { #private; private constructor(); static generateSalt(length?: number): Uint8Array; /** * Create a Cipher from a password using HKDF-SHA256 key derivation. * * QuickJS limitation: PBKDF2/scrypt are preferred for password-based KDFs * but their iteration count causes script timeouts in Minecraft Bedrock * Script API. HKDF is used as a lightweight alternative — suitable here * because communication is confined to the local game instance (no remote * brute-force exposure). The salt parameter is REQUIRED for security; * when omitted, a fixed default salt is used (NOT recommended). */ static fromPassword(password: string, salt?: string | Uint8Array, options?: CipherOptions): Cipher; static fromKey(key: Uint8Array, options?: CipherOptions): Cipher; /** * Encrypt a plaintext string. * Returns the ciphertext as a base64-encoded string. * @param plain - UTF-8 plaintext to encrypt */ encrypt(plain: string): string; /** * Decrypt a base64-encoded ciphertext. * Returns the original plaintext string. * @param cipher - Base64-encoded ciphertext to decrypt */ decrypt(cipher: string): string; } //#endregion export { Cipher, type CipherOptions };