mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2025-05-23 16:27:41 +08:00
19 lines
621 B
TypeScript
19 lines
621 B
TypeScript
import { transformBlob } from '~/decrypt-worker/util/transformBlob';
|
|
import type { CryptoBase } from '../CryptoBase';
|
|
import { KGM_SLOT_1_KEY, KGM_TYPE_4_FILE_KEY_EXPANSION_TABLE, KGM_TYPE_4_SLOT_KEY_EXPANSION_TABLE } from './kgm_pc.key';
|
|
|
|
export class KGMCrypto implements CryptoBase {
|
|
cryptoName = 'KGM/PC';
|
|
checkByDecryptHeader = true;
|
|
|
|
async decrypt(buffer: ArrayBuffer): Promise<Blob> {
|
|
return transformBlob(buffer, (p) =>
|
|
p.make.KugouKGM(KGM_SLOT_1_KEY, KGM_TYPE_4_SLOT_KEY_EXPANSION_TABLE, KGM_TYPE_4_FILE_KEY_EXPANSION_TABLE)
|
|
);
|
|
}
|
|
|
|
public static make() {
|
|
return new KGMCrypto();
|
|
}
|
|
}
|