Compare commits

...

5 Commits

Author SHA1 Message Date
Jixun Wu 016daa67a5 fix: bump indirect-dep minimist 2022-05-09 19:27:36 +01:00
Jixun Wu 0b6165ef99 fix: mark binary as executable 2022-05-09 19:27:06 +01:00
Jixun Wu 6031d31ac6 chore: bump version to 0.0.1-R5 2021-12-23 23:08:56 +00:00
Jixun Wu 1dadf19431 fix: return null instead of throw error on unsupported version 2021-12-23 23:08:06 +00:00
Jixun b982f7114c fix: use package name under the expected namespace
- moved package back to `@unlock-music`
2021-12-20 17:36:20 +00:00
7 changed files with 42 additions and 14 deletions

View File

@ -1,3 +1,15 @@
## v0.0.1-R5
### Bug Fix
- Return null instead of throw an error on unsupported file.
## v0.0.1-R4
### Bug Fix
- Change of package name back to `@unlock-music` namespace.
## v0.0.1-R3
### Bug Fix

View File

@ -9,7 +9,7 @@ Joox 加密处理库。
## 安装 & 使用 (Install & Usage)
```sh
npm i --save @unlock-music-gh/joox-crypto
npm i --save @unlock-music/joox-crypto
```
```js

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-gh/joox-crypto",
"name": "@unlock-music/joox-crypto",
"type": "commonjs",
"version": "0.0.1-R3",
"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;