@ddunigma/node 3.0.3 → 4.0.1
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 +93 -13
- package/dist/BrowserAdapter-G4XORUQJ.js +2 -0
- package/dist/BrowserAdapter-LIUL744V.cjs +2 -0
- package/dist/NodeAdapter-AHALQ4DQ.js +2 -0
- package/dist/NodeAdapter-DS44MI5D.cjs +2 -0
- package/dist/ObfuscationLayer-BRiyE5xu.d.cts +203 -0
- package/dist/ObfuscationLayer-DZiQGHMw.d.ts +203 -0
- package/dist/browser.cjs +1 -6
- package/dist/browser.d.cts +19 -202
- package/dist/browser.d.ts +19 -202
- package/dist/browser.js +1 -6
- package/dist/chunk-342X2QEY.js +2 -0
- package/dist/chunk-65RDFQV7.js +10 -0
- package/dist/chunk-FACJ5LAG.cjs +10 -0
- package/dist/chunk-M7526IW7.js +2 -0
- package/dist/chunk-NY4FGVF3.cjs +2 -0
- package/dist/chunk-P7WJ2LOQ.js +2 -0
- package/dist/chunk-QR43FNIY.js +2 -0
- package/dist/chunk-RFBXQWSA.cjs +2 -0
- package/dist/chunk-RHVBUC4T.cjs +2 -0
- package/dist/chunk-WS6GB27C.cjs +2 -0
- package/dist/core.cjs +1 -6
- package/dist/core.d.cts +40 -1
- package/dist/core.d.ts +40 -1
- package/dist/core.js +1 -6
- package/dist/{core-BpDwIO11.d.cts → errors-DxOlTuHc.d.cts} +142 -120
- package/dist/{core-BpDwIO11.d.ts → errors-DxOlTuHc.d.ts} +142 -120
- package/dist/index.cjs +1 -6
- package/dist/index.d.cts +35 -17
- package/dist/index.d.ts +35 -17
- package/dist/index.js +1 -6
- package/dist/wasm/codec.wasm +0 -0
- package/package.json +42 -5
|
@@ -9,6 +9,15 @@ declare enum DduSetSymbol {
|
|
|
9
9
|
DDU_V1 = "ddu_v1",
|
|
10
10
|
ONECHARSET = "oneCharSet"
|
|
11
11
|
}
|
|
12
|
+
type DduTextEncoding = "utf-8" | "utf8" | "latin1" | "ascii" | "base64" | "base64url" | "hex" | "binary" | "ucs2" | "ucs-2" | "utf16le" | "utf-16le";
|
|
13
|
+
interface EncodingProfile {
|
|
14
|
+
/** 논리 심볼당 비트 수 */
|
|
15
|
+
bitLength: number;
|
|
16
|
+
/** 2의 제곱수 charset 직접 인덱스 모드 여부 */
|
|
17
|
+
usePowerOfTwo: boolean;
|
|
18
|
+
/** 반복 패딩 시 패딩 문자 1개가 나타내는 비트 수 */
|
|
19
|
+
bitsPerPadChar?: number;
|
|
20
|
+
}
|
|
12
21
|
interface CharSetConfig {
|
|
13
22
|
/** charset 식별 심볼 */
|
|
14
23
|
symbol: DduSetSymbol;
|
|
@@ -24,6 +33,12 @@ interface CharSetConfig {
|
|
|
24
33
|
paddingChar: string;
|
|
25
34
|
/** 패딩 문자 반복 방식 사용 여부 */
|
|
26
35
|
useRepeatPadding?: boolean;
|
|
36
|
+
/** 반복 패딩 시 패딩 문자 1개가 나타내는 비트 수 (기본값: 2) */
|
|
37
|
+
bitsPerPadChar?: number;
|
|
38
|
+
/** 2의 제곱수 모드 강제 여부 (false로 설정하면 인덱스 쌍 출력 모드 사용) */
|
|
39
|
+
usePowerOfTwo?: boolean;
|
|
40
|
+
/** 프리셋별 인코딩 프로필. 레거시 와이어 호환성을 고정할 때 사용 */
|
|
41
|
+
encodingProfile?: EncodingProfile;
|
|
27
42
|
}
|
|
28
43
|
interface CharSetInfo {
|
|
29
44
|
/** 인코딩에 사용할 문자 배열 */
|
|
@@ -35,7 +50,7 @@ interface CharSetInfo {
|
|
|
35
50
|
/** 2의 제곱수 charset 여부 */
|
|
36
51
|
usePowerOfTwo: boolean;
|
|
37
52
|
/** 문자열 인코딩 방식 */
|
|
38
|
-
encoding:
|
|
53
|
+
encoding: DduTextEncoding;
|
|
39
54
|
/** 기본 압축 사용 여부 */
|
|
40
55
|
defaultCompress: boolean;
|
|
41
56
|
/** 기본 최대 디코딩 바이트 수 */
|
|
@@ -87,11 +102,22 @@ interface DduEncodeStats {
|
|
|
87
102
|
}
|
|
88
103
|
type KeyDerivationAlgorithm = "sha256" | "pbkdf2";
|
|
89
104
|
interface KeyDerivationOptions {
|
|
90
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Key derivation algorithm. Defaults to `sha256` for legacy compatibility.
|
|
107
|
+
*
|
|
108
|
+
* ⚠️ Security: the default `sha256` is a single, unsalted hash and is fast to
|
|
109
|
+
* brute-force. For low-entropy keys (human passwords) protecting production
|
|
110
|
+
* data, use `pbkdf2` with an application-specific `salt`. Keep `sha256` only
|
|
111
|
+
* for high-entropy keys (e.g. 32 random bytes) or legacy data compatibility.
|
|
112
|
+
*/
|
|
91
113
|
algorithm?: KeyDerivationAlgorithm;
|
|
92
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Salt for PBKDF2. Provide a stable, application-specific value to decode
|
|
116
|
+
* across instances. If omitted, a fixed default salt is used (weaker — set
|
|
117
|
+
* your own when security matters).
|
|
118
|
+
*/
|
|
93
119
|
salt?: string | Uint8Array;
|
|
94
|
-
/** PBKDF2 iteration count.
|
|
120
|
+
/** PBKDF2 iteration count. Positive values below 10000 are clamped to 10000. */
|
|
95
121
|
iterations?: number;
|
|
96
122
|
/** Hash function used by PBKDF2. */
|
|
97
123
|
hash?: "SHA-256" | "SHA-384" | "SHA-512";
|
|
@@ -99,8 +125,6 @@ interface KeyDerivationOptions {
|
|
|
99
125
|
interface DduOptions {
|
|
100
126
|
/** 압축 사용 여부 (zlib deflate 또는 brotli) */
|
|
101
127
|
compress?: boolean;
|
|
102
|
-
/** decode stream에서 footer 기반 자동 감지 사용 여부 (기본값: true) */
|
|
103
|
-
streamAutoDetect?: boolean;
|
|
104
128
|
/** 내부 암/복호화 사용 여부 (기본값: true, 스트림 파이프라인 내부 제어용) */
|
|
105
129
|
encrypt?: boolean;
|
|
106
130
|
/** 압축 알고리즘 (기본값: "deflate") */
|
|
@@ -135,24 +159,13 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
135
159
|
paddingChar?: string;
|
|
136
160
|
/** 필요 문자 수 */
|
|
137
161
|
requiredLength?: number;
|
|
138
|
-
/** 비트 길이 */
|
|
139
|
-
bitLength?: number;
|
|
140
162
|
/** 2의 제곱수 강제 여부 */
|
|
141
163
|
usePowerOfTwo?: boolean;
|
|
142
164
|
/**
|
|
143
165
|
* true이면 초기화 오류 시 throw합니다. false이면 fallback charset으로 대체합니다.
|
|
144
166
|
* @default false
|
|
145
|
-
* @deprecated throwOnError를 사용하세요. 이 옵션은 하위 호환성을 위해 유지됩니다.
|
|
146
|
-
*/
|
|
147
|
-
useBuildErrorReturn?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* true이면 초기화 오류 시 throw합니다. false이면 fallback charset으로 대체합니다.
|
|
150
|
-
* useBuildErrorReturn과 동일한 동작이며, 둘 다 지정 시 throwOnError가 우선합니다.
|
|
151
|
-
* @default false
|
|
152
167
|
*/
|
|
153
168
|
throwOnError?: boolean;
|
|
154
|
-
/** Buffer 인코딩 방식 */
|
|
155
|
-
encoding?: BufferEncoding;
|
|
156
169
|
/** URL-Safe 모드 (특수문자를 URL 안전 문자로 변환) */
|
|
157
170
|
urlSafe?: boolean;
|
|
158
171
|
/** 암호화 키 (AES-256-GCM) */
|
|
@@ -163,9 +176,7 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
163
176
|
useRepeatPadding?: boolean;
|
|
164
177
|
/** 명시적 플랫폼 어댑터 (자동 감지 대신 사용) */
|
|
165
178
|
adapter?: PlatformAdapter;
|
|
166
|
-
/**
|
|
167
|
-
obfuscate?: boolean;
|
|
168
|
-
/** WASM 임계값 (바이트 단위, 기본값: 4096, 범위: 1024-1048576) */
|
|
179
|
+
/** WASM 임계값 (바이트 단위, 기본값: 4096, 범위: 1024-1048576, Infinity면 비활성화) */
|
|
169
180
|
wasmThreshold?: number;
|
|
170
181
|
}
|
|
171
182
|
/**
|
|
@@ -181,13 +192,13 @@ interface PlatformAdapter {
|
|
|
181
192
|
/** 동기적으로 256비트 키를 파생 (Node.js 전용) */
|
|
182
193
|
deriveKeySync?(key: string, options?: KeyDerivationOptions): Uint8Array;
|
|
183
194
|
/** AES-256-GCM으로 데이터를 암호화. IV(12) + authTag(16) + 암호문을 반환 */
|
|
184
|
-
encrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
195
|
+
encrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
185
196
|
/** 동기적으로 데이터를 암호화 (Node.js 전용) */
|
|
186
|
-
encryptSync?(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
197
|
+
encryptSync?(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
187
198
|
/** AES-256-GCM 페이로드를 복호화. IV(12) + authTag(16) + 암호문 형식을 기대 */
|
|
188
|
-
decrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
199
|
+
decrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
189
200
|
/** 동기적으로 데이터를 복호화 (Node.js 전용) */
|
|
190
|
-
decryptSync?(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
201
|
+
decryptSync?(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
191
202
|
/** 암호학적으로 안전한 랜덤 바이트를 생성 */
|
|
192
203
|
randomBytes(length: number): Uint8Array;
|
|
193
204
|
/** deflate 알고리즘으로 데이터를 압축 */
|
|
@@ -230,38 +241,6 @@ interface WasmCodec {
|
|
|
230
241
|
/** WASM 모듈이 초기화되어 사용 가능한지 확인 */
|
|
231
242
|
readonly ready: boolean;
|
|
232
243
|
}
|
|
233
|
-
/**
|
|
234
|
-
* 인코딩/디코딩 연산을 위해 워커 스레드에 전달되는 설정.
|
|
235
|
-
*/
|
|
236
|
-
interface EncoderConfig {
|
|
237
|
-
charSet: string[];
|
|
238
|
-
paddingChar: string;
|
|
239
|
-
bitLength: number;
|
|
240
|
-
usePowerOfTwo: boolean;
|
|
241
|
-
compress?: boolean;
|
|
242
|
-
compressionAlgorithm?: "deflate" | "brotli";
|
|
243
|
-
compressionLevel?: number;
|
|
244
|
-
encrypt?: boolean;
|
|
245
|
-
encryptionKeyHash?: Uint8Array;
|
|
246
|
-
checksum?: boolean;
|
|
247
|
-
urlSafe?: boolean;
|
|
248
|
-
chunkSize?: number;
|
|
249
|
-
chunkSeparator?: string;
|
|
250
|
-
useRepeatPadding?: boolean;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* 대용량 페이로드의 인코딩/디코딩 연산을 오프로드하는 워커 스레드 풀 인터페이스.
|
|
254
|
-
*/
|
|
255
|
-
interface WorkerPool {
|
|
256
|
-
/** 워커 스레드를 사용하여 인코딩 */
|
|
257
|
-
encode(input: Uint8Array, config: EncoderConfig): Promise<string>;
|
|
258
|
-
/** 워커 스레드를 사용하여 디코딩 */
|
|
259
|
-
decode(input: string, config: EncoderConfig): Promise<Uint8Array>;
|
|
260
|
-
/** 풀의 워커 스레드 수를 설정 (1-64) */
|
|
261
|
-
setPoolSize(n: number): void;
|
|
262
|
-
/** 모든 워커 스레드를 종료하고 리소스를 정리 */
|
|
263
|
-
terminate(): Promise<void>;
|
|
264
|
-
}
|
|
265
244
|
/**
|
|
266
245
|
* 한글 음절 난독화 레이어 인터페이스.
|
|
267
246
|
* 암호화된 출력을 자연스러운 한국어 음절 블록으로 변환합니다.
|
|
@@ -342,16 +321,16 @@ interface TestVector {
|
|
|
342
321
|
declare class Ddu64Core {
|
|
343
322
|
/** 인코딩에 사용되는 문자 */
|
|
344
323
|
protected readonly dduChar: string[];
|
|
324
|
+
/** 인코딩 문자의 코드포인트 배열 (String.fromCharCode 배치 호출용) */
|
|
325
|
+
private readonly dduCharCodes;
|
|
345
326
|
/** 패딩 문자 */
|
|
346
327
|
protected readonly paddingChar: string;
|
|
347
328
|
/** 비트 길이 (2의 제곱수 charset의 경우 charset 크기의 log2) */
|
|
348
329
|
protected readonly bitLength: number;
|
|
349
330
|
/** charset 크기가 2의 제곱수인지 여부 */
|
|
350
331
|
protected readonly usePowerOfTwo: boolean;
|
|
351
|
-
/**
|
|
352
|
-
private readonly
|
|
353
|
-
/** 문자 → 인덱스 역방향 룩업 맵 */
|
|
354
|
-
protected readonly dduBinaryLookup: Map<string, number>;
|
|
332
|
+
/** UTF-16 코드 유닛 → 인덱스 direct lookup (단일 BMP 심볼 전용) */
|
|
333
|
+
private readonly dduCharCodeLookup;
|
|
355
334
|
/** 미리 정의된 charset 사용 여부 */
|
|
356
335
|
private readonly isPredefinedCharSet;
|
|
357
336
|
/** 기본 압축 활성화 */
|
|
@@ -380,20 +359,22 @@ declare class Ddu64Core {
|
|
|
380
359
|
private readonly defaultCompressionAlgorithm;
|
|
381
360
|
/** 반복 패딩 모드 사용 여부 */
|
|
382
361
|
private readonly useRepeatPadding;
|
|
362
|
+
/** 반복 패딩 시 패딩 문자 1개가 나타내는 비트 수 */
|
|
363
|
+
private readonly bitsPerPadChar;
|
|
383
364
|
/** BitPack 설정 */
|
|
384
365
|
private readonly bitPackConfig;
|
|
385
366
|
/** WASM 사용 임계값 */
|
|
386
367
|
private readonly wasmThreshold;
|
|
387
|
-
/** 네이티브 Base64 fast path 사용 여부 */
|
|
368
|
+
/** 표준 Base64 charset에서 네이티브 Base64 fast path 사용 여부 */
|
|
388
369
|
private readonly canUseNativeBase64;
|
|
389
|
-
/**
|
|
390
|
-
private readonly
|
|
370
|
+
/** 인코딩/디코딩 payload codec 공유 컨텍스트 */
|
|
371
|
+
private readonly payloadCodecContext;
|
|
391
372
|
/** 플랫폼 어댑터 (동기용 지연 로드 또는 명시적 제공) */
|
|
392
373
|
private adapter;
|
|
393
374
|
/** 기본 난독화 활성화 */
|
|
394
375
|
private readonly defaultObfuscate;
|
|
395
376
|
/** 지연 초기화되는 난독화 레이어 */
|
|
396
|
-
private
|
|
377
|
+
private obfuscationLayer;
|
|
397
378
|
constructor(dduChar?: string[] | string | DduConstructorOptions, paddingChar?: string, dduOptions?: DduConstructorOptions);
|
|
398
379
|
/**
|
|
399
380
|
* 입력 데이터를 charset 인코딩 문자열로 인코딩합니다.
|
|
@@ -402,6 +383,7 @@ declare class Ddu64Core {
|
|
|
402
383
|
* @param options - 인코딩 옵션
|
|
403
384
|
* @returns 인코딩된 문자열
|
|
404
385
|
* @throws 동기 암호화/압축이 필요하지만 어댑터가 지원하지 않는 경우
|
|
386
|
+
* @group Sync
|
|
405
387
|
*/
|
|
406
388
|
encode(input: Uint8Array | string, options?: DduOptions): string;
|
|
407
389
|
/**
|
|
@@ -410,6 +392,7 @@ declare class Ddu64Core {
|
|
|
410
392
|
* @param input - 디코딩할 인코딩된 문자열
|
|
411
393
|
* @param options - 디코딩 옵션
|
|
412
394
|
* @returns 디코딩된 문자열
|
|
395
|
+
* @group Sync
|
|
413
396
|
*/
|
|
414
397
|
decode(input: string, options?: DduOptions): string;
|
|
415
398
|
/**
|
|
@@ -418,64 +401,68 @@ declare class Ddu64Core {
|
|
|
418
401
|
* @param input - 디코딩할 인코딩된 문자열
|
|
419
402
|
* @param options - 디코딩 옵션
|
|
420
403
|
* @returns 디코딩된 바이트
|
|
404
|
+
* @group Sync
|
|
421
405
|
*/
|
|
422
406
|
decodeToUint8Array(input: string, options?: DduOptions): Uint8Array;
|
|
407
|
+
private decodeToUint8ArrayInternal;
|
|
423
408
|
/**
|
|
424
409
|
* 비동기 인코딩 - 브라우저를 포함한 모든 런타임에서 동작합니다.
|
|
410
|
+
*
|
|
411
|
+
* @group Async
|
|
425
412
|
*/
|
|
426
413
|
encodeAsync(input: Uint8Array | string, options?: DduOptions): Promise<string>;
|
|
414
|
+
private encodeAsyncInternal;
|
|
427
415
|
/**
|
|
428
416
|
* 비동기 디코딩 - 브라우저를 포함한 모든 런타임에서 동작합니다.
|
|
417
|
+
*
|
|
418
|
+
* @group Async
|
|
429
419
|
*/
|
|
430
420
|
decodeAsync(input: string, options?: DduOptions): Promise<string>;
|
|
431
421
|
/**
|
|
432
422
|
* 비동기 Uint8Array 디코딩 - 브라우저를 포함한 모든 런타임에서 동작합니다.
|
|
423
|
+
*
|
|
424
|
+
* @group Async
|
|
433
425
|
*/
|
|
434
426
|
decodeToUint8ArrayAsync(input: string, options?: DduOptions): Promise<Uint8Array>;
|
|
427
|
+
private decodeToUint8ArrayAsyncInternal;
|
|
435
428
|
/**
|
|
436
429
|
* charset 정보를 가져옵니다.
|
|
430
|
+
*
|
|
431
|
+
* @group Introspection
|
|
437
432
|
*/
|
|
438
433
|
getCharSetInfo(): CharSetInfo;
|
|
439
434
|
/**
|
|
440
435
|
* 인코딩 통계를 가져옵니다.
|
|
441
|
-
*/
|
|
442
|
-
getStats(input: Uint8Array | string, options?: DduOptions): DduEncodeStats;
|
|
443
|
-
/**
|
|
444
|
-
* 대용량 인코딩/디코딩 연산을 오프로드하기 위한 전역 워커 풀 크기를 설정합니다.
|
|
445
436
|
*
|
|
446
|
-
* @
|
|
447
|
-
* @throws n이 정수가 아니거나 [1, 64] 범위를 벗어난 경우 에러
|
|
437
|
+
* @group Introspection
|
|
448
438
|
*/
|
|
449
|
-
|
|
439
|
+
getStats(input: Uint8Array | string, options?: DduOptions): DduEncodeStats;
|
|
450
440
|
/**
|
|
451
441
|
* 통계를 위한 메타데이터 포함 내부 인코딩.
|
|
452
442
|
*/
|
|
453
443
|
private encodeInternal;
|
|
454
444
|
/**
|
|
455
|
-
* 인코딩
|
|
445
|
+
* 인코딩 마무리: 비트팩 인코딩 + 후처리(난독화/체크섬/URL-safe/청킹).
|
|
446
|
+
* 동기/비동기 인코딩에서 공유하는 순수 동기 단계입니다.
|
|
456
447
|
*/
|
|
457
|
-
private
|
|
448
|
+
private finalizeEncode;
|
|
458
449
|
/**
|
|
459
|
-
*
|
|
450
|
+
* 인코딩 후처리: 난독화, 체크섬, URL-safe, 청킹을 적용합니다.
|
|
460
451
|
*/
|
|
461
|
-
private
|
|
452
|
+
private applyPostEncoding;
|
|
462
453
|
/**
|
|
463
|
-
*
|
|
454
|
+
* 디코딩 전처리: 동기/비동기 디코딩에서 공통으로 쓰는 순수 동기 단계.
|
|
455
|
+
* 청크 제거 → URL-safe 역변환 → 체크섬 추출 → 역난독화 → 푸터 파싱 →
|
|
456
|
+
* 검증(정렬/패딩/크기) → 비트팩 해제까지 수행합니다.
|
|
464
457
|
*/
|
|
465
|
-
private
|
|
466
|
-
private
|
|
467
|
-
private decodeCharsWithNativeBase64;
|
|
468
|
-
private bytesToBase64;
|
|
469
|
-
private base64ToBytes;
|
|
470
|
-
private shouldUseWasm;
|
|
458
|
+
private decodePrelude;
|
|
459
|
+
private getPayloadCodecContext;
|
|
471
460
|
private reportProgress;
|
|
472
|
-
private requireSyncAdapter;
|
|
473
461
|
private encryptSync;
|
|
474
462
|
private decryptSync;
|
|
475
463
|
private compressSync;
|
|
476
464
|
private decompressSync;
|
|
477
|
-
private
|
|
478
|
-
private getKeyHashAsync;
|
|
465
|
+
private getSyncGatewayContext;
|
|
479
466
|
/**
|
|
480
467
|
* 난독화 레이어를 가져오거나 생성합니다 (지연 초기화).
|
|
481
468
|
* 알파벳에는 charset 문자, 패딩 문자, 모든 푸터 마커 문자가 포함됩니다.
|
|
@@ -487,9 +474,8 @@ declare class Ddu64Core {
|
|
|
487
474
|
* 암호화 키 없이 난독화가 활성화되면 throw합니다.
|
|
488
475
|
*/
|
|
489
476
|
private shouldObfuscate;
|
|
490
|
-
private
|
|
491
|
-
private
|
|
492
|
-
private assertEncodedInputAligned;
|
|
477
|
+
private assertSafeChunkSeparator;
|
|
478
|
+
private isLineBreakSeparator;
|
|
493
479
|
}
|
|
494
480
|
|
|
495
481
|
/**
|
|
@@ -625,39 +611,75 @@ declare class CharsetBuilder {
|
|
|
625
611
|
}
|
|
626
612
|
|
|
627
613
|
/**
|
|
628
|
-
* ddunigma
|
|
629
|
-
*
|
|
630
|
-
* 순수 JavaScript 구현과 바이트 단위로 동일한 선택적 WASM 가속
|
|
631
|
-
* 인코딩/디코딩을 제공합니다. WASM을 사용할 수 없거나 실패하면
|
|
632
|
-
* 조용히 JS로 폴백합니다.
|
|
633
|
-
*
|
|
634
|
-
* @module wasm/WasmCodec
|
|
635
|
-
*/
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* WASM 모듈을 사전 로드하고 초기화합니다.
|
|
639
|
-
*
|
|
640
|
-
* 첫 번째 인코딩/디코딩 연산 전에 WASM이 준비되도록 애플리케이션 초기에
|
|
641
|
-
* 호출하세요. WASM이 초기화되면 resolve되고, 10초 내에 초기화에 실패하면
|
|
642
|
-
* reject됩니다.
|
|
643
|
-
*
|
|
644
|
-
* @throws WASM 초기화가 실패하거나 타임아웃(10초)된 경우 에러
|
|
645
|
-
*/
|
|
646
|
-
declare function preloadWasm(): Promise<void>;
|
|
647
|
-
/**
|
|
648
|
-
* WASM 코덱이 준비되었으면 반환하거나, 온디맨드 초기화를 시도합니다.
|
|
614
|
+
* ddunigma custom error hierarchy.
|
|
649
615
|
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
616
|
+
* Public encode/decode APIs wrap internal/runtime failures in these typed
|
|
617
|
+
* errors so callers can branch on a stable code without parsing messages.
|
|
652
618
|
*
|
|
653
|
-
*
|
|
654
|
-
*/
|
|
655
|
-
declare function getWasmCodec(): WasmCodec | null;
|
|
656
|
-
/**
|
|
657
|
-
* WASM 코덱이 이미 초기화된 경우에만 반환합니다.
|
|
658
|
-
* 온디맨드 초기화를 트리거하지 않습니다.
|
|
659
|
-
* WASM이 준비되지 않았으면 null을 반환합니다.
|
|
619
|
+
* @module core/errors
|
|
660
620
|
*/
|
|
661
|
-
|
|
621
|
+
type Ddu64Operation = "construct" | "encode" | "decode" | "compress" | "decompress" | "encrypt" | "decrypt" | "checksum" | "charset" | "adapter" | "obfuscation" | "stream";
|
|
622
|
+
declare enum Ddu64ErrorCode {
|
|
623
|
+
EncodeFailed = "DDU64_ENCODE_FAILED",
|
|
624
|
+
DecodeFailed = "DDU64_DECODE_FAILED",
|
|
625
|
+
CompressionFailed = "DDU64_COMPRESSION_FAILED",
|
|
626
|
+
DecompressionFailed = "DDU64_DECOMPRESSION_FAILED",
|
|
627
|
+
EncryptionFailed = "DDU64_ENCRYPTION_FAILED",
|
|
628
|
+
DecryptionFailed = "DDU64_DECRYPTION_FAILED",
|
|
629
|
+
ChecksumMismatch = "DDU64_CHECKSUM_MISMATCH",
|
|
630
|
+
InvalidCharset = "DDU64_INVALID_CHARSET",
|
|
631
|
+
InvalidInput = "DDU64_INVALID_INPUT",
|
|
632
|
+
LimitExceeded = "DDU64_LIMIT_EXCEEDED",
|
|
633
|
+
AdapterUnavailable = "DDU64_ADAPTER_UNAVAILABLE",
|
|
634
|
+
ObfuscationFailed = "DDU64_OBFUSCATION_FAILED",
|
|
635
|
+
StreamFailed = "DDU64_STREAM_FAILED"
|
|
636
|
+
}
|
|
637
|
+
interface Ddu64ErrorOptions {
|
|
638
|
+
code: Ddu64ErrorCode;
|
|
639
|
+
operation: Ddu64Operation;
|
|
640
|
+
cause?: unknown;
|
|
641
|
+
}
|
|
642
|
+
declare class Ddu64Error extends Error {
|
|
643
|
+
readonly code: Ddu64ErrorCode;
|
|
644
|
+
readonly operation: Ddu64Operation;
|
|
645
|
+
constructor(message: string, options: Ddu64ErrorOptions);
|
|
646
|
+
}
|
|
647
|
+
declare class Ddu64EncodeError extends Ddu64Error {
|
|
648
|
+
constructor(message: string, cause?: unknown);
|
|
649
|
+
}
|
|
650
|
+
declare class Ddu64DecodeError extends Ddu64Error {
|
|
651
|
+
constructor(message: string, cause?: unknown);
|
|
652
|
+
}
|
|
653
|
+
declare class Ddu64CompressionError extends Ddu64Error {
|
|
654
|
+
constructor(message: string, cause?: unknown);
|
|
655
|
+
}
|
|
656
|
+
declare class Ddu64DecompressionError extends Ddu64Error {
|
|
657
|
+
constructor(message: string, cause?: unknown);
|
|
658
|
+
}
|
|
659
|
+
declare class Ddu64EncryptionError extends Ddu64Error {
|
|
660
|
+
constructor(message: string, cause?: unknown);
|
|
661
|
+
}
|
|
662
|
+
declare class Ddu64DecryptionError extends Ddu64Error {
|
|
663
|
+
constructor(message: string, cause?: unknown);
|
|
664
|
+
}
|
|
665
|
+
declare class Ddu64ChecksumError extends Ddu64Error {
|
|
666
|
+
constructor(message: string, cause?: unknown);
|
|
667
|
+
}
|
|
668
|
+
declare class Ddu64CharsetError extends Ddu64Error {
|
|
669
|
+
constructor(message: string, cause?: unknown);
|
|
670
|
+
}
|
|
671
|
+
declare class Ddu64LimitError extends Ddu64Error {
|
|
672
|
+
constructor(message: string, operation: Ddu64Operation, cause?: unknown);
|
|
673
|
+
}
|
|
674
|
+
declare class Ddu64AdapterError extends Ddu64Error {
|
|
675
|
+
constructor(message: string, operation: Ddu64Operation, cause?: unknown);
|
|
676
|
+
}
|
|
677
|
+
declare class Ddu64ObfuscationError extends Ddu64Error {
|
|
678
|
+
constructor(message: string, cause?: unknown);
|
|
679
|
+
}
|
|
680
|
+
declare class Ddu64StreamError extends Ddu64Error {
|
|
681
|
+
constructor(message: string, cause?: unknown);
|
|
682
|
+
}
|
|
683
|
+
declare function isDdu64Error(error: unknown): error is Ddu64Error;
|
|
662
684
|
|
|
663
|
-
export { type CharSetConfig as C, Ddu64Core as D, type
|
|
685
|
+
export { type CharSetConfig as C, Ddu64Core as D, type EncodingProfile as E, type KeyDerivationAlgorithm as K, type ObfuscationLayer as O, type PlatformAdapter as P, type TestVector as T, type WasmCodec as W, type DduConstructorOptions as a, type CharSetInfo as b, CharsetBuilder as c, Ddu64AdapterError as d, Ddu64CharsetError as e, Ddu64ChecksumError as f, Ddu64CompressionError as g, Ddu64DecodeError as h, Ddu64DecompressionError as i, Ddu64DecryptionError as j, Ddu64EncodeError as k, Ddu64EncryptionError as l, Ddu64Error as m, Ddu64ErrorCode as n, type Ddu64ErrorOptions as o, Ddu64LimitError as p, Ddu64ObfuscationError as q, type Ddu64Operation as r, Ddu64StreamError as s, type DduEncodeStats as t, type DduOptions as u, type DduProgressInfo as v, DduSetSymbol as w, type DduTextEncoding as x, type KeyDerivationOptions as y, isDdu64Error as z };
|