diff --git a/Home.md b/Home.md index 1fc5cd8..d4a7037 100644 --- a/Home.md +++ b/Home.md @@ -1 +1,27 @@ -该百科用于放置 joox 加密相关的信息。 \ No newline at end of file +该百科用于放置 joox 加密相关的信息。 + +--- + +## 安装 + +1. 设定 [`.npmrc`][npmrc],加入 `@unlock-music:registry=https://npm.pkg.github.com`; +2. 安装依赖 `npm i --save @unlock-music/joox-crypto@0.0.1`; + +## 使用 + +参考 [`joox-decrypt`][ref_source]。 + +```js +const jooxFactory = require('@unlock-music/joox-crypto'); + +const data = new Uint8Array(...); +const decryptor = jooxFactory(data, '00000000000000000000000000000000'); +if (!decryptor) throw new Error('不支持的加密方案或不是 joox 加密的文件。'); + +/** @type {Uint8Array[]} */ +const decrypted = decryptor.decryptFile(data); +``` + + +[npmrc]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#installing-a-package +[ref_source]: https://github.com/unlock-music/joox-crypto/blob/main/joox-decrypt