import * as crypto from "crypto" ; export function chachaEncrypt ( key , iv , data ) { const cipher = crypto . createCipheriv ( "chacha20" as any , key , iv ) ; return cipher . update ( data ) ; } export function chachaDecrypt ( key , iv , cipher ) { const decipher = crypto . createDecipheriv ( "chacha20" as any , key , iv ) ; return decipher . update ( cipher ) ; }