fix: use jooxFactory for decryption

- Fix factory unable to create new instance of drcryptor
This commit is contained in:
鲁树人 2021-12-19 18:42:05 +00:00
parent 6154a75017
commit 29a1fe4baf
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node
const DecryptorV4 = require("./src/crypto/DecryptorV4");
const jooxFactory = require(".");
const fs = require("fs");
if (process.argv.length < 5) {
@ -12,7 +12,7 @@ if (process.argv.length < 5) {
const [, , uuid, inputPath, outputPath] = process.argv;
const inputBuffer = fs.readFileSync(inputPath);
const decryptor = new DecryptorV4(uuid);
const decryptor = jooxFactory(inputBuffer, uuid);
const result = decryptor.decryptFile(inputBuffer);
const outputHandle = fs.openSync(outputPath, "w");

View File

@ -2,7 +2,7 @@ const DecryptorV4 = require("./crypto/DecryptorV4");
function jooxFactory(fileBody, seed) {
if (DecryptorV4.detect(fileBody)) {
return DecryptorV4(seed);
return new DecryptorV4(seed);
}
throw new Error("input file not supported or invalid");