fix: use jooxFactory for decryption
- Fix factory unable to create new instance of drcryptor
This commit is contained in:
parent
6154a75017
commit
29a1fe4baf
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const DecryptorV4 = require("./src/crypto/DecryptorV4");
|
const jooxFactory = require(".");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
if (process.argv.length < 5) {
|
if (process.argv.length < 5) {
|
||||||
@ -12,7 +12,7 @@ if (process.argv.length < 5) {
|
|||||||
|
|
||||||
const [, , uuid, inputPath, outputPath] = process.argv;
|
const [, , uuid, inputPath, outputPath] = process.argv;
|
||||||
const inputBuffer = fs.readFileSync(inputPath);
|
const inputBuffer = fs.readFileSync(inputPath);
|
||||||
const decryptor = new DecryptorV4(uuid);
|
const decryptor = jooxFactory(inputBuffer, uuid);
|
||||||
const result = decryptor.decryptFile(inputBuffer);
|
const result = decryptor.decryptFile(inputBuffer);
|
||||||
const outputHandle = fs.openSync(outputPath, "w");
|
const outputHandle = fs.openSync(outputPath, "w");
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ const DecryptorV4 = require("./crypto/DecryptorV4");
|
|||||||
|
|
||||||
function jooxFactory(fileBody, seed) {
|
function jooxFactory(fileBody, seed) {
|
||||||
if (DecryptorV4.detect(fileBody)) {
|
if (DecryptorV4.detect(fileBody)) {
|
||||||
return DecryptorV4(seed);
|
return new DecryptorV4(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error("input file not supported or invalid");
|
throw new Error("input file not supported or invalid");
|
||||||
|
Loading…
Reference in New Issue
Block a user