From d989b15582e0b9a381b0c388a23345c1d063e164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sun, 15 Sep 2024 15:42:15 +0100 Subject: [PATCH] [wasm] fix: decode ekey before decryption --- um_wasm/src/exports/qmc.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/um_wasm/src/exports/qmc.rs b/um_wasm/src/exports/qmc.rs index 098f897..43219bf 100644 --- a/um_wasm/src/exports/qmc.rs +++ b/um_wasm/src/exports/qmc.rs @@ -19,7 +19,8 @@ impl JsQMC2 { /// Create a new QMC2 (mgg/mflac) cipher instance. #[wasm_bindgen(constructor)] pub fn new(ekey: &str) -> Result { - let cipher = QMCv2Cipher::new(ekey.as_bytes()).map_err(map_js_error)?; + let key = umc_qmc::ekey::decrypt(ekey).map_err(map_js_error)?; + let cipher = QMCv2Cipher::new(key).map_err(map_js_error)?; Ok(JsQMC2(cipher)) }