diff --git a/joox-decrypt b/joox-decrypt index d641920..2e89753 100644 --- a/joox-decrypt +++ b/joox-decrypt @@ -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"); diff --git a/src/index.js b/src/index.js index 20ef3a5..33eeb8c 100644 --- a/src/index.js +++ b/src/index.js @@ -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");