open-l2encdec 0.0.5 → 0.0.7
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/dist/index.d.ts +4 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -26
- package/dist/index.js.map +1 -1
- package/dist/l2encdec.browser.js +0 -0
- package/dist/l2encdec.node.js +0 -0
- package/package.json +8 -9
- package/dist/l2encdec.js +0 -0
- /package/dist/{interface.d.ts → l2encdec.js.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeScript wrapper for l2encdec WASM module
|
|
3
3
|
*/
|
|
4
|
-
import type { MainModule, Params, Type, EncodeResult, DecodeResult } from
|
|
4
|
+
import type { MainModule, Params, Type, EncodeResult, DecodeResult } from "./l2encdec.js.d.ts";
|
|
5
5
|
export type { MainModule as L2EncDecModule, Params, Type, EncodeResult, DecodeResult };
|
|
6
6
|
/**
|
|
7
7
|
* Initialize and return the l2encdec WASM module
|
|
8
8
|
*/
|
|
9
9
|
export declare function initL2EncDec(): Promise<MainModule>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param input - Input data as Uint8Array or number array
|
|
13
|
-
* @param params - Encoding parameters
|
|
14
|
-
* @param module - Optional pre-initialized module (for performance)
|
|
15
|
-
* @returns Encoded data as Uint8Array
|
|
11
|
+
* Encode data
|
|
16
12
|
*/
|
|
17
13
|
export declare function encode(input: Uint8Array | number[], params: Params, module?: MainModule): Promise<Uint8Array>;
|
|
18
14
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param input - Input data as Uint8Array or number array
|
|
21
|
-
* @param params - Decoding parameters
|
|
22
|
-
* @param module - Optional pre-initialized module (for performance)
|
|
23
|
-
* @returns Decoded data as Uint8Array
|
|
15
|
+
* Decode data
|
|
24
16
|
*/
|
|
25
17
|
export declare function decode(input: Uint8Array | number[], params: Params, module?: MainModule): Promise<Uint8Array>;
|
|
26
18
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param protocol - Protocol number (last three digits of file header)
|
|
29
|
-
* @param filename - Filename used for protocol 121 (XOR_FILENAME)
|
|
30
|
-
* @param use_legacy_decrypt_rsa - Use legacy RSA decryption for protocols 411-414
|
|
31
|
-
* @param module - Optional pre-initialized module (for performance)
|
|
32
|
-
* @returns Initialized Params instance
|
|
19
|
+
* Initialize params
|
|
33
20
|
*/
|
|
34
21
|
export declare function initParams(protocol: number, filename?: string, use_legacy_decrypt_rsa?: boolean, module?: MainModule): Promise<Params>;
|
|
35
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,UAAU,IAAI,cAAc,EAC5B,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,YAAY,EACb,CAAC;AAgBF;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC,CAExD;AAED;;GAEG;AACH,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;;GAEG;AACH,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;;GAEG;AACH,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,53 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeScript wrapper for l2encdec WASM module
|
|
3
3
|
*/
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
// ---- internal module cache ----
|
|
5
|
+
let cachedModule = null;
|
|
6
|
+
// ---- internal loader ----
|
|
7
|
+
async function loadModule() {
|
|
8
|
+
if (cachedModule)
|
|
9
|
+
return cachedModule;
|
|
10
|
+
const mod = await import("./l2encdec.js");
|
|
11
|
+
const createModule = mod.default;
|
|
12
|
+
cachedModule = await createModule();
|
|
13
|
+
return cachedModule;
|
|
14
|
+
}
|
|
9
15
|
/**
|
|
10
16
|
* Initialize and return the l2encdec WASM module
|
|
11
17
|
*/
|
|
12
18
|
export async function initL2EncDec() {
|
|
13
|
-
return
|
|
19
|
+
return loadModule();
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @param input - Input data as Uint8Array or number array
|
|
18
|
-
* @param params - Encoding parameters
|
|
19
|
-
* @param module - Optional pre-initialized module (for performance)
|
|
20
|
-
* @returns Encoded data as Uint8Array
|
|
22
|
+
* Encode data
|
|
21
23
|
*/
|
|
22
24
|
export async function encode(input, params, module) {
|
|
23
|
-
const m = module
|
|
25
|
+
const m = module ?? await loadModule();
|
|
24
26
|
const result = m.encode(input, params);
|
|
25
27
|
return result instanceof Uint8Array ? result : new Uint8Array(result);
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @param input - Input data as Uint8Array or number array
|
|
30
|
-
* @param params - Decoding parameters
|
|
31
|
-
* @param module - Optional pre-initialized module (for performance)
|
|
32
|
-
* @returns Decoded data as Uint8Array
|
|
30
|
+
* Decode data
|
|
33
31
|
*/
|
|
34
32
|
export async function decode(input, params, module) {
|
|
35
|
-
const m = module
|
|
33
|
+
const m = module ?? await loadModule();
|
|
36
34
|
const result = m.decode(input, params);
|
|
37
35
|
return result instanceof Uint8Array ? result : new Uint8Array(result);
|
|
38
36
|
}
|
|
39
37
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @param protocol - Protocol number (last three digits of file header)
|
|
42
|
-
* @param filename - Filename used for protocol 121 (XOR_FILENAME)
|
|
43
|
-
* @param use_legacy_decrypt_rsa - Use legacy RSA decryption for protocols 411-414
|
|
44
|
-
* @param module - Optional pre-initialized module (for performance)
|
|
45
|
-
* @returns Initialized Params instance
|
|
38
|
+
* Initialize params
|
|
46
39
|
*/
|
|
47
40
|
export async function initParams(protocol, filename, use_legacy_decrypt_rsa, module) {
|
|
48
|
-
const m = module
|
|
41
|
+
const m = module ?? await loadModule();
|
|
49
42
|
const params = new m.Params();
|
|
50
|
-
m.init_params(params, protocol, filename
|
|
43
|
+
m.init_params(params, protocol, filename ?? "", use_legacy_decrypt_rsa ?? false);
|
|
51
44
|
return params;
|
|
52
45
|
}
|
|
53
46
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmBD,kCAAkC;AAClC,IAAI,YAAY,GAAsB,IAAI,CAAC;AAE3C,4BAA4B;AAC5B,KAAK,UAAU,UAAU;IACvB,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,GAAG,CAAC,OA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,CAAC"}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-l2encdec",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "TypeScript/JavaScript bindings for open-l2encdec WASM module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"browser": "./dist/index.browser.js",
|
|
13
|
+
"import": "./dist/index.node.js",
|
|
14
|
+
"default": "./dist/index.node.js"
|
|
14
15
|
},
|
|
15
16
|
"./wasm": {
|
|
16
|
-
"
|
|
17
|
-
"import": "./dist/l2encdec.js"
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
"./package.json": "./package.json"
|
|
17
|
+
"browser": "./dist/l2encdec.browser.js",
|
|
18
|
+
"import": "./dist/l2encdec.node.js"
|
|
19
|
+
}
|
|
21
20
|
},
|
|
22
21
|
"files": [
|
|
23
22
|
"dist",
|
|
@@ -53,4 +52,4 @@
|
|
|
53
52
|
"typescript": "^5.3.0",
|
|
54
53
|
"vite": "^7.3.0"
|
|
55
54
|
}
|
|
56
|
-
}
|
|
55
|
+
}
|
package/dist/l2encdec.js
DELETED
|
Binary file
|
|
File without changes
|