diff --git a/src/decrypt-worker/crypto/qmc/qmc_v2.ts b/src/decrypt-worker/crypto/qmc/qmc_v2.ts index c39234a..6996802 100644 --- a/src/decrypt-worker/crypto/qmc/qmc_v2.ts +++ b/src/decrypt-worker/crypto/qmc/qmc_v2.ts @@ -4,6 +4,7 @@ import type { DecryptCommandOptions } from '~/decrypt-worker/types.ts'; import { SEED, ENC_V2_KEY_1, ENC_V2_KEY_2 } from './qmc_v2.key.ts'; import { fetchParakeet } from '@jixun/libparakeet'; import { stringToUTF8Bytes } from '~/decrypt-worker/util/utf8Encoder.ts'; +import { makeQMCv2KeyCrypto } from '~/decrypt-worker/util/qmc2KeyCrypto.ts'; export class QMC2Crypto implements CryptoBase { cryptoName = 'QMC/v2'; @@ -38,7 +39,7 @@ export class QMC2CryptoWithKey implements CryptoBase { const parakeet = await fetchParakeet(); const key = stringToUTF8Bytes(options.qmc2Key); - const keyCrypto = parakeet.make.QMCv2KeyCrypto(SEED, ENC_V2_KEY_1, ENC_V2_KEY_2); + const keyCrypto = makeQMCv2KeyCrypto(parakeet); return transformBlob(buffer, (p) => p.make.QMCv2EKey(key, keyCrypto), { parakeet, cleanup: () => keyCrypto.delete(), diff --git a/src/decrypt-worker/util/qmc2KeyCrypto.ts b/src/decrypt-worker/util/qmc2KeyCrypto.ts new file mode 100644 index 0000000..7f534ee --- /dev/null +++ b/src/decrypt-worker/util/qmc2KeyCrypto.ts @@ -0,0 +1,4 @@ +import type { Parakeet } from '@jixun/libparakeet'; +import { SEED, ENC_V2_KEY_1, ENC_V2_KEY_2 } from '../crypto/qmc/qmc_v2.key'; + +export const makeQMCv2KeyCrypto = (p: Parakeet) => p.make.QMCv2KeyCrypto(SEED, ENC_V2_KEY_1, ENC_V2_KEY_2);