@katlux/providers 0.1.1-alpha.133 → 0.1.1-alpha.135

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { H3Event } from 'h3';
2
- import * as crypto from 'node:crypto';
2
+ import * as NodeCrypto from 'node:crypto';
3
3
 
4
4
  declare enum EDataFilterOperator {
5
5
  Equal = "==",
@@ -18,12 +18,24 @@ declare enum EDataFilterOperator {
18
18
  Contains = "contains",
19
19
  Like = "like"
20
20
  }
21
- interface IDataFilter$1 {
21
+ interface IDataFilter {
22
22
  operator: EDataFilterOperator;
23
- field: TDataRow | IDataFilter$1 | IDataFilter$1[];
23
+ field: TDataRow | IDataFilter | IDataFilter[];
24
24
  active: boolean;
25
25
  }
26
- interface IDataSort$1 {
26
+ declare const SEARCH_FILTER_NOT_OPERATOR: "not";
27
+ interface ISearchFilterNotNode {
28
+ operator: typeof SEARCH_FILTER_NOT_OPERATOR;
29
+ field: TSearchFilterNode;
30
+ active: boolean;
31
+ }
32
+ interface ISearchFilterCompoundNode {
33
+ operator: EDataFilterOperator.And | EDataFilterOperator.Or | EDataFilterOperator.Nand | EDataFilterOperator.Nor;
34
+ field: TSearchFilterNode[];
35
+ active: boolean;
36
+ }
37
+ type TSearchFilterNode = IDataFilter | ISearchFilterNotNode | ISearchFilterCompoundNode;
38
+ interface IDataSort {
27
39
  field: string;
28
40
  direction: 'asc' | 'desc';
29
41
  }
@@ -68,13 +80,54 @@ interface ICookieCacheOptions {
68
80
  path?: string;
69
81
  }
70
82
 
83
+ /**
84
+ * Cryptographic algorithm and key derivation function (KDF) typing for @katlux/providers.
85
+ * Provides compile-time safety, strict autocompletion, and open extensibility.
86
+ */
87
+ /**
88
+ * Key Derivation Function (KDF) strategies supported by Katlux providers:
89
+ * - 'none': Direct key import (for high-entropy raw keys or CryptoKeys).
90
+ * - 'pbkdf2': Password-Based Key Derivation Function 2 (OWASP standard for human passphrases).
91
+ * - 'hkdf': HMAC-based Extract-and-Expand Key Derivation Function (for high-entropy cryptographic secrets).
92
+ */
93
+ type TKdfStrategy = 'none' | 'pbkdf2' | 'hkdf';
94
+ /**
95
+ * Supported cryptographic hash functions for KDF key derivation (PBKDF2 / HKDF) and HMAC blind indexing.
96
+ */
97
+ type TKdfHash = 'SHA-256' | 'SHA-384' | 'SHA-512';
98
+ /**
99
+ * Symmetric authenticated and block cipher algorithms.
100
+ */
101
+ type TSymmetricAlgorithm = 'AES-GCM' | 'AES-GCM-128' | 'AES-GCM-256' | 'AES-CBC' | 'AES-CBC-128' | 'AES-CBC-256' | 'AES-CBC-128+HMAC-SHA256' | 'AES-CBC-256+HMAC-SHA256' | 'AES-CBC-128+HMAC-SHA-256' | 'AES-CBC-256+HMAC-SHA-256';
102
+ /**
103
+ * Asymmetric RSA-OAEP direct and hybrid algorithms.
104
+ */
105
+ type TRSAAlgorithm = 'RSA-OAEP' | 'RSA-OAEP-2048' | 'RSA-OAEP-4096' | 'RSA-OAEP-2048+AES-GCM-256' | 'RSA-OAEP-4096+AES-GCM-256';
106
+ /**
107
+ * Asymmetric Elliptic-Curve Diffie-Hellman (ECDH) direct and hybrid algorithms.
108
+ */
109
+ type TECDHAlgorithm = 'ECDH' | 'ECDH-P-256' | 'ECDH-P-384' | 'ECDH-P-521' | 'ECDH-P-256+AES-GCM-256' | 'ECDH-P-384+AES-GCM-256' | 'ECDH-P-521+AES-GCM-256';
110
+ /**
111
+ * Streaming chunk cipher algorithms.
112
+ */
113
+ type TStreamAlgorithm = 'AES-CTR' | 'AES-256-CTR';
114
+ /**
115
+ * Union of all built-in supported cryptographic algorithms across Katlux providers.
116
+ */
117
+ type TSupportedAlgorithm = TSymmetricAlgorithm | TRSAAlgorithm | TECDHAlgorithm | TStreamAlgorithm;
118
+ /**
119
+ * Open union: provides full IDE autocompletion for all built-in Katlux algorithms
120
+ * while allowing custom user-defined ciphers/algorithms.
121
+ */
122
+ type TEncryptionAlgorithm = TSupportedAlgorithm | (string & {});
123
+
71
124
  interface IEncryptedPayload {
72
125
  __encrypted: true;
73
126
  ciphertext: string;
74
- alg: string;
127
+ alg: TEncryptionAlgorithm;
75
128
  iv?: string;
76
129
  salt?: string;
77
- kdf?: string;
130
+ kdf?: TKdfStrategy | (string & {});
78
131
  iter?: number;
79
132
  tag?: string;
80
133
  wrappedKey?: string;
@@ -84,6 +137,8 @@ interface IEncryptedPayload {
84
137
  kid?: string;
85
138
  /** True if AEAD additionalData was bound during encryption */
86
139
  aad?: boolean;
140
+ /** Optional Base64-encoded ECDSA sender signature over the canonical envelope */
141
+ signature?: string;
87
142
  }
88
143
  type TRawKey = string | CryptoKey | Uint8Array | ArrayBuffer;
89
144
  type TKeyProvider = TRawKey | (() => TRawKey | Promise<TRawKey>);
@@ -108,7 +163,7 @@ interface IKeyPair {
108
163
  */
109
164
  interface IWrappedKey {
110
165
  wrappedKey: string;
111
- alg: string;
166
+ alg: TEncryptionAlgorithm;
112
167
  }
113
168
  /**
114
169
  * Options for Key Derivation Functions (PBKDF2 / HKDF) in CKeyManager and encryption providers.
@@ -117,7 +172,8 @@ interface IKDFOptions {
117
172
  kdf: 'pbkdf2' | 'hkdf';
118
173
  salt?: Uint8Array | ArrayBuffer | string;
119
174
  iterations?: number;
120
- hash?: 'SHA-256' | 'SHA-512';
175
+ maxAllowedIterations?: number;
176
+ hash?: TKdfHash;
121
177
  info?: string | Uint8Array | ArrayBuffer;
122
178
  keyLength?: 128 | 256;
123
179
  extractable?: boolean;
@@ -127,7 +183,7 @@ interface IKDFOptions {
127
183
  */
128
184
  interface IHKDFFromSecretOptions {
129
185
  salt?: Uint8Array | ArrayBuffer | string;
130
- hash?: 'SHA-256' | 'SHA-512';
186
+ hash?: TKdfHash;
131
187
  info?: string | Uint8Array | ArrayBuffer;
132
188
  keyLength?: 128 | 256;
133
189
  extractable?: boolean;
@@ -174,7 +230,8 @@ interface IDomainDerivedKeys {
174
230
  */
175
231
  interface IDeriveAuthAndEncryptionOptions {
176
232
  iterations?: number;
177
- hash?: 'SHA-256' | 'SHA-512';
233
+ maxAllowedIterations?: number;
234
+ hash?: TKdfHash;
178
235
  authKeyLength?: 128 | 256;
179
236
  encryptionKeyLength?: 128 | 256;
180
237
  authAlgorithm?: 'HMAC' | 'AES-GCM';
@@ -386,6 +443,11 @@ interface INormalizeOptions {
386
443
  * (e.g. Arabic/Persian Alef/Yeh unification, Hebrew Niqqud stripping, CJK fullwidth folding).
387
444
  */
388
445
  normalizer?: (value: string) => string;
446
+ /**
447
+ * Optional stable identifier for a custom `normalizer` callback (e.g. 'arabic-alef-v1').
448
+ * Captured by `computeBlindIndexSchemeId` so changes to custom normalizers are detectable.
449
+ */
450
+ normalizerId?: string;
389
451
  }
390
452
  /**
391
453
  * Folds special characters, extended Latin alphabets, and diacritics into deterministic lowercase ASCII equivalents.
@@ -402,28 +464,6 @@ interface INormalizeOptions {
402
464
  * - Final lowercasing and NFKC normalization.
403
465
  */
404
466
  declare function foldAscii(value: string): string;
405
- /**
406
- * Canonical normalization primitive shared across:
407
- * - In-memory filter evaluations (`filterLogic.ts`)
408
- * - Trigram search indexing (`CSearchIndex.ts`)
409
- * - Blind-index token generation (`CKeyManager.ts`)
410
- * - Encrypted filter rewrites (`rewriteEncryptedFilters.ts`)
411
- *
412
- * Default behavior:
413
- * - Coerces value to string
414
- * - Normalizes via Unicode NFKC (Compatibility Decomposition followed by Canonical Composition)
415
- * - Trims leading and trailing whitespace
416
- * - Converts to lowercase via standard Unicode case folding
417
- * - Strips combining dot above (U+0307) so capital dotted 'İ' matches lowercase 'i' by default
418
- * - Folds Greek final sigma (ς / U+03C2) to medial sigma (σ / U+03C3) so queries match across word boundaries
419
- *
420
- * Configurable options:
421
- * - `locale`: When provided (such as 'tr' or 'tr-TR'), uses `toLocaleLowerCase(locale)`
422
- * ensuring Turkish dotted/dotless I conversions (İ -> i, I -> ı).
423
- * - `asciiFold`: When true, maps diacritics and extended Latin characters to pure ASCII equivalents
424
- * ensuring cross-locale equivalence (e.g. 'Çelik' == 'Celik', 'Łódź' == 'lodz', 'Straße' == 'strasse').
425
- * - `normalizer`: Optional custom transformer invoked after baseline normalization.
426
- */
427
467
  declare function normalizeFilterValue(value: any, options?: INormalizeOptions): string;
428
468
 
429
469
  /**
@@ -436,25 +476,74 @@ type TBlindIndexKeyStatus = 'active' | 'search-only' | 'retired';
436
476
  type TDateBucketGranularity = 'year' | 'quarter' | 'month' | 'week' | 'day';
437
477
  /**
438
478
  * Configuration for date/timestamp shadow range bucketing.
479
+ *
480
+ * @security Deterministic Shadow-Bucket Range Index:
481
+ * Plaintext/hashed bucket tokens reveal record group frequency, bucket ordering, and
482
+ * temporal distribution profiling (equivalent to coarse Order-Preserving Encryption).
483
+ * Not IND-CPA / not zero-leakage.
484
+ *
485
+ * DO NOT USE fine granularities (`'week'`, `'day'`) on high-sensitivity personal data
486
+ * fields such as `birthDate`, `dateOfBirth`, or `dob`; prefer `'year'` or `'quarter'`,
487
+ * or leave the field as unindexed AES-256-GCM.
439
488
  */
440
489
  interface IDateRangeBucketConfig {
441
490
  type: 'date';
442
491
  granularity?: TDateBucketGranularity;
492
+ minDate?: Date | string | number;
493
+ maxDate?: Date | string | number;
494
+ /** Explicitly suppress narrow-granularity warnings on sensitive date fields */
495
+ allowNarrowGranularity?: boolean;
496
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
497
+ allowSensitiveBucket?: boolean;
443
498
  }
444
499
  /**
445
500
  * Configuration for stepped numeric shadow range bucketing.
501
+ *
502
+ * @security Deterministic Shadow-Bucket Range Index:
503
+ * Stepped buckets leak value frequency distributions and ordering relations across buckets
504
+ * (coarse OPE-equivalent leakage; NOT IND-CPA and NOT zero-leakage).
505
+ *
506
+ * DO NOT USE narrow steps (`step < 100` throws `ERR_BUCKET_STEP_TOO_NARROW` by default)
507
+ * or fine increments on high-sensitivity personal data (`salary`, `age`, `birthDate`,
508
+ * `creditScore`, `income`, `ssn`, etc.). For sensitive financial data, prefer coarse
509
+ * tier bucketing (e.g. `$25,000+` salary bands) or unindexed AES-256-GCM.
446
510
  */
447
511
  interface ISteppedRangeBucketConfig {
448
512
  type: 'stepped';
449
513
  step: number;
450
514
  min?: number;
515
+ max?: number;
516
+ ceiling?: number;
517
+ floor?: number;
518
+ /** Minimum allowed bucket step width (defaults to `DEFAULT_MIN_BUCKET_STEP` = 100) */
519
+ minStep?: number;
520
+ /** Alias for `minStep`: minimum allowed bucket interval width */
521
+ minBucketWidth?: number;
522
+ /** Explicit opt-in to allow steps below `minStep` (emits a configuration warning; `step <= 0` still rejected) */
523
+ allowNarrowStep?: boolean;
524
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
525
+ allowSensitiveBucket?: boolean;
451
526
  }
452
527
  /**
453
528
  * Configuration for tier / threshold numeric shadow range bucketing.
529
+ *
530
+ * @security Deterministic Shadow-Bucket Range Index:
531
+ * Threshold buckets leak bucket membership frequency and ordering across tiers (NOT zero-leakage).
532
+ *
533
+ * For high-sensitivity fields (`salary`, `age`, `creditScore`, etc.), use broad intervals
534
+ * (e.g. `[0, 25000, 50000, 100000, 250000]`) rather than narrow bands, or use unindexed AES-256-GCM.
454
535
  */
455
536
  interface ITierRangeBucketConfig {
456
537
  type: 'tier' | 'threshold';
457
538
  thresholds: number[];
539
+ /** Minimum allowed interval gap between consecutive thresholds (defaults to `DEFAULT_MIN_BUCKET_STEP` = 100) */
540
+ minStep?: number;
541
+ /** Alias for `minStep`: minimum allowed threshold gap width */
542
+ minBucketWidth?: number;
543
+ /** Explicit opt-in to allow threshold gaps below `minStep` (emits a configuration warning) */
544
+ allowNarrowStep?: boolean;
545
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
546
+ allowSensitiveBucket?: boolean;
458
547
  }
459
548
  /**
460
549
  * Union type of all shadow range bucket configurations.
@@ -475,36 +564,70 @@ interface IBlindIndexKeyring {
475
564
  }>;
476
565
  }
477
566
 
567
+ /**
568
+ * Historical or alternate version configuration for multi-version blind-index query expansion.
569
+ */
570
+ interface IBlindIndexVersionConfig extends INormalizeOptions {
571
+ /** Schema or token version identifier */
572
+ version?: string | number;
573
+ /** Optional version tag prefix (false = unprefixed hex, true = `${version}:`, string = `${versionTag}:`) */
574
+ versionTag?: string | boolean;
575
+ /** Also emit legacy unscoped tokens for this version entry */
576
+ allowLegacyUnscopedTokens?: boolean;
577
+ /** Alias for allowLegacyUnscopedTokens */
578
+ legacyUnscopedTokens?: boolean;
579
+ }
478
580
  /**
479
581
  * Blind-index field configuration options.
480
582
  */
481
- interface IBlindIndexFieldConfig {
583
+ interface IBlindIndexFieldConfig extends INormalizeOptions {
482
584
  /** Custom target persistence column name (defaults to `${fieldName}_bidx`) */
483
585
  column?: string;
484
586
  /** Optional custom trigram column name (defaults to `${fieldName}_trigrams`) */
485
587
  trigramColumn?: string;
486
588
  /** Blind index keyring */
487
589
  keyring: IBlindIndexKeyring;
590
+ /** Optional schema or token version identifier */
591
+ version?: string | number;
592
+ /** Optional version tag prefix for matching versioned tokens */
593
+ versionTag?: string | boolean;
594
+ /** Historical token versions/configs to query alongside the current version */
595
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
596
+ /** Allow matching legacy unscoped tokens alongside domain-separated tokens during migration */
597
+ allowLegacyUnscopedTokens?: boolean;
488
598
  }
489
599
  /**
490
600
  * Trigram substring search field configuration options.
491
601
  */
492
- interface ITrigramFieldConfig {
602
+ interface ITrigramFieldConfig extends INormalizeOptions {
493
603
  /** Custom target persistence column name (defaults to `${fieldName}_trigrams`) */
494
604
  column?: string;
495
605
  /** Blind index keyring */
496
606
  keyring: IBlindIndexKeyring;
607
+ /** Optional schema or token version identifier */
608
+ version?: string | number;
609
+ /** Optional version tag prefix for matching versioned tokens */
610
+ versionTag?: string | boolean;
611
+ /** Historical token versions/configs to query alongside the current version */
612
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
613
+ /** Allow matching legacy unscoped tokens alongside domain-separated tokens during migration */
614
+ allowLegacyUnscopedTokens?: boolean;
497
615
  }
498
616
  /**
499
617
  * Range bucket persistence field configuration options.
618
+ *
619
+ * @security Deterministic Shadow-Bucket Range Index: reveals bucket frequency distributions
620
+ * and relative ordering; not IND-CPA / not zero-leakage. Avoid narrow widths on
621
+ * high-sensitivity fields (`salary`, `age`, `birthDate`, `creditScore`).
500
622
  */
501
623
  interface IRangeBucketFieldConfig {
502
624
  /** Custom target persistence column name (defaults to `${fieldName}_bucket`) */
503
625
  column?: string;
504
626
  /** Range bucketing configuration ('date', 'stepped', or 'tier') */
505
627
  config: TRangeBucketConfig;
628
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
629
+ allowSensitiveBucket?: boolean;
506
630
  }
507
-
508
631
  /**
509
632
  * Options for computing blind index HMAC-SHA256 tokens, supporting normalization and domain separation.
510
633
  */
@@ -515,6 +638,15 @@ interface IBlindIndexOptions extends INormalizeOptions {
515
638
  type?: 'eq' | 'tri';
516
639
  /** Optional Key Identifier */
517
640
  kid?: string;
641
+ /** Optional schema or token version identifier */
642
+ version?: string | number;
643
+ /** Optional version tag prefix for the generated token (e.g. 'v1' produces 'v1:<token>') */
644
+ versionTag?: string | boolean;
645
+ /**
646
+ * PBKDF2 iteration count for blind index HMAC key derivation from passphrase strings (default: 310,000).
647
+ * Edge runtimes such as Cloudflare Workers cap PBKDF2 at 100,000 iterations.
648
+ */
649
+ kdfIterations?: number;
518
650
  }
519
651
  /**
520
652
  * Options for rewriteEncryptedFilters.
@@ -534,17 +666,31 @@ interface IEncryptedFilterRewriteOptions extends INormalizeOptions {
534
666
  maxCandidateTokens?: number;
535
667
  /** Optional normalization options override */
536
668
  normalizeOptions?: INormalizeOptions;
669
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
670
+ allowSensitiveBucket?: boolean;
537
671
  /** Generic fields map that may contain blindIndex, trigrams, and rangeBuckets */
538
672
  fields?: Record<string, any>;
673
+ /** Optional schema or token version identifier for generated query tokens */
674
+ version?: string | number;
675
+ /** Optional version tag prefix for generated query tokens (e.g. true -> `${version}:`, or explicit 'v2') */
676
+ versionTag?: string | boolean;
677
+ /** Historical token versions/configs to expand into query candidates during rolling re-indexing */
678
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
679
+ /** When true, also emits legacy unscoped equality tokens alongside field+type scoped tokens (default: false) */
680
+ allowLegacyUnscopedTokens?: boolean;
681
+ /** Expected persisted token scheme identifier (from computeBlindIndexSchemeId); throws ERR_BIDX_SCHEME_MISMATCH if options diverge */
682
+ expectedTokenScheme?: string;
539
683
  }
540
684
  /**
541
685
  * Result returned by rewriteEncryptedFilters.
542
686
  */
543
687
  interface IRewrittenEncryptedFilters {
544
688
  /** Transformed filter or array of filters with expanded blind-index candidate tokens */
545
- filters: IDataFilter$1 | IDataFilter$1[];
689
+ filters: IDataFilter | IDataFilter[];
546
690
  /** Total candidate tokens generated across all filters */
547
691
  totalCandidateTokens: number;
692
+ /** Deterministic token scheme identifier covering normalization options, scope, and framing */
693
+ tokenSchemeId?: string;
548
694
  }
549
695
  /**
550
696
  * Alias for IRewrittenEncryptedFilters for backward compatibility.
@@ -553,7 +699,7 @@ type IRewrittenPersistenceQuery = IRewrittenEncryptedFilters;
553
699
  /**
554
700
  * Options for reencryptBatch.
555
701
  */
556
- interface IReencryptBatchOptions<TRow = any> {
702
+ interface IReencryptBatchOptions<TRow = any> extends INormalizeOptions {
557
703
  /** Target Key Identifier to migrate payloads to */
558
704
  targetKid: string;
559
705
  /** Keyring containing source keys and target key */
@@ -572,11 +718,54 @@ interface IReencryptBatchOptions<TRow = any> {
572
718
  keyring: IBlindIndexKeyring;
573
719
  /** Optional mapping from field name to persistence column name (defaults to `${fieldName}_bidx`) */
574
720
  columnMap?: Record<string, string>;
575
- /** Enable cryptographic domain separation for blind index tokens */
721
+ /**
722
+ * @deprecated Field+type domain separation (`{ field, type: 'eq' }`) is now enabled by default.
723
+ * Use `legacyUnscopedTokens: true` to explicitly opt out for legacy unscoped datasets.
724
+ */
576
725
  domainSeparation?: boolean;
726
+ /** Opt out of field+type domain separation for legacy unscoped blind-index columns (default: false) */
727
+ legacyUnscopedTokens?: boolean;
728
+ /** Optional normalization locale */
729
+ locale?: string;
730
+ /** Optional normalization ASCII folding */
731
+ asciiFold?: boolean;
732
+ /** Optional custom normalizer */
733
+ normalizer?: (value: string) => string;
734
+ /** Optional stable identifier for custom normalizer */
735
+ normalizerId?: string;
736
+ /** Optional schema or token version identifier */
737
+ version?: string | number;
738
+ /** Optional version tag prefix for regenerated tokens */
739
+ versionTag?: string | boolean;
740
+ /** Optional column name for version metadata (defaults to `${bidxCol}_version`) */
741
+ versionColumn?: string;
742
+ /** Optional mapping from field name to version column name */
743
+ versionColumnMap?: Record<string, string>;
744
+ /** Persist token scheme identifier (`computeBlindIndexSchemeId`) into `${col}_scheme` (or `schemeColumn`) */
745
+ persistScheme?: boolean;
746
+ /** Optional column name for persisted token scheme identifier (defaults to `${bidxCol}_scheme`) */
747
+ schemeColumn?: string;
748
+ /** Optional mapping from field name to scheme column name */
749
+ schemeColumnMap?: Record<string, string>;
577
750
  };
578
- /** Maximum PBKDF2 iterations allowed during key derivation (default: 350,000) */
751
+ /** Optional normalization options override */
752
+ normalizeOptions?: INormalizeOptions;
753
+ /** Opt out of field+type domain separation for legacy unscoped blind-index columns (default: false) */
754
+ legacyUnscopedTokens?: boolean;
755
+ /** Optional schema or token version identifier for regenerated blind index tokens */
756
+ tokenVersion?: string | number;
757
+ /** Optional version tag prefix for regenerated blind index tokens */
758
+ versionTag?: string | boolean;
759
+ /** Persist token scheme identifier (`computeBlindIndexSchemeId`) alongside regenerated tokens */
760
+ persistTokenScheme?: boolean;
761
+ /** Select/re-index rows whose persisted token version matches any value in this list (even if envelope kid === targetKid) */
762
+ staleTokenVersions?: Array<string | number | null | undefined>;
763
+ /** Re-index stale/missing blind-index tokens even if envelope kid === targetKid (default: true when version/versionTag/persistScheme/staleTokenVersions is set) */
764
+ reindexStaleTokens?: boolean;
765
+ /** Maximum PBKDF2 iterations allowed during key derivation (default: 1,000,000) */
579
766
  maxAllowedIterations?: number;
767
+ /** Maximum distinct uncached PBKDF2 salt derivations permitted per batch (default: 5 in strict mode; queued up to safety cap in non-strict mode) */
768
+ maxSaltDerivations?: number;
580
769
  /** Whether to allow insecure KDF (kdf: 'none') under strict mode */
581
770
  allowInsecureKdf?: boolean;
582
771
  /** Concurrency version field name on row (default: 'updatedAt') */
@@ -589,8 +778,10 @@ interface IReencryptBatchOptions<TRow = any> {
589
778
  baseAad?: string;
590
779
  aadFields?: string[];
591
780
  buildAad?: (row: TRow, fieldName: string) => string | Uint8Array | undefined;
592
- /** Error handling strategy when decryption or processing of a row/field fails (default: 'abort') */
781
+ /** Error handling strategy when decryption or processing of a row/field fails (default: 'abort' in reencryptBatch, 'record' in reencryptDataset) */
593
782
  onRowError?: 'abort' | 'skip' | 'record';
783
+ /** Fail-fast on first row/field decryption or processing error (overrides onRowError when true; default: false in reencryptDataset) */
784
+ abortOnError?: boolean;
594
785
  /** Key derivation algorithm for string passphrases (default: 'pbkdf2') */
595
786
  kdf?: 'pbkdf2' | 'hkdf' | 'none';
596
787
  /** PBKDF2 iterations for string passphrases (default: 310,000) */
@@ -603,6 +794,12 @@ interface IReencryptBatchOptions<TRow = any> {
603
794
  signal?: AbortSignal;
604
795
  /** Strict mode: requires version field for CAS concurrency protection; fails if missing */
605
796
  strict?: boolean;
797
+ /** Verify authenticity of envelopes already claiming `targetKid` against `targetKey` (default: true) */
798
+ verifyTargetKid?: boolean;
799
+ /** Attempt recovery using other keys in `keyring` when an envelope claiming `targetKid` fails `targetKey` authentication (default: false) */
800
+ recoverForgedTargetKid?: boolean;
801
+ /** Explicitly allows legacy fallback decryption without AAD when an envelope omits AAD or sets `aad: false` in non-strict mode. Defaults to false. */
802
+ allowUnboundAadFallback?: boolean;
606
803
  }
607
804
  /**
608
805
  * Result returned by reencryptBatch.
@@ -664,6 +861,8 @@ interface IMigrationProgress {
664
861
  skippedRows: number;
665
862
  conflictRows: number;
666
863
  failedRows?: number;
864
+ /** Unique identifiers of rows that encountered errors so far */
865
+ failedRowIds?: any[];
667
866
  currentCursor?: string | number;
668
867
  percentComplete?: number;
669
868
  /** Persistent checkpoint payload */
@@ -691,18 +890,140 @@ interface IMigrationSummary {
691
890
  field: string;
692
891
  error: Error | string;
693
892
  }>;
893
+ /** Unique identifiers of rows that failed during migration */
894
+ failedRowIds?: any[];
694
895
  /** Whether the migration was cancelled/aborted via AbortSignal */
695
896
  aborted?: boolean;
696
897
  }
898
+ /**
899
+ * Configuration options for CSearchIndex.
900
+ */
901
+ interface ISearchIndexOptions extends INormalizeOptions {
902
+ minSearchLength?: number;
903
+ rangeBuckets?: Record<string, TRangeBucketConfig>;
904
+ shadowBuckets?: Record<string, TRangeBucketConfig>;
905
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
906
+ allowSensitiveBucket?: boolean;
907
+ idKey?: string;
908
+ /**
909
+ * Whether to allow matching against unscoped legacy blind index tokens (without field domain separation).
910
+ * Defaults to false for security (prevents cross-field and equality-vs-trigram token collisions).
911
+ */
912
+ allowLegacyUnscopedTokens?: boolean;
913
+ /**
914
+ * PBKDF2 iteration count for deriving the blind index HMAC key from string key material (default: 310,000 per OWASP).
915
+ * Edge/serverless runtimes such as Cloudflare Workers cap WebCrypto PBKDF2 at 100,000 iterations and require lowering this (e.g., 100_000).
916
+ */
917
+ kdfIterations?: number;
918
+ /** Optional schema or token version identifier */
919
+ version?: string | number;
920
+ /** Optional version tag prefix for generated blind-index tokens */
921
+ versionTag?: string | boolean;
922
+ }
923
+ /**
924
+ * Per-field search index entry stored for an indexed row.
925
+ */
926
+ interface ISearchIndexRowEntry {
927
+ token: string;
928
+ trigrams: Set<string>;
929
+ bucket?: string;
930
+ }
931
+ /**
932
+ * Evaluation context passed by CSearchIndex to searchIndexEvaluator helpers.
933
+ */
934
+ interface ISearchIndexEvalContext {
935
+ options: ISearchIndexOptions;
936
+ minSearchLength: number;
937
+ indexedFields: Set<string>;
938
+ getEntry: (row: any, field: string) => ISearchIndexRowEntry | undefined;
939
+ getRowFieldValue: (row: any, key: string) => any;
940
+ computeToken: (term: any, fieldOrOptions?: string | IBlindIndexOptions) => Promise<string>;
941
+ computeTrigramTokens: (term: any, fieldOrOptions?: string | IBlindIndexOptions) => Promise<Set<string>>;
942
+ resolveBucketsForRange: (operator: string, targetValue: any, fieldOrConfig: string | TRangeBucketConfig, knownBuckets?: Iterable<string>, fieldName?: string) => Set<string>;
943
+ getBucketsForField: (field: string) => Set<string>;
944
+ }
697
945
 
698
- interface IEncryptionContext {
699
- url?: string;
700
- method?: string;
701
- isServer?: boolean;
702
- /** Whether to bind the request context (URL and method as `req:${method}:${normalizedUrl}`) into AEAD Authenticated Additional Data (AAD) for outer transport envelopes. Defaults to false (opt-in). */
946
+ /**
947
+ * Shared constructor, keyring, KDF, policy, and asymmetric-security options
948
+ * supported by all `AEncryptionProvider` subclasses and `createEncryptionProvider`.
949
+ */
950
+ interface IBaseEncryptionProviderOptions {
951
+ /** Built-in Keyring dictionary mapping Key Identifiers (kid) to keys or key provider functions */
952
+ keys?: Record<string, TKeyProvider | IKeyPair>;
953
+ /** Active key identifier from `keys` to use for all outbound encryption operations */
954
+ activeKid?: string;
955
+ /** Optional Key Identifier for multi-role key routing and key rotation */
956
+ kid?: string;
957
+ keyId?: string;
958
+ /** Whitelist of allowed Key Identifiers (kid). */
959
+ allowedKids?: string[];
960
+ /** Whitelist of permitted cryptographic algorithms (e.g. ['AES-GCM']). Defaults to ['AES-GCM'] in strict mode. */
961
+ allowedAlgorithms?: TEncryptionAlgorithm[];
962
+ /**
963
+ * Dedicated HMAC key for search indexing and blind index computation.
964
+ * Required when searchIndex is enabled. Must never default to or share the AES data encryption key.
965
+ */
966
+ hmacKey?: TKeyProvider;
967
+ /**
968
+ * Key Derivation Function strategy ('none' | 'pbkdf2' | 'hkdf'). Defaults to 'pbkdf2'.
969
+ * - 'pbkdf2': Recommended for human passphrases/passwords (OWASP recommended with work factor iterations).
970
+ * - 'hkdf': For deriving subkeys from high-entropy cryptographic keys or secrets (not for low-entropy human passwords).
971
+ * - 'none': Direct key import for raw high-entropy 256-bit symmetric keys or CryptoKeys.
972
+ */
973
+ kdf?: TKdfStrategy;
974
+ /**
975
+ * Number of PBKDF2 iterations for cipher key derivation and CSearchIndex blind-index HMAC derivation
976
+ * (default: 310,000 per OWASP recommendation).
977
+ * Edge/serverless runtimes such as Cloudflare Workers cap WebCrypto PBKDF2 at 100,000 iterations and will throw
978
+ * NotSupportedError on the server unless lowered (e.g., `100_000`) or `kdf: 'hkdf'` is used for high-entropy secrets.
979
+ */
980
+ kdfIterations?: number;
981
+ /** Hash algorithm for PBKDF2 or HKDF ('SHA-256' | 'SHA-512', default: 'SHA-256') */
982
+ kdfHash?: TKdfHash;
983
+ /** Optional static salt for KDF. If omitted, a cryptographically secure random salt is generated and included in the envelope. */
984
+ kdfSalt?: string | Uint8Array | ArrayBuffer;
985
+ /** Optional context/info string or buffer for HKDF key derivation */
986
+ info?: string | Uint8Array | ArrayBuffer;
987
+ /** Whether to allow legacy insecure KDF ('none' / raw SHA-256) when strict mode is active. Defaults to false. */
988
+ allowInsecureKdf?: boolean;
989
+ /** Explicitly allows legacy fallback decryption without AAD when an envelope omits AAD or sets `aad: false` in non-strict mode. Defaults to false. */
990
+ allowUnboundAadFallback?: boolean;
991
+ /** Maximum allowable PBKDF2 iterations during decryption (default: 1,000,000). Envelopes exceeding this ceiling are rejected with ERR_EXCESSIVE_KDF_ITERATIONS. */
992
+ maxAllowedIterations?: number;
993
+ /** Maximum distinct uncached PBKDF2 salt derivations permitted per batch/call (default: 5 in strict mode; queued up to safety cap in non-strict mode). */
994
+ maxSaltDerivations?: number;
995
+ /** Optional key-pinning store for Trust On First Use (TOFU) public key verification in asymmetric providers */
996
+ pinningStore?: IKeyPinningStore;
997
+ /** Entity / peer identifier used when pinning or verifying recipient public keys (defaults to resolved kid/keyId if omitted) */
998
+ pinEntityId?: string;
999
+ /** Additional options forwarded to CKeyManager.verifyAndPinKey (trustedAuthorities, fetchAttestation, onPinChange, clockSkewMs, etc.) */
1000
+ pinningOptions?: Partial<Omit<IVerifyAndPinOptions, 'store'>> & {
1001
+ store?: IKeyPinningStore;
1002
+ };
1003
+ /** Optional ECDSA private key used to sign outbound RSA/ECDH envelopes */
1004
+ senderSigningPrivateKey?: CryptoKey;
1005
+ /** Optional ECDSA public key used to verify inbound RSA/ECDH envelope signatures */
1006
+ senderVerifyPublicKey?: CryptoKey;
1007
+ /** When true, RSA/ECDH decryption rejects envelopes without a valid sender signature */
1008
+ requireSenderSignature?: boolean;
1009
+ }
1010
+ /**
1011
+ * Shared runtime envelope, AAD, strict-validation, and error-handling options
1012
+ * common to both per-call `IEncryptionContext` and provider-level `IProviderEncryptionOptions`.
1013
+ */
1014
+ interface IEncryptionOperationOptions extends IBaseEncryptionProviderOptions {
1015
+ /** Secret key, passphrase, CryptoKey, key pair, or async key provider function */
1016
+ key?: TKeyProvider | IKeyPair;
1017
+ /**
1018
+ * Whether to bind the request context (HTTP method and canonical normalized URL as `req:${method}:${normalizedUrl}`) into AEAD Authenticated Additional Data (AAD) on outer transport payloads.
1019
+ * Defaults to false (opt-in). When enabled (true), mitigates replay and cross-endpoint confusion attacks on outer transport envelopes.
1020
+ * Decoupled from persistent record/field envelopes to ensure safe GET vs POST/PUT interoperability.
1021
+ */
703
1022
  bindRequestContextAad?: boolean;
704
1023
  /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
705
1024
  fields?: string[];
1025
+ /** Whitelist of field names permitted to remain unencrypted in strict mode without triggering security violations (e.g. ['id', '_id']). */
1026
+ unencryptedFields?: string[];
706
1027
  /**
707
1028
  * Enforces strict encryption validation. When true:
708
1029
  * 1. Any field in `fields` that is NOT an encrypted envelope triggers a decryption error.
@@ -710,23 +1031,11 @@ interface IEncryptionContext {
710
1031
  * 3. Envelope `kid` (if present) MUST match `allowedKids`.
711
1032
  */
712
1033
  strict?: boolean;
713
- /** Whitelist of permitted cryptographic algorithms (e.g. ['AES-GCM']). Defaults to ['AES-GCM'] in strict mode. */
714
- allowedAlgorithms?: string[];
715
- /** Whitelist of allowed Key Identifiers (kid). */
716
- allowedKids?: string[];
717
- /** Built-in Keyring dictionary mapping Key Identifiers (kid) to keys or key provider functions */
718
- keys?: Record<string, TKeyProvider | IKeyPair>;
719
- /** Active key identifier from `keys` to use for all outbound encryption operations */
720
- activeKid?: string;
721
1034
  /**
722
1035
  * Hook invoked whenever decryption fails for an individual field or row.
723
1036
  * Can return a fallback cell value (e.g. sentinel or marker), or string/boolean.
724
1037
  */
725
1038
  onDecryptError?: ((info: IDecryptErrorInfo) => any) | boolean | string;
726
- key?: TKeyProvider | IKeyPair;
727
- /** Optional Key Identifier for multi-role key routing and rotation */
728
- kid?: string;
729
- keyId?: string;
730
1039
  /**
731
1040
  * Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping.
732
1041
  * Can be static string/buffer or dynamic callback evaluated per record and field.
@@ -736,24 +1045,23 @@ interface IEncryptionContext {
736
1045
  aadFields?: string[];
737
1046
  /** Optional base AAD prefix when aadFields or dynamic aad is enabled */
738
1047
  baseAad?: string;
739
- /** Internal flag indicating that key derivation has already been warmed for this batch */
740
- _warmedKey?: any;
741
1048
  /** Whether to encrypt/decrypt individual values while preserving JSON keys (default: true) */
742
1049
  valueEncryption?: boolean;
1050
+ /** Optional public key for asymmetric providers */
743
1051
  publicKey?: CryptoKey;
1052
+ /** Optional private key for asymmetric providers */
744
1053
  privateKey?: CryptoKey;
1054
+ /** Optional recipient public key for asymmetric/hybrid encryption */
745
1055
  recipientPublicKey?: CryptoKey;
1056
+ /** Optional recipient private key for asymmetric/hybrid decryption */
746
1057
  recipientPrivateKey?: CryptoKey;
1058
+ /** Elliptic curve name for ECDH ('P-256' | 'P-384' | 'P-521') */
747
1059
  curve?: 'P-256' | 'P-384' | 'P-521';
748
- kdf?: 'none' | 'pbkdf2' | 'hkdf';
749
- kdfSalt?: string | Uint8Array | ArrayBuffer;
750
- kdfIterations?: number;
751
- kdfHash?: 'SHA-256' | 'SHA-512';
752
- info?: string | Uint8Array | ArrayBuffer;
753
- /** Whether to allow legacy insecure KDF ('none' / raw SHA-256) when strict mode is active. Defaults to false. */
754
- allowInsecureKdf?: boolean;
755
- /** Maximum allowable PBKDF2 iterations during decryption (default: 350,000). Envelopes exceeding this ceiling are rejected with ERR_EXCESSIVE_KDF_ITERATIONS. */
756
- maxAllowedIterations?: number;
1060
+ }
1061
+ interface IEncryptionContext extends IEncryptionOperationOptions {
1062
+ url?: string;
1063
+ method?: string;
1064
+ isServer?: boolean;
757
1065
  }
758
1066
  /**
759
1067
  * Context options for single scalar field encryption/decryption with bound AAD.
@@ -789,68 +1097,30 @@ interface IEncryptionProvider {
789
1097
  [Symbol.dispose]?(): void;
790
1098
  [Symbol.asyncDispose]?(): Promise<void>;
791
1099
  }
792
- interface IProviderEncryptionOptions {
1100
+ interface IProviderEncryptionOptions extends IEncryptionOperationOptions {
793
1101
  /** Enable or disable encryption */
794
1102
  enabled?: boolean;
795
- /** Secret key, passphrase, CryptoKey, key pair, or async key provider function */
796
- key?: TKeyProvider | IKeyPair;
797
- /** Built-in Keyring dictionary mapping Key Identifiers (kid) to keys or key provider functions */
798
- keys?: Record<string, TKeyProvider | IKeyPair>;
799
- /** Active key identifier from `keys` to use for all outbound encryption operations */
800
- activeKid?: string;
801
- /** Optional Key Identifier for multi-role key routing and key rotation */
802
- kid?: string;
803
- keyId?: string;
804
- /**
805
- * Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping.
806
- * Can be static string/buffer or dynamic callback evaluated per record and field.
807
- */
808
- aad?: string | Uint8Array | ArrayBuffer | ((record: any, field: string) => string | Uint8Array | ArrayBuffer);
809
- /** Sibling record fields to deterministically bind into AEAD additional data (e.g. ['contact_id', 'version']) */
810
- aadFields?: string[];
811
- /** Optional base AAD prefix when aadFields or dynamic aad is enabled */
812
- baseAad?: string;
813
- /**
814
- * Whether to bind the request context (HTTP method and canonical normalized URL as `req:${method}:${normalizedUrl}`) into AEAD Authenticated Additional Data (AAD) on outer transport payloads.
815
- * Defaults to false (opt-in). When enabled (true), mitigates replay and cross-endpoint confusion attacks on outer transport envelopes.
816
- * Decoupled from persistent record/field envelopes to ensure safe GET vs POST/PUT interoperability.
817
- */
818
- bindRequestContextAad?: boolean;
819
1103
  /**
820
1104
  * Whether decryption is permitted during Server-Side Rendering (SSR).
821
1105
  * In an End-to-End (E2E) zero-trust model, defaults to false to prevent
822
1106
  * plaintext data in server memory or SSR payloads.
823
1107
  */
824
1108
  decryptOnSSR?: boolean;
825
- /** Whether to encrypt/decrypt individual values while preserving JSON object keys (default: true) */
826
- valueEncryption?: boolean;
827
1109
  /** Whether to defer row/item decryption to active page rendering in DataProviders */
828
1110
  lazy?: boolean;
829
- /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
830
- fields?: string[];
831
1111
  /**
832
1112
  * When enabled (true) with offline queueing, encrypts binary/FormData payloads
833
1113
  * at rest before persisting into IndexedDB/storage, and decrypts them upon flush.
834
1114
  */
835
1115
  encryptBinary?: boolean;
836
- /**
837
- * Enforces strict encryption validation. When true:
838
- * 1. Any field in `fields` that is NOT an encrypted envelope triggers a decryption error.
839
- * 2. Envelope algorithm MUST match `allowedAlgorithms` (defaults to ['AES-GCM']).
840
- * 3. Envelope `kid` (if present) MUST match `allowedKids`.
841
- */
842
- strict?: boolean;
843
- /** Whitelist of permitted cryptographic algorithms (e.g. ['AES-GCM']). Defaults to ['AES-GCM'] in strict mode. */
844
- allowedAlgorithms?: string[];
845
- /** Whitelist of allowed Key Identifiers (kid). */
846
- allowedKids?: string[];
847
- /**
848
- * Hook invoked whenever decryption fails for an individual field or row.
849
- * Can return a fallback cell value (e.g. sentinel or marker), or string/boolean.
850
- */
851
- onDecryptError?: ((info: IDecryptErrorInfo) => any) | boolean | string;
852
1116
  /** Enable HMAC-SHA256 blind indexing and trigram search index on encrypted fields for local DataProviders */
853
1117
  searchIndex?: boolean;
1118
+ /**
1119
+ * Explicitly permits sending plaintext filters for encrypted fields in outbound server queries
1120
+ * when no searchable encryption rewrite configuration is available (in non-strict mode).
1121
+ * Defaults to false (fail-closed: throws ERR_ENCRYPTED_FILTER_PLAINTEXT_LEAK).
1122
+ */
1123
+ allowPlaintextServerFilter?: boolean;
854
1124
  /**
855
1125
  * Whether to allow matching against unscoped legacy blind index tokens (without field domain separation).
856
1126
  * Defaults to false for security (prevents cross-field and equality-vs-trigram token collisions).
@@ -867,57 +1137,39 @@ interface IProviderEncryptionOptions {
867
1137
  asciiFold?: boolean;
868
1138
  /** Custom normalizer callback for domain- or script-specific character transforms */
869
1139
  normalizer?: (value: string) => string;
870
- /** Range query configuration for shadow bucketing across encrypted numeric or date columns (TASK-031) */
1140
+ /** Stable identifier for a custom normalizer callback (used in scheme versioning) */
1141
+ normalizerId?: string;
1142
+ /** Optional schema or token version identifier for blind-index query rewriting */
1143
+ tokenVersion?: string | number;
1144
+ /** Optional version tag prefix for blind-index query rewriting */
1145
+ versionTag?: string | boolean;
1146
+ /** Historical token versions/configs to also emit when rewriting encrypted filters */
1147
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
1148
+ /** Expected persisted token scheme identifier; throws ERR_BIDX_SCHEME_MISMATCH on divergence */
1149
+ expectedTokenScheme?: string;
1150
+ /**
1151
+ * Deterministic Shadow-Bucket Range Index configuration across encrypted numeric or date columns.
1152
+ * Security note: reveals bucket frequency distributions and order relations (not IND-CPA / not zero-leakage).
1153
+ * Avoid narrow steps or high-sensitivity fields (`salary`, `age`, `birthDate`, `creditScore`) unless using broad bands (`$25,000+` / `'year'`).
1154
+ */
871
1155
  rangeBuckets?: Record<string, TRangeBucketConfig>;
872
1156
  /** Alias for rangeBuckets */
873
1157
  shadowBuckets?: Record<string, TRangeBucketConfig>;
1158
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
1159
+ allowSensitiveBucket?: boolean;
874
1160
  /**
875
1161
  * Set to true if API endpoints or data sources return pre-encrypted ciphertext envelopes.
876
1162
  * When true, DataProviders decrypt search fields during ingest to populate CSearchIndex.
877
1163
  */
878
1164
  preEncrypted?: boolean;
879
- /**
880
- * Dedicated HMAC key for search indexing and blind index computation.
881
- * Required when searchIndex is enabled. Must never default to or share the AES data encryption key.
882
- */
883
- hmacKey?: TKeyProvider;
884
1165
  /** Minimum query length for trigram substring searches (default: 3). Queries shorter than this use fallback verification. */
885
1166
  minSearchLength?: number;
886
1167
  /** Cryptographic algorithm identifier (defaults to 'AES-GCM') */
887
- algorithm?: 'AES-GCM' | string;
1168
+ algorithm?: TEncryptionAlgorithm;
888
1169
  /** Custom cipher adapter implementing IEncryptionProvider (e.g. CRSAEncryptionProvider, CECDHEncryptionProvider, CWebCryptoAESCBCProvider) */
889
1170
  customProvider?: IEncryptionProvider;
890
1171
  /** Whether to use synchronous Node.js crypto provider (CNodeCryptoEncryptionProvider) */
891
1172
  sync?: boolean;
892
- /**
893
- * Key Derivation Function strategy ('none' | 'pbkdf2' | 'hkdf'). Defaults to 'pbkdf2'.
894
- * - 'pbkdf2': Recommended for human passphrases/passwords (OWASP recommended with work factor iterations).
895
- * - 'hkdf': For deriving subkeys from high-entropy cryptographic keys or secrets (not for low-entropy human passwords).
896
- * - 'none': Direct key import for raw high-entropy 256-bit symmetric keys or CryptoKeys.
897
- */
898
- kdf?: 'none' | 'pbkdf2' | 'hkdf';
899
- /** Number of PBKDF2 iterations (default: 310,000 per OWASP recommendation) */
900
- kdfIterations?: number;
901
- /** Hash algorithm for PBKDF2 or HKDF ('SHA-256' | 'SHA-512', default: 'SHA-256') */
902
- kdfHash?: 'SHA-256' | 'SHA-512';
903
- /** Optional static salt for KDF. If omitted, a cryptographically secure random salt is generated and included in the envelope. */
904
- kdfSalt?: string | Uint8Array | ArrayBuffer;
905
- /** Optional public key for asymmetric providers */
906
- publicKey?: CryptoKey;
907
- /** Optional private key for asymmetric providers */
908
- privateKey?: CryptoKey;
909
- /** Optional recipient public key for asymmetric/hybrid encryption */
910
- recipientPublicKey?: CryptoKey;
911
- /** Optional recipient private key for asymmetric/hybrid decryption */
912
- recipientPrivateKey?: CryptoKey;
913
- /** Elliptic curve name for ECDH ('P-256' | 'P-384' | 'P-521') */
914
- curve?: 'P-256' | 'P-384' | 'P-521';
915
- /** Optional context/info string or buffer for HKDF key derivation */
916
- info?: string | Uint8Array | ArrayBuffer;
917
- /** Whether to allow legacy insecure KDF ('none' / raw SHA-256) when strict mode is active. Defaults to false. */
918
- allowInsecureKdf?: boolean;
919
- /** Maximum allowable PBKDF2 iterations during decryption (default: 350,000). Envelopes exceeding this ceiling are rejected with ERR_EXCESSIVE_KDF_ITERATIONS. */
920
- maxAllowedIterations?: number;
921
1173
  }
922
1174
 
923
1175
  type TDataProviderListener<T = unknown> = (provider: T) => void;
@@ -937,9 +1189,10 @@ interface IDataResult<TRow = TDataRow> {
937
1189
  rowCount: number;
938
1190
  rows: TRow[];
939
1191
  }
940
- type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter$1 | null, sortList: IDataSort$1[], options?: {
1192
+ type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter | null, sortList: IDataSort[], options?: {
941
1193
  disableCache?: boolean;
942
1194
  signal?: AbortSignal;
1195
+ sideChannel?: boolean;
943
1196
  }) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
944
1197
  interface IBatchProgress {
945
1198
  loaded: number;
@@ -956,8 +1209,8 @@ interface IDataProviderOptions {
956
1209
  apiUrl?: string;
957
1210
  idKey?: string;
958
1211
  fields?: string[];
959
- filter?: IDataFilter$1;
960
- sortList?: IDataSort$1[];
1212
+ filter?: IDataFilter;
1213
+ sortList?: IDataSort[];
961
1214
  pageSize?: number;
962
1215
  currentPage?: number;
963
1216
  SSR?: boolean;
@@ -975,12 +1228,14 @@ interface IDataProviderOptions {
975
1228
  batchLoad?: 'initially' | 'onDemand';
976
1229
  onDemandFilterPolicy?: 'ingestAll' | 'warnOnly';
977
1230
  onBatchLoaded?: (batch: IBatchLoadedEvent<any>) => void;
1231
+ /** Locale identifier (e.g. 'tr', 'tr-TR', 'de-DE') for locale-aware sorting and string normalization. */
1232
+ locale?: string;
978
1233
  }
979
1234
  interface IDataProviderState<TRow = TDataRow> {
980
1235
  currentPage: number;
981
1236
  pageSize: number;
982
- filter: IDataFilter$1 | null;
983
- sortList: IDataSort$1[];
1237
+ filter: IDataFilter | null;
1238
+ sortList: IDataSort[];
984
1239
  rowCount?: number;
985
1240
  loading?: boolean;
986
1241
  initialLoad?: boolean;
@@ -991,6 +1246,10 @@ interface IDataProviderState<TRow = TDataRow> {
991
1246
  batchProgress?: IBatchProgress;
992
1247
  loadedBatches?: number[];
993
1248
  stateVersion?: number;
1249
+ selectedRows?: TRow[];
1250
+ selectAll?: boolean;
1251
+ unselectedRows?: TRow[];
1252
+ selectAllScope?: 'page' | 'all';
994
1253
  }
995
1254
  interface IDataProviderSetStateOptions {
996
1255
  immediate?: boolean;
@@ -1005,6 +1264,73 @@ interface IVirtualScrollState {
1005
1264
  itemHeight: number;
1006
1265
  }
1007
1266
 
1267
+ declare abstract class ACacheProvider {
1268
+ constructor();
1269
+ abstract getKeyList(context?: unknown): Array<string> | Promise<Array<string>>;
1270
+ abstract get<T>(key: string, context?: unknown): Promise<T | null>;
1271
+ abstract set<T>(key: string, data: T, lifetime: number, context?: unknown): Promise<void>;
1272
+ abstract remove(key: string, context?: unknown): Promise<void>;
1273
+ abstract removeByPrefix(prefix: string, context?: unknown): Promise<void>;
1274
+ abstract getRemainingTime(key: string, context?: unknown): Promise<number | null>;
1275
+ abstract cleanupExpired(): Promise<void>;
1276
+ }
1277
+
1278
+ declare class RequestProvider {
1279
+ private static _activeProvidersWithEncryption;
1280
+ static resolveCipherProvider(kid?: string): IEncryptionProvider | undefined;
1281
+ /**
1282
+ * Clears ephemeral session key discriminators. Used for testing fresh runtime sessions.
1283
+ */
1284
+ static resetEphemeralKeyDiscriminators(): void;
1285
+ cacheProvider: ACacheProvider | null;
1286
+ cacheStrategy?: ECacheStrategy;
1287
+ cacheLifetime: number | null;
1288
+ deduplicate: boolean;
1289
+ cacheKey: string;
1290
+ tags: string[];
1291
+ queue: boolean;
1292
+ private static requestQueue;
1293
+ private static executing;
1294
+ private static requestsInFlight;
1295
+ private static inFlightBridges;
1296
+ private static contextResolver?;
1297
+ static setContextResolver(resolver: ((options?: IRequestOptions) => any) | undefined): void;
1298
+ static getContextResolver(): ((options?: IRequestOptions) => any) | undefined;
1299
+ private _ambientContext?;
1300
+ private lastUrl?;
1301
+ private lastOptions?;
1302
+ private dataReceivedCallback?;
1303
+ encryption?: IProviderEncryptionOptions;
1304
+ private _cachedCipherProvider?;
1305
+ private _lastEncryptionConfig?;
1306
+ private _scopedCipherProviders;
1307
+ constructor(provider?: ACacheProvider | ECacheStrategy, lifetime?: number, deduplicate?: boolean);
1308
+ setCacheProvider(provider?: ACacheProvider | ECacheStrategy): void;
1309
+ setCacheLifetime(lifetime: number): void;
1310
+ setDeduplicate(deduplicate: boolean): void;
1311
+ setQueue(queue: boolean): void;
1312
+ private disposeCipherInstance;
1313
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
1314
+ clearEncryption(): void;
1315
+ onDataReceived(callback: (data: any, generation?: number, url?: string) => void): void;
1316
+ private invokeDataReceivedCallback;
1317
+ private finalizeResponse;
1318
+ hasLastUrl(): boolean;
1319
+ refresh(hardRefresh?: boolean): Promise<any>;
1320
+ private resolveContext;
1321
+ private getInFlightMap;
1322
+ private getInFlightBridgeMap;
1323
+ private isDataEncrypted;
1324
+ private buildEncryptionContext;
1325
+ private decryptPayloadIfNeeded;
1326
+ private getInFlightContainer;
1327
+ getUniqueKey(url: string, options?: IRequestOptions): string;
1328
+ private getCipherProvider;
1329
+ registerRequest<T>(url: string, options?: IRequestOptions): Promise<T>;
1330
+ static executeAll(): void;
1331
+ request<T>(url: string, options?: IRequestOptions): Promise<T>;
1332
+ }
1333
+
1008
1334
  /**
1009
1335
  * Server request event contract. Compatible with H3Event (Nuxt 3 / Nitro),
1010
1336
  * Node.js HTTP incoming messages, and mock/custom server context stubs.
@@ -1040,6 +1366,8 @@ interface IRequestOptions {
1040
1366
  tags?: string[];
1041
1367
  signal?: AbortSignal;
1042
1368
  _generation?: number;
1369
+ /** When true, marks a background/side-channel fetch: does not update lastUrl/lastOptions or fire onDataReceived. */
1370
+ sideChannel?: boolean;
1043
1371
  encryption?: IProviderEncryptionOptions;
1044
1372
  /** If true, returns raw response without decrypting, useful for DataProvider lazy page-level decryption */
1045
1373
  skipDecryption?: boolean;
@@ -1075,6 +1403,26 @@ interface IDeadLetterItem extends IQueuedOperation {
1075
1403
  interface IFlushOptions {
1076
1404
  tag?: string;
1077
1405
  }
1406
+ interface IQueuedRequest {
1407
+ url: string;
1408
+ options?: IRequestOptions;
1409
+ instance: RequestProvider;
1410
+ context?: any;
1411
+ resolve?: (value: unknown) => void;
1412
+ reject?: (error: Error) => void;
1413
+ }
1414
+ interface InFlightSubscriber {
1415
+ id: number;
1416
+ signal?: AbortSignal;
1417
+ cleanup?: () => void;
1418
+ resolve: (val: any) => void;
1419
+ reject: (err: any) => void;
1420
+ }
1421
+ interface InFlightBridge {
1422
+ controller: AbortController;
1423
+ subscribers: Map<number, InFlightSubscriber>;
1424
+ nextId: number;
1425
+ }
1078
1426
 
1079
1427
  interface ITreeNode<TRow = TDataRow> {
1080
1428
  data: TRow;
@@ -1131,7 +1479,7 @@ interface ITreeDataProviderOptions extends IDataProviderOptions {
1131
1479
  * Tree-specific page data handler that includes tree parameters
1132
1480
  * Server handles tree building, visibility, and pagination
1133
1481
  */
1134
- type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter$1 | null, sortList: IDataSort$1[], treeParams: {
1482
+ type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter | null, sortList: IDataSort[], treeParams: {
1135
1483
  expandedNodes: (string | number)[] | Set<string | number>;
1136
1484
  parentKey: string;
1137
1485
  idKey: string;
@@ -1140,24 +1488,9 @@ type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: num
1140
1488
  }, options?: {
1141
1489
  disableCache?: boolean;
1142
1490
  signal?: AbortSignal;
1491
+ sideChannel?: boolean;
1143
1492
  }) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
1144
1493
 
1145
- interface KProductItemData {
1146
- id: string | number;
1147
- title: string;
1148
- image?: string;
1149
- price?: number;
1150
- currency?: string;
1151
- description?: string;
1152
- [key: string]: unknown;
1153
- }
1154
- interface KProductRowAction {
1155
- label: string;
1156
- icon?: string;
1157
- action: (item: KProductItemData) => void;
1158
- color?: 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark' | 'default';
1159
- }
1160
-
1161
1494
  /**
1162
1495
  * types.ts — Framework-agnostic hydration and platform abstraction contracts.
1163
1496
  */
@@ -1189,12 +1522,47 @@ interface IPlatformRouter {
1189
1522
  onReady?(cb: () => void): void;
1190
1523
  }
1191
1524
 
1525
+ interface IDataProviderGlobalConfig {
1526
+ locale?: string;
1527
+ }
1528
+ /**
1529
+ * Configure project-level defaults for all ADataProvider instances.
1530
+ */
1531
+ declare function setGlobalDataProviderConfig(config: IDataProviderGlobalConfig): void;
1532
+ /**
1533
+ * Get the current project-level DataProvider configuration.
1534
+ */
1535
+ declare function getGlobalDataProviderConfig(): IDataProviderGlobalConfig;
1192
1536
  declare abstract class ADataProvider<TRow = TDataRow> {
1193
1537
  idKey: string;
1538
+ protected _locale?: string;
1539
+ get locale(): string | undefined;
1540
+ set locale(val: string | undefined);
1541
+ setLocale(locale?: string): void | Promise<void>;
1194
1542
  protected _pageData: TRow[];
1195
1543
  get pageData(): TRow[];
1196
1544
  set pageData(val: TRow[]);
1545
+ /**
1546
+ * Highest page appended through loadMore() during the current accumulation session.
1547
+ * null when not accumulating (the displayed rows correspond to `currentPage`).
1548
+ * loadMore() never mutates `currentPage`; it tracks progress here instead.
1549
+ */
1550
+ protected _loadedThroughPage: number | null;
1551
+ /** Query signature of the currently loaded pageData. */
1552
+ protected _loadedQuerySignature: string | null;
1553
+ /** Active non-accumulating page load promise. */
1554
+ protected _activePageLoad: Promise<void> | null;
1555
+ /** Merges incoming rows onto existing rows, deduplicating by `idKey` when present. */
1556
+ protected mergeUniqueRows(existing: TRow[], incoming: TRow[]): TRow[];
1557
+ /** Updates `pageData` and `_loadedThroughPage` during an accumulation session. */
1558
+ protected applyAccumulatedPageData(merged: TRow[], targetPage: number): void;
1559
+ /** Stable signature of the query parameters that determine page contents. */
1560
+ protected _querySignature(): string;
1197
1561
  protected _fields: string[];
1562
+ protected _selectedRows: TRow[];
1563
+ protected _selectAll: boolean;
1564
+ protected _unselectedRows: TRow[];
1565
+ protected _selectAllScope: 'page' | 'all';
1198
1566
  get fields(): string[];
1199
1567
  set fields(val: string[]);
1200
1568
  protected _rowCount: number;
@@ -1214,18 +1582,21 @@ declare abstract class ADataProvider<TRow = TDataRow> {
1214
1582
  context: any;
1215
1583
  protected _currentPage: number;
1216
1584
  protected _pageSize: number;
1217
- protected _filter: IDataFilter$1 | null;
1218
- protected _sortList: IDataSort$1[];
1585
+ protected _filter: IDataFilter | null;
1586
+ protected _sortList: IDataSort[];
1219
1587
  get currentPage(): number;
1220
1588
  set currentPage(page: number);
1221
1589
  get pageSize(): number;
1222
1590
  set pageSize(size: number);
1223
- get filter(): IDataFilter$1 | null;
1224
- set filter(f: IDataFilter$1 | null);
1225
- get sortList(): IDataSort$1[];
1226
- set sortList(s: IDataSort$1[]);
1591
+ get filter(): IDataFilter | null;
1592
+ set filter(f: IDataFilter | null);
1593
+ get sortList(): IDataSort[];
1594
+ set sortList(s: IDataSort[]);
1227
1595
  get hasMore(): boolean;
1228
1596
  nextPage(): Promise<void>;
1597
+ /**
1598
+ * Alias for `nextPage()`.
1599
+ */
1229
1600
  loadMore(): Promise<void>;
1230
1601
  prevPage(): Promise<void>;
1231
1602
  protected _stateVersion: number;
@@ -1250,8 +1621,8 @@ declare abstract class ADataProvider<TRow = TDataRow> {
1250
1621
  subscribe(listener: TDataProviderListener<this>): TUnsubscribe;
1251
1622
  notify(): void;
1252
1623
  onStateChange(listener: TDataProviderStateChangeListener<TRow>): TUnsubscribe;
1253
- onSortChanged(listener: (sortList: IDataSort$1[]) => void): TUnsubscribe;
1254
- onFilterChanged(listener: (filter: IDataFilter$1 | null) => void): TUnsubscribe;
1624
+ onSortChanged(listener: (sortList: IDataSort[]) => void): TUnsubscribe;
1625
+ onFilterChanged(listener: (filter: IDataFilter | null) => void): TUnsubscribe;
1255
1626
  onDataChanged(listener: (pageData: TRow[]) => void): TUnsubscribe;
1256
1627
  getState(): IDataProviderState<TRow>;
1257
1628
  protected onFilterUpdated(): void;
@@ -1259,9 +1630,9 @@ declare abstract class ADataProvider<TRow = TDataRow> {
1259
1630
  setState(partial: Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
1260
1631
  serializeState(): string;
1261
1632
  deserializeState(serialized: string | Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
1262
- setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
1263
- setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
1264
- protected _guardEncryptedSorting(sortList: IDataSort$1[]): void;
1633
+ setFilter(filter: IDataFilter | null, immediate?: boolean): void | Promise<void>;
1634
+ setSortList(sortList: IDataSort[], immediate?: boolean): void | Promise<void>;
1635
+ protected _guardEncryptedSorting(sortList: IDataSort[]): void;
1265
1636
  setCurrentPage(currentPage: number): void | Promise<void>;
1266
1637
  setPageSize(pageSize: number, resetPage?: boolean): void | Promise<void>;
1267
1638
  abstract loadPageData(options?: {
@@ -1304,17 +1675,6 @@ declare function decryptPageRows<T = any>(rows: T[], encryption?: IProviderEncry
1304
1675
  declare function encryptRows<T = any>(rows: T[], encryption?: IProviderEncryptionOptions, apiUrl?: string, idKey?: string): Promise<T[]>;
1305
1676
  declare function encryptRowsChunked<T = any>(rows: T[], encryption: IProviderEncryptionOptions, options?: ISetDataChunkedOptions, apiUrl?: string, idKey?: string, onChunkEncrypted?: (chunkPlain: T[], chunkEncrypted: T[], chunkStartIndex: number) => Promise<void> | void): Promise<T[]>;
1306
1677
 
1307
- interface ISearchIndexOptions extends INormalizeOptions {
1308
- minSearchLength?: number;
1309
- rangeBuckets?: Record<string, TRangeBucketConfig>;
1310
- shadowBuckets?: Record<string, TRangeBucketConfig>;
1311
- idKey?: string;
1312
- /**
1313
- * Whether to allow matching against unscoped legacy blind index tokens (without field domain separation).
1314
- * Defaults to false for security (prevents cross-field and equality-vs-trigram token collisions).
1315
- */
1316
- allowLegacyUnscopedTokens?: boolean;
1317
- }
1318
1678
  /**
1319
1679
  * Normalizes text for consistent deterministic blind indexing (lowercased, trimmed, NFKC normalized).
1320
1680
  * Delegates to the shared normalizeFilterValue primitive.
@@ -1324,11 +1684,17 @@ declare function normalizeIndexTerm(value: any, options?: INormalizeOptions): st
1324
1684
  * Extracts 3-character trigrams from a string for substring search.
1325
1685
  */
1326
1686
  declare function extractTrigrams(value: any, options?: INormalizeOptions): string[];
1327
- interface ISearchIndexRowEntry {
1328
- token: string;
1329
- trigrams: Set<string>;
1330
- bucket?: string;
1331
- }
1687
+ /**
1688
+ * Returns the exact logical complement of an operator if one exists in EDataFilterOperator,
1689
+ * or null for operators without an exact inverse (e.g. contains, like, between, unknown).
1690
+ */
1691
+ declare function invertFilterOperator(operator: any): EDataFilterOperator | null;
1692
+ /**
1693
+ * Negates a filter AST node using De Morgan's Laws for compound nodes,
1694
+ * exact operator inversion when available, and explicit NOT wrapping otherwise.
1695
+ */
1696
+ declare function negateFilterNode(filter: TSearchFilterNode | any): TSearchFilterNode;
1697
+
1332
1698
  /**
1333
1699
  * CSearchIndex provides deterministic blind indexing (HMAC-SHA256) and trigram token sets
1334
1700
  * for client-side privacy-preserving searching and filtering across encrypted fields without decryption.
@@ -1340,20 +1706,24 @@ declare class CSearchIndex {
1340
1706
  private _indexedFields;
1341
1707
  private _fieldBuckets;
1342
1708
  private _bucketToRows;
1709
+ private _decryptedRowResolver?;
1343
1710
  minSearchLength: number;
1344
1711
  options: ISearchIndexOptions;
1345
1712
  constructor(keyMaterial: TKeyProvider, fields?: string[], options?: ISearchIndexOptions);
1346
1713
  get indexedFields(): readonly string[];
1347
1714
  setFields(fields: string[]): void;
1348
1715
  isFieldIndexed(field: string): boolean;
1349
- private _decryptedRowResolver?;
1350
1716
  setDecryptedRowResolver(resolver?: (row: any) => any): void;
1351
1717
  hasDecryptedRowResolver(): boolean;
1352
1718
  private _addBucketRow;
1353
1719
  getBucketsForField(field: string): Set<string>;
1354
1720
  setRangeBuckets(rangeBuckets?: Record<string, TRangeBucketConfig>): void;
1355
- computeRangeBucket(val: any, fieldOrConfig: string | TRangeBucketConfig): string | undefined;
1356
- resolveBucketsForRange(operator: string, targetValue: any, fieldOrConfig: string | TRangeBucketConfig, knownBuckets?: Iterable<string>): Set<string>;
1721
+ computeRangeBucket(val: any, fieldOrConfig: string | TRangeBucketConfig, fieldName?: string, options?: {
1722
+ allowSensitiveBucket?: boolean;
1723
+ }): string | undefined;
1724
+ resolveBucketsForRange(operator: string, targetValue: any, fieldOrConfig: string | TRangeBucketConfig, knownBuckets?: Iterable<string>, fieldName?: string, options?: {
1725
+ allowSensitiveBucket?: boolean;
1726
+ }): Set<string>;
1357
1727
  getCandidateRowsForBuckets(field: string, bucketKeys: Iterable<string>): Set<any>;
1358
1728
  getCandidateRecordIdsForBuckets(field: string, bucketKeys: Iterable<string>, idKey?: string): Set<any>;
1359
1729
  getCandidateRecordIdsForRange(operator: string, targetValue: any, field: string, idKey?: string): Set<any>;
@@ -1394,7 +1764,9 @@ declare class CSearchIndex {
1394
1764
  * Evaluates whether a row matches an exact or substring query on an indexed encrypted field.
1395
1765
  */
1396
1766
  evaluateField(operator: string, row: any, field: string, filterValue: any): Promise<boolean | null>;
1767
+ private _isEncryptedEnvelope;
1397
1768
  private _getRowFieldValue;
1769
+ private _createEvalContext;
1398
1770
  /**
1399
1771
  * Pre-computes query tokens for an active filter, returning a high-performance synchronous
1400
1772
  * evaluator function suitable for row-by-row filtering in memory.
@@ -1404,51 +1776,71 @@ declare class CSearchIndex {
1404
1776
  * - Evaluates all unindexed filter conditions against decrypted/plaintext row fields in memory.
1405
1777
  * - Never treats an unhandled filter branch or null evaluator as a match-all inside an AND conjunction.
1406
1778
  */
1407
- createFilterEvaluator(filter: IDataFilter$1 | any): Promise<((row: any) => boolean) | null>;
1779
+ createFilterEvaluator(filter: IDataFilter | any): Promise<((row: any) => boolean) | null>;
1408
1780
  /**
1409
1781
  * Secondary in-memory verification filter executed post-decryption to filter out
1410
1782
  * false positives from non-contiguous trigram matches and verify exact substring containment.
1411
1783
  */
1412
- verifyDecryptedRows<T = any>(rows: T[], filter: IDataFilter$1 | any): T[];
1784
+ verifyDecryptedRows<T = any>(rows: T[], filter: IDataFilter | any): T[];
1413
1785
  /**
1414
1786
  * Verifies a single decrypted row against an active filter post-decryption.
1415
1787
  */
1416
- verifyDecryptedRow(row: any, filter: IDataFilter$1 | any): boolean;
1788
+ verifyDecryptedRow(row: any, filter: IDataFilter | any): boolean;
1417
1789
  /**
1418
1790
  * Determines whether an active filter requires post-decryption verification
1419
1791
  * (e.g. for substring / trigram queries, short queries < minSearchLength, range buckets,
1420
1792
  * or any queries that may yield candidate false positives in stage-1 blind index filtering).
1421
1793
  */
1422
- requiresPostVerification(filter: IDataFilter$1 | any): boolean;
1423
- private _compileEvaluator;
1794
+ requiresPostVerification(filter: IDataFilter | any): boolean;
1424
1795
  }
1425
1796
 
1426
1797
  declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataProvider<TRow> {
1427
1798
  encryption?: IProviderEncryptionOptions;
1428
1799
  protected _searchIndex?: CSearchIndex;
1429
- protected _decryptedCache: Map<string | number, TRow>;
1430
1800
  protected _decryptedRefCache: WeakMap<object, TRow>;
1801
+ protected _idToEncryptedRef: Map<string | number, object>;
1802
+ protected _decryptedCache: Map<string | number, TRow>;
1431
1803
  constructor(options?: IDataProviderOptions);
1432
1804
  get isEncryptionEnabled(): boolean;
1433
1805
  get searchIndex(): CSearchIndex | undefined;
1806
+ protected _deleteCacheIdVariants(map: Map<string | number, TRow>, id: unknown): void;
1807
+ protected _containsEncryptedPayload(row: any): boolean;
1434
1808
  getDecryptedRow(rowOrId: any): TRow | undefined;
1435
1809
  cacheDecryptedRow(rowOrId: any, decryptedRow: TRow): void;
1436
1810
  clearDecryptedCache(): void;
1437
- populateDecryptedCache(rows: TRow[]): Promise<void>;
1811
+ /**
1812
+ * Invalidate cached decrypted representations for a single row or row ID.
1813
+ */
1814
+ invalidateDecryptedRow(rowOrId: any): void;
1815
+ /**
1816
+ * Evicts a single row or row ID from both `_decryptedCache` and `_decryptedRefCache`.
1817
+ */
1818
+ evictDecryptedRow(rowOrId: any): void;
1819
+ private _forEachChunk;
1820
+ populateDecryptedCache(rows: TRow[], options?: {
1821
+ chunkSize?: number;
1822
+ isStale?: () => boolean;
1823
+ }): Promise<void>;
1438
1824
  isFieldEncrypted(field: string, sampleRows?: TRow[]): boolean;
1439
- warnIfEncryptedFilterWithoutSupport(filter: IDataFilter$1 | any, sampleRows?: TRow[]): void;
1825
+ warnIfEncryptedFilterWithoutSupport(filter: IDataFilter | any, sampleRows?: TRow[]): void;
1440
1826
  protected _guardEncryptedSorting(sortList: IDataSort[]): void;
1441
1827
  private _warmupKeyAsync;
1442
1828
  protected _initSearchIndex(): void;
1443
1829
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1444
1830
  clearEncryption(): void;
1831
+ protected _getApiUrl(): string | undefined;
1832
+ private _extractPlainFields;
1833
+ private _indexEncryptedRows;
1445
1834
  protected encryptRows(rows: TRow[]): Promise<TRow[]>;
1446
1835
  protected encryptRowsChunked(rows: TRow[], options?: ISetDataChunkedOptions): Promise<TRow[]>;
1447
1836
  /**
1448
1837
  * Indexes pre-encrypted rows by performing a transient in-memory decryption pass
1449
1838
  * on search fields to populate CSearchIndex without mutating underlying encrypted records in allData.
1450
1839
  */
1451
- indexPreEncryptedRows(rows: TRow[]): Promise<void>;
1840
+ indexPreEncryptedRows(rows: TRow[], options?: {
1841
+ chunkSize?: number;
1842
+ isStale?: () => boolean;
1843
+ }): Promise<void>;
1452
1844
  decryptRows(rows: TRow[]): Promise<{
1453
1845
  rows: TRow[];
1454
1846
  decrypted: boolean;
@@ -1457,6 +1849,33 @@ declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataPr
1457
1849
  setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
1458
1850
  }
1459
1851
 
1852
+ /**
1853
+ * Minimal encryption/cache adapter surface shared across client providers.
1854
+ */
1855
+ interface IProviderEncryptionHost<TRow> {
1856
+ isEncryptionEnabled: boolean;
1857
+ encryption?: IProviderEncryptionOptions;
1858
+ searchIndex?: any;
1859
+ idKey: string;
1860
+ encryptRows(rows: TRow[]): Promise<TRow[]>;
1861
+ encryptRowsChunked(rows: TRow[], options?: ISetDataChunkedOptions): Promise<TRow[]>;
1862
+ indexPreEncryptedRows(rows: TRow[], options?: {
1863
+ chunkSize?: number;
1864
+ isStale?: () => boolean;
1865
+ }): Promise<void>;
1866
+ populateDecryptedCache(rows: TRow[], options?: {
1867
+ chunkSize?: number;
1868
+ isStale?: () => boolean;
1869
+ }): Promise<void>;
1870
+ cacheDecryptedRow(encryptedRow: any, decryptedRow: TRow): void;
1871
+ getDecryptedRow(rowOrId: any): TRow | undefined;
1872
+ decryptRows(rows: TRow[]): Promise<{
1873
+ rows: TRow[];
1874
+ decrypted: boolean;
1875
+ }>;
1876
+ invalidateDecryptedRow(rowOrId: any): void;
1877
+ }
1878
+
1460
1879
  declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientProvider<TRow> {
1461
1880
  private _allData;
1462
1881
  filteredData: TRow[];
@@ -1465,9 +1884,11 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1465
1884
  protected _sortDirty: boolean;
1466
1885
  protected _activeFilterEvaluator: ((row: any) => boolean) | null;
1467
1886
  protected _expectedRowCount?: number;
1887
+ protected _isSparse: boolean;
1468
1888
  batchSize: number | false;
1469
1889
  batchLoad: 'initially' | 'onDemand';
1470
1890
  onDemandFilterPolicy: 'ingestAll' | 'warnOnly';
1891
+ maxCachedBatches?: number;
1471
1892
  onBatchLoaded?: (batch: IBatchLoadedEvent<TRow>) => void;
1472
1893
  loadedBatches: Set<number>;
1473
1894
  protected _rawSourceData?: TRow[];
@@ -1478,18 +1899,28 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1478
1899
  get batchProgress(): IBatchProgress | undefined;
1479
1900
  set batchProgress(val: IBatchProgress | undefined);
1480
1901
  protected _batchGeneration: number;
1902
+ protected _inFlightLoad?: Promise<void>;
1481
1903
  constructor(options?: IDataProviderOptions);
1904
+ /**
1905
+ * Evicts oldest loaded batches when maxCachedBatches is configured and exceeded,
1906
+ * clearing their slots in _allData so they can be re-fetched on demand.
1907
+ */
1908
+ protected _evictOldestBatchesIfNeeded(activeBatch?: number): void;
1909
+ protected _assignAllData(data: TRow[], preserveDecryptedCache?: boolean): void;
1482
1910
  get allData(): TRow[];
1483
1911
  set allData(data: TRow[]);
1484
1912
  get rowMap(): readonly TRow[];
1485
1913
  setData(data: TRow[]): Promise<void> | void;
1486
1914
  protected _setDataBatched(data: TRow[]): Promise<void>;
1915
+ /** Adapts protected encryption/cache hooks for stateless batch helpers without exposing protected methods publicly. */
1916
+ protected _getEncryptionHost(): IProviderEncryptionHost<TRow>;
1487
1917
  protected _setDataEncrypted(data: TRow[]): Promise<void>;
1488
1918
  setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
1489
1919
  protected onFilterUpdated(): void;
1490
1920
  protected onSortUpdated(): void;
1491
- setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
1492
- setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
1921
+ setFilter(filter: IDataFilter | null, immediate?: boolean): void | Promise<void>;
1922
+ setSortList(sortList: IDataSort[], immediate?: boolean): void | Promise<void>;
1923
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
1493
1924
  clearEncryption(): void;
1494
1925
  /**
1495
1926
  * Explicitly rebuilds the reference map array if row properties inside allData were mutated in-place.
@@ -1501,12 +1932,20 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1501
1932
  refresh(hardRefresh?: boolean): Promise<void>;
1502
1933
  fetchAll(): Promise<TRow[]>;
1503
1934
  protected _getNormalizeOptions(): INormalizeOptions | undefined;
1935
+ protected _countDefinedRows(): number;
1936
+ protected _resolveSortValue(row: any, field: string, rangeBuckets: any): any;
1937
+ protected _buildSortedRowMap(): TRow[];
1938
+ protected _hasEncryptedRowFilterField(row: any, filter: IDataFilter | null, filterFields?: string[]): boolean;
1939
+ protected _hasUnindexedEncryptedFilter(filter: IDataFilter, sampleRows: TRow[]): boolean;
1940
+ /**
1941
+ * Builds a synchronous filter evaluator for decryptedCache mode that never falls back
1942
+ * to running evaluateFilter against encrypted ciphertext payloads.
1943
+ */
1944
+ protected _createDecryptedCacheFilterEvaluator(filter: IDataFilter, normOpts?: INormalizeOptions): (row: any) => boolean;
1504
1945
  private _computeFilteredAndSorted;
1505
- protected _inFlightLoad?: Promise<void>;
1506
1946
  loadPageData(): void | Promise<void>;
1507
1947
  protected _executeLoadPageDataSync(): void;
1508
1948
  protected _executeLoadPageData(): Promise<void>;
1509
- loadMore(): Promise<void>;
1510
1949
  loadBatch(batchNumber: number): Promise<void>;
1511
1950
  ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
1512
1951
  loadRange(startIndex: number, endIndex: number): Promise<void>;
@@ -1519,78 +1958,6 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1519
1958
  setState(partial: Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
1520
1959
  }
1521
1960
 
1522
- declare abstract class ACacheProvider {
1523
- constructor();
1524
- abstract getKeyList(context?: unknown): Array<string> | Promise<Array<string>>;
1525
- abstract get<T>(key: string, context?: unknown): Promise<T | null>;
1526
- abstract set<T>(key: string, data: T, lifetime: number, context?: unknown): Promise<void>;
1527
- abstract remove(key: string, context?: unknown): Promise<void>;
1528
- abstract removeByPrefix(prefix: string, context?: unknown): Promise<void>;
1529
- abstract getRemainingTime(key: string, context?: unknown): Promise<number | null>;
1530
- abstract cleanupExpired(): Promise<void>;
1531
- }
1532
-
1533
- declare class RequestProvider {
1534
- /**
1535
- * Clears ephemeral session key discriminators. Used for testing fresh runtime sessions.
1536
- */
1537
- static resetEphemeralKeyDiscriminators(): void;
1538
- cacheProvider: ACacheProvider | null;
1539
- cacheStrategy?: ECacheStrategy;
1540
- cacheLifetime: number | null;
1541
- deduplicate: boolean;
1542
- cacheKey: string;
1543
- /** Registry tags — set via useRequestProvider() or manually */
1544
- tags: string[];
1545
- /** If true, non-GET requests are enqueued instead of sent immediately */
1546
- queue: boolean;
1547
- private static requestQueue;
1548
- private static executing;
1549
- private static requestsInFlight;
1550
- private static inFlightBridges;
1551
- private static contextResolver?;
1552
- static setContextResolver(resolver: ((options?: IRequestOptions) => any) | undefined): void;
1553
- private lastUrl?;
1554
- private lastOptions?;
1555
- private dataReceivedCallback?;
1556
- constructor(provider?: ACacheProvider | ECacheStrategy, lifetime?: number, deduplicate?: boolean);
1557
- setCacheProvider(provider?: ACacheProvider | ECacheStrategy): void;
1558
- setCacheLifetime(lifetime: number): void;
1559
- setDeduplicate(deduplicate: boolean): void;
1560
- setQueue(queue: boolean): void;
1561
- encryption?: IProviderEncryptionOptions;
1562
- private _cachedCipherProvider?;
1563
- private _lastEncryptionConfig?;
1564
- private _scopedCipherProviders;
1565
- /**
1566
- * Configures E2EE payload encryption for outbound mutations and inbound responses.
1567
- *
1568
- * Threat Model: Protects sensitive SaaS tenant data against backend/database breaches.
1569
- * Multi-user sharing is supported by role-based session keys passed dynamically.
1570
- * Local client endpoint compromise (malware, trojans, keyloggers) is out of scope.
1571
- */
1572
- private disposeCipherInstance;
1573
- setEncryption(encryption?: IProviderEncryptionOptions): void;
1574
- clearEncryption(): void;
1575
- onDataReceived(callback: (data: any, generation?: number) => void): void;
1576
- private invokeDataReceivedCallback;
1577
- hasLastUrl(): boolean;
1578
- refresh(hardRefresh?: boolean): Promise<any>;
1579
- private resolveContext;
1580
- private getInFlightMap;
1581
- private getInFlightBridgeMap;
1582
- getUniqueKey(url: string, options?: IRequestOptions): string;
1583
- registerRequest<T>(url: string, options?: IRequestOptions): Promise<T>;
1584
- static executeAll(): void;
1585
- private isSameOriginUrl;
1586
- private getCipherProvider;
1587
- private isDataEncrypted;
1588
- private resolveFullRequestUrl;
1589
- private buildEncryptionContext;
1590
- private decryptPayloadIfNeeded;
1591
- request<T>(url: string, options?: IRequestOptions): Promise<T>;
1592
- }
1593
-
1594
1961
  declare abstract class AAPIDataProvider {
1595
1962
  apiUrl: string;
1596
1963
  cacheStrategy: ECacheStrategy | null;
@@ -1615,28 +1982,60 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
1615
1982
  cacheLifetime: number;
1616
1983
  refreshOnMutation: boolean | undefined;
1617
1984
  protected _isAccumulating: boolean;
1618
- protected _inFlightLoadMore: boolean;
1985
+ protected _isStreamingBatches: boolean;
1619
1986
  protected _inFlightBatches: Map<number, Promise<void>>;
1620
- protected _currentOnDemandBatch?: number;
1987
+ protected _requestGeneration: number;
1988
+ protected _activeUrl: string;
1989
+ protected _abortController?: AbortController;
1990
+ protected _knownIds: Set<string | number>;
1991
+ protected _loadedRowCount: number;
1992
+ protected _optimisticRowCountDelta: number;
1993
+ protected _optimisticallyCreatedIds: Set<string | number>;
1994
+ protected _optimisticallyDeletedIds: Set<string | number>;
1995
+ private _streamRefreshTimer?;
1621
1996
  private _lastDataReceivedPromise;
1997
+ private _lastBatch1CallbackGen;
1998
+ private _suppressOnDemandWarn;
1999
+ protected _getApiUrl(): string | undefined;
2000
+ setData(data: TRow[]): Promise<void> | void;
2001
+ protected _assignAllData(data: TRow[], preserveDecryptedCache?: boolean): void;
2002
+ set allData(data: TRow[]);
2003
+ get allData(): TRow[];
2004
+ protected _extractRowId(row: any): string | number | undefined;
2005
+ protected _resetIndexTrackers(rows?: TRow[]): void;
2006
+ protected _countDefinedRows(): number;
2007
+ protected _clearStreamRefreshTimer(): void;
2008
+ protected _scheduleStreamRefresh(reqGen: number): void;
2009
+ protected _bumpRequestGeneration(nextUrl?: string): number;
2010
+ private _shouldSkipDecryption;
2011
+ private _clearMutationCaches;
1622
2012
  constructor(options?: IDataProviderOptions);
2013
+ /** Encrypts or indexes incoming rows according to provider encryption settings. Returns null if request became stale. */
2014
+ protected _processIncomingRows(incomingRows: TRow[], isStale: () => boolean): Promise<TRow[] | null>;
2015
+ /** Places batch rows into `allData` at `targetIndex`, preserving sparse holes and updating row trackers. */
2016
+ protected _placeBatchRowsAt(processed: TRow[], targetIndex: number): void;
2017
+ private get _effectiveLoadedCount();
1623
2018
  get hasMore(): boolean;
1624
- loadMore(): Promise<void>;
1625
2019
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1626
2020
  clearEncryption(): void;
1627
2021
  setContextKey(key: string): void;
1628
2022
  setCacheStrategy(strategy: ECacheStrategy): void;
1629
2023
  setCacheLifetime(lifetime: number): void;
2024
+ private _tryHydrateFromSsr;
1630
2025
  refreshData(options?: {
1631
2026
  disableCache?: boolean;
1632
2027
  }): Promise<void>;
1633
- protected _fetchBatched(batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
1634
- protected _streamRemainingBatches(batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
1635
- loadBatch(batchNumber: number): Promise<void>;
2028
+ protected _fetchBatched(reqGen: number, batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
2029
+ protected _streamRemainingBatches(reqGen: number, batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
2030
+ loadBatch(batchNumber: number, options?: {
2031
+ skipPageLoad?: boolean;
2032
+ }): Promise<void>;
1636
2033
  ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
1637
2034
  loadRange(startIndex: number, endIndex: number): Promise<void>;
1638
2035
  setCurrentPage(currentPage: number): Promise<void>;
1639
- ingestAllBatches(): Promise<void>;
2036
+ ingestAllBatches(options?: {
2037
+ skipPageLoad?: boolean;
2038
+ }): Promise<void>;
1640
2039
  setFilter(filter: IDataFilter | null, immediate?: boolean): Promise<void>;
1641
2040
  setSortList(sortList: IDataSort[], immediate?: boolean): Promise<void>;
1642
2041
  loadPageData(options?: {
@@ -1654,23 +2053,48 @@ declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1654
2053
  contextKey: string;
1655
2054
  encryption?: IProviderEncryptionOptions;
1656
2055
  protected _allData: TRow[];
2056
+ private _unpaginatedData;
2057
+ private _unpaginatedDataSignature;
1657
2058
  protected _isAccumulating: boolean;
1658
2059
  protected _inFlightLoadMore: boolean;
1659
2060
  get allData(): TRow[];
1660
2061
  set allData(val: TRow[]);
2062
+ protected _invalidateUnpaginatedData(): void;
1661
2063
  private latestRequestId;
1662
2064
  private abortController;
2065
+ private _rangeCache;
2066
+ private _rangeCacheSignature;
2067
+ private _inFlightRangePages;
2068
+ private _verifiedStream;
2069
+ private _preserveVerifiedStreamOnNextLoad;
2070
+ protected _invalidateRangeCache(): void;
2071
+ protected _invalidateVerifiedStream(): void;
2072
+ private _getVerifiedStreamRowCount;
2073
+ private _ensureVerifiedRowsCount;
1663
2074
  constructor(options?: IDataProviderOptions);
1664
2075
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1665
2076
  clearEncryption(): void;
1666
2077
  setContextKey(key: string): void;
1667
2078
  setPageDataHandler(handler: TPageDataHandler<TRow>): Promise<void>;
2079
+ setCurrentPage(currentPage: number): void | Promise<void>;
1668
2080
  loadPageData(options?: {
1669
2081
  disableCache?: boolean;
1670
2082
  signal?: AbortSignal;
1671
2083
  page?: number;
2084
+ accumulate?: boolean;
1672
2085
  }): Promise<void>;
2086
+ private _applySSRNormalizedResult;
2087
+ private _runLoadPageData;
2088
+ /**
2089
+ * Paginated mode: `currentPage * pageSize < rowCount`.
2090
+ * Accumulating mode (after loadMore): `lastAppendedPage * pageSize < rowCount`.
2091
+ * `_allData.length` is intentionally NOT used: in paginated mode it only holds the current
2092
+ * page (always < rowCount), and after fetchAll() it holds the full dataset.
2093
+ */
1673
2094
  get hasMore(): boolean;
2095
+ /**
2096
+ * Appends the next server page to the displayed rows without mutating `currentPage`.
2097
+ */
1674
2098
  loadMore(): Promise<void>;
1675
2099
  /**
1676
2100
  * Fetches the complete unpaginated dataset from the server (e.g. for charts or exports).
@@ -1682,6 +2106,12 @@ declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1682
2106
  signal?: AbortSignal;
1683
2107
  }): Promise<TRow[]>;
1684
2108
  refresh(hardRefresh?: boolean): Promise<void>;
2109
+ /**
2110
+ * Side-channel random-access window slice resolution for server virtual scrolling.
2111
+ * Fetches only the target server pages covering [startIndex, endIndex) without mutating
2112
+ * `currentPage`, `pageData`, `loading`, or downloading preceding pages sequentially.
2113
+ */
2114
+ resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
1685
2115
  cancelPending(): void;
1686
2116
  }
1687
2117
 
@@ -1717,30 +2147,40 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
1717
2147
  private _sortedNodeIdsCache;
1718
2148
  private _filteredNodesCache;
1719
2149
  private _allVisibleRowsCache;
1720
- private _decryptedNodeMap;
2150
+ protected _decryptedNodeMap: Map<string | number, TRow>;
2151
+ protected _knownIds: Set<string | number>;
2152
+ clearDecryptedCache(): void;
2153
+ invalidateDecryptedRow(rowOrId: any): void;
2154
+ protected _assignAllData(data: TRow[], preserveDecryptedCache?: boolean): void;
2155
+ /** Appends unique rows in-place using _knownIds without cloning allData. */
2156
+ protected _appendUniqueTreeRows(rows: TRow[]): boolean;
2157
+ get allData(): TRow[];
2158
+ set allData(data: TRow[]);
1721
2159
  invalidateStaticCache(): void;
1722
2160
  clearVisibleCache(): void;
1723
- setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
2161
+ setFilter(filter: IDataFilter | null, immediate?: boolean): void | Promise<void>;
1724
2162
  protected onFilterUpdated(): void;
1725
2163
  private get _staticNodes();
1726
2164
  private get _nodeMap();
1727
2165
  private get _sortedNodeIds();
1728
2166
  constructor(options?: ITreeDataProviderOptions);
1729
- protected _applyTreeData(rows: TRow[]): void;
2167
+ protected _applyTreeData(rows: TRow[], preserveDecryptedCache?: boolean): void;
1730
2168
  setData(data: TRow[]): Promise<void> | void;
2169
+ private _decryptAndCacheTreeNodes;
1731
2170
  protected _setDataBatchedTree(data: TRow[]): Promise<void>;
1732
2171
  protected _setDataEncrypted(data: TRow[]): Promise<void>;
1733
2172
  setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
1734
- private buildStaticNodes;
1735
2173
  protected onSortUpdated(): void;
1736
- setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
1737
- private computeSortedIds;
1738
- private isNodeVisible;
2174
+ setSortList(sortList: IDataSort[], immediate?: boolean): void | Promise<void>;
1739
2175
  private paginateNodes;
1740
- private _buildFilteredHierarchy;
2176
+ private _createTreeNodeFilterEvaluator;
1741
2177
  private updatePageData;
1742
2178
  protected _executeLoadPageDataSync(): void;
1743
2179
  protected _executeLoadPageData(): Promise<void>;
2180
+ refreshData(options?: {
2181
+ disableCache?: boolean;
2182
+ }): Promise<void>;
2183
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
1744
2184
  clearEncryption(): void;
1745
2185
  get treeNodes(): ITreeNode<TRow>[];
1746
2186
  get allVisibleNodes(): ITreeNode<TRow>[];
@@ -1755,6 +2195,7 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
1755
2195
  get visibleRows(): ITreeNode<TRow>[];
1756
2196
  getAllNodes(): ITreeNode<TRow>[];
1757
2197
  getFlatNodes(): ITreeNode<TRow>[];
2198
+ private _commitExpansionChange;
1758
2199
  toggleNode(nodeId: string | number): void;
1759
2200
  expand(nodeId: string | number): void;
1760
2201
  collapse(nodeId: string | number): void;
@@ -1777,9 +2218,21 @@ declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> exten
1777
2218
  refreshOnMutation: boolean | undefined;
1778
2219
  protected _isAccumulating: boolean;
1779
2220
  protected _inFlightBatches: Map<number, Promise<void>>;
1780
- protected _currentOnDemandBatch?: number;
2221
+ protected _requestGeneration: number;
2222
+ protected _activeUrl: string;
2223
+ protected _abortController?: AbortController;
1781
2224
  private _lastDataReceivedPromise;
2225
+ private _lastBatch1CallbackGen;
2226
+ protected _getApiUrl(): string | undefined;
2227
+ setData(data: TRow[]): Promise<void> | void;
2228
+ protected _bumpRequestGeneration(nextUrl?: string): number;
2229
+ private _shouldSkipDecryption;
2230
+ private _clearMutationCaches;
1782
2231
  constructor(options?: ITreeDataProviderOptions);
2232
+ /** Encrypts or indexes incoming tree rows when field encryption is enabled. Returns null if stale. */
2233
+ protected _processIncomingTreeRows(incomingRows: TRow[], isStale: () => boolean): Promise<TRow[] | null>;
2234
+ /** Deduplicates incoming tree rows by idKey and appends them to the existing tree buffer. */
2235
+ protected _mergeTreeRows(rows: TRow[]): void;
1783
2236
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1784
2237
  clearEncryption(): void;
1785
2238
  setContextKey(key: string): void;
@@ -1787,10 +2240,13 @@ declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> exten
1787
2240
  refreshData(options?: {
1788
2241
  disableCache?: boolean;
1789
2242
  }): Promise<void>;
2243
+ private _tryHydrateTreeFromSsr;
1790
2244
  private _initialFetch;
1791
- protected _fetchBatchedTree(batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
1792
- protected _streamRemainingTreeBatches(batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
1793
- loadBatch(batchNumber: number): Promise<void>;
2245
+ protected _fetchBatchedTree(reqGen: number, batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
2246
+ protected _streamRemainingTreeBatches(reqGen: number, batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
2247
+ loadBatch(batchNumber: number, options?: {
2248
+ skipPageLoad?: boolean;
2249
+ }): Promise<void>;
1794
2250
  ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
1795
2251
  loadRange(startIndex: number, endIndex: number): Promise<void>;
1796
2252
  setCurrentPage(currentPage: number): Promise<void>;
@@ -1823,6 +2279,7 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1823
2279
  paginateBy: TreePaginationMode;
1824
2280
  expandedNodes: Set<string | number>;
1825
2281
  pageDataHandler: TTreePageDataHandler<TRow> | null;
2282
+ protected _isAccumulating: boolean;
1826
2283
  contextKey: string;
1827
2284
  encryption?: IProviderEncryptionOptions;
1828
2285
  constructor(options?: ITreeDataProviderOptions);
@@ -1830,8 +2287,29 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1830
2287
  clearEncryption(): void;
1831
2288
  setContextKey(key: string): void;
1832
2289
  setPageDataHandler(handler: TTreePageDataHandler<TRow>): Promise<void>;
2290
+ setCurrentPage(currentPage: number): void | Promise<void>;
1833
2291
  private latestRequestId;
1834
2292
  private abortController;
2293
+ private _rangeCache;
2294
+ private _rangeCacheSignature;
2295
+ private _inFlightRangePages;
2296
+ private _verifiedTreeStream;
2297
+ private _preserveVerifiedStreamOnNextLoad;
2298
+ private _unpaginatedData;
2299
+ get unpaginatedData(): TRow[] | null;
2300
+ protected _invalidateUnpaginatedData(): void;
2301
+ protected onFilterUpdated(): void;
2302
+ protected onSortUpdated(): void;
2303
+ protected _invalidateRangeCache(): void;
2304
+ protected _invalidateVerifiedStream(): void;
2305
+ private _createTreeParams;
2306
+ private _getTreeFilledItemCount;
2307
+ private _getTreeVerifiedRowCount;
2308
+ private _getTreePageRows;
2309
+ private _appendAndVerifyTreeBatch;
2310
+ private _flushTreeTelemetry;
2311
+ private _ensureVerifiedTreeCount;
2312
+ protected _querySignature(): string;
1835
2313
  /**
1836
2314
  * Load page data from server
1837
2315
  * Server handles tree building, visibility, and pagination
@@ -1839,8 +2317,24 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1839
2317
  loadPageData(options?: {
1840
2318
  disableCache?: boolean;
1841
2319
  signal?: AbortSignal;
2320
+ page?: number;
2321
+ accumulate?: boolean;
1842
2322
  }): Promise<void>;
2323
+ private _applySSRNormalizedResult;
2324
+ private _runLoadPageData;
1843
2325
  refresh(hardRefresh?: boolean): Promise<void>;
2326
+ resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
2327
+ loadMore(): Promise<void>;
2328
+ protected _loadMoreInFlight: boolean;
2329
+ protected fetchPageForLoadMore(page: number): Promise<TRow[]>;
2330
+ protected _unpaginatedCache: {
2331
+ sig: string;
2332
+ rows: TRow[];
2333
+ } | null;
2334
+ fetchAll(options?: {
2335
+ disableCache?: boolean;
2336
+ signal?: AbortSignal;
2337
+ }): Promise<TRow[]>;
1844
2338
  cancelPending(): void;
1845
2339
  toggleNode(nodeId: string | number): void;
1846
2340
  expand(nodeId: string | number): void;
@@ -2214,6 +2708,7 @@ declare class RequestProviderRegistry {
2214
2708
  }
2215
2709
 
2216
2710
  declare const SENSITIVE_HEADER_KEYS: string[];
2711
+
2217
2712
  /**
2218
2713
  * RequestQueue
2219
2714
  *
@@ -2225,19 +2720,6 @@ declare const SENSITIVE_HEADER_KEYS: string[];
2225
2720
  * - No internal retry: the queue is the retry mechanism (items persist until flushed)
2226
2721
  * - Partial refresh: registry refresh fires for succeeded tags only
2227
2722
  * - Dead-letter is final: Katlux never auto-retries — app decides via retryOne() or discard()
2228
- *
2229
- * Usage:
2230
- * RequestQueue.setStorageBackend(EQueueStorage.IndexedDB)
2231
- * await RequestQueue.init() // call once at app startup
2232
- *
2233
- * // Hooks (set in app setup, not in components)
2234
- * RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
2235
- * RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
2236
- * RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
2237
- * RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
2238
- *
2239
- * // Flush when back online
2240
- * window.addEventListener('online', () => RequestQueue.flushAll())
2241
2723
  */
2242
2724
  declare class RequestQueue {
2243
2725
  static queue: IQueuedOperation[];
@@ -2250,30 +2732,17 @@ declare class RequestQueue {
2250
2732
  static setMaxQueueSize(limit: number): void;
2251
2733
  static setMaxDeadLetterSize(limit: number): void;
2252
2734
  /**
2253
- * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
2254
- * request options to persistent storage (IndexedDB / LocalStorage).
2255
- * Sensitive credentials must never be stored in plaintext in browser storage, and are
2256
- * instead regenerated dynamically at execution time.
2735
+ * Canonical URL resolver appending query parameters consistently with RequestProvider.
2257
2736
  */
2737
+ static resolveFullRequestUrl(url: string, query?: any): string;
2258
2738
  /**
2259
- * Adapts binary, multipart, and specialized payload types (FormData, Blob, File,
2260
- * ArrayBuffer, TypedArrays, URLSearchParams) into JSON-serializable structures
2261
- * to prevent silent payload loss (BUG-014) when persisting to offline storage.
2739
+ * Adapts binary, multipart, and specialized payload types into JSON-serializable structures.
2262
2740
  */
2263
2741
  static serializeBody(body: any): Promise<any>;
2264
- private static serializeFieldValue;
2265
2742
  /**
2266
- * Reconstitutes serialized offline request bodies back into their live runtime instances
2267
- * (FormData, Blob, File, ArrayBuffer, Uint8Array, URLSearchParams) before network transmission.
2743
+ * Reconstitutes serialized offline request bodies back into live runtime instances.
2268
2744
  */
2269
2745
  static reconstituteBody(body: any): any;
2270
- /**
2271
- * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
2272
- * request options to persistent storage (IndexedDB / LocalStorage).
2273
- * Sensitive credentials must never be stored in plaintext in browser storage, and are
2274
- * instead regenerated dynamically at execution time.
2275
- */
2276
- private static sanitizeOptions;
2277
2746
  private static _subscribers;
2278
2747
  static subscribe(listener: () => void): () => void;
2279
2748
  static notify(): void;
@@ -2285,15 +2754,21 @@ declare class RequestQueue {
2285
2754
  private static _onNetworkError;
2286
2755
  private static _onError;
2287
2756
  private static _headerProvider;
2757
+ private static _cipherResolver;
2758
+ private static _defaultCipherResolver;
2759
+ private static _resetHooks;
2760
+ static onReset(hook: () => void): void;
2288
2761
  static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
2762
+ static setCipherResolver(resolver: ((kid?: string) => IEncryptionProvider | Promise<IEncryptionProvider> | null | undefined) | null): void;
2763
+ static setCipherProvider(provider: IEncryptionProvider | ((kid?: string) => IEncryptionProvider | Promise<IEncryptionProvider> | null | undefined) | null): void;
2764
+ static setDefaultCipherResolver(resolver: ((kid?: string) => IEncryptionProvider | Promise<IEncryptionProvider> | null | undefined) | null): void;
2765
+ private static resolveCipher;
2289
2766
  /**
2290
2767
  * Load persisted queue from storage into state.
2291
- * Call once at app startup, before any flush or enqueue operations.
2292
2768
  */
2293
2769
  static init(): Promise<void>;
2294
2770
  /**
2295
2771
  * Set the storage backend. Call before init().
2296
- * Defaults to IndexedDB with fallback to LocalStorage → Memory.
2297
2772
  */
2298
2773
  static setStorageBackend(backend: EQueueStorage): void;
2299
2774
  static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
@@ -2303,26 +2778,21 @@ declare class RequestQueue {
2303
2778
  static onQueueFatalError(cb: (error: Error) => void): void;
2304
2779
  /**
2305
2780
  * Add an operation to the pending queue and persist it.
2306
- * Called internally by RequestProvider when queue: true.
2307
- * Returns the stable ID of the queued item.
2308
2781
  */
2309
2782
  static enqueue(operation: Omit<IQueuedOperation, 'id' | 'createdAt' | 'flushAttempts' | 'status'>): Promise<string>;
2310
2783
  static getQueue(tag?: string): IQueuedOperation[];
2311
2784
  static getDeadLetterQueue(tag?: string): IDeadLetterItem[];
2785
+ private static handleFlushFailure;
2312
2786
  /**
2313
- * Flush queued items in FIFO order.
2314
- * Stops on first failure. Refreshes registry for succeeded tags only.
2787
+ * Flush queued items in FIFO order. Stops on first failure.
2315
2788
  */
2316
2789
  static flushAll(options?: IFlushOptions): Promise<void>;
2317
2790
  /**
2318
2791
  * Flush a specific pending item by ID, independent of queue position.
2319
- * On success: triggers registry refresh for its own tags.
2320
- * On failure: moves to dead-letter independently.
2321
2792
  */
2322
2793
  static flushOne(id: string): Promise<void>;
2323
2794
  /**
2324
2795
  * Move a dead-letter item back to the FRONT of the pending queue for retry.
2325
- * App should call flushAll() afterwards.
2326
2796
  */
2327
2797
  static retryOne(id: string): Promise<void>;
2328
2798
  /**
@@ -2331,7 +2801,6 @@ declare class RequestQueue {
2331
2801
  static discard(id: string): Promise<void>;
2332
2802
  /**
2333
2803
  * Reorder the pending queue by providing an ordered array of IDs.
2334
- * Fully permissive — causal ordering is the app's responsibility.
2335
2804
  */
2336
2805
  static reorder(ids: string[]): void;
2337
2806
  private static regenerateHeaders;
@@ -2386,9 +2855,10 @@ declare const applyOperator: (operator: string, rowValue: any, filterValue: any,
2386
2855
  /**
2387
2856
  * Normalizes standard and shorthand filter structures into a canonical IDataFilter tree.
2388
2857
  */
2389
- declare const normalizeFilter: (filter: any) => IDataFilter$1 | null;
2390
- declare const evaluateFilter: (filter: IDataFilter$1 | any, row: TDataRow, options?: INormalizeOptions) => boolean;
2391
- declare const filterTreeData: (nodes: any[], filter: IDataFilter$1, options: {
2858
+ declare const normalizeFilter: (filter: any) => IDataFilter | null;
2859
+ declare const compileFilter: (filter: IDataFilter | any, options?: INormalizeOptions) => ((row: TDataRow) => boolean);
2860
+ declare const evaluateFilter: (filter: IDataFilter | any, row: TDataRow, options?: INormalizeOptions) => boolean;
2861
+ declare const filterTreeData: (nodes: any[], filter: IDataFilter, options: {
2392
2862
  idKey: string;
2393
2863
  parentKey: string;
2394
2864
  normalizeOptions?: INormalizeOptions;
@@ -2396,7 +2866,7 @@ declare const filterTreeData: (nodes: any[], filter: IDataFilter$1, options: {
2396
2866
  visibleNodes: any[];
2397
2867
  expandedNodes: Set<string | number>;
2398
2868
  };
2399
- declare const filterData: (data: any[], filter: IDataFilter$1, options?: {
2869
+ declare const filterData: (data: any[], filter: IDataFilter, options?: {
2400
2870
  treeOptions?: {
2401
2871
  idKey: string;
2402
2872
  parentKey: string;
@@ -2410,7 +2880,7 @@ declare const filterData: (data: any[], filter: IDataFilter$1, options?: {
2410
2880
  declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2411
2881
  isEncryptedPayload: (payload: any) => boolean;
2412
2882
  extractFilterFieldNames: (filter: any) => string[];
2413
- normalizeFilter: (filter: any) => IDataFilter$1 | null;
2883
+ normalizeFilter: (filter: any) => IDataFilter | null;
2414
2884
  normalizeFilterValue: typeof normalizeFilterValue;
2415
2885
  foldAscii: typeof foldAscii;
2416
2886
  compareEqual: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
@@ -2418,8 +2888,8 @@ declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2418
2888
  compareContains: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
2419
2889
  compareValues: (rowValue: any, filterValue: any, options?: INormalizeOptions) => number;
2420
2890
  applyOperator: (operator: string, rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
2421
- evaluateFilter: (filter: IDataFilter$1 | any, row: TDataRow, options?: INormalizeOptions) => boolean;
2422
- filterTreeData: (nodes: any[], filter: IDataFilter$1, options: {
2891
+ evaluateFilter: (filter: IDataFilter | any, row: TDataRow, options?: INormalizeOptions) => boolean;
2892
+ filterTreeData: (nodes: any[], filter: IDataFilter, options: {
2423
2893
  idKey: string;
2424
2894
  parentKey: string;
2425
2895
  normalizeOptions?: INormalizeOptions;
@@ -2427,7 +2897,7 @@ declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2427
2897
  visibleNodes: any[];
2428
2898
  expandedNodes: Set<string | number>;
2429
2899
  };
2430
- filterData: (data: any[], filter: IDataFilter$1, options?: {
2900
+ filterData: (data: any[], filter: IDataFilter, options?: {
2431
2901
  treeOptions?: {
2432
2902
  idKey: string;
2433
2903
  parentKey: string;
@@ -2442,10 +2912,12 @@ declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2442
2912
 
2443
2913
  interface ISortDataOptions {
2444
2914
  resolveValue?: (row: TDataRow, field: string) => any;
2915
+ rangeBuckets?: Record<string, TRangeBucketConfig>;
2916
+ locale?: string;
2445
2917
  }
2446
- declare const sortData: (sortList: IDataSort$1[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2918
+ declare const sortData: (sortList: IDataSort[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2447
2919
  declare const useSortLogic: () => {
2448
- sortData: (sortList: IDataSort$1[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2920
+ sortData: (sortList: IDataSort[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2449
2921
  };
2450
2922
 
2451
2923
  interface IDebouncedFunction<T extends (...args: any[]) => any> {
@@ -2510,6 +2982,41 @@ declare function getAppRouter(): any;
2510
2982
  */
2511
2983
  declare function onPlatformReady(cb: () => void): void;
2512
2984
 
2985
+ /** Converts an optional AAD string or binary view into a non-empty `Uint8Array`. */
2986
+ declare function aadToBytes(aad?: string | Uint8Array | ArrayBuffer): Uint8Array | undefined;
2987
+ /** Decodes and concatenates Base64/binary ciphertext with an optional detached auth tag. */
2988
+ declare function combineCiphertextAndTag(ciphertext: Uint8Array | string, tag?: Uint8Array | string, expectedTagLength?: number, providerLabel?: string): Uint8Array;
2989
+ /** Serializes a JSON-compatible value into UTF-8 plaintext bytes for sealing. */
2990
+ declare function serializePlaintextToBytes(data: any): Uint8Array;
2991
+ /**
2992
+ * Decodes decrypted plaintext bytes into UTF-8, zeroes the plaintext buffer in `finally`,
2993
+ * and parses JSON while throwing a sanitized `SyntaxError` with zero plaintext leakage.
2994
+ */
2995
+ declare function parseDecryptedJsonSafely(decryptedBytes: ArrayBuffer | Uint8Array, providerLabel?: string): any;
2996
+ /** Normalizes low-level cipher/unwrap errors while preserving sanitized `SyntaxError` and tagged provider errors. */
2997
+ declare function normalizeDecryptError(err: any, providerLabel: string, fallbackMessage?: string): Error;
2998
+ type IAsymmetricSecurityDefaults = Pick<IBaseEncryptionProviderOptions, 'pinningStore' | 'pinEntityId' | 'pinningOptions' | 'senderSigningPrivateKey' | 'senderVerifyPublicKey' | 'requireSenderSignature'>;
2999
+ /**
3000
+ * Exhaustive tuple of constructor/keyring/KDF/policy/asymmetric-security keys
3001
+ * forwarded from `IProviderEncryptionOptions` to provider constructors.
3002
+ */
3003
+ declare const PROVIDER_CONSTRUCTOR_OPTION_KEYS: readonly ["keys", "activeKid", "kid", "keyId", "allowedKids", "allowedAlgorithms", "hmacKey", "kdf", "kdfIterations", "kdfHash", "kdfSalt", "info", "allowInsecureKdf", "allowUnboundAadFallback", "maxAllowedIterations", "maxSaltDerivations", "pinningStore", "pinEntityId", "pinningOptions", "senderSigningPrivateKey", "senderVerifyPublicKey", "requireSenderSignature"];
3004
+ /**
3005
+ * Exhaustive tuple of runtime operation keys forwarded from
3006
+ * `IProviderEncryptionOptions` into `IEncryptionContext`.
3007
+ */
3008
+ declare const ENCRYPTION_CONTEXT_KEYS: readonly ["keys", "activeKid", "kid", "keyId", "allowedKids", "allowedAlgorithms", "hmacKey", "kdf", "kdfIterations", "kdfHash", "kdfSalt", "info", "allowInsecureKdf", "allowUnboundAadFallback", "maxAllowedIterations", "maxSaltDerivations", "pinningStore", "pinEntityId", "pinningOptions", "senderSigningPrivateKey", "senderVerifyPublicKey", "requireSenderSignature", "key", "bindRequestContextAad", "fields", "unencryptedFields", "strict", "onDecryptError", "aad", "aadFields", "baseAad", "valueEncryption", "publicKey", "privateKey", "recipientPublicKey", "recipientPrivateKey", "curve"];
3009
+ /** Extracts defined constructor options for `AEncryptionProvider` subclasses, preserving `kid || keyId` fallback. */
3010
+ declare function pickProviderOptions(options?: IProviderEncryptionOptions): IBaseEncryptionProviderOptions;
3011
+ /** Extracts defined `IEncryptionContext` fields from `IProviderEncryptionOptions` plus optional request/url metadata. */
3012
+ declare function pickEncryptionContext(options?: IProviderEncryptionOptions, overrides?: Pick<IEncryptionContext, 'url' | 'method' | 'isServer'>): IEncryptionContext;
3013
+
3014
+ interface IEncryptRecordSession {
3015
+ dispose?(): void;
3016
+ }
3017
+ interface IDecryptBatchSession {
3018
+ dispose?(): void;
3019
+ }
2513
3020
  /**
2514
3021
  * Foundational abstract base class for all Katlux encryption provider implementations.
2515
3022
  * Provides key storage, lifecycle management, reusable value-level traversal,
@@ -2521,178 +3028,81 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
2521
3028
  protected keys?: Record<string, TKeyProvider | IKeyPair>;
2522
3029
  protected activeKid?: string;
2523
3030
  protected allowedKids?: string[];
2524
- protected defaultAllowedAlgorithms: string[];
3031
+ protected allowedAlgorithms?: TEncryptionAlgorithm[];
3032
+ protected defaultAllowedAlgorithms: TEncryptionAlgorithm[];
2525
3033
  protected allowInsecureKdf?: boolean;
3034
+ protected allowUnboundAadFallback?: boolean;
2526
3035
  protected maxAllowedIterations?: number;
2527
- constructor(key?: TKeyProvider | IKeyPair | any, options?: {
2528
- keys?: Record<string, TKeyProvider | IKeyPair>;
2529
- activeKid?: string;
2530
- allowedKids?: string[];
2531
- hmacKey?: TKeyProvider;
2532
- allowInsecureKdf?: boolean;
2533
- maxAllowedIterations?: number;
2534
- [key: string]: any;
2535
- });
2536
- /**
2537
- * Sets or updates the default secret key, CryptoKey, or async key provider function.
2538
- */
3036
+ protected maxSaltDerivations?: number;
3037
+ protected pinningStore?: IKeyPinningStore;
3038
+ protected pinEntityId?: string;
3039
+ protected pinningOptions?: Partial<Omit<IVerifyAndPinOptions, 'store'>> & {
3040
+ store?: IKeyPinningStore;
3041
+ };
3042
+ protected senderSigningPrivateKey?: CryptoKey;
3043
+ protected senderVerifyPublicKey?: CryptoKey;
3044
+ protected requireSenderSignature?: boolean;
3045
+ protected _configuredKid?: string;
3046
+ protected _usesAsymmetricEnvelopeSignature: boolean;
3047
+ constructor(key?: TKeyProvider | IKeyPair | any, options?: IBaseEncryptionProviderOptions);
3048
+ protected _getAsymmetricSecurityDefaults(): IAsymmetricSecurityDefaults;
3049
+ /**
3050
+ * Enforces the symmetric KDF strategy allow-list (`pbkdf2`, `hkdf`, `none`)
3051
+ * and disallows `kdf: 'none'` for encryption or without `allowInsecureKdf: true` on decrypt.
3052
+ */
3053
+ protected _assertKdfAllowed(kdf: string, isEncrypt: boolean, options?: IEncryptionContext): void;
2539
3054
  setDefaultKey(key: TKeyProvider | IKeyPair): void;
2540
- /**
2541
- * Retrieves the currently configured default key or key provider callback.
2542
- */
2543
3055
  getDefaultKey(): TKeyProvider | IKeyPair | undefined;
2544
- /**
2545
- * Configures a keyring dictionary of keys with an optional active key identifier.
2546
- */
2547
3056
  setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
2548
- /**
2549
- * Retrieves the currently configured keyring dictionary.
2550
- */
2551
3057
  getKeyring(): Record<string, TKeyProvider | IKeyPair> | undefined;
2552
- /**
2553
- * Sets the active Key Identifier (kid) to use for outbound encryption.
2554
- */
2555
3058
  setActiveKid(kid: string): void;
2556
- /**
2557
- * Retrieves the active Key Identifier (kid).
2558
- */
2559
3059
  getActiveKid(): string | undefined;
2560
- /**
2561
- * Sets or updates the dedicated HMAC key or key provider callback for blind indexing.
2562
- */
2563
3060
  setHmacKey(key: TKeyProvider): void;
2564
- /**
2565
- * Retrieves the currently configured HMAC key or key provider callback.
2566
- */
2567
3061
  getHmacKey(): TKeyProvider | undefined;
2568
- /**
2569
- * Computes a deterministic HMAC-SHA256 blind index hash for an arbitrary term.
2570
- * Requires a dedicated HMAC key configured via hmacKey or passed directly. Never falls back to the AES data key.
2571
- * Supports domain separation when options include field and/or type.
2572
- */
2573
3062
  computeBlindIndex(value: any, hmacKeyOrOptions?: CryptoKey | TKeyProvider | IBlindIndexOptions, options?: IBlindIndexOptions): Promise<string>;
2574
- /**
2575
- * Pre-derives and caches the native CryptoKey for subsequent cryptographic operations.
2576
- * Subclasses should override this with a dedicated, non-side-effecting implementation.
2577
- */
2578
3063
  warmupKey(_options?: IEncryptionContext): Promise<void>;
2579
- /**
2580
- * Resolves raw key from keyProvider callback or defaultKey.
2581
- */
2582
3064
  protected resolveRawKey(keyProvider?: TKeyProvider | IKeyPair | any): Promise<TRawKey>;
2583
- /**
2584
- * Checks whether the given payload is an encrypted envelope.
2585
- */
2586
3065
  static isEncrypted(payload: any): boolean;
2587
- /**
2588
- * Checks whether the given payload is an encrypted envelope.
2589
- */
2590
3066
  isEncrypted(payload: any): boolean;
2591
- /**
2592
- * Clears configured keys and cached cryptographic material from memory.
2593
- */
2594
3067
  clearKeys(): void;
2595
- /**
2596
- * Alias for clearKeys() to conform with standard disposal patterns.
2597
- */
2598
3068
  dispose(): void;
2599
- /**
2600
- * ECMAScript Explicit Resource Management protocol (using / await using declarations).
2601
- */
2602
3069
  [Symbol.dispose](): void;
2603
3070
  [Symbol.asyncDispose](): Promise<void>;
2604
- /**
2605
- * Deterministically normalizes a request URL for AAD context binding:
2606
- * 1. Strips URL fragments / hash.
2607
- * 2. Normalizes protocol/host (lowercased, default ports 80/443 removed) if absolute URL.
2608
- * 3. Normalizes pathname (collapses duplicate slashes, strips trailing slash unless root '/').
2609
- * 4. Filters out transient cache-busting, tracking, and analytics query parameters (e.g. `utm_*`, `_t`, `fbclid`, `gclid`).
2610
- * 5. Lexicographically sorts query parameters deterministically by key, then value.
2611
- */
2612
3071
  static normalizeUrl(rawUrl?: string): string;
2613
3072
  protected _normalizeUrl(rawUrl?: string): string;
2614
- /**
2615
- * Resolves effective Authenticated Additional Data (AAD) for the operation:
2616
- * 1. If options.bindRequestContextAad is explicitly false, returns options.aad directly without context binding.
2617
- * 2. When encrypting or decrypting: binds request context `req:${method}:${normalizedUrl}` only if options.bindRequestContextAad === true.
2618
- * 3. If explicit options.aad is provided: combines with request context if bound, or returns options.aad directly.
2619
- * 4. Otherwise returns undefined.
2620
- */
2621
- protected _resolveEffectiveAad(options?: IEncryptionContext, isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
2622
- /**
2623
- * Helper to deterministically bind record ID, contextual sibling fields (aadFields),
2624
- * dynamic AAD callbacks, and field name into the AAD to prevent ciphertext swapping
2625
- * between fields, records, or parent entities.
2626
- */
3073
+ protected _resolveEffectiveAad(options?: IEncryptionContext, _isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
2627
3074
  protected _bindFieldAad(data: any, field: string, options?: IEncryptionContext): IEncryptionContext;
2628
- /**
2629
- * Validates envelope metadata against algorithm whitelists and key identifiers (kid).
2630
- * In strict mode, allowedAlgorithms defaults to ['AES-GCM'].
2631
- */
2632
3075
  protected _validateEnvelopeMetadata(payload: any, options?: IEncryptionContext): Error | undefined;
2633
- /**
2634
- * Normalizes encryption options with active keyring parameters:
2635
- * If `keys` and `activeKid` are configured, selects `key = keys[activeKid]` and sets `kid = activeKid`.
2636
- */
3076
+ protected _isRawKeyOrCryptoKey(key: any): boolean;
3077
+ protected _resolveStrictViolationKeys(record: Record<string, any>, targetKeys: string[], options?: IEncryptionContext): string[];
2637
3078
  protected _resolveOutboundKeyringOptions(options?: IEncryptionContext): IEncryptionContext;
2638
- /**
2639
- * Resolves the appropriate decryption key for a specific payload envelope based on its `kid`
2640
- * and the configured keyring (`keys`, `activeKid`, or fallback `key`).
2641
- */
3079
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3080
+ protected _getDefaultFallbackKey(): TKeyProvider | IKeyPair | undefined;
2642
3081
  protected _resolveDecryptionKeyForEnvelope(payload: any, options?: IEncryptionContext): TKeyProvider | IKeyPair | undefined;
2643
- /**
2644
- * Handles a per-field or per-payload decryption error according to configured options:
2645
- * - Invokes onDecryptError callback if provided
2646
- * - Attaches error metadata (__decryptErrors) to the record object
2647
- * - Returns fallback cell placeholder ('[⚠ Decryption Error]') or rethrows
2648
- */
2649
3082
  protected _handleDecryptError(err: Error, record: any, field: string, value: any, index: number | undefined, options?: IEncryptionContext): any;
2650
- /**
2651
- * Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
2652
- * Implemented by concrete cryptographic providers.
2653
- */
2654
- abstract encryptValue(value: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
2655
- /**
2656
- * Decrypts a single IEncryptedPayload envelope back into its original plaintext.
2657
- * Implemented by concrete cryptographic providers.
2658
- */
2659
- abstract decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
2660
- /**
2661
- * Encrypts a single scalar value with contextual AAD binding into an IEncryptedPayload envelope.
2662
- * Binds recordId, fieldName, and sibling aadFields deterministically to protect against ciphertext swapping.
2663
- *
2664
- * @param value - Scalar value (string, number, boolean, object) to encrypt.
2665
- * @param context - Field encryption context with recordId, fieldName, and optional sibling aadFields.
2666
- */
3083
+ protected abstract _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3084
+ protected abstract _resolveEncryptKeyMaterial(options?: IEncryptionContext, session?: IEncryptRecordSession): Promise<any>;
3085
+ protected abstract _sealPayload(plaintextBytes: Uint8Array, keyMaterial: any, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3086
+ protected abstract _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<any>;
3087
+ protected abstract _unsealPayload(payload: IEncryptedPayload, keyMaterial: any, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<ArrayBuffer | Uint8Array>;
3088
+ protected _releaseEncryptKeyMaterial(_keyMaterial: any, _session?: IEncryptRecordSession): void;
3089
+ protected _releaseDecryptKeyMaterial(_keyMaterial: any, _session?: IDecryptBatchSession): void;
3090
+ protected _beginEncryptRecordSession(_options?: IEncryptionContext): Promise<IEncryptRecordSession | undefined>;
3091
+ protected _beginDecryptBatchSession(_options?: IEncryptionContext): IDecryptBatchSession | undefined;
3092
+ protected _prepareFieldDecryptContext(_item: Record<string, any>, _field: string, payload: IEncryptedPayload, options?: IEncryptionContext): {
3093
+ payload: IEncryptedPayload;
3094
+ options?: IEncryptionContext;
3095
+ };
3096
+ protected _finalizeDecryptedRecord(_item: Record<string, any>, _result: Record<string, any>, _options?: IEncryptionContext): void;
3097
+ private _encryptValueWithSession;
3098
+ private _decryptEnvelopeWithAadFallback;
3099
+ private _decryptValueWithSession;
3100
+ encryptValue(value: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3101
+ decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
2667
3102
  encryptField(value: any, context?: IFieldEncryptionContext): Promise<IEncryptedPayload>;
2668
- /**
2669
- * Decrypts a single IEncryptedPayload envelope back into its scalar plaintext value using contextual AAD.
2670
- * Validates recordId, fieldName, and sibling aadFields integrity.
2671
- *
2672
- * @param envelope - The IEncryptedPayload envelope to decrypt.
2673
- * @param context - Field encryption context matching the encryption parameters.
2674
- */
2675
3103
  decryptField(envelope: IEncryptedPayload, context?: IFieldEncryptionContext): Promise<any>;
2676
- /**
2677
- * Top-level polymorphic encryption method.
2678
- * Automatically performs value-level encryption:
2679
- * - If data is an array of objects: recursively encrypts each row.
2680
- * - If data is an object: encrypts specified fields (or all values if valueEncryption is true),
2681
- * preserving JSON object keys so backend APIs and ORMs can parse keys and perform upserts.
2682
- * - If data is a primitive or whole-payload envelope: encrypts as a single value.
2683
- */
2684
3104
  encrypt(data: any, options?: IEncryptionContext): Promise<any>;
2685
- /**
2686
- * Top-level polymorphic decryption method.
2687
- * Automatically performs value-level decryption:
2688
- * - If payload is an encrypted envelope: validates metadata and decrypts directly via decryptValue.
2689
- * - If payload is an array of objects: decrypts each row (batched with local memoization).
2690
- * - If payload is an object: decrypts any encrypted value cells across fields.
2691
- * In strict mode:
2692
- * - Unencrypted plaintext in configured `fields` triggers a decryption error.
2693
- * - Envelopes are validated against `allowedAlgorithms` and `allowedKids`.
2694
- * - Errors are routed through `onDecryptError` or populated into `__decryptErrors`.
2695
- */
3105
+ private _decryptRecordFields;
2696
3106
  decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
2697
3107
  }
2698
3108
  declare function normalizeUrl(rawUrl?: string): string;
@@ -2715,10 +3125,8 @@ declare function resolveSalt(salt?: Uint8Array | ArrayBuffer | string): Uint8Arr
2715
3125
  /**
2716
3126
  * Generates a random AES CryptoKey suitable for AES-GCM or AES-CBC.
2717
3127
  *
2718
- * E2EE Threat Model Note: Focuses on protecting GDPR/tenant data against database and
2719
- * server-side leaks. Keys remain extractable by default to enable role-based key sharing,
2720
- * wrapping, and transfer between authorized client sessions in multi-user SaaS apps.
2721
- * Client-side malware/trojan protection is out of scope.
3128
+ * Defaults to `extractable = false` so key material cannot be exported via
3129
+ * `exportKey`/`wrapKey` unless the caller explicitly opts in with `extractable: true`.
2722
3130
  */
2723
3131
  declare function generateAESKey(length?: 128 | 256, algorithm?: 'AES-GCM' | 'AES-CBC' | 'AES-KW', extractable?: boolean): Promise<CryptoKey>;
2724
3132
  /**
@@ -2852,6 +3260,27 @@ declare function deriveKeyFromSecret(secretKey: CryptoKey, options?: IHKDFFromSe
2852
3260
  */
2853
3261
  declare function deriveAuthAndEncryptionKeys(password: string | Uint8Array | ArrayBuffer, salt?: Uint8Array | ArrayBuffer | string, options?: IDeriveAuthAndEncryptionOptions): Promise<IDomainDerivedKeys>;
2854
3262
 
3263
+ /** Current blind-index HMAC framing protocol identifier (length-prefixed framing). */
3264
+ declare const BLIND_INDEX_FRAMING_VERSION = "lp1";
3265
+ /**
3266
+ * Parameters that determine blind-index token compatibility across writers and queries.
3267
+ */
3268
+ interface IBlindIndexSchemeOptions extends INormalizeOptions {
3269
+ /** Whether tokens omit field+type domain separation (default: false -> 'field-type') */
3270
+ legacyUnscopedTokens?: boolean;
3271
+ /** Framing protocol version (default: 'lp1') */
3272
+ framing?: 'lp1' | 'legacy-unframed';
3273
+ /** Whether `kid` is explicitly framed into HMAC input (default: false) */
3274
+ includeKidInHmac?: boolean;
3275
+ /** Optional explicit `kid` if passed to `computeBlindIndex` */
3276
+ kid?: string;
3277
+ }
3278
+ /**
3279
+ * Computes a canonical, deterministic scheme identifier covering HMAC framing, domain scope,
3280
+ * and normalization configuration (`locale`, `asciiFold`, `normalizerId`).
3281
+ * Persisting this identifier alongside blind-index columns makes normalization or scope drift detectable.
3282
+ */
3283
+ declare function computeBlindIndexSchemeId(options?: IBlindIndexSchemeOptions): string;
2855
3284
  declare const _bidxHmacKeyCache: Map<string, CryptoKey>;
2856
3285
  /**
2857
3286
  * Clears the in-memory memoization cache for derived blind-index HMAC CryptoKeys.
@@ -2885,22 +3314,30 @@ declare function verify(data: any | string | Uint8Array, signature: string, publ
2885
3314
  * Security Guarantees:
2886
3315
  * 1. Dedicated Key Requirement: Throws ERR_BIDX_MISSING_HMAC_KEY if keyMaterial is missing/undefined.
2887
3316
  * 2. Domain Separation: If a string passphrase is provided, it is NEVER imported directly as raw HMAC key material.
2888
- * Instead, it is derived using HKDF with an independent salt ('katlux-blind-index-salt-v1') and explicit
3317
+ * Instead, it is stretched via PBKDF2 (default 600,000 iterations; lower to e.g. 100,000 on edge runtimes like
3318
+ * Cloudflare Workers) and expanded with HKDF using an independent salt ('katlux-blind-index-salt-v1') and explicit
2889
3319
  * domain separation info ('katlux-blind-index'). This prevents GPU dictionary attacks against the AES data key.
2890
3320
  * 3. Type Enforcement: If a CryptoKey is passed, enforces algorithm.name === 'HMAC'.
2891
3321
  */
2892
- declare function deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined): Promise<CryptoKey>;
3322
+ declare function deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined, options?: {
3323
+ kdfIterations?: number;
3324
+ maxAllowedIterations?: number;
3325
+ }): Promise<CryptoKey>;
2893
3326
  /**
2894
- * Computes a deterministic HMAC-SHA256 blind index hash for an arbitrary term using the supplied CryptoKey.
3327
+ * Computes a deterministic, length-prefixed, domain-separated HMAC-SHA256 blind index token.
2895
3328
  * Performs Unicode NFKC normalization, trimming, and lowercasing before computing the signature.
2896
3329
  *
2897
- * Enforces cryptographic domain separation:
2898
- * `token = HMAC("${kid ? kid + ':' : ''}${fieldName}:${tokenType}:${normalizedValue}", key)`
3330
+ * Enforces cryptographic domain separation and unambiguous length-prefixed framing:
3331
+ * `token = HMAC("${bytes(kid)}:${kid}|${bytes(field)}:${field}|${bytes(type)}:${type}|${bytes(val)}:${normalizedValue}", key)`
3332
+ *
3333
+ * Convention on `kid`: `IBlindIndexKeyring` writers (`computeWriteBlindIndex`, `reencryptField`, `CSearchIndex`)
3334
+ * and `rewriteEncryptedFilters` intentionally omit `kid` from HMAC input because each `kid` in a keyring already
3335
+ * maps to a distinct HMAC key. Pass `options.kid` explicitly only if multiple logical key IDs share one raw HMAC key.
2899
3336
  *
2900
3337
  * @param value - The input string, number, or object to compute the blind index for.
2901
3338
  * @param hmacKey - CryptoKey configured for HMAC signing.
2902
- * @param options - Normalization options and optional domain separation context ({ field?: string; type?: 'eq' | 'tri'; kid?: string }).
2903
- * @returns Lowercase hexadecimal HMAC-SHA256 blind index hash.
3339
+ * @param options - Normalization options and optional domain separation context ({ field?: string; type?: 'eq' | 'tri'; kid?: string; version?: string | number; versionTag?: string | boolean }).
3340
+ * @returns Lowercase hexadecimal HMAC-SHA256 blind index hash (or `${tag}:${hex}` when `versionTag` is enabled).
2904
3341
  */
2905
3342
  declare function computeBlindIndex(value: any, hmacKey: CryptoKey, options?: IBlindIndexOptions): Promise<string>;
2906
3343
  /**
@@ -3095,7 +3532,10 @@ declare class CKeyManager {
3095
3532
  static getKeyFingerprint(publicKey: CryptoKey | Uint8Array | ArrayBuffer | string): Promise<string>;
3096
3533
  static sign(data: any | string | Uint8Array, privateKey: CryptoKey): Promise<string>;
3097
3534
  static verify(data: any | string | Uint8Array, signature: string, publicKey: CryptoKey): Promise<boolean>;
3098
- static deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined): Promise<CryptoKey>;
3535
+ static deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined, options?: {
3536
+ kdfIterations?: number;
3537
+ maxAllowedIterations?: number;
3538
+ }): Promise<CryptoKey>;
3099
3539
  static computeBlindIndex(value: any, hmacKey: CryptoKey, options?: IBlindIndexOptions): Promise<string>;
3100
3540
  static signGrant(grant: IAccessGrant, granterPrivateKey: CryptoKey, granterPublicKey?: CryptoKey): Promise<ISignedGrant>;
3101
3541
  static verifyGrant(signedGrant: ISignedGrant, granterPublicKey: CryptoKey, options?: IVerifyGrantOptions): Promise<boolean>;
@@ -3120,6 +3560,7 @@ declare class CKeyManager {
3120
3560
  static validateBlindIndexKeyring(keyring: IBlindIndexKeyring): void;
3121
3561
  static computeMultiBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string[]>;
3122
3562
  static computeWriteBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string>;
3563
+ static computeBlindIndexSchemeId(options?: IBlindIndexSchemeOptions): string;
3123
3564
  }
3124
3565
 
3125
3566
  /**
@@ -3174,6 +3615,16 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
3174
3615
  * cross-tenant cache collisions and avoid storing secrets in heap Map keys.
3175
3616
  */
3176
3617
  declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
3618
+ declare const DEFAULT_KEY_CACHE_MAX_SIZE = 100;
3619
+ /**
3620
+ * Retrieves an entry from an LRU Map cache and refreshes its recency position.
3621
+ */
3622
+ declare function getLruCacheEntry<K, V>(cache: Map<K, V>, key: K): V | undefined;
3623
+ /**
3624
+ * Inserts or updates an entry in a bounded LRU Map cache, evicting the least-recently-used
3625
+ * entry if the cache has reached `maxSize`.
3626
+ */
3627
+ declare function setLruCacheEntry<K, V>(cache: Map<K, V>, key: K, value: V, maxSize?: number, onEvict?: (evictedKey: K, evictedValue: V) => void): void;
3177
3628
  /**
3178
3629
  * Detects whether an error thrown during ciphertext decryption is an authentication failure
3179
3630
  * (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
@@ -3195,21 +3646,110 @@ declare function isAuthOrDecryptionError(err: any): boolean;
3195
3646
  * standard ECMAScript number formatting (-0 serialized as 0), and detection of circular references.
3196
3647
  */
3197
3648
  declare function canonicalizeJson(value: any, seen?: Set<any>): string;
3649
+ declare const DEFAULT_PBKDF2_ITERATIONS = 600000;
3650
+ declare const DEFAULT_MAX_ALLOWED_ITERATIONS = 1000000;
3651
+ declare const DEFAULT_MAX_SALT_DERIVATIONS = 5;
3652
+ /**
3653
+ * Validates that a requested PBKDF2 iteration count does not exceed the configured ceiling.
3654
+ * Throws an Error with `code = 'ERR_EXCESSIVE_KDF_ITERATIONS'` when `iterations > maxAllowed`.
3655
+ */
3656
+ declare function assertMaxAllowedIterations(iterations: number, maxAllowed?: number, context?: string): void;
3657
+ /**
3658
+ * Resolves the effective PBKDF2 iteration count from override, per-call options,
3659
+ * provider defaults, and `DEFAULT_PBKDF2_ITERATIONS`, validates it against the
3660
+ * configured `maxAllowedIterations` ceiling, and clamps it to `[1000, maxAllowed]`.
3661
+ */
3662
+ declare function resolveAndClampPbkdf2Iterations(params: {
3663
+ iterationsOverride?: number;
3664
+ optionsIterations?: number;
3665
+ defaultIterations?: number;
3666
+ optionsMaxAllowed?: number;
3667
+ providerMaxAllowed?: number;
3668
+ context?: string;
3669
+ }): number;
3670
+ declare const SALT_BUDGET_SYM: unique symbol;
3671
+ interface ISaltDerivationBudget {
3672
+ maxDistinctSalts: number;
3673
+ hardCapSalts: number;
3674
+ strict: boolean;
3675
+ explicitLimit: boolean;
3676
+ seenSalts: Set<string>;
3677
+ queue: Promise<void>;
3678
+ }
3679
+ /**
3680
+ * Escapes AAD delimiter characters (`%`, `|`, `:`, `=`, `,`) so user-supplied
3681
+ * record IDs, field names, and context values cannot collide with canonical AAD structure.
3682
+ */
3683
+ declare function escapeAadComponent(value: string): string;
3684
+ /**
3685
+ * Extracts a record's primary key using standard Katlux primary key fallbacks
3686
+ * (`id`, `_id`, `uuid`, `key`), ignoring `null` and `undefined`.
3687
+ */
3688
+ declare function extractDefaultRowId(row: any): any;
3689
+ /**
3690
+ * Type-tags and delimiter-escapes an `aadFields` value so distinct JS types
3691
+ * (`null` vs `'null'`, `undefined` vs `''`, `7` vs `'7'`, objects) never collide.
3692
+ */
3693
+ declare function serializeAadFieldValue(val: any): string;
3694
+ /**
3695
+ * Builds the canonical framed AAD string shared by field encryption and batch re-encryption.
3696
+ */
3697
+ declare function buildCanonicalFieldAad(params: {
3698
+ data: any;
3699
+ field: string;
3700
+ baseAad?: string;
3701
+ explicitAad?: string;
3702
+ aadFields?: string[];
3703
+ recordId?: string | number;
3704
+ getRowId?: (row: any) => string | number | undefined;
3705
+ reqPart?: string;
3706
+ }): string;
3707
+ /**
3708
+ * Attaches a request/batch-scoped PBKDF2 distinct salt derivation budget to options
3709
+ * without adding enumerable string keys. Preserved across object-spread copies.
3710
+ */
3711
+ declare function attachSaltDerivationBudget<T extends Record<string, any> | undefined>(options: T, providerMaxSaltDerivations?: number): T & {
3712
+ [SALT_BUDGET_SYM]?: ISaltDerivationBudget;
3713
+ };
3714
+ declare function getSaltDerivationBudget(options?: Record<string, any>): ISaltDerivationBudget | undefined;
3715
+ /**
3716
+ * Synchronously claims a PBKDF2 salt derivation slot for `saltKey` within a request/batch budget.
3717
+ * Rejects with `ERR_KDF_SALT_LIMIT_EXCEEDED` when distinct uncached salts exceed the budget cap.
3718
+ */
3719
+ declare function claimSaltDerivationSlotSync(options: Record<string, any> | undefined, saltKey: string): void;
3720
+ /**
3721
+ * Acquires a PBKDF2 salt derivation slot for `saltKey` within a request/batch budget.
3722
+ * Rejects immediately under strict mode or explicit caps, and safely serializes non-strict
3723
+ * overflow bursts up to `hardCapSalts` before rejecting with `ERR_KDF_SALT_LIMIT_EXCEEDED`.
3724
+ */
3725
+ declare function acquireSaltDerivationSlot<R>(options: Record<string, any> | undefined, saltKey: string, task: () => Promise<R>): Promise<R>;
3726
+ /**
3727
+ * Runs an async key derivation task inside `acquireSaltDerivationSlot` when `useSlotBudget` is true,
3728
+ * or directly when no PBKDF2 salt-budget slot is needed.
3729
+ */
3730
+ declare function runWithSaltDerivationSlot<R>(useSlotBudget: boolean, options: Record<string, any> | undefined, saltKey: string, task: () => Promise<R>): Promise<R>;
3731
+ /**
3732
+ * Resolves a salt-scoped key derivation from an LRU Promise cache (bounded to `maxSize`, default 100),
3733
+ * wrapping new PBKDF2 derivations in `acquireSaltDerivationSlot` and evicting failed promises.
3734
+ */
3735
+ declare function resolveCachedSaltDerivation<T>(params: {
3736
+ cache: Map<string, Promise<T>>;
3737
+ compoundKey: string;
3738
+ deriveTask: () => Promise<T>;
3739
+ useSlotBudget: boolean;
3740
+ options?: Record<string, any>;
3741
+ onCacheHit?: () => void;
3742
+ maxSize?: number;
3743
+ }): Promise<T>;
3198
3744
 
3199
- interface ICWebCryptoOptions {
3200
- kdf?: 'none' | 'pbkdf2' | 'hkdf';
3201
- kdfIterations?: number;
3202
- kdfHash?: 'SHA-256' | 'SHA-512';
3203
- kdfSalt?: string | Uint8Array | ArrayBuffer;
3204
- info?: string | Uint8Array | ArrayBuffer;
3205
- kid?: string;
3745
+ interface IResolvedWebCryptoKey {
3746
+ cryptoKey: CryptoKey;
3747
+ salt?: string;
3748
+ kdf?: string;
3749
+ iter?: number;
3206
3750
  keyId?: string;
3207
- keys?: Record<string, TKeyProvider | IKeyPair>;
3208
- activeKid?: string;
3209
- allowedKids?: string[];
3210
- hmacKey?: TKeyProvider;
3211
- allowInsecureKdf?: boolean;
3212
- maxAllowedIterations?: number;
3751
+ }
3752
+ interface ICWebCryptoOptions extends IBaseEncryptionProviderOptions {
3213
3753
  }
3214
3754
  /**
3215
3755
  * Zero-dependency AES-256-GCM cipher provider using native Web Crypto API (crypto.subtle).
@@ -3224,20 +3764,21 @@ interface ICWebCryptoOptions {
3224
3764
  */
3225
3765
  declare class CWebCryptoEncryptionProvider extends AEncryptionProvider {
3226
3766
  private _defaultKdf;
3227
- private _allowInsecureKdf?;
3228
3767
  private _maxAllowedIterations?;
3229
3768
  private _cachedKey?;
3769
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3230
3770
  private _kdfOptions?;
3231
3771
  private _cachedSalt?;
3232
3772
  private _cachedKdf?;
3233
3773
  private _cachedIter?;
3234
3774
  private _cachedHash?;
3235
3775
  private _cachedKeyId?;
3236
- private _configuredKid?;
3237
3776
  private _decryptSaltCache;
3238
3777
  private _keyringCache;
3778
+ private _inflightKeyCache;
3239
3779
  setDefaultKey(key: TKeyProvider): void;
3240
3780
  clearKeys(): void;
3781
+ setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
3241
3782
  constructor(key?: TKeyProvider | IKeyPair, options?: ICWebCryptoOptions);
3242
3783
  /**
3243
3784
  * Derives or returns a CryptoKey for encryption/decryption based on KDF settings.
@@ -3247,29 +3788,22 @@ declare class CWebCryptoEncryptionProvider extends AEncryptionProvider {
3247
3788
  static isEncrypted(payload: any): boolean;
3248
3789
  isEncrypted(payload: any): boolean;
3249
3790
  warmupKey(options?: IEncryptionContext): Promise<void>;
3250
- /**
3251
- * Encrypts a single value into an AES-GCM envelope.
3252
- */
3253
- encryptValue(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3254
- /**
3255
- * Decrypts a single AES-GCM envelope back into its plaintext.
3256
- */
3257
- decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
3791
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3792
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext): Promise<IResolvedWebCryptoKey>;
3793
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IResolvedWebCryptoKey, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3794
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<CryptoKey>;
3795
+ protected _unsealPayload(payload: IEncryptedPayload, cryptoKey: CryptoKey, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3258
3796
  }
3259
3797
 
3260
- interface ICWebCryptoAESCBCOptions {
3261
- kdf?: 'none' | 'pbkdf2' | 'hkdf';
3262
- kdfIterations?: number;
3263
- kdfHash?: 'SHA-256' | 'SHA-512';
3264
- kdfSalt?: string | Uint8Array | ArrayBuffer;
3265
- info?: string | Uint8Array | ArrayBuffer;
3266
- kid?: string;
3798
+ interface ICWebCryptoAESCBCOptions extends IBaseEncryptionProviderOptions {
3799
+ }
3800
+ interface IDerivedCBCKeys {
3801
+ encKey: CryptoKey;
3802
+ macKey: CryptoKey;
3803
+ salt?: string;
3804
+ kdf?: string;
3805
+ iter?: number;
3267
3806
  keyId?: string;
3268
- keys?: Record<string, TKeyProvider | IKeyPair | any>;
3269
- activeKid?: string;
3270
- allowedKids?: string[];
3271
- allowInsecureKdf?: boolean;
3272
- maxAllowedIterations?: number;
3273
3807
  }
3274
3808
  /**
3275
3809
  * Authenticated AES-CBC-256 provider with Encrypt-then-MAC (HMAC-SHA-256).
@@ -3282,21 +3816,22 @@ interface ICWebCryptoAESCBCOptions {
3282
3816
  */
3283
3817
  declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
3284
3818
  private _defaultKdf;
3285
- private _allowInsecureKdf?;
3286
3819
  private _maxAllowedIterations?;
3287
3820
  private _cachedEncKey?;
3821
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3288
3822
  private _cachedMacKey?;
3289
3823
  private _cachedSalt?;
3290
3824
  private _cachedKdf?;
3291
3825
  private _cachedIter?;
3292
3826
  private _cachedHash?;
3293
3827
  private _cachedKeyId?;
3294
- private _configuredKid?;
3295
3828
  private _kdfOptions?;
3296
3829
  private _decryptSaltCache;
3830
+ private _inflightKeyCache;
3297
3831
  constructor(key?: TKeyProvider | IKeyPair | any, options?: ICWebCryptoAESCBCOptions);
3298
3832
  setDefaultKey(key: TKeyProvider | IKeyPair): void;
3299
3833
  clearKeys(): void;
3834
+ setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
3300
3835
  warmupKey(options?: IEncryptionContext): Promise<void>;
3301
3836
  /**
3302
3837
  * Derives 64 bytes (512 bits) of key material:
@@ -3307,16 +3842,23 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
3307
3842
  private _deriveCBCKeysInternal;
3308
3843
  static isEncrypted(payload: any): boolean;
3309
3844
  isEncrypted(payload: any): boolean;
3310
- /**
3311
- * Encrypts a single value into an authenticated AES-CBC-256+HMAC-SHA-256 envelope.
3312
- */
3313
- encryptValue(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3314
- /**
3315
- * Decrypts a single AES-CBC-256+HMAC-SHA-256 envelope back into its plaintext.
3316
- */
3317
- decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
3845
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3846
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext): Promise<IDerivedCBCKeys>;
3847
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IDerivedCBCKeys, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3848
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<IDerivedCBCKeys>;
3849
+ protected _unsealPayload(payload: IEncryptedPayload, keyMaterial: IDerivedCBCKeys, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3318
3850
  }
3319
3851
 
3852
+ interface IRsaKeyMaterial extends IEncryptRecordSession {
3853
+ dataKey: CryptoKey;
3854
+ wrappedKeyBase64: string;
3855
+ alg: string;
3856
+ kid?: string;
3857
+ sharedKey: boolean;
3858
+ }
3859
+ interface IRsaDecryptBatchSession extends IDecryptBatchSession {
3860
+ keyCache: Map<string, Promise<CryptoKey>>;
3861
+ }
3320
3862
  /**
3321
3863
  * Asymmetric / Hybrid encryption provider combining RSA-OAEP (2048/4096-bit) with AES-GCM-256.
3322
3864
  *
@@ -3335,21 +3877,18 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
3335
3877
  * authenticated symmetric role keys (AES-GCM) governed by database role permissions.
3336
3878
  */
3337
3879
  declare class CRSAEncryptionProvider extends AEncryptionProvider {
3880
+ protected _usesAsymmetricEnvelopeSignature: boolean;
3338
3881
  private publicKey?;
3339
3882
  private privateKey?;
3883
+ protected _getDefaultFallbackKey(): TKeyProvider | IKeyPair | undefined;
3340
3884
  setDefaultKey(key: TKeyProvider | IKeyPair | Record<string, any>): void;
3341
- constructor(publicKeyOrPair?: CryptoKey | IKeyPair | {
3342
- publicKey?: CryptoKey;
3343
- privateKey?: CryptoKey;
3344
- recipientPublicKey?: CryptoKey;
3345
- recipientPrivateKey?: CryptoKey;
3346
- }, privateKey?: CryptoKey);
3885
+ constructor(publicKeyOrPair?: CryptoKey | IKeyPair | (IBaseEncryptionProviderOptions & Pick<IEncryptionOperationOptions, 'publicKey' | 'privateKey' | 'recipientPublicKey' | 'recipientPrivateKey'>), privateKey?: CryptoKey);
3347
3886
  setPublicKey(key: CryptoKey): void;
3348
3887
  getPublicKey(): CryptoKey | undefined;
3349
3888
  setPrivateKey(key: CryptoKey): void;
3350
3889
  getPrivateKey(): CryptoKey | undefined;
3351
3890
  clearKeys(): void;
3352
- static generateKeyPair(bits?: 2048 | 4096): Promise<IKeyPair>;
3891
+ static generateKeyPair(bits?: 2048 | 4096, extractable?: boolean): Promise<IKeyPair>;
3353
3892
  static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
3354
3893
  static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
3355
3894
  static importPublicKey(jwk: JsonWebKey): Promise<CryptoKey>;
@@ -3360,18 +3899,33 @@ declare class CRSAEncryptionProvider extends AEncryptionProvider {
3360
3899
  static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
3361
3900
  static isEncrypted(payload: any): boolean;
3362
3901
  isEncrypted(payload: any): boolean;
3363
- /**
3364
- * Encrypts a single value into a hybrid RSA-OAEP + AES-GCM envelope.
3365
- */
3366
- encryptValue(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3367
- /**
3368
- * Decrypts a single hybrid RSA-OAEP + AES-GCM envelope back into its plaintext.
3369
- */
3370
- decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
3371
- encrypt(data: any, options?: IEncryptionContext): Promise<any>;
3372
- decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
3902
+ private _resolvePublicKeyAndKid;
3903
+ private _resolvePrivateKeyForDecrypt;
3904
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3905
+ private _createEphemeralRsaKeyMaterial;
3906
+ protected _beginEncryptRecordSession(options?: IEncryptionContext): Promise<IRsaKeyMaterial>;
3907
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext, session?: IEncryptRecordSession): Promise<IRsaKeyMaterial>;
3908
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IRsaKeyMaterial, aadBytes: Uint8Array | undefined): Promise<IEncryptedPayload>;
3909
+ protected _beginDecryptBatchSession(): IRsaDecryptBatchSession;
3910
+ protected _prepareFieldDecryptContext(item: Record<string, any>, _field: string, payload: IEncryptedPayload, options?: IEncryptionContext): {
3911
+ payload: IEncryptedPayload;
3912
+ options?: IEncryptionContext;
3913
+ };
3914
+ protected _finalizeDecryptedRecord(item: Record<string, any>, result: Record<string, any>): void;
3915
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<CryptoKey>;
3916
+ protected _unsealPayload(payload: IEncryptedPayload, dataKey: CryptoKey, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3373
3917
  }
3374
3918
 
3919
+ interface IEcdhKeyMaterial extends IEncryptRecordSession {
3920
+ dataKey: CryptoKey;
3921
+ epkJwk: JsonWebKey;
3922
+ saltBase64: string;
3923
+ alg: string;
3924
+ kid?: string;
3925
+ }
3926
+ interface IEcdhDecryptBatchSession extends IDecryptBatchSession {
3927
+ keyCache: Map<string, Promise<CryptoKey>>;
3928
+ }
3375
3929
  type TECDHCurve = 'P-256' | 'P-384' | 'P-521';
3376
3930
  /**
3377
3931
  * Modern Asymmetric / Hybrid encryption provider using ECDH (Elliptic Curve Diffie-Hellman)
@@ -3392,24 +3946,20 @@ type TECDHCurve = 'P-256' | 'P-384' | 'P-521';
3392
3946
  * or use authenticated symmetric role keys (AES-GCM) managed via database role permissions.
3393
3947
  */
3394
3948
  declare class CECDHEncryptionProvider extends AEncryptionProvider {
3949
+ protected _usesAsymmetricEnvelopeSignature: boolean;
3395
3950
  private recipientPublicKey?;
3396
3951
  private recipientPrivateKey?;
3952
+ protected _getDefaultFallbackKey(): TKeyProvider | IKeyPair | undefined;
3397
3953
  private curve;
3398
3954
  setDefaultKey(key: TKeyProvider | IKeyPair | Record<string, any>): void;
3399
- constructor(recipientPublicKeyOrPair?: CryptoKey | IKeyPair | {
3400
- recipientPublicKey?: CryptoKey;
3401
- publicKey?: CryptoKey;
3402
- recipientPrivateKey?: CryptoKey;
3403
- privateKey?: CryptoKey;
3404
- curve?: TECDHCurve;
3405
- }, recipientPrivateKey?: CryptoKey, curve?: TECDHCurve);
3955
+ constructor(recipientPublicKeyOrPair?: CryptoKey | IKeyPair | (IBaseEncryptionProviderOptions & Pick<IEncryptionOperationOptions, 'publicKey' | 'privateKey' | 'recipientPublicKey' | 'recipientPrivateKey' | 'curve'>), recipientPrivateKey?: CryptoKey, curve?: TECDHCurve);
3406
3956
  setRecipientPublicKey(key: CryptoKey): void;
3407
3957
  getRecipientPublicKey(): CryptoKey | undefined;
3408
3958
  setRecipientPrivateKey(key: CryptoKey): void;
3409
3959
  getRecipientPrivateKey(): CryptoKey | undefined;
3410
3960
  getCurve(): TECDHCurve;
3411
3961
  clearKeys(): void;
3412
- static generateKeyPair(curve?: TECDHCurve): Promise<IKeyPair>;
3962
+ static generateKeyPair(curve?: TECDHCurve, extractable?: boolean): Promise<IKeyPair>;
3413
3963
  static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
3414
3964
  static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
3415
3965
  static importPublicKey(jwk: JsonWebKey, curve?: TECDHCurve): Promise<CryptoKey>;
@@ -3420,44 +3970,31 @@ declare class CECDHEncryptionProvider extends AEncryptionProvider {
3420
3970
  static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
3421
3971
  static isEncrypted(payload: any): boolean;
3422
3972
  isEncrypted(payload: any): boolean;
3423
- /**
3424
- * Encrypts a single value into an ECDH+HKDF+AES-GCM envelope.
3425
- */
3426
- encryptValue(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3427
- /**
3428
- * Encrypts multiple designated fields of a record using a single ephemeral ECDH keypair and shared DEK.
3429
- */
3430
- private encryptFieldsWithSharedDEK;
3431
- /**
3432
- * Derives the AES-GCM data key for a given ECDH envelope.
3433
- */
3434
- private deriveDecryptionKey;
3435
- /**
3436
- * Decrypts ciphertext buffer using a derived data key.
3437
- */
3438
- private decryptCiphertextWithKey;
3439
- /**
3440
- * Decrypts a single ECDH+HKDF+AES-GCM envelope back into its plaintext.
3441
- */
3442
- decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
3443
- encrypt(data: any, options?: IEncryptionContext): Promise<any>;
3444
- decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
3973
+ private _resolvePublicKeyAndKid;
3974
+ private _resolvePrivateKeyForDecrypt;
3975
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3976
+ private _createEphemeralEcdhKeyMaterial;
3977
+ protected _beginEncryptRecordSession(options?: IEncryptionContext): Promise<IEcdhKeyMaterial>;
3978
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext, session?: IEncryptRecordSession): Promise<IEcdhKeyMaterial>;
3979
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IEcdhKeyMaterial, aadBytes: Uint8Array | undefined): Promise<IEncryptedPayload>;
3980
+ protected _beginDecryptBatchSession(): IEcdhDecryptBatchSession;
3981
+ private _deriveDecryptionKeyWithPrivKey;
3982
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<CryptoKey>;
3983
+ protected _unsealPayload(payload: IEncryptedPayload, dataKey: CryptoKey, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3445
3984
  }
3446
3985
 
3447
- interface ICNodeCryptoOptions {
3448
- kdf?: 'none' | 'pbkdf2' | 'hkdf';
3449
- kdfIterations?: number;
3450
- kdfHash?: 'SHA-256' | 'SHA-512';
3451
- kdfSalt?: string | Uint8Array | ArrayBuffer;
3452
- info?: string | Uint8Array | ArrayBuffer;
3453
- kid?: string;
3454
- keyId?: string;
3455
- keys?: Record<string, TKeyProvider | IKeyPair>;
3456
- activeKid?: string;
3457
- allowedKids?: string[];
3458
- hmacKey?: TKeyProvider;
3459
- allowInsecureKdf?: boolean;
3460
- maxAllowedIterations?: number;
3986
+ interface ICachedNodeKeyEntry {
3987
+ key: Buffer;
3988
+ salt?: string;
3989
+ kdf?: string;
3990
+ iter?: number;
3991
+ }
3992
+
3993
+ interface INodeDecryptBatchSession extends IDecryptBatchSession {
3994
+ keyCache: Map<string, Promise<Buffer>>;
3995
+ tempBuffers: Set<Buffer>;
3996
+ }
3997
+ interface ICNodeCryptoOptions extends IBaseEncryptionProviderOptions {
3461
3998
  }
3462
3999
  /**
3463
4000
  * Server-side synchronous AES-GCM-256 encryption provider using Node.js native `node:crypto`.
@@ -3470,53 +4007,45 @@ interface ICNodeCryptoOptions {
3470
4007
  * (`encrypt`, `decrypt`) methods for Nitro routes, worker threads, and CLI tools.
3471
4008
  */
3472
4009
  declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3473
- /**
3474
- * Cryptographically secure random bytes generator for Node.js.
3475
- */
3476
4010
  static randomBytes(length: number): Buffer;
3477
- /**
3478
- * Creates a decipher instance for AES decryption in Node.js.
3479
- */
3480
- static createDecipheriv(algorithm: string, key: crypto.CipherKey, iv: crypto.BinaryLike | null, options?: crypto.CipherCCMOptions): crypto.DecipherGCM;
4011
+ static createDecipheriv(algorithm: string, key: NodeCrypto.CipherKey, iv: NodeCrypto.BinaryLike | null, options?: NodeCrypto.CipherCCMOptions): NodeCrypto.DecipherGCM;
3481
4012
  private _defaultKdf;
3482
- private _allowInsecureKdf?;
3483
4013
  private _maxAllowedIterations?;
3484
4014
  private _kdfOptions?;
3485
4015
  private _cachedKey?;
4016
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3486
4017
  private _cachedSalt?;
3487
4018
  private _cachedKdf?;
3488
4019
  private _cachedIter?;
3489
4020
  private _cachedHash?;
3490
4021
  private _cachedKeyId?;
3491
- private _configuredKid?;
3492
4022
  private _keyringCache;
3493
4023
  private _decryptSaltCache;
3494
4024
  private _inFlightSaltDerivations;
4025
+ constructor(key?: TKeyProvider | IKeyPair, options?: ICNodeCryptoOptions);
3495
4026
  private isKeyRetained;
4027
+ private _wipeCachedBuffers;
3496
4028
  setDefaultKey(key: TKeyProvider): void;
3497
4029
  clearKeys(): void;
3498
4030
  setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
4031
+ private _setPrimaryCached;
4032
+ private _setKeyringCached;
4033
+ private _setDecryptSaltCached;
3499
4034
  warmupKey(options?: IEncryptionContext): Promise<void>;
3500
- /**
3501
- * Synchronously pre-derives and caches the encryption key for subsequent synchronous operations.
3502
- */
3503
4035
  warmupKeySync(options?: IEncryptionContext): void;
3504
- private resolveInfoBuffer;
3505
- constructor(key?: TKeyProvider | IKeyPair, options?: ICNodeCryptoOptions);
3506
4036
  private resolveRawKeySync;
3507
4037
  private resolveRawKeyAsync;
4038
+ private _resolveCachedOrRawBuffer;
4039
+ private _recordDerivedKey;
3508
4040
  private deriveKeySync;
3509
4041
  private deriveKeyAsync;
3510
4042
  static isEncrypted(payload: any): boolean;
3511
4043
  isEncrypted(payload: any): boolean;
3512
- /**
3513
- * Synchronously encrypts a single value into an AES-GCM envelope using Node.js crypto.
3514
- */
4044
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
4045
+ private _validateDecryptPreconditions;
4046
+ private _decryptEnvelopeSyncWithAadFallback;
4047
+ private _decryptFieldPayloadSyncWithKey;
3515
4048
  encryptValueSync(data: any, options?: IEncryptionContext): IEncryptedPayload;
3516
- private decryptCiphertextWithKey;
3517
- /**
3518
- * Synchronously decrypts a single AES-GCM envelope back into its plaintext.
3519
- */
3520
4049
  decryptValueSync(payload: IEncryptedPayload, options?: IEncryptionContext): any;
3521
4050
  encryptSync(data: any, options?: IEncryptionContext): any;
3522
4051
  private _decryptRowSync;
@@ -3525,10 +4054,13 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3525
4054
  decryptFieldsSync(data: any, fields: string[], options?: IEncryptionContext): any;
3526
4055
  encryptFields(data: any, fields: string[]): Promise<any>;
3527
4056
  decryptFields(data: any, fields: string[], options?: IEncryptionContext): Promise<any>;
3528
- encryptValue(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3529
- decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
3530
- private _decryptRowAsync;
3531
- decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
4057
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext): Promise<ICachedNodeKeyEntry>;
4058
+ protected _releaseEncryptKeyMaterial(derived: ICachedNodeKeyEntry): void;
4059
+ protected _sealPayload(plaintextBytes: Uint8Array, derived: ICachedNodeKeyEntry, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
4060
+ protected _beginDecryptBatchSession(): INodeDecryptBatchSession;
4061
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<Buffer>;
4062
+ protected _releaseDecryptKeyMaterial(key: Buffer, session?: IDecryptBatchSession): void;
4063
+ protected _unsealPayload(payload: IEncryptedPayload, key: Buffer, aadBytes: Uint8Array | undefined): Promise<Buffer>;
3532
4064
  }
3533
4065
 
3534
4066
  /**
@@ -3565,6 +4097,14 @@ interface IStreamEncryptionOptions {
3565
4097
  * Allowed range: 4096 (4 KiB) to 4194304 (4 MiB).
3566
4098
  */
3567
4099
  chunkSize?: number;
4100
+ /**
4101
+ * PBKDF2 iteration count when `key` is a human passphrase. Default: DEFAULT_PBKDF2_ITERATIONS (600,000).
4102
+ */
4103
+ kdfIterations?: number;
4104
+ /**
4105
+ * Maximum allowed PBKDF2 iteration count ceiling. Default: DEFAULT_MAX_ALLOWED_ITERATIONS (1,000,000).
4106
+ */
4107
+ maxAllowedIterations?: number;
3568
4108
  }
3569
4109
  interface IStreamDecryptionOptions {
3570
4110
  /**
@@ -3579,6 +4119,14 @@ interface IStreamDecryptionOptions {
3579
4119
  * Alias for keyring to maintain consistency with IProviderEncryptionOptions.
3580
4120
  */
3581
4121
  keys?: Record<string, TKeyProvider | IKeyPair>;
4122
+ /**
4123
+ * PBKDF2 iteration count when `key` or keyring entry is a human passphrase. Default: DEFAULT_PBKDF2_ITERATIONS (600,000).
4124
+ */
4125
+ kdfIterations?: number;
4126
+ /**
4127
+ * Maximum allowed PBKDF2 iteration count ceiling. Default: DEFAULT_MAX_ALLOWED_ITERATIONS (1,000,000).
4128
+ */
4129
+ maxAllowedIterations?: number;
3582
4130
  }
3583
4131
  interface IStreamWithBufferMetric<I, O> extends TransformStream<I, O> {
3584
4132
  /**
@@ -3676,14 +4224,13 @@ declare const CKeyPinningStore: {
3676
4224
  * @param filters - Single IDataFilter or array of filters
3677
4225
  * @param options - Configuration mapping fields to blind index keyrings, trigrams, and range buckets
3678
4226
  */
3679
- declare function rewriteEncryptedFilters(filters: IDataFilter$1 | IDataFilter$1[], options: IEncryptedFilterRewriteOptions): Promise<IRewrittenEncryptedFilters>;
4227
+ declare function rewriteEncryptedFilters(filters: IDataFilter | IDataFilter[], options: IEncryptedFilterRewriteOptions): Promise<IRewrittenEncryptedFilters>;
3680
4228
 
3681
4229
  /**
3682
- * Katlux Batch Re-Encryption & Key Migration Orchestrator
3683
- *
3684
- * Implements storage-agnostic, memory-bounded batch re-encryption and
3685
- * key migration pipelines for persistent datasets across key rotation lifecycles.
4230
+ * Builds standard contextual AAD string matching Katlux AEAD convention.
4231
+ * Prioritizes explicit `recordId`, then `getRowId(row)`, then standard PK fallbacks (`id`, `_id`, `uuid`, `key`).
3686
4232
  */
4233
+ declare function buildAadString(row: any, field: string, baseAad?: string, aadFields?: string[], recordId?: string | number, getRowId?: (row: any) => string | number | undefined): string;
3687
4234
 
3688
4235
  /**
3689
4236
  * Re-encrypts an array of row objects in memory, selectively updating fields that
@@ -3694,6 +4241,20 @@ declare function rewriteEncryptedFilters(filters: IDataFilter$1 | IDataFilter$1[
3694
4241
  * @returns Batch processing result detailing modified rows, patches, and metrics
3695
4242
  */
3696
4243
  declare function reencryptBatch<TRow = any>(rows: TRow[], options: IReencryptBatchOptions<TRow>): Promise<IReencryptBatchResult<TRow>>;
4244
+
4245
+ /**
4246
+ * Determines whether a row's persisted blind-index or trigram tokens for `field` are stale
4247
+ * relative to `tokenVersion`, `versionTag`, `schemeId`, or `staleTokenVersions`.
4248
+ */
4249
+ declare function isFieldBlindIndexStale<TRow>(row: TRow, field: string, options: IReencryptBatchOptions<TRow>): boolean;
4250
+
4251
+ /**
4252
+ * Katlux Batch Re-Encryption & Key Migration Orchestrator
4253
+ *
4254
+ * Implements storage-agnostic, memory-bounded batch re-encryption and
4255
+ * key migration pipelines for persistent datasets across key rotation lifecycles.
4256
+ */
4257
+
3697
4258
  /**
3698
4259
  * Universal storage-agnostic orchestrator for executing memory-bounded batch
3699
4260
  * re-encryption across database tables or remote datasets with optimistic concurrency.
@@ -3703,6 +4264,103 @@ declare function reencryptBatch<TRow = any>(rows: TRow[], options: IReencryptBat
3703
4264
  */
3704
4265
  declare function reencryptDataset<TRow = any>(options: IReencryptDatasetOptions<TRow>): Promise<IMigrationSummary>;
3705
4266
 
4267
+ /**
4268
+ * Default minimum numeric bucket width enforced for non-sensitive fields to prevent
4269
+ * micro-bucketing (which approaches 1:1 deterministic equality leakage / exact value recovery).
4270
+ */
4271
+ declare const DEFAULT_MIN_BUCKET_STEP = 100;
4272
+ /**
4273
+ * High-sensitivity personal and demographic fields where deterministic shadow-bucket
4274
+ * range indexes are prohibited by default (`ERR_RANGE_BUCKET_SENSITIVE_FIELD`) unless
4275
+ * `allowSensitiveBucket: true` is explicitly configured and per-class floors are respected.
4276
+ */
4277
+ declare const SENSITIVE_RANGE_BUCKET_FIELDS: readonly string[];
4278
+ interface ISensitiveFieldPolicyRule {
4279
+ readonly classification: 'financial' | 'identifier' | 'creditScore' | 'age' | 'sensitiveDate';
4280
+ readonly minStep?: number;
4281
+ readonly allowedGranularities?: readonly TDateBucketGranularity[];
4282
+ }
4283
+ /**
4284
+ * Per-class range bucket security policy (`rangeBucketPolicy`).
4285
+ *
4286
+ * Sensitive fields throw `ERR_RANGE_BUCKET_SENSITIVE_FIELD` by default unless `allowSensitiveBucket: true`
4287
+ * is explicitly set. Even with `allowSensitiveBucket: true`, each class enforces a minimum floor
4288
+ * (cannot be weakened by `minStep`) unless `allowNarrowStep: true` / `allowNarrowGranularity: true` is passed.
4289
+ */
4290
+ declare const RANGE_BUCKET_POLICY: {
4291
+ readonly defaultMinStep: 100;
4292
+ readonly classes: {
4293
+ readonly financial: {
4294
+ readonly fields: Set<string>;
4295
+ readonly minStep: 10000;
4296
+ };
4297
+ readonly identifier: {
4298
+ readonly fields: Set<string>;
4299
+ readonly minStep: 1000000;
4300
+ };
4301
+ readonly creditScore: {
4302
+ readonly fields: Set<string>;
4303
+ readonly minStep: 100;
4304
+ };
4305
+ readonly age: {
4306
+ readonly fields: Set<string>;
4307
+ readonly minStep: 10;
4308
+ };
4309
+ readonly sensitiveDate: {
4310
+ readonly fields: Set<string>;
4311
+ readonly allowedGranularities: readonly TDateBucketGranularity[];
4312
+ };
4313
+ };
4314
+ };
4315
+ /** Alias for `RANGE_BUCKET_POLICY`. */
4316
+ declare const rangeBucketPolicy: {
4317
+ readonly defaultMinStep: 100;
4318
+ readonly classes: {
4319
+ readonly financial: {
4320
+ readonly fields: Set<string>;
4321
+ readonly minStep: 10000;
4322
+ };
4323
+ readonly identifier: {
4324
+ readonly fields: Set<string>;
4325
+ readonly minStep: 1000000;
4326
+ };
4327
+ readonly creditScore: {
4328
+ readonly fields: Set<string>;
4329
+ readonly minStep: 100;
4330
+ };
4331
+ readonly age: {
4332
+ readonly fields: Set<string>;
4333
+ readonly minStep: 10;
4334
+ };
4335
+ readonly sensitiveDate: {
4336
+ readonly fields: Set<string>;
4337
+ readonly allowedGranularities: readonly TDateBucketGranularity[];
4338
+ };
4339
+ };
4340
+ };
4341
+ /**
4342
+ * Options controlling bucket width validation, sensitive-field opt-in, and narrow-bucket opt-in behavior.
4343
+ */
4344
+ interface IRangeBucketValidationOptions {
4345
+ minStep?: number;
4346
+ minBucketWidth?: number;
4347
+ allowNarrowStep?: boolean;
4348
+ allowNarrowGranularity?: boolean;
4349
+ /** Explicit opt-in required to use range bucketing on fields in `SENSITIVE_RANGE_BUCKET_FIELDS`. */
4350
+ allowSensitiveBucket?: boolean;
4351
+ }
4352
+ /**
4353
+ * Validates a range bucket configuration against `rangeBucketPolicy` sensitivity and per-class floor rules.
4354
+ *
4355
+ * - Throws `ERR_RANGE_BUCKET_SENSITIVE_FIELD` for fields in `SENSITIVE_RANGE_BUCKET_FIELDS` unless
4356
+ * `allowSensitiveBucket: true` is set on `config` or `options`.
4357
+ * - Throws `ERR_BUCKET_STEP_TOO_NARROW` when a numeric bucket width/gap is below the effective floor
4358
+ * (per-class floor for sensitive fields, or `minStep` / `DEFAULT_MIN_BUCKET_STEP` = 100 otherwise)
4359
+ * unless `allowNarrowStep: true` is explicitly set (and `step > 0`).
4360
+ * - Throws `ERR_BUCKET_STEP_TOO_NARROW` when a sensitive date field uses fine granularity (`'month'`, `'week'`, `'day'`)
4361
+ * unless `allowNarrowGranularity: true` is explicitly set.
4362
+ */
4363
+ declare function validateRangeBucketConfig(config: TRangeBucketConfig, fieldName?: string, options?: IRangeBucketValidationOptions): void;
3706
4364
  /**
3707
4365
  * Safely parses any date string, Unix timestamp (in seconds or ms), or Date instance.
3708
4366
  */
@@ -3711,11 +4369,15 @@ declare function parseDateValue(val: any): Date | null;
3711
4369
  * Safely parses numbers from numbers or numeric strings (including currency/commas).
3712
4370
  */
3713
4371
  declare function parseNumericValue(val: any): number | null;
4372
+ type TDirectBucketValidationArg = string | (IRangeBucketValidationOptions & {
4373
+ fieldName?: string;
4374
+ });
3714
4375
  /**
3715
4376
  * Computes a deterministic string shadow bucket key for a date or timestamp.
3716
4377
  * Supported granularities: 'year', 'quarter', 'month', 'week', 'day'.
4378
+ * Validates sensitive-field and granularity rules when `fieldName` or `options` are provided.
3717
4379
  */
3718
- declare function computeDateBucket(val: any, granularity?: TDateBucketGranularity): string | undefined;
4380
+ declare function computeDateBucket(val: any, granularity?: TDateBucketGranularity, optionsOrFieldName?: TDirectBucketValidationArg, maybeOptions?: IRangeBucketValidationOptions): string | undefined;
3719
4381
  /**
3720
4382
  * Resolves the bounding interval [min, max] (in UTC milliseconds) for a given date bucket key.
3721
4383
  */
@@ -3725,8 +4387,10 @@ declare function getDateBucketRange(bucketKey: string, granularity?: TDateBucket
3725
4387
  } | null;
3726
4388
  /**
3727
4389
  * Computes a stepped numeric shadow bucket key (e.g. 10000 step -> '0-9999', '10000-19999').
4390
+ * Enforces `rangeBucketPolicy` sensitive-field checks and per-class minimum floors
4391
+ * (`DEFAULT_MIN_BUCKET_STEP` = 100 for non-sensitive fields) unless overridden via options.
3728
4392
  */
3729
- declare function computeSteppedBucket(val: any, step: number, min?: number): string | undefined;
4393
+ declare function computeSteppedBucket(val: any, step: number, min?: number, optionsOrFieldName?: TDirectBucketValidationArg, maybeOptions?: IRangeBucketValidationOptions): string | undefined;
3730
4394
  /**
3731
4395
  * Resolves the numeric interval [min, max] for a stepped bucket key.
3732
4396
  */
@@ -3736,8 +4400,9 @@ declare function getSteppedBucketRange(bucketKey: string, step?: number): {
3736
4400
  } | null;
3737
4401
  /**
3738
4402
  * Computes a threshold / tier shadow bucket key (e.g. [0, 25000, 50000] -> '<0', '0-24999', '25000-49999', '>=50000').
4403
+ * Enforces `rangeBucketPolicy` sensitive-field checks and per-class minimum threshold gap floors.
3739
4404
  */
3740
- declare function computeTierBucket(val: any, rawThresholds: number[]): string | undefined;
4405
+ declare function computeTierBucket(val: any, rawThresholds: number[], optionsOrFieldName?: TDirectBucketValidationArg, maybeOptions?: IRangeBucketValidationOptions): string | undefined;
3741
4406
  /**
3742
4407
  * Resolves the numeric interval [min, max] for a tier bucket key.
3743
4408
  */
@@ -3745,10 +4410,16 @@ declare function getTierBucketRange(bucketKey: string, rawThresholds: number[]):
3745
4410
  min: number;
3746
4411
  max: number;
3747
4412
  } | null;
4413
+ /**
4414
+ * Computes a shadow range bucket key without re-running config validation (for internal loops
4415
+ * where config has already been validated at setup time).
4416
+ */
4417
+ declare function computeRangeBucketUnchecked(val: any, config: TRangeBucketConfig): string | undefined;
3748
4418
  /**
3749
4419
  * Computes a shadow range bucket key for any value according to its configuration.
4420
+ * Validates the configuration via `validateRangeBucketConfig`.
3750
4421
  */
3751
- declare function computeRangeBucket(val: any, config: TRangeBucketConfig): string | undefined;
4422
+ declare function computeRangeBucket(val: any, config: TRangeBucketConfig, fieldName?: string, options?: IRangeBucketValidationOptions): string | undefined;
3752
4423
  /**
3753
4424
  * Resolves the bounding interval [min, max] for any bucket key and configuration.
3754
4425
  */
@@ -3757,19 +4428,57 @@ declare function getRangeBucketRange(bucketKey: string, config: TRangeBucketConf
3757
4428
  max: number;
3758
4429
  } | null;
3759
4430
  /**
3760
- * Resolves the set of eligible shadow bucket keys that satisfy a given range comparison query.
4431
+ * Comparator for stepped numeric shadow bucket keys (e.g. `'25000-49999'` vs `'100000-124999'`).
4432
+ * Orders buckets mathematically by their lower bound (and upper bound as tie-breaker) rather than ASCII order.
4433
+ */
4434
+ declare function compareSteppedBuckets(a: string, b: string): number;
4435
+ /**
4436
+ * Compares two shadow bucket values (or resolved sort values) numerically/chronologically
4437
+ * using the configured TRangeBucketConfig (supports stepped, tier, and date buckets).
4438
+ */
4439
+ declare function compareRangeBuckets(a: any, b: any, config?: TRangeBucketConfig): number;
4440
+ /**
4441
+ * Checks whether an interval [min, max] satisfies the given query comparison operator and target value.
4442
+ */
4443
+ declare function isIntervalMatchingOperator(interval: {
4444
+ min: number;
4445
+ max: number;
4446
+ }, operator: string, targetVal: any, isDate: boolean): boolean;
4447
+ /**
4448
+ * Checks whether an interval [min, max] fully satisfies the given query comparison operator and target value
4449
+ * across all points in the interval (i.e. every point in [min, max] satisfies the condition).
4450
+ */
4451
+ declare function isIntervalFullyMatchingOperator(interval: {
4452
+ min: number;
4453
+ max: number;
4454
+ }, operator: string, targetVal: any, isDate: boolean): boolean;
4455
+ /**
4456
+ * Resolves the complete set of eligible shadow bucket keys that satisfy a given range comparison query.
4457
+ *
4458
+ * Sound-or-throw contract:
4459
+ * - Never silently truncates open-ended stepped or date queries.
4460
+ * - When `knownBuckets` is omitted for open-ended queries (`>`, `>=`, `<`, `<=`, `!=`, `nin`),
4461
+ * requires explicit domain bounds (`min`/`floor` and/or `max`/`ceiling` for stepped; `minDate`/`maxDate` for date)
4462
+ * and throws `ERR_BUCKET_RANGE_UNBOUNDED` if the required bound is absent.
3761
4463
  *
3762
- * @param operator - Range operator: '>', '>=', '<', '<=', 'between', '==', '!=', 'in'
4464
+ * @param operator - Range operator: '>', '>=', '<', '<=', 'between', '==', '!=', 'in', 'nin'
3763
4465
  * @param targetValue - Plaintext target comparison value (number, date string, timestamp, or tuple for between)
3764
4466
  * @param config - Range bucketing configuration ('date', 'stepped', or 'tier')
3765
4467
  * @param knownBuckets - Optional iterable of all unique bucket keys present in the indexed dataset
3766
4468
  */
3767
- declare function resolveBucketsForRange(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>): Set<string>;
4469
+ declare function resolveBucketsForRangeUnchecked(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>): Set<string>;
4470
+ /**
4471
+ * Resolves all candidate shadow bucket keys for a filter operator and target value.
4472
+ * Validates the range bucket configuration via `validateRangeBucketConfig` (enforcing
4473
+ * `ERR_RANGE_BUCKET_SENSITIVE_FIELD` and `ERR_BUCKET_STEP_TOO_NARROW`) and enforces the
4474
+ * sound-or-throw range contract (`ERR_BUCKET_RANGE_UNBOUNDED`).
4475
+ */
4476
+ declare function resolveBucketsForRange(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>, fieldName?: string, options?: IRangeBucketValidationOptions): Set<string>;
3768
4477
 
3769
4478
  /**
3770
4479
  * Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
3771
4480
  */
3772
4481
  declare function isEncrypted(payload: any): boolean;
3773
4482
 
3774
- export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CIndexedDBKeyPinningStore, CKeyManager, CKeyPinningStore, CLocalStorageCache, CLocalStorageKeyPinningStore, CMemoryCache, CMemoryKeyPinningStore, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CWebCryptoStreamCipher, CacheProviderFactory, DECRYPT_ERROR_SENTINEL, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, ERR_AUTH_UNAUTHORIZED, ERR_CRYPTO_AUTH_FAILED, ERR_CRYPTO_DECRYPT_FAILED, ERR_CRYPTO_TAG_MISMATCH, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, _bidxHmacKeyCache, applyOperator, areKeysIdentical, buildEncryptionContext, canonicalizeJson, clearBlindIndexKeyCache, clearCachedCipherProvider, clearSSRData, compareAnd, compareContains, compareEqual, compareIn, compareOr, compareValues, computeBlindIndex, computeDateBucket, computeMultiBlindIndex, computeRangeBucket, computeSteppedBucket, computeTierBucket, computeWriteBlindIndex, createDecryptionStream, createEncryptionProvider, createEncryptionStream, debounce, decryptBlob, decryptPageRows, decryptPayload, deriveAuthAndEncryptionKeys, deriveBlindIndexHmacKey, deriveKey, deriveKeyFromSecret, encryptBlob, encryptPayload, encryptRows, encryptRowsChunked, evaluateFilter, exportAESKey, exportPrivateKey, exportPrivateKeyToPEM, exportPublicKey, exportPublicKeyToPEM, extractFilterFieldNames, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, foldAscii, fromBase64, generateAESKey, generateAccountDataKey, generateECDHKeyPair, generateECDSAKeyPair, generateRSAKeyPair, generateSigningKeyPair, getAppRoute, getAppRouter, getCipherProvider, getDateBucketRange, getHydrationAdapter, getKeyFingerprint, getKeyIdentifier, getPlatformApp, getRandomValues, getRangeBucketRange, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSteppedBucketRange, getSubtleCrypto, getTierBucketRange, importAESKey, importECDSAPrivateKeyFromPEM, importECDSAPublicKeyFromPEM, importPrivateKey, importPrivateKeyFromPEM, importPublicKey, importPublicKeyFromPEM, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, isEncryptedPayload, normalizeFilter, normalizeFilterValue, normalizeIndexTerm, normalizeUrl, onPlatformReady, parseDateValue, parseNumericValue, randomBytes, reencryptBatch, reencryptDataset, rekeyEncryptedPayload, rekeyUserKeypair, resolveAuthorityCryptoKey, resolveBucketsForRange, resolveInfoBytes, resolveSalt, rewrapAccountKeyForUser, rewriteEncryptedFilters, safeSetProperty, setHydrationAdapter, sign, signGrant, signKeyResetAttestation, sortData, textDecoder, textEncoder, toBase64, unwrapAccountKeyForUser, unwrapHMACKeyForUser, unwrapKey, useDebounce, useFilterLogic, useSortLogic, validateBlindIndexKeyring, verify, verifyAndPinKey, verifyAttestation, verifyGrant, wrapAccountKeyForUser, wrapHMACKeyForUser, wrapKey };
3775
- export type { CacheDriverLoader, IAccessGrant, IBatchLoadedEvent, IBatchProgress, IBlindIndexFieldConfig, IBlindIndexKeyring, IBlindIndexOptions, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, ICookieCacheOptions, IDataFilter$1 as IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort$1 as IDataSort, IDateRangeBucketConfig, IDeadLetterItem, IDebouncedFunction, IDecryptErrorInfo, IDeriveAuthAndEncryptionOptions, IDomainDerivedKeys, IEncryptedFilterRewriteOptions, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFieldEncryptionContext, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IKeyPin, IKeyPinChangeEvent, IKeyPinningStore, IKeyResetAttestation, IMigrationProgress, IMigrationSummary, INormalizeOptions, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRangeBucketFieldConfig, IReencryptBatchOptions, IReencryptBatchResult, IReencryptDatasetOptions, IRekeyKeypairParams, IRekeyPayloadOptions, IRekeyedKeypairResult, IRequestOptions, IRewrittenEncryptedFilters, IRewrittenPersistenceQuery, ISSRHydrationAdapter, ISearchIndexOptions, ISearchIndexRowEntry, ISetDataChunkedOptions, ISignedGrant, ISignedKeyResetAttestation, ISortDataOptions, ISteppedRangeBucketConfig, IStreamDecryptionOptions, IStreamEncryptionOptions, IStreamWithBufferMetric, ITierRangeBucketConfig, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, ITrigramFieldConfig, IVerifyAndPinOptions, IVerifyAndPinResult, IVerifyGrantOptions, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TBlindIndexKeyStatus, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TDateBucketGranularity, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRangeBucketConfig, TRawKey, TServerRequestEvent, TTreePageDataHandler, TTreeRow, TTrustedAuthorities, TUnsubscribe, TreePaginationMode };
4483
+ export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, BLIND_INDEX_FRAMING_VERSION, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CIndexedDBKeyPinningStore, CKeyManager, CKeyPinningStore, CLocalStorageCache, CLocalStorageKeyPinningStore, CMemoryCache, CMemoryKeyPinningStore, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CWebCryptoStreamCipher, CacheProviderFactory, DECRYPT_ERROR_SENTINEL, DEFAULT_KEY_CACHE_MAX_SIZE, DEFAULT_MAX_ALLOWED_ITERATIONS, DEFAULT_MAX_SALT_DERIVATIONS, DEFAULT_MIN_BUCKET_STEP, DEFAULT_PBKDF2_ITERATIONS, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, ENCRYPTION_CONTEXT_KEYS, EQueueStorage, ERR_AUTH_UNAUTHORIZED, ERR_CRYPTO_AUTH_FAILED, ERR_CRYPTO_DECRYPT_FAILED, ERR_CRYPTO_TAG_MISMATCH, KatluxIndexedDB, PROVIDER_CONSTRUCTOR_OPTION_KEYS, QueueStorageFactory, RANGE_BUCKET_POLICY, RequestProvider, RequestProviderRegistry, RequestQueue, SEARCH_FILTER_NOT_OPERATOR, SENSITIVE_HEADER_KEYS, SENSITIVE_RANGE_BUCKET_FIELDS, _bidxHmacKeyCache, aadToBytes, acquireSaltDerivationSlot, applyOperator, areKeysIdentical, assertMaxAllowedIterations, attachSaltDerivationBudget, buildAadString, buildCanonicalFieldAad, buildEncryptionContext, canonicalizeJson, claimSaltDerivationSlotSync, clearBlindIndexKeyCache, clearCachedCipherProvider, clearSSRData, combineCiphertextAndTag, compareAnd, compareContains, compareEqual, compareIn, compareOr, compareRangeBuckets, compareSteppedBuckets, compareValues, compileFilter, computeBlindIndex, computeBlindIndexSchemeId, computeDateBucket, computeMultiBlindIndex, computeRangeBucket, computeRangeBucketUnchecked, computeSteppedBucket, computeTierBucket, computeWriteBlindIndex, createDecryptionStream, createEncryptionProvider, createEncryptionStream, debounce, decryptBlob, decryptPageRows, decryptPayload, deriveAuthAndEncryptionKeys, deriveBlindIndexHmacKey, deriveKey, deriveKeyFromSecret, encryptBlob, encryptPayload, encryptRows, encryptRowsChunked, escapeAadComponent, evaluateFilter, exportAESKey, exportPrivateKey, exportPrivateKeyToPEM, exportPublicKey, exportPublicKeyToPEM, extractDefaultRowId, extractFilterFieldNames, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, foldAscii, fromBase64, generateAESKey, generateAccountDataKey, generateECDHKeyPair, generateECDSAKeyPair, generateRSAKeyPair, generateSigningKeyPair, getAppRoute, getAppRouter, getCipherProvider, getDateBucketRange, getGlobalDataProviderConfig, getHydrationAdapter, getKeyFingerprint, getKeyIdentifier, getLruCacheEntry, getPlatformApp, getRandomValues, getRangeBucketRange, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSaltDerivationBudget, getSteppedBucketRange, getSubtleCrypto, getTierBucketRange, importAESKey, importECDSAPrivateKeyFromPEM, importECDSAPublicKeyFromPEM, importPrivateKey, importPrivateKeyFromPEM, importPublicKey, importPublicKeyFromPEM, invertFilterOperator, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, isEncryptedPayload, isFieldBlindIndexStale, isIntervalFullyMatchingOperator, isIntervalMatchingOperator, negateFilterNode, normalizeDecryptError, normalizeFilter, normalizeFilterValue, normalizeIndexTerm, normalizeUrl, onPlatformReady, parseDateValue, parseDecryptedJsonSafely, parseNumericValue, pickEncryptionContext, pickProviderOptions, randomBytes, rangeBucketPolicy, reencryptBatch, reencryptDataset, rekeyEncryptedPayload, rekeyUserKeypair, resolveAndClampPbkdf2Iterations, resolveAuthorityCryptoKey, resolveBucketsForRange, resolveBucketsForRangeUnchecked, resolveCachedSaltDerivation, resolveInfoBytes, resolveSalt, rewrapAccountKeyForUser, rewriteEncryptedFilters, runWithSaltDerivationSlot, safeSetProperty, serializeAadFieldValue, serializePlaintextToBytes, setGlobalDataProviderConfig, setHydrationAdapter, setLruCacheEntry, sign, signGrant, signKeyResetAttestation, sortData, textDecoder, textEncoder, toBase64, unwrapAccountKeyForUser, unwrapHMACKeyForUser, unwrapKey, useDebounce, useFilterLogic, useSortLogic, validateBlindIndexKeyring, validateRangeBucketConfig, verify, verifyAndPinKey, verifyAttestation, verifyGrant, wrapAccountKeyForUser, wrapHMACKeyForUser, wrapKey };
4484
+ export type { CacheDriverLoader, IAccessGrant, IAsymmetricSecurityDefaults, IBaseEncryptionProviderOptions, IBatchLoadedEvent, IBatchProgress, IBlindIndexFieldConfig, IBlindIndexKeyring, IBlindIndexOptions, IBlindIndexSchemeOptions, IBlindIndexVersionConfig, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, ICookieCacheOptions, IDataFilter, IDataProviderGlobalConfig, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDateRangeBucketConfig, IDeadLetterItem, IDebouncedFunction, IDecryptBatchSession, IDecryptErrorInfo, IDeriveAuthAndEncryptionOptions, IDomainDerivedKeys, IEncryptRecordSession, IEncryptedFilterRewriteOptions, IEncryptedPayload, IEncryptionContext, IEncryptionOperationOptions, IEncryptionProvider, IFieldEncryptionContext, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IKeyPin, IKeyPinChangeEvent, IKeyPinningStore, IKeyResetAttestation, IMigrationProgress, IMigrationSummary, INormalizeOptions, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IQueuedRequest, IRangeBucketFieldConfig, IRangeBucketValidationOptions, IReencryptBatchOptions, IReencryptBatchResult, IReencryptDatasetOptions, IRekeyKeypairParams, IRekeyPayloadOptions, IRekeyedKeypairResult, IRequestOptions, IRewrittenEncryptedFilters, IRewrittenPersistenceQuery, ISSRHydrationAdapter, ISaltDerivationBudget, ISearchFilterCompoundNode, ISearchFilterNotNode, ISearchIndexEvalContext, ISearchIndexOptions, ISearchIndexRowEntry, ISensitiveFieldPolicyRule, ISetDataChunkedOptions, ISignedGrant, ISignedKeyResetAttestation, ISortDataOptions, ISteppedRangeBucketConfig, IStreamDecryptionOptions, IStreamEncryptionOptions, IStreamWithBufferMetric, ITierRangeBucketConfig, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, ITrigramFieldConfig, IVerifyAndPinOptions, IVerifyAndPinResult, IVerifyGrantOptions, IVirtualScrollState, IWrappedKey, InFlightBridge, InFlightSubscriber, TBlindIndexKeyStatus, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TDateBucketGranularity, TECDHAlgorithm, TECDHCurve, TEncryptionAlgorithm, TKatluxStore, TKdfHash, TKdfStrategy, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRSAAlgorithm, TRangeBucketConfig, TRawKey, TSearchFilterNode, TServerRequestEvent, TStreamAlgorithm, TSupportedAlgorithm, TSymmetricAlgorithm, TTreePageDataHandler, TTreeRow, TTrustedAuthorities, TUnsubscribe, TreePaginationMode };