[wasm] fix: decode ekey before decryption
This commit is contained in:
parent
5de74ba6c3
commit
d989b15582
@ -19,7 +19,8 @@ impl JsQMC2 {
|
||||
/// Create a new QMC2 (mgg/mflac) cipher instance.
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(ekey: &str) -> Result<JsQMC2, JsError> {
|
||||
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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user