open-l2encdec 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -16
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.web.d.ts +7 -0
- package/dist/index.web.d.ts.map +1 -0
- package/dist/index.web.js +29 -0
- package/dist/index.web.js.map +1 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,7 +15,10 @@ $ pnpm add open-l2encdec
|
|
|
15
15
|
### TypeScript / ES Modules
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
+
// node
|
|
18
19
|
import { initL2EncDec, encode, decode, initParams } from 'open-l2encdec';
|
|
20
|
+
// browser
|
|
21
|
+
import { initL2EncDec, encode, decode, initParams } from 'open-l2encdec/web';
|
|
19
22
|
|
|
20
23
|
const module = await initL2EncDec();
|
|
21
24
|
|
|
@@ -26,24 +29,8 @@ const encoded = await encode(input, params, module);
|
|
|
26
29
|
const decoded = await decode(encoded, params, module);
|
|
27
30
|
```
|
|
28
31
|
|
|
29
|
-
### JavaScript / CommonJS
|
|
30
|
-
|
|
31
|
-
```javascript
|
|
32
|
-
const { initL2EncDec, encode, decode, initParams } = require('open-l2encdec');
|
|
33
|
-
|
|
34
|
-
(async () => {
|
|
35
|
-
const module = await initL2EncDec();
|
|
36
|
-
const params = await initParams(111);
|
|
37
|
-
const input = new Uint8Array([1, 2, 3, 4, 5]);
|
|
38
|
-
const encoded = await encode(input, params, module);
|
|
39
|
-
const decoded = await decode(encoded, params, module);
|
|
40
|
-
})();
|
|
41
|
-
```
|
|
42
|
-
|
|
43
32
|
## API Reference
|
|
44
33
|
|
|
45
|
-
### Functions
|
|
46
|
-
|
|
47
34
|
#### `initL2EncDec(): Promise<MainModule>`
|
|
48
35
|
|
|
49
36
|
Initializes and returns the l2encdec WASM module. The module is cached, so subsequent calls return the same instance.
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ let cachedModule;
|
|
|
2
2
|
async function loadModule() {
|
|
3
3
|
if (cachedModule)
|
|
4
4
|
return cachedModule;
|
|
5
|
-
|
|
6
|
-
const mod = await import(
|
|
5
|
+
// @ts-ignore - generated file
|
|
6
|
+
const mod = await import("./l2encdec.node.js");
|
|
7
7
|
cachedModule = (await mod.default());
|
|
8
8
|
return cachedModule;
|
|
9
9
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgBA,IAAI,YAAoC,CAAC;AAEzC,KAAK,UAAU,UAAU;IACvB,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgBA,IAAI,YAAoC,CAAC;AAEzC,KAAK,UAAU,UAAU;IACvB,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,8BAA8B;IAC9B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC/C,YAAY,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,EAAE,CAAe,CAAC;IACnD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAA4B,EAC5B,MAAc,EACd,MAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,UAAU,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,YAAY,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAA4B,EAC5B,MAAc,EACd,MAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,UAAU,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,YAAY,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAgB,EAChB,QAAiB,EACjB,sBAAgC,EAChC,MAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,UAAU,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC,CAAC,WAAW,CACX,MAAM,EACN,QAAQ,EACR,QAAQ,IAAI,EAAE,EACd,sBAAsB,IAAI,KAAK,CAChC,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MainModule, Params, Type, EncodeResult, DecodeResult } from "./l2encdec.js";
|
|
2
|
+
export type { MainModule as L2EncDecModule, Params, Type, EncodeResult, DecodeResult };
|
|
3
|
+
export declare function initL2EncDec(): Promise<MainModule>;
|
|
4
|
+
export declare function encode(input: Uint8Array | number[], params: Params, module?: MainModule): Promise<Uint8Array>;
|
|
5
|
+
export declare function decode(input: Uint8Array | number[], params: Params, module?: MainModule): Promise<Uint8Array>;
|
|
6
|
+
export declare function initParams(protocol: number, filename?: string, use_legacy_decrypt_rsa?: boolean, module?: MainModule): Promise<Params>;
|
|
7
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../index.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,UAAU,IAAI,cAAc,EAC5B,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,YAAY,EACb,CAAC;AAaF,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC,CAExD;AAED,wBAAsB,MAAM,CAC1B,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,EAC5B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED,wBAAsB,MAAM,CAC1B,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,EAC5B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,EACjB,sBAAsB,CAAC,EAAE,OAAO,EAChC,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
let cachedModule;
|
|
2
|
+
async function loadModule() {
|
|
3
|
+
if (cachedModule)
|
|
4
|
+
return cachedModule;
|
|
5
|
+
// @ts-ignore - generated file
|
|
6
|
+
const mod = await import("./l2encdec.web.js");
|
|
7
|
+
cachedModule = (await mod.default());
|
|
8
|
+
return cachedModule;
|
|
9
|
+
}
|
|
10
|
+
export async function initL2EncDec() {
|
|
11
|
+
return loadModule();
|
|
12
|
+
}
|
|
13
|
+
export async function encode(input, params, module) {
|
|
14
|
+
const m = module ?? await loadModule();
|
|
15
|
+
const result = m.encode(input, params);
|
|
16
|
+
return result instanceof Uint8Array ? result : new Uint8Array(result);
|
|
17
|
+
}
|
|
18
|
+
export async function decode(input, params, module) {
|
|
19
|
+
const m = module ?? await loadModule();
|
|
20
|
+
const result = m.decode(input, params);
|
|
21
|
+
return result instanceof Uint8Array ? result : new Uint8Array(result);
|
|
22
|
+
}
|
|
23
|
+
export async function initParams(protocol, filename, use_legacy_decrypt_rsa, module) {
|
|
24
|
+
const m = module ?? await loadModule();
|
|
25
|
+
const params = new m.Params();
|
|
26
|
+
m.init_params(params, protocol, filename ?? "", use_legacy_decrypt_rsa ?? false);
|
|
27
|
+
return params;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.js","sourceRoot":"","sources":["../index.web.ts"],"names":[],"mappings":"AAgBA,IAAI,YAAoC,CAAC;AAEzC,KAAK,UAAU,UAAU;IACvB,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,8BAA8B;IAC9B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC9C,YAAY,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,EAAE,CAAe,CAAC;IACnD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAA4B,EAC5B,MAAc,EACd,MAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,UAAU,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,YAAY,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAA4B,EAC5B,MAAc,EACd,MAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,UAAU,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,YAAY,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAgB,EAChB,QAAiB,EACjB,sBAAgC,EAChC,MAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,UAAU,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC,CAAC,WAAW,CACX,MAAM,EACN,QAAQ,EACR,QAAQ,IAAI,EAAE,EACd,sBAAsB,IAAI,KAAK,CAChC,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-l2encdec",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "TypeScript/JavaScript bindings for open-l2encdec - Lineage 2 encryption library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
-
"./
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"default": "./dist/
|
|
15
|
+
"./web": {
|
|
16
|
+
"types": "./dist/index.web.d.ts",
|
|
17
|
+
"import": "./dist/index.web.js",
|
|
18
|
+
"default": "./dist/index.web.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^25.0.3",
|
|
50
|
-
"typescript": "^5.3
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
51
|
}
|
|
52
52
|
}
|