feat: added support for QMCv2 (#11)

This commit is contained in:
鲁树人
2023-05-14 23:15:59 +01:00
parent 08c082ec2c
commit 8ab267019c
5 changed files with 44 additions and 14 deletions

View File

@@ -0,0 +1,3 @@
export const SEED = 106;
export const ENC_V2_KEY_1 = '386ZJY!@#*$%^&)(';
export const ENC_V2_KEY_2 = '**#!(#$%&^a1cZ,T';

View File

@@ -0,0 +1,17 @@
import { transformBlob } from '~/decrypt-worker/util/transformBlob';
import type { CryptoBase } from '../CryptoBase';
import { SEED, ENC_V2_KEY_1, ENC_V2_KEY_2 } from './qmc_v2.key.ts';
export class QMC2Crypto implements CryptoBase {
hasSignature(): boolean {
return false;
}
async isSupported(): Promise<boolean> {
return true;
}
async decrypt(blob: Blob): Promise<Blob> {
return transformBlob(blob, (p) => p.make.QMCv2(p.make.QMCv2FooterParser(SEED, ENC_V2_KEY_1, ENC_V2_KEY_2)));
}
}