@ddunigma/node 3.1.0 → 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 +42 -8
- 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-DAVKTnHf.d.cts → ObfuscationLayer-BRiyE5xu.d.cts} +10 -12
- package/dist/{ObfuscationLayer-D-xl5d7P.d.ts → ObfuscationLayer-DZiQGHMw.d.ts} +10 -12
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +5 -4
- package/dist/browser.d.ts +5 -4
- package/dist/browser.js +1 -1
- 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-P7WJ2LOQ.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 -1
- package/dist/core.d.cts +40 -1
- package/dist/core.d.ts +40 -1
- package/dist/core.js +1 -1
- package/dist/{core-DYSnygnp.d.cts → errors-DxOlTuHc.d.cts} +94 -81
- package/dist/{core-DYSnygnp.d.ts → errors-DxOlTuHc.d.ts} +94 -81
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +23 -8
- package/dist/index.d.ts +23 -8
- package/dist/index.js +1 -1
- package/package.json +42 -5
- package/dist/BrowserAdapter-BHHWPUTB.js +0 -2
- package/dist/BrowserAdapter-M7PUHVGS.cjs +0 -2
- package/dist/NodeAdapter-JB2EZ3T4.js +0 -2
- package/dist/NodeAdapter-JRRSYUJT.cjs +0 -2
- package/dist/chunk-5RZDTEOZ.js +0 -2
- package/dist/chunk-JUBMOKKH.js +0 -2
- package/dist/chunk-JZSHJ6KN.cjs +0 -9
- package/dist/chunk-KEWLOPEV.js +0 -9
- package/dist/chunk-M6LY6DIE.js +0 -2
- package/dist/chunk-NFMYVNOG.cjs +0 -2
- package/dist/chunk-PHMARSJE.cjs +0 -2
- package/dist/chunk-TJTDYO65.cjs +0 -2
|
@@ -159,23 +159,11 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
159
159
|
paddingChar?: string;
|
|
160
160
|
/** 필요 문자 수 */
|
|
161
161
|
requiredLength?: number;
|
|
162
|
-
/**
|
|
163
|
-
* 비트 길이.
|
|
164
|
-
* @deprecated 무시되는 옵션입니다. 심볼당 비트 수는 charset 길이에서 자동 계산됩니다.
|
|
165
|
-
*/
|
|
166
|
-
bitLength?: number;
|
|
167
162
|
/** 2의 제곱수 강제 여부 */
|
|
168
163
|
usePowerOfTwo?: boolean;
|
|
169
164
|
/**
|
|
170
165
|
* true이면 초기화 오류 시 throw합니다. false이면 fallback charset으로 대체합니다.
|
|
171
166
|
* @default false
|
|
172
|
-
* @deprecated throwOnError를 사용하세요. 이 옵션은 하위 호환성을 위해 유지됩니다.
|
|
173
|
-
*/
|
|
174
|
-
useBuildErrorReturn?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* true이면 초기화 오류 시 throw합니다. false이면 fallback charset으로 대체합니다.
|
|
177
|
-
* useBuildErrorReturn과 동일한 동작이며, 둘 다 지정 시 throwOnError가 우선합니다.
|
|
178
|
-
* @default false
|
|
179
167
|
*/
|
|
180
168
|
throwOnError?: boolean;
|
|
181
169
|
/** URL-Safe 모드 (특수문자를 URL 안전 문자로 변환) */
|
|
@@ -188,7 +176,7 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
188
176
|
useRepeatPadding?: boolean;
|
|
189
177
|
/** 명시적 플랫폼 어댑터 (자동 감지 대신 사용) */
|
|
190
178
|
adapter?: PlatformAdapter;
|
|
191
|
-
/** WASM 임계값 (바이트 단위, 기본값: 4096, 범위: 1024-1048576) */
|
|
179
|
+
/** WASM 임계값 (바이트 단위, 기본값: 4096, 범위: 1024-1048576, Infinity면 비활성화) */
|
|
192
180
|
wasmThreshold?: number;
|
|
193
181
|
}
|
|
194
182
|
/**
|
|
@@ -204,13 +192,13 @@ interface PlatformAdapter {
|
|
|
204
192
|
/** 동기적으로 256비트 키를 파생 (Node.js 전용) */
|
|
205
193
|
deriveKeySync?(key: string, options?: KeyDerivationOptions): Uint8Array;
|
|
206
194
|
/** AES-256-GCM으로 데이터를 암호화. IV(12) + authTag(16) + 암호문을 반환 */
|
|
207
|
-
encrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
195
|
+
encrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
208
196
|
/** 동기적으로 데이터를 암호화 (Node.js 전용) */
|
|
209
|
-
encryptSync?(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
197
|
+
encryptSync?(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
210
198
|
/** AES-256-GCM 페이로드를 복호화. IV(12) + authTag(16) + 암호문 형식을 기대 */
|
|
211
|
-
decrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
199
|
+
decrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
212
200
|
/** 동기적으로 데이터를 복호화 (Node.js 전용) */
|
|
213
|
-
decryptSync?(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
201
|
+
decryptSync?(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
214
202
|
/** 암호학적으로 안전한 랜덤 바이트를 생성 */
|
|
215
203
|
randomBytes(length: number): Uint8Array;
|
|
216
204
|
/** deflate 알고리즘으로 데이터를 압축 */
|
|
@@ -379,12 +367,14 @@ declare class Ddu64Core {
|
|
|
379
367
|
private readonly wasmThreshold;
|
|
380
368
|
/** 표준 Base64 charset에서 네이티브 Base64 fast path 사용 여부 */
|
|
381
369
|
private readonly canUseNativeBase64;
|
|
370
|
+
/** 인코딩/디코딩 payload codec 공유 컨텍스트 */
|
|
371
|
+
private readonly payloadCodecContext;
|
|
382
372
|
/** 플랫폼 어댑터 (동기용 지연 로드 또는 명시적 제공) */
|
|
383
373
|
private adapter;
|
|
384
374
|
/** 기본 난독화 활성화 */
|
|
385
375
|
private readonly defaultObfuscate;
|
|
386
376
|
/** 지연 초기화되는 난독화 레이어 */
|
|
387
|
-
private
|
|
377
|
+
private obfuscationLayer;
|
|
388
378
|
constructor(dduChar?: string[] | string | DduConstructorOptions, paddingChar?: string, dduOptions?: DduConstructorOptions);
|
|
389
379
|
/**
|
|
390
380
|
* 입력 데이터를 charset 인코딩 문자열로 인코딩합니다.
|
|
@@ -393,6 +383,7 @@ declare class Ddu64Core {
|
|
|
393
383
|
* @param options - 인코딩 옵션
|
|
394
384
|
* @returns 인코딩된 문자열
|
|
395
385
|
* @throws 동기 암호화/압축이 필요하지만 어댑터가 지원하지 않는 경우
|
|
386
|
+
* @group Sync
|
|
396
387
|
*/
|
|
397
388
|
encode(input: Uint8Array | string, options?: DduOptions): string;
|
|
398
389
|
/**
|
|
@@ -401,6 +392,7 @@ declare class Ddu64Core {
|
|
|
401
392
|
* @param input - 디코딩할 인코딩된 문자열
|
|
402
393
|
* @param options - 디코딩 옵션
|
|
403
394
|
* @returns 디코딩된 문자열
|
|
395
|
+
* @group Sync
|
|
404
396
|
*/
|
|
405
397
|
decode(input: string, options?: DduOptions): string;
|
|
406
398
|
/**
|
|
@@ -409,33 +401,46 @@ declare class Ddu64Core {
|
|
|
409
401
|
* @param input - 디코딩할 인코딩된 문자열
|
|
410
402
|
* @param options - 디코딩 옵션
|
|
411
403
|
* @returns 디코딩된 바이트
|
|
404
|
+
* @group Sync
|
|
412
405
|
*/
|
|
413
406
|
decodeToUint8Array(input: string, options?: DduOptions): Uint8Array;
|
|
407
|
+
private decodeToUint8ArrayInternal;
|
|
414
408
|
/**
|
|
415
409
|
* 비동기 인코딩 - 브라우저를 포함한 모든 런타임에서 동작합니다.
|
|
410
|
+
*
|
|
411
|
+
* @group Async
|
|
416
412
|
*/
|
|
417
413
|
encodeAsync(input: Uint8Array | string, options?: DduOptions): Promise<string>;
|
|
414
|
+
private encodeAsyncInternal;
|
|
418
415
|
/**
|
|
419
416
|
* 비동기 디코딩 - 브라우저를 포함한 모든 런타임에서 동작합니다.
|
|
417
|
+
*
|
|
418
|
+
* @group Async
|
|
420
419
|
*/
|
|
421
420
|
decodeAsync(input: string, options?: DduOptions): Promise<string>;
|
|
422
421
|
/**
|
|
423
422
|
* 비동기 Uint8Array 디코딩 - 브라우저를 포함한 모든 런타임에서 동작합니다.
|
|
423
|
+
*
|
|
424
|
+
* @group Async
|
|
424
425
|
*/
|
|
425
426
|
decodeToUint8ArrayAsync(input: string, options?: DduOptions): Promise<Uint8Array>;
|
|
427
|
+
private decodeToUint8ArrayAsyncInternal;
|
|
426
428
|
/**
|
|
427
429
|
* charset 정보를 가져옵니다.
|
|
430
|
+
*
|
|
431
|
+
* @group Introspection
|
|
428
432
|
*/
|
|
429
433
|
getCharSetInfo(): CharSetInfo;
|
|
430
434
|
/**
|
|
431
435
|
* 인코딩 통계를 가져옵니다.
|
|
436
|
+
*
|
|
437
|
+
* @group Introspection
|
|
432
438
|
*/
|
|
433
439
|
getStats(input: Uint8Array | string, options?: DduOptions): DduEncodeStats;
|
|
434
440
|
/**
|
|
435
441
|
* 통계를 위한 메타데이터 포함 내부 인코딩.
|
|
436
442
|
*/
|
|
437
443
|
private encodeInternal;
|
|
438
|
-
private resolveEncodeSettings;
|
|
439
444
|
/**
|
|
440
445
|
* 인코딩 마무리: 비트팩 인코딩 + 후처리(난독화/체크섬/URL-safe/청킹).
|
|
441
446
|
* 동기/비동기 인코딩에서 공유하는 순수 동기 단계입니다.
|
|
@@ -445,43 +450,19 @@ declare class Ddu64Core {
|
|
|
445
450
|
* 인코딩 후처리: 난독화, 체크섬, URL-safe, 청킹을 적용합니다.
|
|
446
451
|
*/
|
|
447
452
|
private applyPostEncoding;
|
|
448
|
-
/**
|
|
449
|
-
* BitPack + 푸터를 사용하여 바이트를 charset 문자열로 인코딩합니다.
|
|
450
|
-
*/
|
|
451
|
-
private encodeBytes;
|
|
452
453
|
/**
|
|
453
454
|
* 디코딩 전처리: 동기/비동기 디코딩에서 공통으로 쓰는 순수 동기 단계.
|
|
454
455
|
* 청크 제거 → URL-safe 역변환 → 체크섬 추출 → 역난독화 → 푸터 파싱 →
|
|
455
456
|
* 검증(정렬/패딩/크기) → 비트팩 해제까지 수행합니다.
|
|
456
457
|
*/
|
|
457
458
|
private decodePrelude;
|
|
458
|
-
|
|
459
|
-
* 압축 해제 단계를 실행해야 하는지 결정합니다.
|
|
460
|
-
* (압축 마커 존재 + 내부 압축 해제 허용 + 파이프라인 단계 조건)
|
|
461
|
-
*/
|
|
462
|
-
private shouldDecompress;
|
|
463
|
-
/**
|
|
464
|
-
* 추출된 체크섬이 있으면 복원된 데이터의 CRC32와 비교 검증합니다.
|
|
465
|
-
* 동기/비동기 디코딩에서 공유하는 순수 동기 단계입니다.
|
|
466
|
-
*/
|
|
467
|
-
private verifyDecodedChecksum;
|
|
468
|
-
/**
|
|
469
|
-
* charset 문자열을 인덱스로 변환한 후 BitPack으로 바이트를 얻습니다.
|
|
470
|
-
*/
|
|
471
|
-
private decodeChars;
|
|
472
|
-
private encodeBytesWithNativeBase64;
|
|
473
|
-
private decodeCharsWithNativeBase64;
|
|
474
|
-
private bytesToBase64;
|
|
475
|
-
private base64ToBytes;
|
|
476
|
-
private shouldUseWasm;
|
|
459
|
+
private getPayloadCodecContext;
|
|
477
460
|
private reportProgress;
|
|
478
|
-
private requireSyncAdapter;
|
|
479
461
|
private encryptSync;
|
|
480
462
|
private decryptSync;
|
|
481
463
|
private compressSync;
|
|
482
464
|
private decompressSync;
|
|
483
|
-
private
|
|
484
|
-
private getKeyHashAsync;
|
|
465
|
+
private getSyncGatewayContext;
|
|
485
466
|
/**
|
|
486
467
|
* 난독화 레이어를 가져오거나 생성합니다 (지연 초기화).
|
|
487
468
|
* 알파벳에는 charset 문자, 패딩 문자, 모든 푸터 마커 문자가 포함됩니다.
|
|
@@ -493,12 +474,8 @@ declare class Ddu64Core {
|
|
|
493
474
|
* 암호화 키 없이 난독화가 활성화되면 throw합니다.
|
|
494
475
|
*/
|
|
495
476
|
private shouldObfuscate;
|
|
496
|
-
private normalizeLimit;
|
|
497
477
|
private assertSafeChunkSeparator;
|
|
498
478
|
private isLineBreakSeparator;
|
|
499
|
-
private estimateDecodedBytes;
|
|
500
|
-
private assertEncodedInputAligned;
|
|
501
|
-
private assertCanonicalPadding;
|
|
502
479
|
}
|
|
503
480
|
|
|
504
481
|
/**
|
|
@@ -634,39 +611,75 @@ declare class CharsetBuilder {
|
|
|
634
611
|
}
|
|
635
612
|
|
|
636
613
|
/**
|
|
637
|
-
* ddunigma
|
|
614
|
+
* ddunigma custom error hierarchy.
|
|
638
615
|
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* 조용히 JS로 폴백합니다.
|
|
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.
|
|
642
618
|
*
|
|
643
|
-
* @module
|
|
619
|
+
* @module core/errors
|
|
644
620
|
*/
|
|
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;
|
|
645
684
|
|
|
646
|
-
|
|
647
|
-
* WASM 모듈을 사전 로드하고 초기화합니다.
|
|
648
|
-
*
|
|
649
|
-
* 첫 번째 인코딩/디코딩 연산 전에 WASM이 준비되도록 애플리케이션 초기에
|
|
650
|
-
* 호출하세요. WASM이 초기화되면 resolve되고, 10초 내에 초기화에 실패하면
|
|
651
|
-
* reject됩니다.
|
|
652
|
-
*
|
|
653
|
-
* @throws WASM 초기화가 실패하거나 타임아웃(10초)된 경우 에러
|
|
654
|
-
*/
|
|
655
|
-
declare function preloadWasm(): Promise<void>;
|
|
656
|
-
/**
|
|
657
|
-
* WASM 코덱이 준비되었으면 반환하거나, 온디맨드 초기화를 시도합니다.
|
|
658
|
-
*
|
|
659
|
-
* `preloadWasm()`이 호출되지 않았으면 5초 타임아웃으로 초기화를 시도합니다.
|
|
660
|
-
* WASM을 사용할 수 없으면 null을 반환합니다.
|
|
661
|
-
*
|
|
662
|
-
* 이 함수는 throw하지 않음 — 실패 시 null을 반환합니다.
|
|
663
|
-
*/
|
|
664
|
-
declare function getWasmCodec(): WasmCodec | null;
|
|
665
|
-
/**
|
|
666
|
-
* WASM 코덱이 이미 초기화된 경우에만 반환합니다.
|
|
667
|
-
* 온디맨드 초기화를 트리거하지 않습니다.
|
|
668
|
-
* WASM이 준비되지 않았으면 null을 반환합니다.
|
|
669
|
-
*/
|
|
670
|
-
declare function getWasmCodecSync(): WasmCodec | null;
|
|
671
|
-
|
|
672
|
-
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, type DduEncodeStats as d, type DduOptions as e, type DduProgressInfo as f, DduSetSymbol as g, type DduTextEncoding as h, type KeyDerivationOptions as i, getWasmCodec as j, getWasmCodecSync as k, preloadWasm as p };
|
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkWS6GB27C_cjs=require('./chunk-WS6GB27C.cjs'),chunkFACJ5LAG_cjs=require('./chunk-FACJ5LAG.cjs'),chunkRFBXQWSA_cjs=require('./chunk-RFBXQWSA.cjs'),chunkRHVBUC4T_cjs=require('./chunk-RHVBUC4T.cjs');require('./chunk-NY4FGVF3.cjs');var promises=require('fs/promises'),path=require('path'),url=require('url');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var d=class extends chunkFACJ5LAG_cjs.B{constructor(r,t,e){let s=chunkFACJ5LAG_cjs.x(r,t,e),C={...s.dduOptions,adapter:s.dduOptions?.adapter??new chunkRHVBUC4T_cjs.a};super(s.dduChar,s.paddingChar,C);}decodeToBuffer(r,t){let e=this.decodeToUint8Array(r,t);return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}async decodeToBufferAsync(r,t){let e=await this.decodeToUint8ArrayAsync(r,t);return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}};async function M(){let o=chunkWS6GB27C_cjs.a();switch(o){case "node":{let{NodeAdapter:r}=await import('./NodeAdapter-DS44MI5D.cjs');return new r}case "deno":case "bun":case "browser":case "edge":{let{BrowserAdapter:r}=await import('./BrowserAdapter-LIUL744V.cjs');return new r(o)}default:throw new Error("[ddunigma] No suitable crypto provider found. Detected runtime lacks both Node.js crypto module and Web Crypto API (SubtleCrypto).")}}var D=false;async function V(o){try{let r=await promises.readFile(o);return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch{return null}}async function X(){let o=path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))),r=[path.join(o,"wasm","codec.wasm"),path.join(o,"codec.wasm"),path.join(o,"..","wasm","codec.wasm")];for(let t of r){let e=await V(t);if(e)return e}return null}function i(){D||(chunkFACJ5LAG_cjs.g(X),D=true);}async function q(){return i(),chunkFACJ5LAG_cjs.d()}function z(){return i(),chunkFACJ5LAG_cjs.e()}function G(){return i(),chunkFACJ5LAG_cjs.f()}Object.defineProperty(exports,"createReadableDecodeStream",{enumerable:true,get:function(){return chunkWS6GB27C_cjs.c}});Object.defineProperty(exports,"createReadableEncodeStream",{enumerable:true,get:function(){return chunkWS6GB27C_cjs.b}});Object.defineProperty(exports,"detectRuntime",{enumerable:true,get:function(){return chunkWS6GB27C_cjs.a}});Object.defineProperty(exports,"CharsetBuilder",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.C}});Object.defineProperty(exports,"Ddu64AdapterError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.s}});Object.defineProperty(exports,"Ddu64CharsetError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.q}});Object.defineProperty(exports,"Ddu64ChecksumError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.p}});Object.defineProperty(exports,"Ddu64CompressionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.l}});Object.defineProperty(exports,"Ddu64Core",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.B}});Object.defineProperty(exports,"Ddu64DecodeError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.k}});Object.defineProperty(exports,"Ddu64DecompressionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.m}});Object.defineProperty(exports,"Ddu64DecryptionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.o}});Object.defineProperty(exports,"Ddu64EncodeError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.j}});Object.defineProperty(exports,"Ddu64EncryptionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.n}});Object.defineProperty(exports,"Ddu64Error",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.i}});Object.defineProperty(exports,"Ddu64ErrorCode",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.h}});Object.defineProperty(exports,"Ddu64LimitError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.r}});Object.defineProperty(exports,"Ddu64ObfuscationError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.t}});Object.defineProperty(exports,"Ddu64StreamError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.u}});Object.defineProperty(exports,"DduSetSymbol",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.a}});Object.defineProperty(exports,"HangulObfuscationLayer",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.b}});Object.defineProperty(exports,"createObfuscationLayer",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.c}});Object.defineProperty(exports,"isDdu64Error",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.v}});Object.defineProperty(exports,"BrowserAdapter",{enumerable:true,get:function(){return chunkRFBXQWSA_cjs.a}});Object.defineProperty(exports,"NodeAdapter",{enumerable:true,get:function(){return chunkRHVBUC4T_cjs.a}});exports.Ddu64=d;exports.Ddu64Node=d;exports.getAdapter=M;exports.getWasmCodec=z;exports.getWasmCodecSync=G;exports.preloadWasm=q;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as Ddu64Core, a as DduConstructorOptions,
|
|
2
|
-
export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, d as
|
|
3
|
-
export { B as BrowserAdapter, H as HangulObfuscationLayer, c as createObfuscationLayer, a as createReadableDecodeStream, b as createReadableEncodeStream, d as detectRuntime } from './ObfuscationLayer-
|
|
1
|
+
import { D as Ddu64Core, a as DduConstructorOptions, u as DduOptions, P as PlatformAdapter, y as KeyDerivationOptions, W as WasmCodec } from './errors-DxOlTuHc.cjs';
|
|
2
|
+
export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, t as DduEncodeStats, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, O as ObfuscationLayer, T as TestVector, z as isDdu64Error } from './errors-DxOlTuHc.cjs';
|
|
3
|
+
export { B as BrowserAdapter, H as HangulObfuscationLayer, c as createObfuscationLayer, a as createReadableDecodeStream, b as createReadableEncodeStream, d as detectRuntime } from './ObfuscationLayer-BRiyE5xu.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Node.js 전용 Ddu64 래퍼.
|
|
@@ -36,6 +36,7 @@ declare class Ddu64Node extends Ddu64Core {
|
|
|
36
36
|
* @param input - 디코딩할 인코딩된 문자열
|
|
37
37
|
* @param options - 디코딩 옵션
|
|
38
38
|
* @returns 디코딩된 Buffer
|
|
39
|
+
* @group Sync
|
|
39
40
|
*/
|
|
40
41
|
decodeToBuffer(input: string, options?: DduOptions): Buffer;
|
|
41
42
|
/**
|
|
@@ -44,6 +45,7 @@ declare class Ddu64Node extends Ddu64Core {
|
|
|
44
45
|
* @param input - 디코딩할 인코딩된 문자열
|
|
45
46
|
* @param options - 디코딩 옵션
|
|
46
47
|
* @returns 디코딩된 Buffer로 resolve되는 Promise
|
|
48
|
+
* @group Async
|
|
47
49
|
*/
|
|
48
50
|
decodeToBufferAsync(input: string, options?: DduOptions): Promise<Buffer>;
|
|
49
51
|
}
|
|
@@ -67,10 +69,10 @@ declare class NodeAdapter implements PlatformAdapter {
|
|
|
67
69
|
readonly runtime: "node";
|
|
68
70
|
deriveKey(key: string, options?: KeyDerivationOptions): Promise<Uint8Array>;
|
|
69
71
|
deriveKeySync(key: string, options?: KeyDerivationOptions): Uint8Array;
|
|
70
|
-
encrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
71
|
-
encryptSync(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
72
|
-
decrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
73
|
-
decryptSync(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
72
|
+
encrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
73
|
+
encryptSync(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
74
|
+
decrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
75
|
+
decryptSync(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
74
76
|
randomBytes(length: number): Uint8Array;
|
|
75
77
|
deflate(data: Uint8Array, level?: number): Promise<Uint8Array>;
|
|
76
78
|
deflateSync(data: Uint8Array, level?: number): Uint8Array;
|
|
@@ -103,4 +105,17 @@ declare class NodeAdapter implements PlatformAdapter {
|
|
|
103
105
|
*/
|
|
104
106
|
declare function getAdapter(): Promise<PlatformAdapter>;
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Node.js 파일시스템 기반 WASM 로더.
|
|
110
|
+
*
|
|
111
|
+
* 브라우저/core 엔트리에서 Node.js 내장 모듈이 번들에 섞이지 않도록
|
|
112
|
+
* Node 전용 진입점(`@ddunigma/node`)에서만 이 모듈을 가져옵니다.
|
|
113
|
+
*
|
|
114
|
+
* @module wasm/WasmCodecNode
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
declare function preloadWasm(): Promise<void>;
|
|
118
|
+
declare function getWasmCodec(): WasmCodec | null;
|
|
119
|
+
declare function getWasmCodecSync(): WasmCodec | null;
|
|
120
|
+
|
|
121
|
+
export { Ddu64Node as Ddu64, Ddu64Core, Ddu64Node, DduConstructorOptions, DduOptions, KeyDerivationOptions, NodeAdapter, PlatformAdapter, WasmCodec, getAdapter, getWasmCodec, getWasmCodecSync, preloadWasm };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as Ddu64Core, a as DduConstructorOptions,
|
|
2
|
-
export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, d as
|
|
3
|
-
export { B as BrowserAdapter, H as HangulObfuscationLayer, c as createObfuscationLayer, a as createReadableDecodeStream, b as createReadableEncodeStream, d as detectRuntime } from './ObfuscationLayer-
|
|
1
|
+
import { D as Ddu64Core, a as DduConstructorOptions, u as DduOptions, P as PlatformAdapter, y as KeyDerivationOptions, W as WasmCodec } from './errors-DxOlTuHc.js';
|
|
2
|
+
export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, t as DduEncodeStats, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, O as ObfuscationLayer, T as TestVector, z as isDdu64Error } from './errors-DxOlTuHc.js';
|
|
3
|
+
export { B as BrowserAdapter, H as HangulObfuscationLayer, c as createObfuscationLayer, a as createReadableDecodeStream, b as createReadableEncodeStream, d as detectRuntime } from './ObfuscationLayer-DZiQGHMw.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Node.js 전용 Ddu64 래퍼.
|
|
@@ -36,6 +36,7 @@ declare class Ddu64Node extends Ddu64Core {
|
|
|
36
36
|
* @param input - 디코딩할 인코딩된 문자열
|
|
37
37
|
* @param options - 디코딩 옵션
|
|
38
38
|
* @returns 디코딩된 Buffer
|
|
39
|
+
* @group Sync
|
|
39
40
|
*/
|
|
40
41
|
decodeToBuffer(input: string, options?: DduOptions): Buffer;
|
|
41
42
|
/**
|
|
@@ -44,6 +45,7 @@ declare class Ddu64Node extends Ddu64Core {
|
|
|
44
45
|
* @param input - 디코딩할 인코딩된 문자열
|
|
45
46
|
* @param options - 디코딩 옵션
|
|
46
47
|
* @returns 디코딩된 Buffer로 resolve되는 Promise
|
|
48
|
+
* @group Async
|
|
47
49
|
*/
|
|
48
50
|
decodeToBufferAsync(input: string, options?: DduOptions): Promise<Buffer>;
|
|
49
51
|
}
|
|
@@ -67,10 +69,10 @@ declare class NodeAdapter implements PlatformAdapter {
|
|
|
67
69
|
readonly runtime: "node";
|
|
68
70
|
deriveKey(key: string, options?: KeyDerivationOptions): Promise<Uint8Array>;
|
|
69
71
|
deriveKeySync(key: string, options?: KeyDerivationOptions): Uint8Array;
|
|
70
|
-
encrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
71
|
-
encryptSync(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
72
|
-
decrypt(data: Uint8Array, keyHash: Uint8Array): Promise<Uint8Array>;
|
|
73
|
-
decryptSync(data: Uint8Array, keyHash: Uint8Array): Uint8Array;
|
|
72
|
+
encrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
73
|
+
encryptSync(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
74
|
+
decrypt(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
75
|
+
decryptSync(data: Uint8Array, keyHash: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
74
76
|
randomBytes(length: number): Uint8Array;
|
|
75
77
|
deflate(data: Uint8Array, level?: number): Promise<Uint8Array>;
|
|
76
78
|
deflateSync(data: Uint8Array, level?: number): Uint8Array;
|
|
@@ -103,4 +105,17 @@ declare class NodeAdapter implements PlatformAdapter {
|
|
|
103
105
|
*/
|
|
104
106
|
declare function getAdapter(): Promise<PlatformAdapter>;
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Node.js 파일시스템 기반 WASM 로더.
|
|
110
|
+
*
|
|
111
|
+
* 브라우저/core 엔트리에서 Node.js 내장 모듈이 번들에 섞이지 않도록
|
|
112
|
+
* Node 전용 진입점(`@ddunigma/node`)에서만 이 모듈을 가져옵니다.
|
|
113
|
+
*
|
|
114
|
+
* @module wasm/WasmCodecNode
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
declare function preloadWasm(): Promise<void>;
|
|
118
|
+
declare function getWasmCodec(): WasmCodec | null;
|
|
119
|
+
declare function getWasmCodecSync(): WasmCodec | null;
|
|
120
|
+
|
|
121
|
+
export { Ddu64Node as Ddu64, Ddu64Core, Ddu64Node, DduConstructorOptions, DduOptions, KeyDerivationOptions, NodeAdapter, PlatformAdapter, WasmCodec, getAdapter, getWasmCodec, getWasmCodecSync, preloadWasm };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-M7526IW7.js';export{c as createReadableDecodeStream,b as createReadableEncodeStream,a as detectRuntime}from'./chunk-M7526IW7.js';import {B,x,d as d$1,e,f,g}from'./chunk-65RDFQV7.js';export{C as CharsetBuilder,s as Ddu64AdapterError,q as Ddu64CharsetError,p as Ddu64ChecksumError,l as Ddu64CompressionError,B as Ddu64Core,k as Ddu64DecodeError,m as Ddu64DecompressionError,o as Ddu64DecryptionError,j as Ddu64EncodeError,n as Ddu64EncryptionError,i as Ddu64Error,h as Ddu64ErrorCode,r as Ddu64LimitError,t as Ddu64ObfuscationError,u as Ddu64StreamError,a as DduSetSymbol,b as HangulObfuscationLayer,c as createObfuscationLayer,v as isDdu64Error}from'./chunk-65RDFQV7.js';export{a as BrowserAdapter}from'./chunk-P7WJ2LOQ.js';import {a}from'./chunk-342X2QEY.js';export{a as NodeAdapter}from'./chunk-342X2QEY.js';import'./chunk-QR43FNIY.js';import {readFile}from'fs/promises';import {dirname,join}from'path';import {fileURLToPath}from'url';var d=class extends B{constructor(r,t,e){let s=x(r,t,e),C={...s.dduOptions,adapter:s.dduOptions?.adapter??new a};super(s.dduChar,s.paddingChar,C);}decodeToBuffer(r,t){let e=this.decodeToUint8Array(r,t);return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}async decodeToBufferAsync(r,t){let e=await this.decodeToUint8ArrayAsync(r,t);return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}};async function M(){let o=a$1();switch(o){case "node":{let{NodeAdapter:r}=await import('./NodeAdapter-AHALQ4DQ.js');return new r}case "deno":case "bun":case "browser":case "edge":{let{BrowserAdapter:r}=await import('./BrowserAdapter-G4XORUQJ.js');return new r(o)}default:throw new Error("[ddunigma] No suitable crypto provider found. Detected runtime lacks both Node.js crypto module and Web Crypto API (SubtleCrypto).")}}var D=false;async function V(o){try{let r=await readFile(o);return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch{return null}}async function X(){let o=dirname(fileURLToPath(import.meta.url)),r=[join(o,"wasm","codec.wasm"),join(o,"codec.wasm"),join(o,"..","wasm","codec.wasm")];for(let t of r){let e=await V(t);if(e)return e}return null}function i(){D||(g(X),D=true);}async function q(){return i(),d$1()}function z(){return i(),e()}function G(){return i(),f()}export{d as Ddu64,d as Ddu64Node,M as getAdapter,z as getWasmCodec,G as getWasmCodecSync,q as preloadWasm};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddunigma/node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"browser": "./dist/browser.js",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"sideEffects": false,
|
|
9
10
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
11
|
+
"node": ">=22.0.0"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "tsup",
|
|
14
15
|
"bench": "node --expose-gc --import tsx benchmarks/encoding-benchmark.ts",
|
|
15
16
|
"pack:check": "node scripts/verify-pack.mjs",
|
|
17
|
+
"prepublishOnly": "pnpm test && pnpm build && pnpm pack:check",
|
|
16
18
|
"test": "vitest run",
|
|
17
19
|
"test:watch": "vitest",
|
|
18
20
|
"test:coverage": "vitest run --coverage",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
19
22
|
"lint": "eslint src eslint.config.mjs tsup.config.ts",
|
|
20
23
|
"lint:fix": "eslint src eslint.config.mjs tsup.config.ts --fix",
|
|
21
24
|
"format": "prettier --write src/",
|
|
@@ -23,14 +26,48 @@
|
|
|
23
26
|
},
|
|
24
27
|
"exports": {
|
|
25
28
|
".": {
|
|
29
|
+
"browser": {
|
|
30
|
+
"types": "./dist/browser.d.ts",
|
|
31
|
+
"import": "./dist/browser.js",
|
|
32
|
+
"require": "./dist/browser.cjs"
|
|
33
|
+
},
|
|
34
|
+
"worker": {
|
|
35
|
+
"types": "./dist/browser.d.ts",
|
|
36
|
+
"import": "./dist/browser.js",
|
|
37
|
+
"require": "./dist/browser.cjs"
|
|
38
|
+
},
|
|
39
|
+
"workerd": {
|
|
40
|
+
"types": "./dist/browser.d.ts",
|
|
41
|
+
"default": "./dist/browser.js"
|
|
42
|
+
},
|
|
43
|
+
"deno": {
|
|
44
|
+
"types": "./dist/browser.d.ts",
|
|
45
|
+
"default": "./dist/browser.js"
|
|
46
|
+
},
|
|
47
|
+
"bun": {
|
|
48
|
+
"types": "./dist/browser.d.ts",
|
|
49
|
+
"import": "./dist/browser.js",
|
|
50
|
+
"require": "./dist/browser.cjs"
|
|
51
|
+
},
|
|
52
|
+
"node": {
|
|
53
|
+
"import": {
|
|
54
|
+
"types": "./dist/index.d.ts",
|
|
55
|
+
"default": "./dist/index.js"
|
|
56
|
+
},
|
|
57
|
+
"require": {
|
|
58
|
+
"types": "./dist/index.d.cts",
|
|
59
|
+
"default": "./dist/index.cjs"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
26
62
|
"import": {
|
|
27
|
-
"types": "./dist/
|
|
28
|
-
"default": "./dist/
|
|
63
|
+
"types": "./dist/browser.d.ts",
|
|
64
|
+
"default": "./dist/browser.js"
|
|
29
65
|
},
|
|
30
66
|
"require": {
|
|
31
67
|
"types": "./dist/index.d.cts",
|
|
32
68
|
"default": "./dist/index.cjs"
|
|
33
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"default": "./dist/browser.js"
|
|
34
71
|
},
|
|
35
72
|
"./browser": {
|
|
36
73
|
"import": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkNFMYVNOG_cjs=require('./chunk-NFMYVNOG.cjs');require('./chunk-NY4FGVF3.cjs');Object.defineProperty(exports,"BrowserAdapter",{enumerable:true,get:function(){return chunkNFMYVNOG_cjs.a}});//# sourceMappingURL=BrowserAdapter-M7PUHVGS.cjs.map
|
|
2
|
-
//# sourceMappingURL=BrowserAdapter-M7PUHVGS.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkTJTDYO65_cjs=require('./chunk-TJTDYO65.cjs');require('./chunk-NY4FGVF3.cjs');Object.defineProperty(exports,"NodeAdapter",{enumerable:true,get:function(){return chunkTJTDYO65_cjs.a}});//# sourceMappingURL=NodeAdapter-JRRSYUJT.cjs.map
|
|
2
|
-
//# sourceMappingURL=NodeAdapter-JRRSYUJT.cjs.map
|
package/dist/chunk-5RZDTEOZ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {c,a,d}from'./chunk-QR43FNIY.js';var y=new Map;function m(r){if(r.buffer instanceof ArrayBuffer)return r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);let e=new Uint8Array(r.byteLength);return e.set(r),e.buffer}function h(r){let e=y.get(r);if(e!==void 0)return e;if(typeof CompressionStream>"u"||typeof DecompressionStream>"u")return y.set(r,false),false;try{return new CompressionStream(r),new DecompressionStream(r),y.set(r,!0),!0}catch{return y.set(r,false),false}}function u(r,e){if(!h(r)){let n=r==="brotli"?"Brotli":"Deflate raw";throw new Error(`[Ddu64 ${e}] ${n} ${e}ion is unsupported in the current runtime. CompressionStream/DecompressionStream does not support "${r}".`)}return r}var w=class{supportsSyncCrypto=false;supportsSyncCompression=false;supportsBrotli=h("brotli");runtime="browser";async deriveKey(e,n){let t=new TextEncoder().encode(e);if(n?.algorithm==="pbkdf2"){let o=await crypto.subtle.importKey("raw",t,"PBKDF2",false,["deriveBits"]),i=await crypto.subtle.deriveBits({name:"PBKDF2",salt:d(n.salt),iterations:a(n.iterations),hash:c(n.hash)},o,256);return new Uint8Array(i)}let a$1=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(a$1)}async encrypt(e,n){let s=crypto.getRandomValues(new Uint8Array(12)),t=await crypto.subtle.importKey("raw",m(n),{name:"AES-GCM"},false,["encrypt"]),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:s,tagLength:128},t,m(e)),o=new Uint8Array(a),i=o.slice(0,o.length-16),c=o.slice(o.length-16),p=new Uint8Array(28+i.length);return p.set(s,0),p.set(c,12),p.set(i,28),p}async decrypt(e,n){if(e.length<28)throw new Error("[Ddu64 decrypt] Encrypted data is invalid. Payload must be at least 28 bytes (12 IV + 16 authTag + ciphertext).");let s=e.slice(0,12),t=e.slice(12,28),a=e.slice(28),o=new Uint8Array(a.length+16);o.set(a,0),o.set(t,a.length);let i=await crypto.subtle.importKey("raw",m(n),{name:"AES-GCM"},false,["decrypt"]);try{let c=await crypto.subtle.decrypt({name:"AES-GCM",iv:s,tagLength:128},i,m(o));return new Uint8Array(c)}catch{throw new Error("[Ddu64 decrypt] Decryption failed: data tampering or incorrect key.")}}randomBytes(e){return crypto.getRandomValues(new Uint8Array(e))}async deflate(e,n){if(typeof CompressionStream>"u")throw new Error("[Ddu64 compress] Deflate compression is unsupported in the current runtime. CompressionStream API is not available.");let s=this.getDeflateFormat("compress"),t=new CompressionStream(s);return this.writeAndReadStream(t,e)}async inflate(e,n){if(typeof DecompressionStream>"u")throw new Error("[Ddu64 decompress] Deflate decompression is unsupported in the current runtime. DecompressionStream API is not available.");let s=this.getDeflateFormat("decompress"),t=new DecompressionStream(s);return this.writeAndReadStream(t,e,n)}async brotliCompress(e,n){let s=u("brotli","compress"),t=new CompressionStream(s);return this.writeAndReadStream(t,e)}async brotliDecompress(e,n){let s=u("brotli","decompress"),t=new DecompressionStream(s);return this.writeAndReadStream(t,e,n)}getDeflateFormat(e){return u("deflate-raw",e)}async writeAndReadStream(e,n,s){let t=e.writable.getWriter(),a=e.readable.getReader(),o=(async()=>{await t.write(new Uint8Array(m(n))),await t.close();})(),i=this.readAllChunks(a,s);try{let[c]=await Promise.all([i,o]);return c}catch(c){throw await a.cancel(c).catch(()=>{}),await t.abort(c).catch(()=>{}),c}}async readAllChunks(e,n){let s=[],t=0;for(;;){let{done:i,value:c}=await e.read();if(i)break;if(t+=c.length,n!==void 0&&t>n)throw new Error(`[Ddu64 decompress] Decompressed size exceeds limit. Estimated ${t}+ bytes exceeds maximum of ${n} bytes.`);s.push(c);}let a=new Uint8Array(t),o=0;for(let i of s)a.set(i,o),o+=i.length;return a}};export{w as a};//# sourceMappingURL=chunk-5RZDTEOZ.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-5RZDTEOZ.js.map
|
package/dist/chunk-JUBMOKKH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b,a,c}from'./chunk-KEWLOPEV.js';function I(){let e=globalThis;if(e.Deno?.version?.deno)return "deno";if(e.Bun?.version)return "bun";if(e.process?.versions?.node)return "node";if(typeof e.crypto<"u"&&e.crypto?.subtle)return "browser";throw new Error("[ddunigma] No suitable crypto provider found. Detected runtime lacks both Node.js crypto module and Web Crypto API (SubtleCrypto).")}function v(e,n){let a=e.getCharSetInfo(),h=n?.compress??a.defaultCompress,p=(n?.encrypt??true)&&a.hasEncryptionKey,g=n?.checksum??a.defaultChecksum,r=h?n?.compressionAlgorithm??a.defaultCompressionAlgorithm:void 0,m=a.paddingChar,d=C(a,{compressed:h,encrypted:p,checksum:g}),y=false,u=[],s=0,o=null;return new TransformStream({async transform(t,c){if(d){if(!y){let k=b(m,{compressionAlgorithm:void 0,encrypted:false});c.enqueue(k),y=true;}let i;o&&o.length>0?(i=new Uint8Array(o.length+t.length),i.set(o,0),i.set(t,o.length)):i=t;let l=a.bitLength,S=E(l,8)/8,f=Math.floor(i.length/S)*S;if(f>0){let k=i.subarray(0,f),D=await e.encodeAsync(k,{compress:false,encrypt:false,checksum:false,chunkSize:void 0,chunkSeparator:void 0,omitFooter:true});c.enqueue(D);}f<i.length?o=i.slice(f):o=null;}else u.push(t),s+=t.length;},async flush(t){try{if(d){if(!y){let c=b(m,{compressionAlgorithm:void 0,encrypted:!1});t.enqueue(c);}if(o&&o.length>0){let c=await e.encodeAsync(o,{compress:!1,encrypt:!1,checksum:!1,chunkSize:void 0,chunkSeparator:void 0});t.enqueue(c);}o=null;}else {let c=b(m,{compressionAlgorithm:r,encrypted:p});if(t.enqueue(c),s>0){let i=new Uint8Array(s),l=0;for(let f of u)i.set(f,l),l+=f.length;let S=await e.encodeAsync(i,{...n,compress:h,encrypt:p,checksum:g,chunkSize:void 0,chunkSeparator:void 0});t.enqueue(S);}u=[],s=0;}}catch(c){t.error(c instanceof Error?c:new Error(String(c)));}}})}function L(e,n){let a$1=e.getCharSetInfo(),h=a$1.paddingChar,p=a(h),g=n?.checksum??a$1.defaultChecksum,r="",m=false,d=null,y=false;return new TransformStream({async transform(u,s){if(r+=u,!m&&r.length>=p){if(!r.startsWith(h)){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(d=c(r,h),d===null){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(d.encrypted&&!a$1.hasEncryptionKey){s.error(new Error("[WebStreams decode] Encrypted stream requires an encryptionKey"));return}m=true,y=C(a$1,{compressed:!!d.compressionAlgorithm,encrypted:d.encrypted,checksum:g}),r=r.slice(p);}if(m&&y&&r.length>0){let o=a$1.bitLength,t=E(o,8)/o,c=Math.floor(r.length/t)*t;if(c>0){let i=r.slice(0,c);r=r.slice(c);try{let l=await e.decodeToUint8ArrayAsync(i,{compress:!1,encrypt:!1,checksum:!1,chunkSize:void 0,chunkSeparator:void 0});l.length>0&&s.enqueue(l);}catch{r=i+r;}}}},async flush(u){try{if(!m){if(r.length===0)return;u.error(new Error("[WebStreams decode] Incomplete stream header"));return}if(r.length===0)return;let s=d.compressionAlgorithm,o=d.encrypted,t=await e.decodeToUint8ArrayAsync(r,{...n,compress:!!s,compressionAlgorithm:s,encrypt:o,checksum:g,chunkSize:void 0,chunkSeparator:void 0});t.length>0&&u.enqueue(t),r="";}catch(s){u.error(s instanceof Error?s:new Error(String(s)));}}})}function C(e,n){return e.usePowerOfTwo&&!n.compressed&&!n.encrypted&&!n.checksum}function E(e,n){return e*n/U(e,n)}function U(e,n){for(;n!==0;){let a=n;n=e%n,e=a;}return e}export{I as a,v as b,L as c};//# sourceMappingURL=chunk-JUBMOKKH.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-JUBMOKKH.js.map
|