Compare commits

...

4 Commits

6 changed files with 34 additions and 12 deletions

View File

@ -1,3 +1,9 @@
## v0.0.1-R5
### Bug Fix
- Return null instead of throw an error on unsupported file.
## v0.0.1-R4
### Bug Fix

0
joox-decrypt Normal file → Executable file
View File

20
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "joox-crypto",
"version": "1.0.0",
"name": "@unlock-music/joox-crypto",
"version": "0.0.1-R5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "joox-crypto",
"version": "1.0.0",
"name": "@unlock-music/joox-crypto",
"version": "0.0.1-R5",
"license": "MIT",
"dependencies": {
"crypto-js": "^4.1.1"
@ -3338,9 +3338,9 @@
}
},
"node_modules/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/ms": {
@ -6944,9 +6944,9 @@
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"ms": {

View File

@ -1,7 +1,7 @@
{
"name": "@unlock-music/joox-crypto",
"type": "commonjs",
"version": "0.0.1-R4",
"version": "0.0.1-R5",
"description": "Crypto library to decrypt joox encrypted music files.",
"main": "src/index.js",
"types": "src/index.d.ts",

View File

@ -0,0 +1,16 @@
const DecryptorV4 = require("../crypto/DecryptorV4");
const jooxFactory = require("../index");
describe("package entry", () => {
it("should return null on unsupported file", () => {
const input = Buffer.from("E!99........", "utf-8");
const decryptor = jooxFactory(input, "".padStart(32, "0"));
expect(decryptor).toBeNull();
});
it("should return an encryptor on v4 magic file", () => {
const input = Buffer.from("E!04........", "utf-8");
const decryptor = jooxFactory(input, "".padStart(32, "0"));
expect(decryptor).toBeInstanceOf(DecryptorV4);
});
});

View File

@ -5,7 +5,7 @@ function jooxFactory(fileBody, seed) {
return new DecryptorV4(seed);
}
throw new Error("input file not supported or invalid");
return null;
}
module.exports = jooxFactory;