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

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.
@@ -436,25 +498,74 @@ type TBlindIndexKeyStatus = 'active' | 'search-only' | 'retired';
436
498
  type TDateBucketGranularity = 'year' | 'quarter' | 'month' | 'week' | 'day';
437
499
  /**
438
500
  * Configuration for date/timestamp shadow range bucketing.
501
+ *
502
+ * @security Deterministic Shadow-Bucket Range Index:
503
+ * Plaintext/hashed bucket tokens reveal record group frequency, bucket ordering, and
504
+ * temporal distribution profiling (equivalent to coarse Order-Preserving Encryption).
505
+ * Not IND-CPA / not zero-leakage.
506
+ *
507
+ * DO NOT USE fine granularities (`'week'`, `'day'`) on high-sensitivity personal data
508
+ * fields such as `birthDate`, `dateOfBirth`, or `dob`; prefer `'year'` or `'quarter'`,
509
+ * or leave the field as unindexed AES-256-GCM.
439
510
  */
440
511
  interface IDateRangeBucketConfig {
441
512
  type: 'date';
442
513
  granularity?: TDateBucketGranularity;
514
+ minDate?: Date | string | number;
515
+ maxDate?: Date | string | number;
516
+ /** Explicitly suppress narrow-granularity warnings on sensitive date fields */
517
+ allowNarrowGranularity?: boolean;
518
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
519
+ allowSensitiveBucket?: boolean;
443
520
  }
444
521
  /**
445
522
  * Configuration for stepped numeric shadow range bucketing.
523
+ *
524
+ * @security Deterministic Shadow-Bucket Range Index:
525
+ * Stepped buckets leak value frequency distributions and ordering relations across buckets
526
+ * (coarse OPE-equivalent leakage; NOT IND-CPA and NOT zero-leakage).
527
+ *
528
+ * DO NOT USE narrow steps (`step < 100` throws `ERR_BUCKET_STEP_TOO_NARROW` by default)
529
+ * or fine increments on high-sensitivity personal data (`salary`, `age`, `birthDate`,
530
+ * `creditScore`, `income`, `ssn`, etc.). For sensitive financial data, prefer coarse
531
+ * tier bucketing (e.g. `$25,000+` salary bands) or unindexed AES-256-GCM.
446
532
  */
447
533
  interface ISteppedRangeBucketConfig {
448
534
  type: 'stepped';
449
535
  step: number;
450
536
  min?: number;
537
+ max?: number;
538
+ ceiling?: number;
539
+ floor?: number;
540
+ /** Minimum allowed bucket step width (defaults to `DEFAULT_MIN_BUCKET_STEP` = 100) */
541
+ minStep?: number;
542
+ /** Alias for `minStep`: minimum allowed bucket interval width */
543
+ minBucketWidth?: number;
544
+ /** Explicit opt-in to allow steps below `minStep` (emits a configuration warning; `step <= 0` still rejected) */
545
+ allowNarrowStep?: boolean;
546
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
547
+ allowSensitiveBucket?: boolean;
451
548
  }
452
549
  /**
453
550
  * Configuration for tier / threshold numeric shadow range bucketing.
551
+ *
552
+ * @security Deterministic Shadow-Bucket Range Index:
553
+ * Threshold buckets leak bucket membership frequency and ordering across tiers (NOT zero-leakage).
554
+ *
555
+ * For high-sensitivity fields (`salary`, `age`, `creditScore`, etc.), use broad intervals
556
+ * (e.g. `[0, 25000, 50000, 100000, 250000]`) rather than narrow bands, or use unindexed AES-256-GCM.
454
557
  */
455
558
  interface ITierRangeBucketConfig {
456
559
  type: 'tier' | 'threshold';
457
560
  thresholds: number[];
561
+ /** Minimum allowed interval gap between consecutive thresholds (defaults to `DEFAULT_MIN_BUCKET_STEP` = 100) */
562
+ minStep?: number;
563
+ /** Alias for `minStep`: minimum allowed threshold gap width */
564
+ minBucketWidth?: number;
565
+ /** Explicit opt-in to allow threshold gaps below `minStep` (emits a configuration warning) */
566
+ allowNarrowStep?: boolean;
567
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
568
+ allowSensitiveBucket?: boolean;
458
569
  }
459
570
  /**
460
571
  * Union type of all shadow range bucket configurations.
@@ -475,36 +586,70 @@ interface IBlindIndexKeyring {
475
586
  }>;
476
587
  }
477
588
 
589
+ /**
590
+ * Historical or alternate version configuration for multi-version blind-index query expansion.
591
+ */
592
+ interface IBlindIndexVersionConfig extends INormalizeOptions {
593
+ /** Schema or token version identifier */
594
+ version?: string | number;
595
+ /** Optional version tag prefix (false = unprefixed hex, true = `${version}:`, string = `${versionTag}:`) */
596
+ versionTag?: string | boolean;
597
+ /** Also emit legacy unscoped tokens for this version entry */
598
+ allowLegacyUnscopedTokens?: boolean;
599
+ /** Alias for allowLegacyUnscopedTokens */
600
+ legacyUnscopedTokens?: boolean;
601
+ }
478
602
  /**
479
603
  * Blind-index field configuration options.
480
604
  */
481
- interface IBlindIndexFieldConfig {
605
+ interface IBlindIndexFieldConfig extends INormalizeOptions {
482
606
  /** Custom target persistence column name (defaults to `${fieldName}_bidx`) */
483
607
  column?: string;
484
608
  /** Optional custom trigram column name (defaults to `${fieldName}_trigrams`) */
485
609
  trigramColumn?: string;
486
610
  /** Blind index keyring */
487
611
  keyring: IBlindIndexKeyring;
612
+ /** Optional schema or token version identifier */
613
+ version?: string | number;
614
+ /** Optional version tag prefix for matching versioned tokens */
615
+ versionTag?: string | boolean;
616
+ /** Historical token versions/configs to query alongside the current version */
617
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
618
+ /** Allow matching legacy unscoped tokens alongside domain-separated tokens during migration */
619
+ allowLegacyUnscopedTokens?: boolean;
488
620
  }
489
621
  /**
490
622
  * Trigram substring search field configuration options.
491
623
  */
492
- interface ITrigramFieldConfig {
624
+ interface ITrigramFieldConfig extends INormalizeOptions {
493
625
  /** Custom target persistence column name (defaults to `${fieldName}_trigrams`) */
494
626
  column?: string;
495
627
  /** Blind index keyring */
496
628
  keyring: IBlindIndexKeyring;
629
+ /** Optional schema or token version identifier */
630
+ version?: string | number;
631
+ /** Optional version tag prefix for matching versioned tokens */
632
+ versionTag?: string | boolean;
633
+ /** Historical token versions/configs to query alongside the current version */
634
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
635
+ /** Allow matching legacy unscoped tokens alongside domain-separated tokens during migration */
636
+ allowLegacyUnscopedTokens?: boolean;
497
637
  }
498
638
  /**
499
639
  * Range bucket persistence field configuration options.
640
+ *
641
+ * @security Deterministic Shadow-Bucket Range Index: reveals bucket frequency distributions
642
+ * and relative ordering; not IND-CPA / not zero-leakage. Avoid narrow widths on
643
+ * high-sensitivity fields (`salary`, `age`, `birthDate`, `creditScore`).
500
644
  */
501
645
  interface IRangeBucketFieldConfig {
502
646
  /** Custom target persistence column name (defaults to `${fieldName}_bucket`) */
503
647
  column?: string;
504
648
  /** Range bucketing configuration ('date', 'stepped', or 'tier') */
505
649
  config: TRangeBucketConfig;
650
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
651
+ allowSensitiveBucket?: boolean;
506
652
  }
507
-
508
653
  /**
509
654
  * Options for computing blind index HMAC-SHA256 tokens, supporting normalization and domain separation.
510
655
  */
@@ -515,6 +660,15 @@ interface IBlindIndexOptions extends INormalizeOptions {
515
660
  type?: 'eq' | 'tri';
516
661
  /** Optional Key Identifier */
517
662
  kid?: string;
663
+ /** Optional schema or token version identifier */
664
+ version?: string | number;
665
+ /** Optional version tag prefix for the generated token (e.g. 'v1' produces 'v1:<token>') */
666
+ versionTag?: string | boolean;
667
+ /**
668
+ * PBKDF2 iteration count for blind index HMAC key derivation from passphrase strings (default: 310,000).
669
+ * Edge runtimes such as Cloudflare Workers cap PBKDF2 at 100,000 iterations.
670
+ */
671
+ kdfIterations?: number;
518
672
  }
519
673
  /**
520
674
  * Options for rewriteEncryptedFilters.
@@ -534,17 +688,31 @@ interface IEncryptedFilterRewriteOptions extends INormalizeOptions {
534
688
  maxCandidateTokens?: number;
535
689
  /** Optional normalization options override */
536
690
  normalizeOptions?: INormalizeOptions;
691
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
692
+ allowSensitiveBucket?: boolean;
537
693
  /** Generic fields map that may contain blindIndex, trigrams, and rangeBuckets */
538
694
  fields?: Record<string, any>;
695
+ /** Optional schema or token version identifier for generated query tokens */
696
+ version?: string | number;
697
+ /** Optional version tag prefix for generated query tokens (e.g. true -> `${version}:`, or explicit 'v2') */
698
+ versionTag?: string | boolean;
699
+ /** Historical token versions/configs to expand into query candidates during rolling re-indexing */
700
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
701
+ /** When true, also emits legacy unscoped equality tokens alongside field+type scoped tokens (default: false) */
702
+ allowLegacyUnscopedTokens?: boolean;
703
+ /** Expected persisted token scheme identifier (from computeBlindIndexSchemeId); throws ERR_BIDX_SCHEME_MISMATCH if options diverge */
704
+ expectedTokenScheme?: string;
539
705
  }
540
706
  /**
541
707
  * Result returned by rewriteEncryptedFilters.
542
708
  */
543
709
  interface IRewrittenEncryptedFilters {
544
710
  /** Transformed filter or array of filters with expanded blind-index candidate tokens */
545
- filters: IDataFilter$1 | IDataFilter$1[];
711
+ filters: IDataFilter | IDataFilter[];
546
712
  /** Total candidate tokens generated across all filters */
547
713
  totalCandidateTokens: number;
714
+ /** Deterministic token scheme identifier covering normalization options, scope, and framing */
715
+ tokenSchemeId?: string;
548
716
  }
549
717
  /**
550
718
  * Alias for IRewrittenEncryptedFilters for backward compatibility.
@@ -553,7 +721,7 @@ type IRewrittenPersistenceQuery = IRewrittenEncryptedFilters;
553
721
  /**
554
722
  * Options for reencryptBatch.
555
723
  */
556
- interface IReencryptBatchOptions<TRow = any> {
724
+ interface IReencryptBatchOptions<TRow = any> extends INormalizeOptions {
557
725
  /** Target Key Identifier to migrate payloads to */
558
726
  targetKid: string;
559
727
  /** Keyring containing source keys and target key */
@@ -572,11 +740,54 @@ interface IReencryptBatchOptions<TRow = any> {
572
740
  keyring: IBlindIndexKeyring;
573
741
  /** Optional mapping from field name to persistence column name (defaults to `${fieldName}_bidx`) */
574
742
  columnMap?: Record<string, string>;
575
- /** Enable cryptographic domain separation for blind index tokens */
743
+ /**
744
+ * @deprecated Field+type domain separation (`{ field, type: 'eq' }`) is now enabled by default.
745
+ * Use `legacyUnscopedTokens: true` to explicitly opt out for legacy unscoped datasets.
746
+ */
576
747
  domainSeparation?: boolean;
748
+ /** Opt out of field+type domain separation for legacy unscoped blind-index columns (default: false) */
749
+ legacyUnscopedTokens?: boolean;
750
+ /** Optional normalization locale */
751
+ locale?: string;
752
+ /** Optional normalization ASCII folding */
753
+ asciiFold?: boolean;
754
+ /** Optional custom normalizer */
755
+ normalizer?: (value: string) => string;
756
+ /** Optional stable identifier for custom normalizer */
757
+ normalizerId?: string;
758
+ /** Optional schema or token version identifier */
759
+ version?: string | number;
760
+ /** Optional version tag prefix for regenerated tokens */
761
+ versionTag?: string | boolean;
762
+ /** Optional column name for version metadata (defaults to `${bidxCol}_version`) */
763
+ versionColumn?: string;
764
+ /** Optional mapping from field name to version column name */
765
+ versionColumnMap?: Record<string, string>;
766
+ /** Persist token scheme identifier (`computeBlindIndexSchemeId`) into `${col}_scheme` (or `schemeColumn`) */
767
+ persistScheme?: boolean;
768
+ /** Optional column name for persisted token scheme identifier (defaults to `${bidxCol}_scheme`) */
769
+ schemeColumn?: string;
770
+ /** Optional mapping from field name to scheme column name */
771
+ schemeColumnMap?: Record<string, string>;
577
772
  };
578
- /** Maximum PBKDF2 iterations allowed during key derivation (default: 350,000) */
773
+ /** Optional normalization options override */
774
+ normalizeOptions?: INormalizeOptions;
775
+ /** Opt out of field+type domain separation for legacy unscoped blind-index columns (default: false) */
776
+ legacyUnscopedTokens?: boolean;
777
+ /** Optional schema or token version identifier for regenerated blind index tokens */
778
+ tokenVersion?: string | number;
779
+ /** Optional version tag prefix for regenerated blind index tokens */
780
+ versionTag?: string | boolean;
781
+ /** Persist token scheme identifier (`computeBlindIndexSchemeId`) alongside regenerated tokens */
782
+ persistTokenScheme?: boolean;
783
+ /** Select/re-index rows whose persisted token version matches any value in this list (even if envelope kid === targetKid) */
784
+ staleTokenVersions?: Array<string | number | null | undefined>;
785
+ /** Re-index stale/missing blind-index tokens even if envelope kid === targetKid (default: true when version/versionTag/persistScheme/staleTokenVersions is set) */
786
+ reindexStaleTokens?: boolean;
787
+ /** Maximum PBKDF2 iterations allowed during key derivation (default: 1,000,000) */
579
788
  maxAllowedIterations?: number;
789
+ /** Maximum distinct uncached PBKDF2 salt derivations permitted per batch (default: 5 in strict mode; queued up to safety cap in non-strict mode) */
790
+ maxSaltDerivations?: number;
580
791
  /** Whether to allow insecure KDF (kdf: 'none') under strict mode */
581
792
  allowInsecureKdf?: boolean;
582
793
  /** Concurrency version field name on row (default: 'updatedAt') */
@@ -589,8 +800,10 @@ interface IReencryptBatchOptions<TRow = any> {
589
800
  baseAad?: string;
590
801
  aadFields?: string[];
591
802
  buildAad?: (row: TRow, fieldName: string) => string | Uint8Array | undefined;
592
- /** Error handling strategy when decryption or processing of a row/field fails (default: 'abort') */
803
+ /** Error handling strategy when decryption or processing of a row/field fails (default: 'abort' in reencryptBatch, 'record' in reencryptDataset) */
593
804
  onRowError?: 'abort' | 'skip' | 'record';
805
+ /** Fail-fast on first row/field decryption or processing error (overrides onRowError when true; default: false in reencryptDataset) */
806
+ abortOnError?: boolean;
594
807
  /** Key derivation algorithm for string passphrases (default: 'pbkdf2') */
595
808
  kdf?: 'pbkdf2' | 'hkdf' | 'none';
596
809
  /** PBKDF2 iterations for string passphrases (default: 310,000) */
@@ -603,6 +816,12 @@ interface IReencryptBatchOptions<TRow = any> {
603
816
  signal?: AbortSignal;
604
817
  /** Strict mode: requires version field for CAS concurrency protection; fails if missing */
605
818
  strict?: boolean;
819
+ /** Verify authenticity of envelopes already claiming `targetKid` against `targetKey` (default: true) */
820
+ verifyTargetKid?: boolean;
821
+ /** Attempt recovery using other keys in `keyring` when an envelope claiming `targetKid` fails `targetKey` authentication (default: false) */
822
+ recoverForgedTargetKid?: boolean;
823
+ /** Explicitly allows legacy fallback decryption without AAD when an envelope omits AAD or sets `aad: false` in non-strict mode. Defaults to false. */
824
+ allowUnboundAadFallback?: boolean;
606
825
  }
607
826
  /**
608
827
  * Result returned by reencryptBatch.
@@ -664,6 +883,8 @@ interface IMigrationProgress {
664
883
  skippedRows: number;
665
884
  conflictRows: number;
666
885
  failedRows?: number;
886
+ /** Unique identifiers of rows that encountered errors so far */
887
+ failedRowIds?: any[];
667
888
  currentCursor?: string | number;
668
889
  percentComplete?: number;
669
890
  /** Persistent checkpoint payload */
@@ -691,18 +912,140 @@ interface IMigrationSummary {
691
912
  field: string;
692
913
  error: Error | string;
693
914
  }>;
915
+ /** Unique identifiers of rows that failed during migration */
916
+ failedRowIds?: any[];
694
917
  /** Whether the migration was cancelled/aborted via AbortSignal */
695
918
  aborted?: boolean;
696
919
  }
920
+ /**
921
+ * Configuration options for CSearchIndex.
922
+ */
923
+ interface ISearchIndexOptions extends INormalizeOptions {
924
+ minSearchLength?: number;
925
+ rangeBuckets?: Record<string, TRangeBucketConfig>;
926
+ shadowBuckets?: Record<string, TRangeBucketConfig>;
927
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
928
+ allowSensitiveBucket?: boolean;
929
+ idKey?: string;
930
+ /**
931
+ * Whether to allow matching against unscoped legacy blind index tokens (without field domain separation).
932
+ * Defaults to false for security (prevents cross-field and equality-vs-trigram token collisions).
933
+ */
934
+ allowLegacyUnscopedTokens?: boolean;
935
+ /**
936
+ * PBKDF2 iteration count for deriving the blind index HMAC key from string key material (default: 310,000 per OWASP).
937
+ * Edge/serverless runtimes such as Cloudflare Workers cap WebCrypto PBKDF2 at 100,000 iterations and require lowering this (e.g., 100_000).
938
+ */
939
+ kdfIterations?: number;
940
+ /** Optional schema or token version identifier */
941
+ version?: string | number;
942
+ /** Optional version tag prefix for generated blind-index tokens */
943
+ versionTag?: string | boolean;
944
+ }
945
+ /**
946
+ * Per-field search index entry stored for an indexed row.
947
+ */
948
+ interface ISearchIndexRowEntry {
949
+ token: string;
950
+ trigrams: Set<string>;
951
+ bucket?: string;
952
+ }
953
+ /**
954
+ * Evaluation context passed by CSearchIndex to searchIndexEvaluator helpers.
955
+ */
956
+ interface ISearchIndexEvalContext {
957
+ options: ISearchIndexOptions;
958
+ minSearchLength: number;
959
+ indexedFields: Set<string>;
960
+ getEntry: (row: any, field: string) => ISearchIndexRowEntry | undefined;
961
+ getRowFieldValue: (row: any, key: string) => any;
962
+ computeToken: (term: any, fieldOrOptions?: string | IBlindIndexOptions) => Promise<string>;
963
+ computeTrigramTokens: (term: any, fieldOrOptions?: string | IBlindIndexOptions) => Promise<Set<string>>;
964
+ resolveBucketsForRange: (operator: string, targetValue: any, fieldOrConfig: string | TRangeBucketConfig, knownBuckets?: Iterable<string>, fieldName?: string) => Set<string>;
965
+ getBucketsForField: (field: string) => Set<string>;
966
+ }
697
967
 
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). */
968
+ /**
969
+ * Shared constructor, keyring, KDF, policy, and asymmetric-security options
970
+ * supported by all `AEncryptionProvider` subclasses and `createEncryptionProvider`.
971
+ */
972
+ interface IBaseEncryptionProviderOptions {
973
+ /** Built-in Keyring dictionary mapping Key Identifiers (kid) to keys or key provider functions */
974
+ keys?: Record<string, TKeyProvider | IKeyPair>;
975
+ /** Active key identifier from `keys` to use for all outbound encryption operations */
976
+ activeKid?: string;
977
+ /** Optional Key Identifier for multi-role key routing and key rotation */
978
+ kid?: string;
979
+ keyId?: string;
980
+ /** Whitelist of allowed Key Identifiers (kid). */
981
+ allowedKids?: string[];
982
+ /** Whitelist of permitted cryptographic algorithms (e.g. ['AES-GCM']). Defaults to ['AES-GCM'] in strict mode. */
983
+ allowedAlgorithms?: TEncryptionAlgorithm[];
984
+ /**
985
+ * Dedicated HMAC key for search indexing and blind index computation.
986
+ * Required when searchIndex is enabled. Must never default to or share the AES data encryption key.
987
+ */
988
+ hmacKey?: TKeyProvider;
989
+ /**
990
+ * Key Derivation Function strategy ('none' | 'pbkdf2' | 'hkdf'). Defaults to 'pbkdf2'.
991
+ * - 'pbkdf2': Recommended for human passphrases/passwords (OWASP recommended with work factor iterations).
992
+ * - 'hkdf': For deriving subkeys from high-entropy cryptographic keys or secrets (not for low-entropy human passwords).
993
+ * - 'none': Direct key import for raw high-entropy 256-bit symmetric keys or CryptoKeys.
994
+ */
995
+ kdf?: TKdfStrategy;
996
+ /**
997
+ * Number of PBKDF2 iterations for cipher key derivation and CSearchIndex blind-index HMAC derivation
998
+ * (default: 310,000 per OWASP recommendation).
999
+ * Edge/serverless runtimes such as Cloudflare Workers cap WebCrypto PBKDF2 at 100,000 iterations and will throw
1000
+ * NotSupportedError on the server unless lowered (e.g., `100_000`) or `kdf: 'hkdf'` is used for high-entropy secrets.
1001
+ */
1002
+ kdfIterations?: number;
1003
+ /** Hash algorithm for PBKDF2 or HKDF ('SHA-256' | 'SHA-512', default: 'SHA-256') */
1004
+ kdfHash?: TKdfHash;
1005
+ /** Optional static salt for KDF. If omitted, a cryptographically secure random salt is generated and included in the envelope. */
1006
+ kdfSalt?: string | Uint8Array | ArrayBuffer;
1007
+ /** Optional context/info string or buffer for HKDF key derivation */
1008
+ info?: string | Uint8Array | ArrayBuffer;
1009
+ /** Whether to allow legacy insecure KDF ('none' / raw SHA-256) when strict mode is active. Defaults to false. */
1010
+ allowInsecureKdf?: boolean;
1011
+ /** Explicitly allows legacy fallback decryption without AAD when an envelope omits AAD or sets `aad: false` in non-strict mode. Defaults to false. */
1012
+ allowUnboundAadFallback?: boolean;
1013
+ /** Maximum allowable PBKDF2 iterations during decryption (default: 1,000,000). Envelopes exceeding this ceiling are rejected with ERR_EXCESSIVE_KDF_ITERATIONS. */
1014
+ maxAllowedIterations?: number;
1015
+ /** Maximum distinct uncached PBKDF2 salt derivations permitted per batch/call (default: 5 in strict mode; queued up to safety cap in non-strict mode). */
1016
+ maxSaltDerivations?: number;
1017
+ /** Optional key-pinning store for Trust On First Use (TOFU) public key verification in asymmetric providers */
1018
+ pinningStore?: IKeyPinningStore;
1019
+ /** Entity / peer identifier used when pinning or verifying recipient public keys (defaults to resolved kid/keyId if omitted) */
1020
+ pinEntityId?: string;
1021
+ /** Additional options forwarded to CKeyManager.verifyAndPinKey (trustedAuthorities, fetchAttestation, onPinChange, clockSkewMs, etc.) */
1022
+ pinningOptions?: Partial<Omit<IVerifyAndPinOptions, 'store'>> & {
1023
+ store?: IKeyPinningStore;
1024
+ };
1025
+ /** Optional ECDSA private key used to sign outbound RSA/ECDH envelopes */
1026
+ senderSigningPrivateKey?: CryptoKey;
1027
+ /** Optional ECDSA public key used to verify inbound RSA/ECDH envelope signatures */
1028
+ senderVerifyPublicKey?: CryptoKey;
1029
+ /** When true, RSA/ECDH decryption rejects envelopes without a valid sender signature */
1030
+ requireSenderSignature?: boolean;
1031
+ }
1032
+ /**
1033
+ * Shared runtime envelope, AAD, strict-validation, and error-handling options
1034
+ * common to both per-call `IEncryptionContext` and provider-level `IProviderEncryptionOptions`.
1035
+ */
1036
+ interface IEncryptionOperationOptions extends IBaseEncryptionProviderOptions {
1037
+ /** Secret key, passphrase, CryptoKey, key pair, or async key provider function */
1038
+ key?: TKeyProvider | IKeyPair;
1039
+ /**
1040
+ * 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.
1041
+ * Defaults to false (opt-in). When enabled (true), mitigates replay and cross-endpoint confusion attacks on outer transport envelopes.
1042
+ * Decoupled from persistent record/field envelopes to ensure safe GET vs POST/PUT interoperability.
1043
+ */
703
1044
  bindRequestContextAad?: boolean;
704
1045
  /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
705
1046
  fields?: string[];
1047
+ /** Whitelist of field names permitted to remain unencrypted in strict mode without triggering security violations (e.g. ['id', '_id']). */
1048
+ unencryptedFields?: string[];
706
1049
  /**
707
1050
  * Enforces strict encryption validation. When true:
708
1051
  * 1. Any field in `fields` that is NOT an encrypted envelope triggers a decryption error.
@@ -710,23 +1053,11 @@ interface IEncryptionContext {
710
1053
  * 3. Envelope `kid` (if present) MUST match `allowedKids`.
711
1054
  */
712
1055
  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
1056
  /**
722
1057
  * Hook invoked whenever decryption fails for an individual field or row.
723
1058
  * Can return a fallback cell value (e.g. sentinel or marker), or string/boolean.
724
1059
  */
725
1060
  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
1061
  /**
731
1062
  * Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping.
732
1063
  * Can be static string/buffer or dynamic callback evaluated per record and field.
@@ -736,24 +1067,23 @@ interface IEncryptionContext {
736
1067
  aadFields?: string[];
737
1068
  /** Optional base AAD prefix when aadFields or dynamic aad is enabled */
738
1069
  baseAad?: string;
739
- /** Internal flag indicating that key derivation has already been warmed for this batch */
740
- _warmedKey?: any;
741
1070
  /** Whether to encrypt/decrypt individual values while preserving JSON keys (default: true) */
742
1071
  valueEncryption?: boolean;
1072
+ /** Optional public key for asymmetric providers */
743
1073
  publicKey?: CryptoKey;
1074
+ /** Optional private key for asymmetric providers */
744
1075
  privateKey?: CryptoKey;
1076
+ /** Optional recipient public key for asymmetric/hybrid encryption */
745
1077
  recipientPublicKey?: CryptoKey;
1078
+ /** Optional recipient private key for asymmetric/hybrid decryption */
746
1079
  recipientPrivateKey?: CryptoKey;
1080
+ /** Elliptic curve name for ECDH ('P-256' | 'P-384' | 'P-521') */
747
1081
  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;
1082
+ }
1083
+ interface IEncryptionContext extends IEncryptionOperationOptions {
1084
+ url?: string;
1085
+ method?: string;
1086
+ isServer?: boolean;
757
1087
  }
758
1088
  /**
759
1089
  * Context options for single scalar field encryption/decryption with bound AAD.
@@ -789,68 +1119,30 @@ interface IEncryptionProvider {
789
1119
  [Symbol.dispose]?(): void;
790
1120
  [Symbol.asyncDispose]?(): Promise<void>;
791
1121
  }
792
- interface IProviderEncryptionOptions {
1122
+ interface IProviderEncryptionOptions extends IEncryptionOperationOptions {
793
1123
  /** Enable or disable encryption */
794
1124
  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
1125
  /**
820
1126
  * Whether decryption is permitted during Server-Side Rendering (SSR).
821
1127
  * In an End-to-End (E2E) zero-trust model, defaults to false to prevent
822
1128
  * plaintext data in server memory or SSR payloads.
823
1129
  */
824
1130
  decryptOnSSR?: boolean;
825
- /** Whether to encrypt/decrypt individual values while preserving JSON object keys (default: true) */
826
- valueEncryption?: boolean;
827
1131
  /** Whether to defer row/item decryption to active page rendering in DataProviders */
828
1132
  lazy?: boolean;
829
- /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
830
- fields?: string[];
831
1133
  /**
832
1134
  * When enabled (true) with offline queueing, encrypts binary/FormData payloads
833
1135
  * at rest before persisting into IndexedDB/storage, and decrypts them upon flush.
834
1136
  */
835
1137
  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
1138
  /** Enable HMAC-SHA256 blind indexing and trigram search index on encrypted fields for local DataProviders */
853
1139
  searchIndex?: boolean;
1140
+ /**
1141
+ * Explicitly permits sending plaintext filters for encrypted fields in outbound server queries
1142
+ * when no searchable encryption rewrite configuration is available (in non-strict mode).
1143
+ * Defaults to false (fail-closed: throws ERR_ENCRYPTED_FILTER_PLAINTEXT_LEAK).
1144
+ */
1145
+ allowPlaintextServerFilter?: boolean;
854
1146
  /**
855
1147
  * Whether to allow matching against unscoped legacy blind index tokens (without field domain separation).
856
1148
  * Defaults to false for security (prevents cross-field and equality-vs-trigram token collisions).
@@ -867,57 +1159,39 @@ interface IProviderEncryptionOptions {
867
1159
  asciiFold?: boolean;
868
1160
  /** Custom normalizer callback for domain- or script-specific character transforms */
869
1161
  normalizer?: (value: string) => string;
870
- /** Range query configuration for shadow bucketing across encrypted numeric or date columns (TASK-031) */
1162
+ /** Stable identifier for a custom normalizer callback (used in scheme versioning) */
1163
+ normalizerId?: string;
1164
+ /** Optional schema or token version identifier for blind-index query rewriting */
1165
+ tokenVersion?: string | number;
1166
+ /** Optional version tag prefix for blind-index query rewriting */
1167
+ versionTag?: string | boolean;
1168
+ /** Historical token versions/configs to also emit when rewriting encrypted filters */
1169
+ previousVersions?: Array<string | number | IBlindIndexVersionConfig>;
1170
+ /** Expected persisted token scheme identifier; throws ERR_BIDX_SCHEME_MISMATCH on divergence */
1171
+ expectedTokenScheme?: string;
1172
+ /**
1173
+ * Deterministic Shadow-Bucket Range Index configuration across encrypted numeric or date columns.
1174
+ * Security note: reveals bucket frequency distributions and order relations (not IND-CPA / not zero-leakage).
1175
+ * Avoid narrow steps or high-sensitivity fields (`salary`, `age`, `birthDate`, `creditScore`) unless using broad bands (`$25,000+` / `'year'`).
1176
+ */
871
1177
  rangeBuckets?: Record<string, TRangeBucketConfig>;
872
1178
  /** Alias for rangeBuckets */
873
1179
  shadowBuckets?: Record<string, TRangeBucketConfig>;
1180
+ /** Explicit opt-in to allow range bucketing on high-sensitivity fields */
1181
+ allowSensitiveBucket?: boolean;
874
1182
  /**
875
1183
  * Set to true if API endpoints or data sources return pre-encrypted ciphertext envelopes.
876
1184
  * When true, DataProviders decrypt search fields during ingest to populate CSearchIndex.
877
1185
  */
878
1186
  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
1187
  /** Minimum query length for trigram substring searches (default: 3). Queries shorter than this use fallback verification. */
885
1188
  minSearchLength?: number;
886
1189
  /** Cryptographic algorithm identifier (defaults to 'AES-GCM') */
887
- algorithm?: 'AES-GCM' | string;
1190
+ algorithm?: TEncryptionAlgorithm;
888
1191
  /** Custom cipher adapter implementing IEncryptionProvider (e.g. CRSAEncryptionProvider, CECDHEncryptionProvider, CWebCryptoAESCBCProvider) */
889
1192
  customProvider?: IEncryptionProvider;
890
1193
  /** Whether to use synchronous Node.js crypto provider (CNodeCryptoEncryptionProvider) */
891
1194
  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
1195
  }
922
1196
 
923
1197
  type TDataProviderListener<T = unknown> = (provider: T) => void;
@@ -937,9 +1211,10 @@ interface IDataResult<TRow = TDataRow> {
937
1211
  rowCount: number;
938
1212
  rows: TRow[];
939
1213
  }
940
- type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter$1 | null, sortList: IDataSort$1[], options?: {
1214
+ type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter | null, sortList: IDataSort[], options?: {
941
1215
  disableCache?: boolean;
942
1216
  signal?: AbortSignal;
1217
+ sideChannel?: boolean;
943
1218
  }) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
944
1219
  interface IBatchProgress {
945
1220
  loaded: number;
@@ -956,8 +1231,8 @@ interface IDataProviderOptions {
956
1231
  apiUrl?: string;
957
1232
  idKey?: string;
958
1233
  fields?: string[];
959
- filter?: IDataFilter$1;
960
- sortList?: IDataSort$1[];
1234
+ filter?: IDataFilter;
1235
+ sortList?: IDataSort[];
961
1236
  pageSize?: number;
962
1237
  currentPage?: number;
963
1238
  SSR?: boolean;
@@ -975,12 +1250,14 @@ interface IDataProviderOptions {
975
1250
  batchLoad?: 'initially' | 'onDemand';
976
1251
  onDemandFilterPolicy?: 'ingestAll' | 'warnOnly';
977
1252
  onBatchLoaded?: (batch: IBatchLoadedEvent<any>) => void;
1253
+ /** Locale identifier (e.g. 'tr', 'tr-TR', 'de-DE') for locale-aware sorting and string normalization. */
1254
+ locale?: string;
978
1255
  }
979
1256
  interface IDataProviderState<TRow = TDataRow> {
980
1257
  currentPage: number;
981
1258
  pageSize: number;
982
- filter: IDataFilter$1 | null;
983
- sortList: IDataSort$1[];
1259
+ filter: IDataFilter | null;
1260
+ sortList: IDataSort[];
984
1261
  rowCount?: number;
985
1262
  loading?: boolean;
986
1263
  initialLoad?: boolean;
@@ -991,6 +1268,10 @@ interface IDataProviderState<TRow = TDataRow> {
991
1268
  batchProgress?: IBatchProgress;
992
1269
  loadedBatches?: number[];
993
1270
  stateVersion?: number;
1271
+ selectedRows?: TRow[];
1272
+ selectAll?: boolean;
1273
+ unselectedRows?: TRow[];
1274
+ selectAllScope?: 'page' | 'all';
994
1275
  }
995
1276
  interface IDataProviderSetStateOptions {
996
1277
  immediate?: boolean;
@@ -1005,6 +1286,73 @@ interface IVirtualScrollState {
1005
1286
  itemHeight: number;
1006
1287
  }
1007
1288
 
1289
+ declare abstract class ACacheProvider {
1290
+ constructor();
1291
+ abstract getKeyList(context?: unknown): Array<string> | Promise<Array<string>>;
1292
+ abstract get<T>(key: string, context?: unknown): Promise<T | null>;
1293
+ abstract set<T>(key: string, data: T, lifetime: number, context?: unknown): Promise<void>;
1294
+ abstract remove(key: string, context?: unknown): Promise<void>;
1295
+ abstract removeByPrefix(prefix: string, context?: unknown): Promise<void>;
1296
+ abstract getRemainingTime(key: string, context?: unknown): Promise<number | null>;
1297
+ abstract cleanupExpired(): Promise<void>;
1298
+ }
1299
+
1300
+ declare class RequestProvider {
1301
+ private static _activeProvidersWithEncryption;
1302
+ static resolveCipherProvider(kid?: string): IEncryptionProvider | undefined;
1303
+ /**
1304
+ * Clears ephemeral session key discriminators. Used for testing fresh runtime sessions.
1305
+ */
1306
+ static resetEphemeralKeyDiscriminators(): void;
1307
+ cacheProvider: ACacheProvider | null;
1308
+ cacheStrategy?: ECacheStrategy;
1309
+ cacheLifetime: number | null;
1310
+ deduplicate: boolean;
1311
+ cacheKey: string;
1312
+ tags: string[];
1313
+ queue: boolean;
1314
+ private static requestQueue;
1315
+ private static executing;
1316
+ private static requestsInFlight;
1317
+ private static inFlightBridges;
1318
+ private static contextResolver?;
1319
+ static setContextResolver(resolver: ((options?: IRequestOptions) => any) | undefined): void;
1320
+ static getContextResolver(): ((options?: IRequestOptions) => any) | undefined;
1321
+ private _ambientContext?;
1322
+ private lastUrl?;
1323
+ private lastOptions?;
1324
+ private dataReceivedCallback?;
1325
+ encryption?: IProviderEncryptionOptions;
1326
+ private _cachedCipherProvider?;
1327
+ private _lastEncryptionConfig?;
1328
+ private _scopedCipherProviders;
1329
+ constructor(provider?: ACacheProvider | ECacheStrategy, lifetime?: number, deduplicate?: boolean);
1330
+ setCacheProvider(provider?: ACacheProvider | ECacheStrategy): void;
1331
+ setCacheLifetime(lifetime: number): void;
1332
+ setDeduplicate(deduplicate: boolean): void;
1333
+ setQueue(queue: boolean): void;
1334
+ private disposeCipherInstance;
1335
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
1336
+ clearEncryption(): void;
1337
+ onDataReceived(callback: (data: any, generation?: number, url?: string) => void): void;
1338
+ private invokeDataReceivedCallback;
1339
+ private finalizeResponse;
1340
+ hasLastUrl(): boolean;
1341
+ refresh(hardRefresh?: boolean): Promise<any>;
1342
+ private resolveContext;
1343
+ private getInFlightMap;
1344
+ private getInFlightBridgeMap;
1345
+ private isDataEncrypted;
1346
+ private buildEncryptionContext;
1347
+ private decryptPayloadIfNeeded;
1348
+ private getInFlightContainer;
1349
+ getUniqueKey(url: string, options?: IRequestOptions): string;
1350
+ private getCipherProvider;
1351
+ registerRequest<T>(url: string, options?: IRequestOptions): Promise<T>;
1352
+ static executeAll(): void;
1353
+ request<T>(url: string, options?: IRequestOptions): Promise<T>;
1354
+ }
1355
+
1008
1356
  /**
1009
1357
  * Server request event contract. Compatible with H3Event (Nuxt 3 / Nitro),
1010
1358
  * Node.js HTTP incoming messages, and mock/custom server context stubs.
@@ -1040,6 +1388,8 @@ interface IRequestOptions {
1040
1388
  tags?: string[];
1041
1389
  signal?: AbortSignal;
1042
1390
  _generation?: number;
1391
+ /** When true, marks a background/side-channel fetch: does not update lastUrl/lastOptions or fire onDataReceived. */
1392
+ sideChannel?: boolean;
1043
1393
  encryption?: IProviderEncryptionOptions;
1044
1394
  /** If true, returns raw response without decrypting, useful for DataProvider lazy page-level decryption */
1045
1395
  skipDecryption?: boolean;
@@ -1075,6 +1425,26 @@ interface IDeadLetterItem extends IQueuedOperation {
1075
1425
  interface IFlushOptions {
1076
1426
  tag?: string;
1077
1427
  }
1428
+ interface IQueuedRequest {
1429
+ url: string;
1430
+ options?: IRequestOptions;
1431
+ instance: RequestProvider;
1432
+ context?: any;
1433
+ resolve?: (value: unknown) => void;
1434
+ reject?: (error: Error) => void;
1435
+ }
1436
+ interface InFlightSubscriber {
1437
+ id: number;
1438
+ signal?: AbortSignal;
1439
+ cleanup?: () => void;
1440
+ resolve: (val: any) => void;
1441
+ reject: (err: any) => void;
1442
+ }
1443
+ interface InFlightBridge {
1444
+ controller: AbortController;
1445
+ subscribers: Map<number, InFlightSubscriber>;
1446
+ nextId: number;
1447
+ }
1078
1448
 
1079
1449
  interface ITreeNode<TRow = TDataRow> {
1080
1450
  data: TRow;
@@ -1131,7 +1501,7 @@ interface ITreeDataProviderOptions extends IDataProviderOptions {
1131
1501
  * Tree-specific page data handler that includes tree parameters
1132
1502
  * Server handles tree building, visibility, and pagination
1133
1503
  */
1134
- type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter$1 | null, sortList: IDataSort$1[], treeParams: {
1504
+ type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter | null, sortList: IDataSort[], treeParams: {
1135
1505
  expandedNodes: (string | number)[] | Set<string | number>;
1136
1506
  parentKey: string;
1137
1507
  idKey: string;
@@ -1140,24 +1510,9 @@ type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: num
1140
1510
  }, options?: {
1141
1511
  disableCache?: boolean;
1142
1512
  signal?: AbortSignal;
1513
+ sideChannel?: boolean;
1143
1514
  }) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
1144
1515
 
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
1516
  /**
1162
1517
  * types.ts — Framework-agnostic hydration and platform abstraction contracts.
1163
1518
  */
@@ -1189,12 +1544,47 @@ interface IPlatformRouter {
1189
1544
  onReady?(cb: () => void): void;
1190
1545
  }
1191
1546
 
1547
+ interface IDataProviderGlobalConfig {
1548
+ locale?: string;
1549
+ }
1550
+ /**
1551
+ * Configure project-level defaults for all ADataProvider instances.
1552
+ */
1553
+ declare function setGlobalDataProviderConfig(config: IDataProviderGlobalConfig): void;
1554
+ /**
1555
+ * Get the current project-level DataProvider configuration.
1556
+ */
1557
+ declare function getGlobalDataProviderConfig(): IDataProviderGlobalConfig;
1192
1558
  declare abstract class ADataProvider<TRow = TDataRow> {
1193
1559
  idKey: string;
1560
+ protected _locale?: string;
1561
+ get locale(): string | undefined;
1562
+ set locale(val: string | undefined);
1563
+ setLocale(locale?: string): void | Promise<void>;
1194
1564
  protected _pageData: TRow[];
1195
1565
  get pageData(): TRow[];
1196
1566
  set pageData(val: TRow[]);
1567
+ /**
1568
+ * Highest page appended through loadMore() during the current accumulation session.
1569
+ * null when not accumulating (the displayed rows correspond to `currentPage`).
1570
+ * loadMore() never mutates `currentPage`; it tracks progress here instead.
1571
+ */
1572
+ protected _loadedThroughPage: number | null;
1573
+ /** Query signature of the currently loaded pageData. */
1574
+ protected _loadedQuerySignature: string | null;
1575
+ /** Active non-accumulating page load promise. */
1576
+ protected _activePageLoad: Promise<void> | null;
1577
+ /** Merges incoming rows onto existing rows, deduplicating by `idKey` when present. */
1578
+ protected mergeUniqueRows(existing: TRow[], incoming: TRow[]): TRow[];
1579
+ /** Updates `pageData` and `_loadedThroughPage` during an accumulation session. */
1580
+ protected applyAccumulatedPageData(merged: TRow[], targetPage: number): void;
1581
+ /** Stable signature of the query parameters that determine page contents. */
1582
+ protected _querySignature(): string;
1197
1583
  protected _fields: string[];
1584
+ protected _selectedRows: TRow[];
1585
+ protected _selectAll: boolean;
1586
+ protected _unselectedRows: TRow[];
1587
+ protected _selectAllScope: 'page' | 'all';
1198
1588
  get fields(): string[];
1199
1589
  set fields(val: string[]);
1200
1590
  protected _rowCount: number;
@@ -1214,18 +1604,21 @@ declare abstract class ADataProvider<TRow = TDataRow> {
1214
1604
  context: any;
1215
1605
  protected _currentPage: number;
1216
1606
  protected _pageSize: number;
1217
- protected _filter: IDataFilter$1 | null;
1218
- protected _sortList: IDataSort$1[];
1607
+ protected _filter: IDataFilter | null;
1608
+ protected _sortList: IDataSort[];
1219
1609
  get currentPage(): number;
1220
1610
  set currentPage(page: number);
1221
1611
  get pageSize(): number;
1222
1612
  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[]);
1613
+ get filter(): IDataFilter | null;
1614
+ set filter(f: IDataFilter | null);
1615
+ get sortList(): IDataSort[];
1616
+ set sortList(s: IDataSort[]);
1227
1617
  get hasMore(): boolean;
1228
1618
  nextPage(): Promise<void>;
1619
+ /**
1620
+ * Alias for `nextPage()`.
1621
+ */
1229
1622
  loadMore(): Promise<void>;
1230
1623
  prevPage(): Promise<void>;
1231
1624
  protected _stateVersion: number;
@@ -1250,8 +1643,8 @@ declare abstract class ADataProvider<TRow = TDataRow> {
1250
1643
  subscribe(listener: TDataProviderListener<this>): TUnsubscribe;
1251
1644
  notify(): void;
1252
1645
  onStateChange(listener: TDataProviderStateChangeListener<TRow>): TUnsubscribe;
1253
- onSortChanged(listener: (sortList: IDataSort$1[]) => void): TUnsubscribe;
1254
- onFilterChanged(listener: (filter: IDataFilter$1 | null) => void): TUnsubscribe;
1646
+ onSortChanged(listener: (sortList: IDataSort[]) => void): TUnsubscribe;
1647
+ onFilterChanged(listener: (filter: IDataFilter | null) => void): TUnsubscribe;
1255
1648
  onDataChanged(listener: (pageData: TRow[]) => void): TUnsubscribe;
1256
1649
  getState(): IDataProviderState<TRow>;
1257
1650
  protected onFilterUpdated(): void;
@@ -1259,9 +1652,9 @@ declare abstract class ADataProvider<TRow = TDataRow> {
1259
1652
  setState(partial: Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
1260
1653
  serializeState(): string;
1261
1654
  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;
1655
+ setFilter(filter: IDataFilter | null, immediate?: boolean): void | Promise<void>;
1656
+ setSortList(sortList: IDataSort[], immediate?: boolean): void | Promise<void>;
1657
+ protected _guardEncryptedSorting(sortList: IDataSort[]): void;
1265
1658
  setCurrentPage(currentPage: number): void | Promise<void>;
1266
1659
  setPageSize(pageSize: number, resetPage?: boolean): void | Promise<void>;
1267
1660
  abstract loadPageData(options?: {
@@ -1304,17 +1697,6 @@ declare function decryptPageRows<T = any>(rows: T[], encryption?: IProviderEncry
1304
1697
  declare function encryptRows<T = any>(rows: T[], encryption?: IProviderEncryptionOptions, apiUrl?: string, idKey?: string): Promise<T[]>;
1305
1698
  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
1699
 
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
1700
  /**
1319
1701
  * Normalizes text for consistent deterministic blind indexing (lowercased, trimmed, NFKC normalized).
1320
1702
  * Delegates to the shared normalizeFilterValue primitive.
@@ -1324,11 +1706,17 @@ declare function normalizeIndexTerm(value: any, options?: INormalizeOptions): st
1324
1706
  * Extracts 3-character trigrams from a string for substring search.
1325
1707
  */
1326
1708
  declare function extractTrigrams(value: any, options?: INormalizeOptions): string[];
1327
- interface ISearchIndexRowEntry {
1328
- token: string;
1329
- trigrams: Set<string>;
1330
- bucket?: string;
1331
- }
1709
+ /**
1710
+ * Returns the exact logical complement of an operator if one exists in EDataFilterOperator,
1711
+ * or null for operators without an exact inverse (e.g. contains, like, between, unknown).
1712
+ */
1713
+ declare function invertFilterOperator(operator: any): EDataFilterOperator | null;
1714
+ /**
1715
+ * Negates a filter AST node using De Morgan's Laws for compound nodes,
1716
+ * exact operator inversion when available, and explicit NOT wrapping otherwise.
1717
+ */
1718
+ declare function negateFilterNode(filter: TSearchFilterNode | any): TSearchFilterNode;
1719
+
1332
1720
  /**
1333
1721
  * CSearchIndex provides deterministic blind indexing (HMAC-SHA256) and trigram token sets
1334
1722
  * for client-side privacy-preserving searching and filtering across encrypted fields without decryption.
@@ -1340,20 +1728,24 @@ declare class CSearchIndex {
1340
1728
  private _indexedFields;
1341
1729
  private _fieldBuckets;
1342
1730
  private _bucketToRows;
1731
+ private _decryptedRowResolver?;
1343
1732
  minSearchLength: number;
1344
1733
  options: ISearchIndexOptions;
1345
1734
  constructor(keyMaterial: TKeyProvider, fields?: string[], options?: ISearchIndexOptions);
1346
1735
  get indexedFields(): readonly string[];
1347
1736
  setFields(fields: string[]): void;
1348
1737
  isFieldIndexed(field: string): boolean;
1349
- private _decryptedRowResolver?;
1350
1738
  setDecryptedRowResolver(resolver?: (row: any) => any): void;
1351
1739
  hasDecryptedRowResolver(): boolean;
1352
1740
  private _addBucketRow;
1353
1741
  getBucketsForField(field: string): Set<string>;
1354
1742
  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>;
1743
+ computeRangeBucket(val: any, fieldOrConfig: string | TRangeBucketConfig, fieldName?: string, options?: {
1744
+ allowSensitiveBucket?: boolean;
1745
+ }): string | undefined;
1746
+ resolveBucketsForRange(operator: string, targetValue: any, fieldOrConfig: string | TRangeBucketConfig, knownBuckets?: Iterable<string>, fieldName?: string, options?: {
1747
+ allowSensitiveBucket?: boolean;
1748
+ }): Set<string>;
1357
1749
  getCandidateRowsForBuckets(field: string, bucketKeys: Iterable<string>): Set<any>;
1358
1750
  getCandidateRecordIdsForBuckets(field: string, bucketKeys: Iterable<string>, idKey?: string): Set<any>;
1359
1751
  getCandidateRecordIdsForRange(operator: string, targetValue: any, field: string, idKey?: string): Set<any>;
@@ -1394,7 +1786,9 @@ declare class CSearchIndex {
1394
1786
  * Evaluates whether a row matches an exact or substring query on an indexed encrypted field.
1395
1787
  */
1396
1788
  evaluateField(operator: string, row: any, field: string, filterValue: any): Promise<boolean | null>;
1789
+ private _isEncryptedEnvelope;
1397
1790
  private _getRowFieldValue;
1791
+ private _createEvalContext;
1398
1792
  /**
1399
1793
  * Pre-computes query tokens for an active filter, returning a high-performance synchronous
1400
1794
  * evaluator function suitable for row-by-row filtering in memory.
@@ -1404,23 +1798,22 @@ declare class CSearchIndex {
1404
1798
  * - Evaluates all unindexed filter conditions against decrypted/plaintext row fields in memory.
1405
1799
  * - Never treats an unhandled filter branch or null evaluator as a match-all inside an AND conjunction.
1406
1800
  */
1407
- createFilterEvaluator(filter: IDataFilter$1 | any): Promise<((row: any) => boolean) | null>;
1801
+ createFilterEvaluator(filter: IDataFilter | any): Promise<((row: any) => boolean) | null>;
1408
1802
  /**
1409
1803
  * Secondary in-memory verification filter executed post-decryption to filter out
1410
1804
  * false positives from non-contiguous trigram matches and verify exact substring containment.
1411
1805
  */
1412
- verifyDecryptedRows<T = any>(rows: T[], filter: IDataFilter$1 | any): T[];
1806
+ verifyDecryptedRows<T = any>(rows: T[], filter: IDataFilter | any): T[];
1413
1807
  /**
1414
1808
  * Verifies a single decrypted row against an active filter post-decryption.
1415
1809
  */
1416
- verifyDecryptedRow(row: any, filter: IDataFilter$1 | any): boolean;
1810
+ verifyDecryptedRow(row: any, filter: IDataFilter | any): boolean;
1417
1811
  /**
1418
1812
  * Determines whether an active filter requires post-decryption verification
1419
1813
  * (e.g. for substring / trigram queries, short queries < minSearchLength, range buckets,
1420
1814
  * or any queries that may yield candidate false positives in stage-1 blind index filtering).
1421
1815
  */
1422
- requiresPostVerification(filter: IDataFilter$1 | any): boolean;
1423
- private _compileEvaluator;
1816
+ requiresPostVerification(filter: IDataFilter | any): boolean;
1424
1817
  }
1425
1818
 
1426
1819
  declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataProvider<TRow> {
@@ -1431,12 +1824,22 @@ declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataPr
1431
1824
  constructor(options?: IDataProviderOptions);
1432
1825
  get isEncryptionEnabled(): boolean;
1433
1826
  get searchIndex(): CSearchIndex | undefined;
1827
+ protected _deleteCacheIdVariants(map: Map<string | number, TRow>, id: unknown): void;
1828
+ protected _containsEncryptedPayload(row: any): boolean;
1434
1829
  getDecryptedRow(rowOrId: any): TRow | undefined;
1435
1830
  cacheDecryptedRow(rowOrId: any, decryptedRow: TRow): void;
1436
1831
  clearDecryptedCache(): void;
1832
+ /**
1833
+ * Invalidate cached decrypted representations for a single row or row ID.
1834
+ */
1835
+ invalidateDecryptedRow(rowOrId: any): void;
1836
+ /**
1837
+ * Evicts a single row or row ID from both `_decryptedCache` and `_decryptedRefCache`.
1838
+ */
1839
+ evictDecryptedRow(rowOrId: any): void;
1437
1840
  populateDecryptedCache(rows: TRow[]): Promise<void>;
1438
1841
  isFieldEncrypted(field: string, sampleRows?: TRow[]): boolean;
1439
- warnIfEncryptedFilterWithoutSupport(filter: IDataFilter$1 | any, sampleRows?: TRow[]): void;
1842
+ warnIfEncryptedFilterWithoutSupport(filter: IDataFilter | any, sampleRows?: TRow[]): void;
1440
1843
  protected _guardEncryptedSorting(sortList: IDataSort[]): void;
1441
1844
  private _warmupKeyAsync;
1442
1845
  protected _initSearchIndex(): void;
@@ -1457,6 +1860,27 @@ declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataPr
1457
1860
  setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
1458
1861
  }
1459
1862
 
1863
+ /**
1864
+ * Minimal encryption/cache adapter surface shared across client providers.
1865
+ */
1866
+ interface IProviderEncryptionHost<TRow> {
1867
+ isEncryptionEnabled: boolean;
1868
+ encryption?: IProviderEncryptionOptions;
1869
+ searchIndex?: any;
1870
+ idKey: string;
1871
+ encryptRows(rows: TRow[]): Promise<TRow[]>;
1872
+ encryptRowsChunked(rows: TRow[], options?: ISetDataChunkedOptions): Promise<TRow[]>;
1873
+ indexPreEncryptedRows(rows: TRow[]): Promise<void>;
1874
+ populateDecryptedCache(rows: TRow[]): Promise<void>;
1875
+ cacheDecryptedRow(encryptedRow: any, decryptedRow: TRow): void;
1876
+ getDecryptedRow(rowOrId: any): TRow | undefined;
1877
+ decryptRows(rows: TRow[]): Promise<{
1878
+ rows: TRow[];
1879
+ decrypted: boolean;
1880
+ }>;
1881
+ invalidateDecryptedRow(rowOrId: any): void;
1882
+ }
1883
+
1460
1884
  declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientProvider<TRow> {
1461
1885
  private _allData;
1462
1886
  filteredData: TRow[];
@@ -1465,6 +1889,7 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1465
1889
  protected _sortDirty: boolean;
1466
1890
  protected _activeFilterEvaluator: ((row: any) => boolean) | null;
1467
1891
  protected _expectedRowCount?: number;
1892
+ protected _isSparse: boolean;
1468
1893
  batchSize: number | false;
1469
1894
  batchLoad: 'initially' | 'onDemand';
1470
1895
  onDemandFilterPolicy: 'ingestAll' | 'warnOnly';
@@ -1478,18 +1903,23 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1478
1903
  get batchProgress(): IBatchProgress | undefined;
1479
1904
  set batchProgress(val: IBatchProgress | undefined);
1480
1905
  protected _batchGeneration: number;
1906
+ protected _inFlightLoad?: Promise<void>;
1481
1907
  constructor(options?: IDataProviderOptions);
1908
+ protected _assignAllData(data: TRow[], preserveDecryptedCache?: boolean): void;
1482
1909
  get allData(): TRow[];
1483
1910
  set allData(data: TRow[]);
1484
1911
  get rowMap(): readonly TRow[];
1485
1912
  setData(data: TRow[]): Promise<void> | void;
1486
1913
  protected _setDataBatched(data: TRow[]): Promise<void>;
1914
+ /** Adapts protected encryption/cache hooks for stateless batch helpers without exposing protected methods publicly. */
1915
+ protected _getEncryptionHost(): IProviderEncryptionHost<TRow>;
1487
1916
  protected _setDataEncrypted(data: TRow[]): Promise<void>;
1488
1917
  setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
1489
1918
  protected onFilterUpdated(): void;
1490
1919
  protected onSortUpdated(): void;
1491
- setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
1492
- setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
1920
+ setFilter(filter: IDataFilter | null, immediate?: boolean): void | Promise<void>;
1921
+ setSortList(sortList: IDataSort[], immediate?: boolean): void | Promise<void>;
1922
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
1493
1923
  clearEncryption(): void;
1494
1924
  /**
1495
1925
  * Explicitly rebuilds the reference map array if row properties inside allData were mutated in-place.
@@ -1501,12 +1931,20 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1501
1931
  refresh(hardRefresh?: boolean): Promise<void>;
1502
1932
  fetchAll(): Promise<TRow[]>;
1503
1933
  protected _getNormalizeOptions(): INormalizeOptions | undefined;
1934
+ protected _countDefinedRows(): number;
1935
+ protected _resolveSortValue(row: any, field: string, rangeBuckets: any): any;
1936
+ protected _buildSortedRowMap(): TRow[];
1937
+ protected _hasEncryptedRowFilterField(row: any, filter: IDataFilter | null, filterFields?: string[]): boolean;
1938
+ protected _hasUnindexedEncryptedFilter(filter: IDataFilter, sampleRows: TRow[]): boolean;
1939
+ /**
1940
+ * Builds a synchronous filter evaluator for decryptedCache mode that never falls back
1941
+ * to running evaluateFilter against encrypted ciphertext payloads.
1942
+ */
1943
+ protected _createDecryptedCacheFilterEvaluator(filter: IDataFilter, normOpts?: INormalizeOptions): (row: any) => boolean;
1504
1944
  private _computeFilteredAndSorted;
1505
- protected _inFlightLoad?: Promise<void>;
1506
1945
  loadPageData(): void | Promise<void>;
1507
1946
  protected _executeLoadPageDataSync(): void;
1508
1947
  protected _executeLoadPageData(): Promise<void>;
1509
- loadMore(): Promise<void>;
1510
1948
  loadBatch(batchNumber: number): Promise<void>;
1511
1949
  ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
1512
1950
  loadRange(startIndex: number, endIndex: number): Promise<void>;
@@ -1519,78 +1957,6 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
1519
1957
  setState(partial: Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
1520
1958
  }
1521
1959
 
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
1960
  declare abstract class AAPIDataProvider {
1595
1961
  apiUrl: string;
1596
1962
  cacheStrategy: ECacheStrategy | null;
@@ -1615,28 +1981,59 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
1615
1981
  cacheLifetime: number;
1616
1982
  refreshOnMutation: boolean | undefined;
1617
1983
  protected _isAccumulating: boolean;
1618
- protected _inFlightLoadMore: boolean;
1984
+ protected _isStreamingBatches: boolean;
1619
1985
  protected _inFlightBatches: Map<number, Promise<void>>;
1620
- protected _currentOnDemandBatch?: number;
1986
+ protected _requestGeneration: number;
1987
+ protected _activeUrl: string;
1988
+ protected _abortController?: AbortController;
1989
+ protected _knownIds: Set<string | number>;
1990
+ protected _loadedRowCount: number;
1991
+ protected _optimisticRowCountDelta: number;
1992
+ protected _optimisticallyCreatedIds: Set<string | number>;
1993
+ protected _optimisticallyDeletedIds: Set<string | number>;
1994
+ private _streamRefreshTimer?;
1621
1995
  private _lastDataReceivedPromise;
1996
+ private _lastBatch1CallbackGen;
1997
+ private _suppressOnDemandWarn;
1998
+ setData(data: TRow[]): Promise<void> | void;
1999
+ protected _assignAllData(data: TRow[], preserveDecryptedCache?: boolean): void;
2000
+ set allData(data: TRow[]);
2001
+ get allData(): TRow[];
2002
+ protected _extractRowId(row: any): string | number | undefined;
2003
+ protected _resetIndexTrackers(rows?: TRow[]): void;
2004
+ protected _countDefinedRows(): number;
2005
+ protected _clearStreamRefreshTimer(): void;
2006
+ protected _scheduleStreamRefresh(reqGen: number): void;
2007
+ protected _bumpRequestGeneration(nextUrl?: string): number;
2008
+ private _shouldSkipDecryption;
2009
+ private _clearMutationCaches;
1622
2010
  constructor(options?: IDataProviderOptions);
2011
+ /** Encrypts or indexes incoming rows according to provider encryption settings. Returns null if request became stale. */
2012
+ protected _processIncomingRows(incomingRows: TRow[], isStale: () => boolean): Promise<TRow[] | null>;
2013
+ /** Places batch rows into `allData` at `targetIndex`, preserving sparse holes and updating row trackers. */
2014
+ protected _placeBatchRowsAt(processed: TRow[], targetIndex: number): void;
2015
+ private get _effectiveLoadedCount();
1623
2016
  get hasMore(): boolean;
1624
- loadMore(): Promise<void>;
1625
2017
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1626
2018
  clearEncryption(): void;
1627
2019
  setContextKey(key: string): void;
1628
2020
  setCacheStrategy(strategy: ECacheStrategy): void;
1629
2021
  setCacheLifetime(lifetime: number): void;
2022
+ private _tryHydrateFromSsr;
1630
2023
  refreshData(options?: {
1631
2024
  disableCache?: boolean;
1632
2025
  }): 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>;
2026
+ protected _fetchBatched(reqGen: number, batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
2027
+ protected _streamRemainingBatches(reqGen: number, batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
2028
+ loadBatch(batchNumber: number, options?: {
2029
+ skipPageLoad?: boolean;
2030
+ }): Promise<void>;
1636
2031
  ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
1637
2032
  loadRange(startIndex: number, endIndex: number): Promise<void>;
1638
2033
  setCurrentPage(currentPage: number): Promise<void>;
1639
- ingestAllBatches(): Promise<void>;
2034
+ ingestAllBatches(options?: {
2035
+ skipPageLoad?: boolean;
2036
+ }): Promise<void>;
1640
2037
  setFilter(filter: IDataFilter | null, immediate?: boolean): Promise<void>;
1641
2038
  setSortList(sortList: IDataSort[], immediate?: boolean): Promise<void>;
1642
2039
  loadPageData(options?: {
@@ -1654,23 +2051,48 @@ declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1654
2051
  contextKey: string;
1655
2052
  encryption?: IProviderEncryptionOptions;
1656
2053
  protected _allData: TRow[];
2054
+ private _unpaginatedData;
2055
+ private _unpaginatedDataSignature;
1657
2056
  protected _isAccumulating: boolean;
1658
2057
  protected _inFlightLoadMore: boolean;
1659
2058
  get allData(): TRow[];
1660
2059
  set allData(val: TRow[]);
2060
+ protected _invalidateUnpaginatedData(): void;
1661
2061
  private latestRequestId;
1662
2062
  private abortController;
2063
+ private _rangeCache;
2064
+ private _rangeCacheSignature;
2065
+ private _inFlightRangePages;
2066
+ private _verifiedStream;
2067
+ private _preserveVerifiedStreamOnNextLoad;
2068
+ protected _invalidateRangeCache(): void;
2069
+ protected _invalidateVerifiedStream(): void;
2070
+ private _getVerifiedStreamRowCount;
2071
+ private _ensureVerifiedRowsCount;
1663
2072
  constructor(options?: IDataProviderOptions);
1664
2073
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1665
2074
  clearEncryption(): void;
1666
2075
  setContextKey(key: string): void;
1667
2076
  setPageDataHandler(handler: TPageDataHandler<TRow>): Promise<void>;
2077
+ setCurrentPage(currentPage: number): void | Promise<void>;
1668
2078
  loadPageData(options?: {
1669
2079
  disableCache?: boolean;
1670
2080
  signal?: AbortSignal;
1671
2081
  page?: number;
2082
+ accumulate?: boolean;
1672
2083
  }): Promise<void>;
2084
+ private _applySSRNormalizedResult;
2085
+ private _runLoadPageData;
2086
+ /**
2087
+ * Paginated mode: `currentPage * pageSize < rowCount`.
2088
+ * Accumulating mode (after loadMore): `lastAppendedPage * pageSize < rowCount`.
2089
+ * `_allData.length` is intentionally NOT used: in paginated mode it only holds the current
2090
+ * page (always < rowCount), and after fetchAll() it holds the full dataset.
2091
+ */
1673
2092
  get hasMore(): boolean;
2093
+ /**
2094
+ * Appends the next server page to the displayed rows without mutating `currentPage`.
2095
+ */
1674
2096
  loadMore(): Promise<void>;
1675
2097
  /**
1676
2098
  * Fetches the complete unpaginated dataset from the server (e.g. for charts or exports).
@@ -1682,6 +2104,12 @@ declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1682
2104
  signal?: AbortSignal;
1683
2105
  }): Promise<TRow[]>;
1684
2106
  refresh(hardRefresh?: boolean): Promise<void>;
2107
+ /**
2108
+ * Side-channel random-access window slice resolution for server virtual scrolling.
2109
+ * Fetches only the target server pages covering [startIndex, endIndex) without mutating
2110
+ * `currentPage`, `pageData`, `loading`, or downloading preceding pages sequentially.
2111
+ */
2112
+ resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
1685
2113
  cancelPending(): void;
1686
2114
  }
1687
2115
 
@@ -1717,30 +2145,37 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
1717
2145
  private _sortedNodeIdsCache;
1718
2146
  private _filteredNodesCache;
1719
2147
  private _allVisibleRowsCache;
1720
- private _decryptedNodeMap;
2148
+ protected _decryptedNodeMap: Map<string | number, TRow>;
2149
+ clearDecryptedCache(): void;
2150
+ invalidateDecryptedRow(rowOrId: any): void;
2151
+ protected _assignAllData(data: TRow[], preserveDecryptedCache?: boolean): void;
2152
+ get allData(): TRow[];
2153
+ set allData(data: TRow[]);
1721
2154
  invalidateStaticCache(): void;
1722
2155
  clearVisibleCache(): void;
1723
- setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
2156
+ setFilter(filter: IDataFilter | null, immediate?: boolean): void | Promise<void>;
1724
2157
  protected onFilterUpdated(): void;
1725
2158
  private get _staticNodes();
1726
2159
  private get _nodeMap();
1727
2160
  private get _sortedNodeIds();
1728
2161
  constructor(options?: ITreeDataProviderOptions);
1729
- protected _applyTreeData(rows: TRow[]): void;
2162
+ protected _applyTreeData(rows: TRow[], preserveDecryptedCache?: boolean): void;
1730
2163
  setData(data: TRow[]): Promise<void> | void;
2164
+ private _decryptAndCacheTreeNodes;
1731
2165
  protected _setDataBatchedTree(data: TRow[]): Promise<void>;
1732
2166
  protected _setDataEncrypted(data: TRow[]): Promise<void>;
1733
2167
  setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
1734
- private buildStaticNodes;
1735
2168
  protected onSortUpdated(): void;
1736
- setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
1737
- private computeSortedIds;
1738
- private isNodeVisible;
2169
+ setSortList(sortList: IDataSort[], immediate?: boolean): void | Promise<void>;
1739
2170
  private paginateNodes;
1740
- private _buildFilteredHierarchy;
2171
+ private _createTreeNodeFilterEvaluator;
1741
2172
  private updatePageData;
1742
2173
  protected _executeLoadPageDataSync(): void;
1743
2174
  protected _executeLoadPageData(): Promise<void>;
2175
+ refreshData(options?: {
2176
+ disableCache?: boolean;
2177
+ }): Promise<void>;
2178
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
1744
2179
  clearEncryption(): void;
1745
2180
  get treeNodes(): ITreeNode<TRow>[];
1746
2181
  get allVisibleNodes(): ITreeNode<TRow>[];
@@ -1755,6 +2190,7 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
1755
2190
  get visibleRows(): ITreeNode<TRow>[];
1756
2191
  getAllNodes(): ITreeNode<TRow>[];
1757
2192
  getFlatNodes(): ITreeNode<TRow>[];
2193
+ private _commitExpansionChange;
1758
2194
  toggleNode(nodeId: string | number): void;
1759
2195
  expand(nodeId: string | number): void;
1760
2196
  collapse(nodeId: string | number): void;
@@ -1777,9 +2213,20 @@ declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> exten
1777
2213
  refreshOnMutation: boolean | undefined;
1778
2214
  protected _isAccumulating: boolean;
1779
2215
  protected _inFlightBatches: Map<number, Promise<void>>;
1780
- protected _currentOnDemandBatch?: number;
2216
+ protected _requestGeneration: number;
2217
+ protected _activeUrl: string;
2218
+ protected _abortController?: AbortController;
1781
2219
  private _lastDataReceivedPromise;
2220
+ private _lastBatch1CallbackGen;
2221
+ setData(data: TRow[]): Promise<void> | void;
2222
+ protected _bumpRequestGeneration(nextUrl?: string): number;
2223
+ private _shouldSkipDecryption;
2224
+ private _clearMutationCaches;
1782
2225
  constructor(options?: ITreeDataProviderOptions);
2226
+ /** Encrypts or indexes incoming tree rows when field encryption is enabled. Returns null if stale. */
2227
+ protected _processIncomingTreeRows(incomingRows: TRow[], isStale: () => boolean): Promise<TRow[] | null>;
2228
+ /** Deduplicates incoming tree rows by idKey and appends them to the existing tree buffer. */
2229
+ protected _mergeTreeRows(rows: TRow[]): void;
1783
2230
  setEncryption(encryption?: IProviderEncryptionOptions): void;
1784
2231
  clearEncryption(): void;
1785
2232
  setContextKey(key: string): void;
@@ -1787,9 +2234,10 @@ declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> exten
1787
2234
  refreshData(options?: {
1788
2235
  disableCache?: boolean;
1789
2236
  }): Promise<void>;
2237
+ private _tryHydrateTreeFromSsr;
1790
2238
  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>;
2239
+ protected _fetchBatchedTree(reqGen: number, batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
2240
+ protected _streamRemainingTreeBatches(reqGen: number, batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
1793
2241
  loadBatch(batchNumber: number): Promise<void>;
1794
2242
  ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
1795
2243
  loadRange(startIndex: number, endIndex: number): Promise<void>;
@@ -1823,6 +2271,7 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1823
2271
  paginateBy: TreePaginationMode;
1824
2272
  expandedNodes: Set<string | number>;
1825
2273
  pageDataHandler: TTreePageDataHandler<TRow> | null;
2274
+ protected _isAccumulating: boolean;
1826
2275
  contextKey: string;
1827
2276
  encryption?: IProviderEncryptionOptions;
1828
2277
  constructor(options?: ITreeDataProviderOptions);
@@ -1830,8 +2279,29 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1830
2279
  clearEncryption(): void;
1831
2280
  setContextKey(key: string): void;
1832
2281
  setPageDataHandler(handler: TTreePageDataHandler<TRow>): Promise<void>;
2282
+ setCurrentPage(currentPage: number): void | Promise<void>;
1833
2283
  private latestRequestId;
1834
2284
  private abortController;
2285
+ private _rangeCache;
2286
+ private _rangeCacheSignature;
2287
+ private _inFlightRangePages;
2288
+ private _verifiedTreeStream;
2289
+ private _preserveVerifiedStreamOnNextLoad;
2290
+ private _unpaginatedData;
2291
+ get unpaginatedData(): TRow[] | null;
2292
+ protected _invalidateUnpaginatedData(): void;
2293
+ protected onFilterUpdated(): void;
2294
+ protected onSortUpdated(): void;
2295
+ protected _invalidateRangeCache(): void;
2296
+ protected _invalidateVerifiedStream(): void;
2297
+ private _createTreeParams;
2298
+ private _getTreeFilledItemCount;
2299
+ private _getTreeVerifiedRowCount;
2300
+ private _getTreePageRows;
2301
+ private _appendAndVerifyTreeBatch;
2302
+ private _flushTreeTelemetry;
2303
+ private _ensureVerifiedTreeCount;
2304
+ protected _querySignature(): string;
1835
2305
  /**
1836
2306
  * Load page data from server
1837
2307
  * Server handles tree building, visibility, and pagination
@@ -1839,8 +2309,24 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
1839
2309
  loadPageData(options?: {
1840
2310
  disableCache?: boolean;
1841
2311
  signal?: AbortSignal;
2312
+ page?: number;
2313
+ accumulate?: boolean;
1842
2314
  }): Promise<void>;
2315
+ private _applySSRNormalizedResult;
2316
+ private _runLoadPageData;
1843
2317
  refresh(hardRefresh?: boolean): Promise<void>;
2318
+ resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
2319
+ loadMore(): Promise<void>;
2320
+ protected _loadMoreInFlight: boolean;
2321
+ protected fetchPageForLoadMore(page: number): Promise<TRow[]>;
2322
+ protected _unpaginatedCache: {
2323
+ sig: string;
2324
+ rows: TRow[];
2325
+ } | null;
2326
+ fetchAll(options?: {
2327
+ disableCache?: boolean;
2328
+ signal?: AbortSignal;
2329
+ }): Promise<TRow[]>;
1844
2330
  cancelPending(): void;
1845
2331
  toggleNode(nodeId: string | number): void;
1846
2332
  expand(nodeId: string | number): void;
@@ -2214,6 +2700,7 @@ declare class RequestProviderRegistry {
2214
2700
  }
2215
2701
 
2216
2702
  declare const SENSITIVE_HEADER_KEYS: string[];
2703
+
2217
2704
  /**
2218
2705
  * RequestQueue
2219
2706
  *
@@ -2225,19 +2712,6 @@ declare const SENSITIVE_HEADER_KEYS: string[];
2225
2712
  * - No internal retry: the queue is the retry mechanism (items persist until flushed)
2226
2713
  * - Partial refresh: registry refresh fires for succeeded tags only
2227
2714
  * - 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
2715
  */
2242
2716
  declare class RequestQueue {
2243
2717
  static queue: IQueuedOperation[];
@@ -2250,30 +2724,17 @@ declare class RequestQueue {
2250
2724
  static setMaxQueueSize(limit: number): void;
2251
2725
  static setMaxDeadLetterSize(limit: number): void;
2252
2726
  /**
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.
2727
+ * Canonical URL resolver appending query parameters consistently with RequestProvider.
2257
2728
  */
2729
+ static resolveFullRequestUrl(url: string, query?: any): string;
2258
2730
  /**
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.
2731
+ * Adapts binary, multipart, and specialized payload types into JSON-serializable structures.
2262
2732
  */
2263
2733
  static serializeBody(body: any): Promise<any>;
2264
- private static serializeFieldValue;
2265
2734
  /**
2266
- * Reconstitutes serialized offline request bodies back into their live runtime instances
2267
- * (FormData, Blob, File, ArrayBuffer, Uint8Array, URLSearchParams) before network transmission.
2735
+ * Reconstitutes serialized offline request bodies back into live runtime instances.
2268
2736
  */
2269
2737
  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
2738
  private static _subscribers;
2278
2739
  static subscribe(listener: () => void): () => void;
2279
2740
  static notify(): void;
@@ -2285,15 +2746,21 @@ declare class RequestQueue {
2285
2746
  private static _onNetworkError;
2286
2747
  private static _onError;
2287
2748
  private static _headerProvider;
2749
+ private static _cipherResolver;
2750
+ private static _defaultCipherResolver;
2751
+ private static _resetHooks;
2752
+ static onReset(hook: () => void): void;
2288
2753
  static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
2754
+ static setCipherResolver(resolver: ((kid?: string) => IEncryptionProvider | Promise<IEncryptionProvider> | null | undefined) | null): void;
2755
+ static setCipherProvider(provider: IEncryptionProvider | ((kid?: string) => IEncryptionProvider | Promise<IEncryptionProvider> | null | undefined) | null): void;
2756
+ static setDefaultCipherResolver(resolver: ((kid?: string) => IEncryptionProvider | Promise<IEncryptionProvider> | null | undefined) | null): void;
2757
+ private static resolveCipher;
2289
2758
  /**
2290
2759
  * Load persisted queue from storage into state.
2291
- * Call once at app startup, before any flush or enqueue operations.
2292
2760
  */
2293
2761
  static init(): Promise<void>;
2294
2762
  /**
2295
2763
  * Set the storage backend. Call before init().
2296
- * Defaults to IndexedDB with fallback to LocalStorage → Memory.
2297
2764
  */
2298
2765
  static setStorageBackend(backend: EQueueStorage): void;
2299
2766
  static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
@@ -2303,26 +2770,21 @@ declare class RequestQueue {
2303
2770
  static onQueueFatalError(cb: (error: Error) => void): void;
2304
2771
  /**
2305
2772
  * 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
2773
  */
2309
2774
  static enqueue(operation: Omit<IQueuedOperation, 'id' | 'createdAt' | 'flushAttempts' | 'status'>): Promise<string>;
2310
2775
  static getQueue(tag?: string): IQueuedOperation[];
2311
2776
  static getDeadLetterQueue(tag?: string): IDeadLetterItem[];
2777
+ private static handleFlushFailure;
2312
2778
  /**
2313
- * Flush queued items in FIFO order.
2314
- * Stops on first failure. Refreshes registry for succeeded tags only.
2779
+ * Flush queued items in FIFO order. Stops on first failure.
2315
2780
  */
2316
2781
  static flushAll(options?: IFlushOptions): Promise<void>;
2317
2782
  /**
2318
2783
  * 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
2784
  */
2322
2785
  static flushOne(id: string): Promise<void>;
2323
2786
  /**
2324
2787
  * Move a dead-letter item back to the FRONT of the pending queue for retry.
2325
- * App should call flushAll() afterwards.
2326
2788
  */
2327
2789
  static retryOne(id: string): Promise<void>;
2328
2790
  /**
@@ -2331,7 +2793,6 @@ declare class RequestQueue {
2331
2793
  static discard(id: string): Promise<void>;
2332
2794
  /**
2333
2795
  * Reorder the pending queue by providing an ordered array of IDs.
2334
- * Fully permissive — causal ordering is the app's responsibility.
2335
2796
  */
2336
2797
  static reorder(ids: string[]): void;
2337
2798
  private static regenerateHeaders;
@@ -2386,9 +2847,9 @@ declare const applyOperator: (operator: string, rowValue: any, filterValue: any,
2386
2847
  /**
2387
2848
  * Normalizes standard and shorthand filter structures into a canonical IDataFilter tree.
2388
2849
  */
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: {
2850
+ declare const normalizeFilter: (filter: any) => IDataFilter | null;
2851
+ declare const evaluateFilter: (filter: IDataFilter | any, row: TDataRow, options?: INormalizeOptions) => boolean;
2852
+ declare const filterTreeData: (nodes: any[], filter: IDataFilter, options: {
2392
2853
  idKey: string;
2393
2854
  parentKey: string;
2394
2855
  normalizeOptions?: INormalizeOptions;
@@ -2396,7 +2857,7 @@ declare const filterTreeData: (nodes: any[], filter: IDataFilter$1, options: {
2396
2857
  visibleNodes: any[];
2397
2858
  expandedNodes: Set<string | number>;
2398
2859
  };
2399
- declare const filterData: (data: any[], filter: IDataFilter$1, options?: {
2860
+ declare const filterData: (data: any[], filter: IDataFilter, options?: {
2400
2861
  treeOptions?: {
2401
2862
  idKey: string;
2402
2863
  parentKey: string;
@@ -2410,7 +2871,7 @@ declare const filterData: (data: any[], filter: IDataFilter$1, options?: {
2410
2871
  declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2411
2872
  isEncryptedPayload: (payload: any) => boolean;
2412
2873
  extractFilterFieldNames: (filter: any) => string[];
2413
- normalizeFilter: (filter: any) => IDataFilter$1 | null;
2874
+ normalizeFilter: (filter: any) => IDataFilter | null;
2414
2875
  normalizeFilterValue: typeof normalizeFilterValue;
2415
2876
  foldAscii: typeof foldAscii;
2416
2877
  compareEqual: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
@@ -2418,8 +2879,8 @@ declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2418
2879
  compareContains: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
2419
2880
  compareValues: (rowValue: any, filterValue: any, options?: INormalizeOptions) => number;
2420
2881
  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: {
2882
+ evaluateFilter: (filter: IDataFilter | any, row: TDataRow, options?: INormalizeOptions) => boolean;
2883
+ filterTreeData: (nodes: any[], filter: IDataFilter, options: {
2423
2884
  idKey: string;
2424
2885
  parentKey: string;
2425
2886
  normalizeOptions?: INormalizeOptions;
@@ -2427,7 +2888,7 @@ declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2427
2888
  visibleNodes: any[];
2428
2889
  expandedNodes: Set<string | number>;
2429
2890
  };
2430
- filterData: (data: any[], filter: IDataFilter$1, options?: {
2891
+ filterData: (data: any[], filter: IDataFilter, options?: {
2431
2892
  treeOptions?: {
2432
2893
  idKey: string;
2433
2894
  parentKey: string;
@@ -2442,10 +2903,12 @@ declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
2442
2903
 
2443
2904
  interface ISortDataOptions {
2444
2905
  resolveValue?: (row: TDataRow, field: string) => any;
2906
+ rangeBuckets?: Record<string, TRangeBucketConfig>;
2907
+ locale?: string;
2445
2908
  }
2446
- declare const sortData: (sortList: IDataSort$1[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2909
+ declare const sortData: (sortList: IDataSort[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2447
2910
  declare const useSortLogic: () => {
2448
- sortData: (sortList: IDataSort$1[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2911
+ sortData: (sortList: IDataSort[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
2449
2912
  };
2450
2913
 
2451
2914
  interface IDebouncedFunction<T extends (...args: any[]) => any> {
@@ -2510,6 +2973,41 @@ declare function getAppRouter(): any;
2510
2973
  */
2511
2974
  declare function onPlatformReady(cb: () => void): void;
2512
2975
 
2976
+ /** Converts an optional AAD string or binary view into a non-empty `Uint8Array`. */
2977
+ declare function aadToBytes(aad?: string | Uint8Array | ArrayBuffer): Uint8Array | undefined;
2978
+ /** Decodes and concatenates Base64/binary ciphertext with an optional detached auth tag. */
2979
+ declare function combineCiphertextAndTag(ciphertext: Uint8Array | string, tag?: Uint8Array | string, expectedTagLength?: number, providerLabel?: string): Uint8Array;
2980
+ /** Serializes a JSON-compatible value into UTF-8 plaintext bytes for sealing. */
2981
+ declare function serializePlaintextToBytes(data: any): Uint8Array;
2982
+ /**
2983
+ * Decodes decrypted plaintext bytes into UTF-8, zeroes the plaintext buffer in `finally`,
2984
+ * and parses JSON while throwing a sanitized `SyntaxError` with zero plaintext leakage.
2985
+ */
2986
+ declare function parseDecryptedJsonSafely(decryptedBytes: ArrayBuffer | Uint8Array, providerLabel?: string): any;
2987
+ /** Normalizes low-level cipher/unwrap errors while preserving sanitized `SyntaxError` and tagged provider errors. */
2988
+ declare function normalizeDecryptError(err: any, providerLabel: string, fallbackMessage?: string): Error;
2989
+ type IAsymmetricSecurityDefaults = Pick<IBaseEncryptionProviderOptions, 'pinningStore' | 'pinEntityId' | 'pinningOptions' | 'senderSigningPrivateKey' | 'senderVerifyPublicKey' | 'requireSenderSignature'>;
2990
+ /**
2991
+ * Exhaustive tuple of constructor/keyring/KDF/policy/asymmetric-security keys
2992
+ * forwarded from `IProviderEncryptionOptions` to provider constructors.
2993
+ */
2994
+ 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"];
2995
+ /**
2996
+ * Exhaustive tuple of runtime operation keys forwarded from
2997
+ * `IProviderEncryptionOptions` into `IEncryptionContext`.
2998
+ */
2999
+ 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"];
3000
+ /** Extracts defined constructor options for `AEncryptionProvider` subclasses, preserving `kid || keyId` fallback. */
3001
+ declare function pickProviderOptions(options?: IProviderEncryptionOptions): IBaseEncryptionProviderOptions;
3002
+ /** Extracts defined `IEncryptionContext` fields from `IProviderEncryptionOptions` plus optional request/url metadata. */
3003
+ declare function pickEncryptionContext(options?: IProviderEncryptionOptions, overrides?: Pick<IEncryptionContext, 'url' | 'method' | 'isServer'>): IEncryptionContext;
3004
+
3005
+ interface IEncryptRecordSession {
3006
+ dispose?(): void;
3007
+ }
3008
+ interface IDecryptBatchSession {
3009
+ dispose?(): void;
3010
+ }
2513
3011
  /**
2514
3012
  * Foundational abstract base class for all Katlux encryption provider implementations.
2515
3013
  * Provides key storage, lifecycle management, reusable value-level traversal,
@@ -2521,178 +3019,81 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
2521
3019
  protected keys?: Record<string, TKeyProvider | IKeyPair>;
2522
3020
  protected activeKid?: string;
2523
3021
  protected allowedKids?: string[];
2524
- protected defaultAllowedAlgorithms: string[];
3022
+ protected allowedAlgorithms?: TEncryptionAlgorithm[];
3023
+ protected defaultAllowedAlgorithms: TEncryptionAlgorithm[];
2525
3024
  protected allowInsecureKdf?: boolean;
3025
+ protected allowUnboundAadFallback?: boolean;
2526
3026
  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
- */
3027
+ protected maxSaltDerivations?: number;
3028
+ protected pinningStore?: IKeyPinningStore;
3029
+ protected pinEntityId?: string;
3030
+ protected pinningOptions?: Partial<Omit<IVerifyAndPinOptions, 'store'>> & {
3031
+ store?: IKeyPinningStore;
3032
+ };
3033
+ protected senderSigningPrivateKey?: CryptoKey;
3034
+ protected senderVerifyPublicKey?: CryptoKey;
3035
+ protected requireSenderSignature?: boolean;
3036
+ protected _configuredKid?: string;
3037
+ protected _usesAsymmetricEnvelopeSignature: boolean;
3038
+ constructor(key?: TKeyProvider | IKeyPair | any, options?: IBaseEncryptionProviderOptions);
3039
+ protected _getAsymmetricSecurityDefaults(): IAsymmetricSecurityDefaults;
3040
+ /**
3041
+ * Enforces the symmetric KDF strategy allow-list (`pbkdf2`, `hkdf`, `none`)
3042
+ * and disallows `kdf: 'none'` for encryption or without `allowInsecureKdf: true` on decrypt.
3043
+ */
3044
+ protected _assertKdfAllowed(kdf: string, isEncrypt: boolean, options?: IEncryptionContext): void;
2539
3045
  setDefaultKey(key: TKeyProvider | IKeyPair): void;
2540
- /**
2541
- * Retrieves the currently configured default key or key provider callback.
2542
- */
2543
3046
  getDefaultKey(): TKeyProvider | IKeyPair | undefined;
2544
- /**
2545
- * Configures a keyring dictionary of keys with an optional active key identifier.
2546
- */
2547
3047
  setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
2548
- /**
2549
- * Retrieves the currently configured keyring dictionary.
2550
- */
2551
3048
  getKeyring(): Record<string, TKeyProvider | IKeyPair> | undefined;
2552
- /**
2553
- * Sets the active Key Identifier (kid) to use for outbound encryption.
2554
- */
2555
3049
  setActiveKid(kid: string): void;
2556
- /**
2557
- * Retrieves the active Key Identifier (kid).
2558
- */
2559
3050
  getActiveKid(): string | undefined;
2560
- /**
2561
- * Sets or updates the dedicated HMAC key or key provider callback for blind indexing.
2562
- */
2563
3051
  setHmacKey(key: TKeyProvider): void;
2564
- /**
2565
- * Retrieves the currently configured HMAC key or key provider callback.
2566
- */
2567
3052
  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
3053
  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
3054
  warmupKey(_options?: IEncryptionContext): Promise<void>;
2579
- /**
2580
- * Resolves raw key from keyProvider callback or defaultKey.
2581
- */
2582
3055
  protected resolveRawKey(keyProvider?: TKeyProvider | IKeyPair | any): Promise<TRawKey>;
2583
- /**
2584
- * Checks whether the given payload is an encrypted envelope.
2585
- */
2586
3056
  static isEncrypted(payload: any): boolean;
2587
- /**
2588
- * Checks whether the given payload is an encrypted envelope.
2589
- */
2590
3057
  isEncrypted(payload: any): boolean;
2591
- /**
2592
- * Clears configured keys and cached cryptographic material from memory.
2593
- */
2594
3058
  clearKeys(): void;
2595
- /**
2596
- * Alias for clearKeys() to conform with standard disposal patterns.
2597
- */
2598
3059
  dispose(): void;
2599
- /**
2600
- * ECMAScript Explicit Resource Management protocol (using / await using declarations).
2601
- */
2602
3060
  [Symbol.dispose](): void;
2603
3061
  [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
3062
  static normalizeUrl(rawUrl?: string): string;
2613
3063
  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
- */
3064
+ protected _resolveEffectiveAad(options?: IEncryptionContext, _isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
2627
3065
  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
3066
  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
- */
3067
+ protected _isRawKeyOrCryptoKey(key: any): boolean;
3068
+ protected _resolveStrictViolationKeys(record: Record<string, any>, targetKeys: string[], options?: IEncryptionContext): string[];
2637
3069
  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
- */
3070
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3071
+ protected _getDefaultFallbackKey(): TKeyProvider | IKeyPair | undefined;
2642
3072
  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
3073
  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
- */
3074
+ protected abstract _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3075
+ protected abstract _resolveEncryptKeyMaterial(options?: IEncryptionContext, session?: IEncryptRecordSession): Promise<any>;
3076
+ protected abstract _sealPayload(plaintextBytes: Uint8Array, keyMaterial: any, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3077
+ protected abstract _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<any>;
3078
+ protected abstract _unsealPayload(payload: IEncryptedPayload, keyMaterial: any, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<ArrayBuffer | Uint8Array>;
3079
+ protected _releaseEncryptKeyMaterial(_keyMaterial: any, _session?: IEncryptRecordSession): void;
3080
+ protected _releaseDecryptKeyMaterial(_keyMaterial: any, _session?: IDecryptBatchSession): void;
3081
+ protected _beginEncryptRecordSession(_options?: IEncryptionContext): Promise<IEncryptRecordSession | undefined>;
3082
+ protected _beginDecryptBatchSession(_options?: IEncryptionContext): IDecryptBatchSession | undefined;
3083
+ protected _prepareFieldDecryptContext(_item: Record<string, any>, _field: string, payload: IEncryptedPayload, options?: IEncryptionContext): {
3084
+ payload: IEncryptedPayload;
3085
+ options?: IEncryptionContext;
3086
+ };
3087
+ protected _finalizeDecryptedRecord(_item: Record<string, any>, _result: Record<string, any>, _options?: IEncryptionContext): void;
3088
+ private _encryptValueWithSession;
3089
+ private _decryptEnvelopeWithAadFallback;
3090
+ private _decryptValueWithSession;
3091
+ encryptValue(value: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3092
+ decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
2667
3093
  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
3094
  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
3095
  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
- */
3096
+ private _decryptRecordFields;
2696
3097
  decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
2697
3098
  }
2698
3099
  declare function normalizeUrl(rawUrl?: string): string;
@@ -2715,10 +3116,8 @@ declare function resolveSalt(salt?: Uint8Array | ArrayBuffer | string): Uint8Arr
2715
3116
  /**
2716
3117
  * Generates a random AES CryptoKey suitable for AES-GCM or AES-CBC.
2717
3118
  *
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.
3119
+ * Defaults to `extractable = false` so key material cannot be exported via
3120
+ * `exportKey`/`wrapKey` unless the caller explicitly opts in with `extractable: true`.
2722
3121
  */
2723
3122
  declare function generateAESKey(length?: 128 | 256, algorithm?: 'AES-GCM' | 'AES-CBC' | 'AES-KW', extractable?: boolean): Promise<CryptoKey>;
2724
3123
  /**
@@ -2852,6 +3251,27 @@ declare function deriveKeyFromSecret(secretKey: CryptoKey, options?: IHKDFFromSe
2852
3251
  */
2853
3252
  declare function deriveAuthAndEncryptionKeys(password: string | Uint8Array | ArrayBuffer, salt?: Uint8Array | ArrayBuffer | string, options?: IDeriveAuthAndEncryptionOptions): Promise<IDomainDerivedKeys>;
2854
3253
 
3254
+ /** Current blind-index HMAC framing protocol identifier (length-prefixed framing). */
3255
+ declare const BLIND_INDEX_FRAMING_VERSION = "lp1";
3256
+ /**
3257
+ * Parameters that determine blind-index token compatibility across writers and queries.
3258
+ */
3259
+ interface IBlindIndexSchemeOptions extends INormalizeOptions {
3260
+ /** Whether tokens omit field+type domain separation (default: false -> 'field-type') */
3261
+ legacyUnscopedTokens?: boolean;
3262
+ /** Framing protocol version (default: 'lp1') */
3263
+ framing?: 'lp1' | 'legacy-unframed';
3264
+ /** Whether `kid` is explicitly framed into HMAC input (default: false) */
3265
+ includeKidInHmac?: boolean;
3266
+ /** Optional explicit `kid` if passed to `computeBlindIndex` */
3267
+ kid?: string;
3268
+ }
3269
+ /**
3270
+ * Computes a canonical, deterministic scheme identifier covering HMAC framing, domain scope,
3271
+ * and normalization configuration (`locale`, `asciiFold`, `normalizerId`).
3272
+ * Persisting this identifier alongside blind-index columns makes normalization or scope drift detectable.
3273
+ */
3274
+ declare function computeBlindIndexSchemeId(options?: IBlindIndexSchemeOptions): string;
2855
3275
  declare const _bidxHmacKeyCache: Map<string, CryptoKey>;
2856
3276
  /**
2857
3277
  * Clears the in-memory memoization cache for derived blind-index HMAC CryptoKeys.
@@ -2885,22 +3305,30 @@ declare function verify(data: any | string | Uint8Array, signature: string, publ
2885
3305
  * Security Guarantees:
2886
3306
  * 1. Dedicated Key Requirement: Throws ERR_BIDX_MISSING_HMAC_KEY if keyMaterial is missing/undefined.
2887
3307
  * 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
3308
+ * Instead, it is stretched via PBKDF2 (default 600,000 iterations; lower to e.g. 100,000 on edge runtimes like
3309
+ * Cloudflare Workers) and expanded with HKDF using an independent salt ('katlux-blind-index-salt-v1') and explicit
2889
3310
  * domain separation info ('katlux-blind-index'). This prevents GPU dictionary attacks against the AES data key.
2890
3311
  * 3. Type Enforcement: If a CryptoKey is passed, enforces algorithm.name === 'HMAC'.
2891
3312
  */
2892
- declare function deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined): Promise<CryptoKey>;
3313
+ declare function deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined, options?: {
3314
+ kdfIterations?: number;
3315
+ maxAllowedIterations?: number;
3316
+ }): Promise<CryptoKey>;
2893
3317
  /**
2894
- * Computes a deterministic HMAC-SHA256 blind index hash for an arbitrary term using the supplied CryptoKey.
3318
+ * Computes a deterministic, length-prefixed, domain-separated HMAC-SHA256 blind index token.
2895
3319
  * Performs Unicode NFKC normalization, trimming, and lowercasing before computing the signature.
2896
3320
  *
2897
- * Enforces cryptographic domain separation:
2898
- * `token = HMAC("${kid ? kid + ':' : ''}${fieldName}:${tokenType}:${normalizedValue}", key)`
3321
+ * Enforces cryptographic domain separation and unambiguous length-prefixed framing:
3322
+ * `token = HMAC("${bytes(kid)}:${kid}|${bytes(field)}:${field}|${bytes(type)}:${type}|${bytes(val)}:${normalizedValue}", key)`
3323
+ *
3324
+ * Convention on `kid`: `IBlindIndexKeyring` writers (`computeWriteBlindIndex`, `reencryptField`, `CSearchIndex`)
3325
+ * and `rewriteEncryptedFilters` intentionally omit `kid` from HMAC input because each `kid` in a keyring already
3326
+ * maps to a distinct HMAC key. Pass `options.kid` explicitly only if multiple logical key IDs share one raw HMAC key.
2899
3327
  *
2900
3328
  * @param value - The input string, number, or object to compute the blind index for.
2901
3329
  * @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.
3330
+ * @param options - Normalization options and optional domain separation context ({ field?: string; type?: 'eq' | 'tri'; kid?: string; version?: string | number; versionTag?: string | boolean }).
3331
+ * @returns Lowercase hexadecimal HMAC-SHA256 blind index hash (or `${tag}:${hex}` when `versionTag` is enabled).
2904
3332
  */
2905
3333
  declare function computeBlindIndex(value: any, hmacKey: CryptoKey, options?: IBlindIndexOptions): Promise<string>;
2906
3334
  /**
@@ -3095,7 +3523,10 @@ declare class CKeyManager {
3095
3523
  static getKeyFingerprint(publicKey: CryptoKey | Uint8Array | ArrayBuffer | string): Promise<string>;
3096
3524
  static sign(data: any | string | Uint8Array, privateKey: CryptoKey): Promise<string>;
3097
3525
  static verify(data: any | string | Uint8Array, signature: string, publicKey: CryptoKey): Promise<boolean>;
3098
- static deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined): Promise<CryptoKey>;
3526
+ static deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined, options?: {
3527
+ kdfIterations?: number;
3528
+ maxAllowedIterations?: number;
3529
+ }): Promise<CryptoKey>;
3099
3530
  static computeBlindIndex(value: any, hmacKey: CryptoKey, options?: IBlindIndexOptions): Promise<string>;
3100
3531
  static signGrant(grant: IAccessGrant, granterPrivateKey: CryptoKey, granterPublicKey?: CryptoKey): Promise<ISignedGrant>;
3101
3532
  static verifyGrant(signedGrant: ISignedGrant, granterPublicKey: CryptoKey, options?: IVerifyGrantOptions): Promise<boolean>;
@@ -3120,6 +3551,7 @@ declare class CKeyManager {
3120
3551
  static validateBlindIndexKeyring(keyring: IBlindIndexKeyring): void;
3121
3552
  static computeMultiBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string[]>;
3122
3553
  static computeWriteBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string>;
3554
+ static computeBlindIndexSchemeId(options?: IBlindIndexSchemeOptions): string;
3123
3555
  }
3124
3556
 
3125
3557
  /**
@@ -3174,6 +3606,16 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
3174
3606
  * cross-tenant cache collisions and avoid storing secrets in heap Map keys.
3175
3607
  */
3176
3608
  declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
3609
+ declare const DEFAULT_KEY_CACHE_MAX_SIZE = 100;
3610
+ /**
3611
+ * Retrieves an entry from an LRU Map cache and refreshes its recency position.
3612
+ */
3613
+ declare function getLruCacheEntry<K, V>(cache: Map<K, V>, key: K): V | undefined;
3614
+ /**
3615
+ * Inserts or updates an entry in a bounded LRU Map cache, evicting the least-recently-used
3616
+ * entry if the cache has reached `maxSize`.
3617
+ */
3618
+ declare function setLruCacheEntry<K, V>(cache: Map<K, V>, key: K, value: V, maxSize?: number, onEvict?: (evictedKey: K, evictedValue: V) => void): void;
3177
3619
  /**
3178
3620
  * Detects whether an error thrown during ciphertext decryption is an authentication failure
3179
3621
  * (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
@@ -3195,21 +3637,110 @@ declare function isAuthOrDecryptionError(err: any): boolean;
3195
3637
  * standard ECMAScript number formatting (-0 serialized as 0), and detection of circular references.
3196
3638
  */
3197
3639
  declare function canonicalizeJson(value: any, seen?: Set<any>): string;
3640
+ declare const DEFAULT_PBKDF2_ITERATIONS = 600000;
3641
+ declare const DEFAULT_MAX_ALLOWED_ITERATIONS = 1000000;
3642
+ declare const DEFAULT_MAX_SALT_DERIVATIONS = 5;
3643
+ /**
3644
+ * Validates that a requested PBKDF2 iteration count does not exceed the configured ceiling.
3645
+ * Throws an Error with `code = 'ERR_EXCESSIVE_KDF_ITERATIONS'` when `iterations > maxAllowed`.
3646
+ */
3647
+ declare function assertMaxAllowedIterations(iterations: number, maxAllowed?: number, context?: string): void;
3648
+ /**
3649
+ * Resolves the effective PBKDF2 iteration count from override, per-call options,
3650
+ * provider defaults, and `DEFAULT_PBKDF2_ITERATIONS`, validates it against the
3651
+ * configured `maxAllowedIterations` ceiling, and clamps it to `[1000, maxAllowed]`.
3652
+ */
3653
+ declare function resolveAndClampPbkdf2Iterations(params: {
3654
+ iterationsOverride?: number;
3655
+ optionsIterations?: number;
3656
+ defaultIterations?: number;
3657
+ optionsMaxAllowed?: number;
3658
+ providerMaxAllowed?: number;
3659
+ context?: string;
3660
+ }): number;
3661
+ declare const SALT_BUDGET_SYM: unique symbol;
3662
+ interface ISaltDerivationBudget {
3663
+ maxDistinctSalts: number;
3664
+ hardCapSalts: number;
3665
+ strict: boolean;
3666
+ explicitLimit: boolean;
3667
+ seenSalts: Set<string>;
3668
+ queue: Promise<void>;
3669
+ }
3670
+ /**
3671
+ * Escapes AAD delimiter characters (`%`, `|`, `:`, `=`, `,`) so user-supplied
3672
+ * record IDs, field names, and context values cannot collide with canonical AAD structure.
3673
+ */
3674
+ declare function escapeAadComponent(value: string): string;
3675
+ /**
3676
+ * Extracts a record's primary key using standard Katlux primary key fallbacks
3677
+ * (`id`, `_id`, `uuid`, `key`), ignoring `null` and `undefined`.
3678
+ */
3679
+ declare function extractDefaultRowId(row: any): any;
3680
+ /**
3681
+ * Type-tags and delimiter-escapes an `aadFields` value so distinct JS types
3682
+ * (`null` vs `'null'`, `undefined` vs `''`, `7` vs `'7'`, objects) never collide.
3683
+ */
3684
+ declare function serializeAadFieldValue(val: any): string;
3685
+ /**
3686
+ * Builds the canonical framed AAD string shared by field encryption and batch re-encryption.
3687
+ */
3688
+ declare function buildCanonicalFieldAad(params: {
3689
+ data: any;
3690
+ field: string;
3691
+ baseAad?: string;
3692
+ explicitAad?: string;
3693
+ aadFields?: string[];
3694
+ recordId?: string | number;
3695
+ getRowId?: (row: any) => string | number | undefined;
3696
+ reqPart?: string;
3697
+ }): string;
3698
+ /**
3699
+ * Attaches a request/batch-scoped PBKDF2 distinct salt derivation budget to options
3700
+ * without adding enumerable string keys. Preserved across object-spread copies.
3701
+ */
3702
+ declare function attachSaltDerivationBudget<T extends Record<string, any> | undefined>(options: T, providerMaxSaltDerivations?: number): T & {
3703
+ [SALT_BUDGET_SYM]?: ISaltDerivationBudget;
3704
+ };
3705
+ declare function getSaltDerivationBudget(options?: Record<string, any>): ISaltDerivationBudget | undefined;
3706
+ /**
3707
+ * Synchronously claims a PBKDF2 salt derivation slot for `saltKey` within a request/batch budget.
3708
+ * Rejects with `ERR_KDF_SALT_LIMIT_EXCEEDED` when distinct uncached salts exceed the budget cap.
3709
+ */
3710
+ declare function claimSaltDerivationSlotSync(options: Record<string, any> | undefined, saltKey: string): void;
3711
+ /**
3712
+ * Acquires a PBKDF2 salt derivation slot for `saltKey` within a request/batch budget.
3713
+ * Rejects immediately under strict mode or explicit caps, and safely serializes non-strict
3714
+ * overflow bursts up to `hardCapSalts` before rejecting with `ERR_KDF_SALT_LIMIT_EXCEEDED`.
3715
+ */
3716
+ declare function acquireSaltDerivationSlot<R>(options: Record<string, any> | undefined, saltKey: string, task: () => Promise<R>): Promise<R>;
3717
+ /**
3718
+ * Runs an async key derivation task inside `acquireSaltDerivationSlot` when `useSlotBudget` is true,
3719
+ * or directly when no PBKDF2 salt-budget slot is needed.
3720
+ */
3721
+ declare function runWithSaltDerivationSlot<R>(useSlotBudget: boolean, options: Record<string, any> | undefined, saltKey: string, task: () => Promise<R>): Promise<R>;
3722
+ /**
3723
+ * Resolves a salt-scoped key derivation from an LRU Promise cache (bounded to `maxSize`, default 100),
3724
+ * wrapping new PBKDF2 derivations in `acquireSaltDerivationSlot` and evicting failed promises.
3725
+ */
3726
+ declare function resolveCachedSaltDerivation<T>(params: {
3727
+ cache: Map<string, Promise<T>>;
3728
+ compoundKey: string;
3729
+ deriveTask: () => Promise<T>;
3730
+ useSlotBudget: boolean;
3731
+ options?: Record<string, any>;
3732
+ onCacheHit?: () => void;
3733
+ maxSize?: number;
3734
+ }): Promise<T>;
3198
3735
 
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;
3736
+ interface IResolvedWebCryptoKey {
3737
+ cryptoKey: CryptoKey;
3738
+ salt?: string;
3739
+ kdf?: string;
3740
+ iter?: number;
3206
3741
  keyId?: string;
3207
- keys?: Record<string, TKeyProvider | IKeyPair>;
3208
- activeKid?: string;
3209
- allowedKids?: string[];
3210
- hmacKey?: TKeyProvider;
3211
- allowInsecureKdf?: boolean;
3212
- maxAllowedIterations?: number;
3742
+ }
3743
+ interface ICWebCryptoOptions extends IBaseEncryptionProviderOptions {
3213
3744
  }
3214
3745
  /**
3215
3746
  * Zero-dependency AES-256-GCM cipher provider using native Web Crypto API (crypto.subtle).
@@ -3224,18 +3755,18 @@ interface ICWebCryptoOptions {
3224
3755
  */
3225
3756
  declare class CWebCryptoEncryptionProvider extends AEncryptionProvider {
3226
3757
  private _defaultKdf;
3227
- private _allowInsecureKdf?;
3228
3758
  private _maxAllowedIterations?;
3229
3759
  private _cachedKey?;
3760
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3230
3761
  private _kdfOptions?;
3231
3762
  private _cachedSalt?;
3232
3763
  private _cachedKdf?;
3233
3764
  private _cachedIter?;
3234
3765
  private _cachedHash?;
3235
3766
  private _cachedKeyId?;
3236
- private _configuredKid?;
3237
3767
  private _decryptSaltCache;
3238
3768
  private _keyringCache;
3769
+ private _inflightKeyCache;
3239
3770
  setDefaultKey(key: TKeyProvider): void;
3240
3771
  clearKeys(): void;
3241
3772
  constructor(key?: TKeyProvider | IKeyPair, options?: ICWebCryptoOptions);
@@ -3247,29 +3778,22 @@ declare class CWebCryptoEncryptionProvider extends AEncryptionProvider {
3247
3778
  static isEncrypted(payload: any): boolean;
3248
3779
  isEncrypted(payload: any): boolean;
3249
3780
  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>;
3781
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3782
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext): Promise<IResolvedWebCryptoKey>;
3783
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IResolvedWebCryptoKey, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3784
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<CryptoKey>;
3785
+ protected _unsealPayload(payload: IEncryptedPayload, cryptoKey: CryptoKey, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3258
3786
  }
3259
3787
 
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;
3788
+ interface ICWebCryptoAESCBCOptions extends IBaseEncryptionProviderOptions {
3789
+ }
3790
+ interface IDerivedCBCKeys {
3791
+ encKey: CryptoKey;
3792
+ macKey: CryptoKey;
3793
+ salt?: string;
3794
+ kdf?: string;
3795
+ iter?: number;
3267
3796
  keyId?: string;
3268
- keys?: Record<string, TKeyProvider | IKeyPair | any>;
3269
- activeKid?: string;
3270
- allowedKids?: string[];
3271
- allowInsecureKdf?: boolean;
3272
- maxAllowedIterations?: number;
3273
3797
  }
3274
3798
  /**
3275
3799
  * Authenticated AES-CBC-256 provider with Encrypt-then-MAC (HMAC-SHA-256).
@@ -3282,16 +3806,15 @@ interface ICWebCryptoAESCBCOptions {
3282
3806
  */
3283
3807
  declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
3284
3808
  private _defaultKdf;
3285
- private _allowInsecureKdf?;
3286
3809
  private _maxAllowedIterations?;
3287
3810
  private _cachedEncKey?;
3811
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3288
3812
  private _cachedMacKey?;
3289
3813
  private _cachedSalt?;
3290
3814
  private _cachedKdf?;
3291
3815
  private _cachedIter?;
3292
3816
  private _cachedHash?;
3293
3817
  private _cachedKeyId?;
3294
- private _configuredKid?;
3295
3818
  private _kdfOptions?;
3296
3819
  private _decryptSaltCache;
3297
3820
  constructor(key?: TKeyProvider | IKeyPair | any, options?: ICWebCryptoAESCBCOptions);
@@ -3307,16 +3830,23 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
3307
3830
  private _deriveCBCKeysInternal;
3308
3831
  static isEncrypted(payload: any): boolean;
3309
3832
  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>;
3833
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3834
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext): Promise<IDerivedCBCKeys>;
3835
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IDerivedCBCKeys, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
3836
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<IDerivedCBCKeys>;
3837
+ protected _unsealPayload(payload: IEncryptedPayload, keyMaterial: IDerivedCBCKeys, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3318
3838
  }
3319
3839
 
3840
+ interface IRsaKeyMaterial extends IEncryptRecordSession {
3841
+ dataKey: CryptoKey;
3842
+ wrappedKeyBase64: string;
3843
+ alg: string;
3844
+ kid?: string;
3845
+ sharedKey: boolean;
3846
+ }
3847
+ interface IRsaDecryptBatchSession extends IDecryptBatchSession {
3848
+ keyCache: Map<string, Promise<CryptoKey>>;
3849
+ }
3320
3850
  /**
3321
3851
  * Asymmetric / Hybrid encryption provider combining RSA-OAEP (2048/4096-bit) with AES-GCM-256.
3322
3852
  *
@@ -3335,21 +3865,18 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
3335
3865
  * authenticated symmetric role keys (AES-GCM) governed by database role permissions.
3336
3866
  */
3337
3867
  declare class CRSAEncryptionProvider extends AEncryptionProvider {
3868
+ protected _usesAsymmetricEnvelopeSignature: boolean;
3338
3869
  private publicKey?;
3339
3870
  private privateKey?;
3871
+ protected _getDefaultFallbackKey(): TKeyProvider | IKeyPair | undefined;
3340
3872
  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);
3873
+ constructor(publicKeyOrPair?: CryptoKey | IKeyPair | (IBaseEncryptionProviderOptions & Pick<IEncryptionOperationOptions, 'publicKey' | 'privateKey' | 'recipientPublicKey' | 'recipientPrivateKey'>), privateKey?: CryptoKey);
3347
3874
  setPublicKey(key: CryptoKey): void;
3348
3875
  getPublicKey(): CryptoKey | undefined;
3349
3876
  setPrivateKey(key: CryptoKey): void;
3350
3877
  getPrivateKey(): CryptoKey | undefined;
3351
3878
  clearKeys(): void;
3352
- static generateKeyPair(bits?: 2048 | 4096): Promise<IKeyPair>;
3879
+ static generateKeyPair(bits?: 2048 | 4096, extractable?: boolean): Promise<IKeyPair>;
3353
3880
  static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
3354
3881
  static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
3355
3882
  static importPublicKey(jwk: JsonWebKey): Promise<CryptoKey>;
@@ -3360,18 +3887,33 @@ declare class CRSAEncryptionProvider extends AEncryptionProvider {
3360
3887
  static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
3361
3888
  static isEncrypted(payload: any): boolean;
3362
3889
  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>;
3890
+ private _resolvePublicKeyAndKid;
3891
+ private _resolvePrivateKeyForDecrypt;
3892
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3893
+ private _createEphemeralRsaKeyMaterial;
3894
+ protected _beginEncryptRecordSession(options?: IEncryptionContext): Promise<IRsaKeyMaterial>;
3895
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext, session?: IEncryptRecordSession): Promise<IRsaKeyMaterial>;
3896
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IRsaKeyMaterial, aadBytes: Uint8Array | undefined): Promise<IEncryptedPayload>;
3897
+ protected _beginDecryptBatchSession(): IRsaDecryptBatchSession;
3898
+ protected _prepareFieldDecryptContext(item: Record<string, any>, _field: string, payload: IEncryptedPayload, options?: IEncryptionContext): {
3899
+ payload: IEncryptedPayload;
3900
+ options?: IEncryptionContext;
3901
+ };
3902
+ protected _finalizeDecryptedRecord(item: Record<string, any>, result: Record<string, any>): void;
3903
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<CryptoKey>;
3904
+ protected _unsealPayload(payload: IEncryptedPayload, dataKey: CryptoKey, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3373
3905
  }
3374
3906
 
3907
+ interface IEcdhKeyMaterial extends IEncryptRecordSession {
3908
+ dataKey: CryptoKey;
3909
+ epkJwk: JsonWebKey;
3910
+ saltBase64: string;
3911
+ alg: string;
3912
+ kid?: string;
3913
+ }
3914
+ interface IEcdhDecryptBatchSession extends IDecryptBatchSession {
3915
+ keyCache: Map<string, Promise<CryptoKey>>;
3916
+ }
3375
3917
  type TECDHCurve = 'P-256' | 'P-384' | 'P-521';
3376
3918
  /**
3377
3919
  * Modern Asymmetric / Hybrid encryption provider using ECDH (Elliptic Curve Diffie-Hellman)
@@ -3392,24 +3934,20 @@ type TECDHCurve = 'P-256' | 'P-384' | 'P-521';
3392
3934
  * or use authenticated symmetric role keys (AES-GCM) managed via database role permissions.
3393
3935
  */
3394
3936
  declare class CECDHEncryptionProvider extends AEncryptionProvider {
3937
+ protected _usesAsymmetricEnvelopeSignature: boolean;
3395
3938
  private recipientPublicKey?;
3396
3939
  private recipientPrivateKey?;
3940
+ protected _getDefaultFallbackKey(): TKeyProvider | IKeyPair | undefined;
3397
3941
  private curve;
3398
3942
  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);
3943
+ constructor(recipientPublicKeyOrPair?: CryptoKey | IKeyPair | (IBaseEncryptionProviderOptions & Pick<IEncryptionOperationOptions, 'publicKey' | 'privateKey' | 'recipientPublicKey' | 'recipientPrivateKey' | 'curve'>), recipientPrivateKey?: CryptoKey, curve?: TECDHCurve);
3406
3944
  setRecipientPublicKey(key: CryptoKey): void;
3407
3945
  getRecipientPublicKey(): CryptoKey | undefined;
3408
3946
  setRecipientPrivateKey(key: CryptoKey): void;
3409
3947
  getRecipientPrivateKey(): CryptoKey | undefined;
3410
3948
  getCurve(): TECDHCurve;
3411
3949
  clearKeys(): void;
3412
- static generateKeyPair(curve?: TECDHCurve): Promise<IKeyPair>;
3950
+ static generateKeyPair(curve?: TECDHCurve, extractable?: boolean): Promise<IKeyPair>;
3413
3951
  static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
3414
3952
  static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
3415
3953
  static importPublicKey(jwk: JsonWebKey, curve?: TECDHCurve): Promise<CryptoKey>;
@@ -3420,44 +3958,31 @@ declare class CECDHEncryptionProvider extends AEncryptionProvider {
3420
3958
  static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
3421
3959
  static isEncrypted(payload: any): boolean;
3422
3960
  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>;
3961
+ private _resolvePublicKeyAndKid;
3962
+ private _resolvePrivateKeyForDecrypt;
3963
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
3964
+ private _createEphemeralEcdhKeyMaterial;
3965
+ protected _beginEncryptRecordSession(options?: IEncryptionContext): Promise<IEcdhKeyMaterial>;
3966
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext, session?: IEncryptRecordSession): Promise<IEcdhKeyMaterial>;
3967
+ protected _sealPayload(plaintextBytes: Uint8Array, keyMaterial: IEcdhKeyMaterial, aadBytes: Uint8Array | undefined): Promise<IEncryptedPayload>;
3968
+ protected _beginDecryptBatchSession(): IEcdhDecryptBatchSession;
3969
+ private _deriveDecryptionKeyWithPrivKey;
3970
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<CryptoKey>;
3971
+ protected _unsealPayload(payload: IEncryptedPayload, dataKey: CryptoKey, aadBytes: Uint8Array | undefined): Promise<ArrayBuffer>;
3445
3972
  }
3446
3973
 
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;
3974
+ interface ICachedNodeKeyEntry {
3975
+ key: Buffer;
3976
+ salt?: string;
3977
+ kdf?: string;
3978
+ iter?: number;
3979
+ }
3980
+
3981
+ interface INodeDecryptBatchSession extends IDecryptBatchSession {
3982
+ keyCache: Map<string, Promise<Buffer>>;
3983
+ tempBuffers: Set<Buffer>;
3984
+ }
3985
+ interface ICNodeCryptoOptions extends IBaseEncryptionProviderOptions {
3461
3986
  }
3462
3987
  /**
3463
3988
  * Server-side synchronous AES-GCM-256 encryption provider using Node.js native `node:crypto`.
@@ -3470,53 +3995,45 @@ interface ICNodeCryptoOptions {
3470
3995
  * (`encrypt`, `decrypt`) methods for Nitro routes, worker threads, and CLI tools.
3471
3996
  */
3472
3997
  declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3473
- /**
3474
- * Cryptographically secure random bytes generator for Node.js.
3475
- */
3476
3998
  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;
3999
+ static createDecipheriv(algorithm: string, key: NodeCrypto.CipherKey, iv: NodeCrypto.BinaryLike | null, options?: NodeCrypto.CipherCCMOptions): NodeCrypto.DecipherGCM;
3481
4000
  private _defaultKdf;
3482
- private _allowInsecureKdf?;
3483
4001
  private _maxAllowedIterations?;
3484
4002
  private _kdfOptions?;
3485
4003
  private _cachedKey?;
4004
+ protected _getActiveDecryptionKey(): TKeyProvider | IKeyPair | undefined;
3486
4005
  private _cachedSalt?;
3487
4006
  private _cachedKdf?;
3488
4007
  private _cachedIter?;
3489
4008
  private _cachedHash?;
3490
4009
  private _cachedKeyId?;
3491
- private _configuredKid?;
3492
4010
  private _keyringCache;
3493
4011
  private _decryptSaltCache;
3494
4012
  private _inFlightSaltDerivations;
4013
+ constructor(key?: TKeyProvider | IKeyPair, options?: ICNodeCryptoOptions);
3495
4014
  private isKeyRetained;
4015
+ private _wipeCachedBuffers;
3496
4016
  setDefaultKey(key: TKeyProvider): void;
3497
4017
  clearKeys(): void;
3498
4018
  setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
4019
+ private _setPrimaryCached;
4020
+ private _setKeyringCached;
4021
+ private _setDecryptSaltCached;
3499
4022
  warmupKey(options?: IEncryptionContext): Promise<void>;
3500
- /**
3501
- * Synchronously pre-derives and caches the encryption key for subsequent synchronous operations.
3502
- */
3503
4023
  warmupKeySync(options?: IEncryptionContext): void;
3504
- private resolveInfoBuffer;
3505
- constructor(key?: TKeyProvider | IKeyPair, options?: ICNodeCryptoOptions);
3506
4024
  private resolveRawKeySync;
3507
4025
  private resolveRawKeyAsync;
4026
+ private _resolveCachedOrRawBuffer;
4027
+ private _recordDerivedKey;
3508
4028
  private deriveKeySync;
3509
4029
  private deriveKeyAsync;
3510
4030
  static isEncrypted(payload: any): boolean;
3511
4031
  isEncrypted(payload: any): boolean;
3512
- /**
3513
- * Synchronously encrypts a single value into an AES-GCM envelope using Node.js crypto.
3514
- */
4032
+ protected _assertSupportedEnvelopeAlgorithm(alg?: string): void;
4033
+ private _validateDecryptPreconditions;
4034
+ private _decryptEnvelopeSyncWithAadFallback;
4035
+ private _decryptFieldPayloadSyncWithKey;
3515
4036
  encryptValueSync(data: any, options?: IEncryptionContext): IEncryptedPayload;
3516
- private decryptCiphertextWithKey;
3517
- /**
3518
- * Synchronously decrypts a single AES-GCM envelope back into its plaintext.
3519
- */
3520
4037
  decryptValueSync(payload: IEncryptedPayload, options?: IEncryptionContext): any;
3521
4038
  encryptSync(data: any, options?: IEncryptionContext): any;
3522
4039
  private _decryptRowSync;
@@ -3525,10 +4042,13 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3525
4042
  decryptFieldsSync(data: any, fields: string[], options?: IEncryptionContext): any;
3526
4043
  encryptFields(data: any, fields: string[]): Promise<any>;
3527
4044
  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>;
4045
+ protected _resolveEncryptKeyMaterial(options?: IEncryptionContext): Promise<ICachedNodeKeyEntry>;
4046
+ protected _releaseEncryptKeyMaterial(derived: ICachedNodeKeyEntry): void;
4047
+ protected _sealPayload(plaintextBytes: Uint8Array, derived: ICachedNodeKeyEntry, aadBytes: Uint8Array | undefined, options?: IEncryptionContext): Promise<IEncryptedPayload>;
4048
+ protected _beginDecryptBatchSession(): INodeDecryptBatchSession;
4049
+ protected _resolveDecryptKeyMaterial(payload: IEncryptedPayload, options?: IEncryptionContext, session?: IDecryptBatchSession): Promise<Buffer>;
4050
+ protected _releaseDecryptKeyMaterial(key: Buffer, session?: IDecryptBatchSession): void;
4051
+ protected _unsealPayload(payload: IEncryptedPayload, key: Buffer, aadBytes: Uint8Array | undefined): Promise<Buffer>;
3532
4052
  }
3533
4053
 
3534
4054
  /**
@@ -3565,6 +4085,14 @@ interface IStreamEncryptionOptions {
3565
4085
  * Allowed range: 4096 (4 KiB) to 4194304 (4 MiB).
3566
4086
  */
3567
4087
  chunkSize?: number;
4088
+ /**
4089
+ * PBKDF2 iteration count when `key` is a human passphrase. Default: DEFAULT_PBKDF2_ITERATIONS (600,000).
4090
+ */
4091
+ kdfIterations?: number;
4092
+ /**
4093
+ * Maximum allowed PBKDF2 iteration count ceiling. Default: DEFAULT_MAX_ALLOWED_ITERATIONS (1,000,000).
4094
+ */
4095
+ maxAllowedIterations?: number;
3568
4096
  }
3569
4097
  interface IStreamDecryptionOptions {
3570
4098
  /**
@@ -3579,6 +4107,14 @@ interface IStreamDecryptionOptions {
3579
4107
  * Alias for keyring to maintain consistency with IProviderEncryptionOptions.
3580
4108
  */
3581
4109
  keys?: Record<string, TKeyProvider | IKeyPair>;
4110
+ /**
4111
+ * PBKDF2 iteration count when `key` or keyring entry is a human passphrase. Default: DEFAULT_PBKDF2_ITERATIONS (600,000).
4112
+ */
4113
+ kdfIterations?: number;
4114
+ /**
4115
+ * Maximum allowed PBKDF2 iteration count ceiling. Default: DEFAULT_MAX_ALLOWED_ITERATIONS (1,000,000).
4116
+ */
4117
+ maxAllowedIterations?: number;
3582
4118
  }
3583
4119
  interface IStreamWithBufferMetric<I, O> extends TransformStream<I, O> {
3584
4120
  /**
@@ -3676,14 +4212,13 @@ declare const CKeyPinningStore: {
3676
4212
  * @param filters - Single IDataFilter or array of filters
3677
4213
  * @param options - Configuration mapping fields to blind index keyrings, trigrams, and range buckets
3678
4214
  */
3679
- declare function rewriteEncryptedFilters(filters: IDataFilter$1 | IDataFilter$1[], options: IEncryptedFilterRewriteOptions): Promise<IRewrittenEncryptedFilters>;
4215
+ declare function rewriteEncryptedFilters(filters: IDataFilter | IDataFilter[], options: IEncryptedFilterRewriteOptions): Promise<IRewrittenEncryptedFilters>;
3680
4216
 
3681
4217
  /**
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.
4218
+ * Builds standard contextual AAD string matching Katlux AEAD convention.
4219
+ * Prioritizes explicit `recordId`, then `getRowId(row)`, then standard PK fallbacks (`id`, `_id`, `uuid`, `key`).
3686
4220
  */
4221
+ declare function buildAadString(row: any, field: string, baseAad?: string, aadFields?: string[], recordId?: string | number, getRowId?: (row: any) => string | number | undefined): string;
3687
4222
 
3688
4223
  /**
3689
4224
  * Re-encrypts an array of row objects in memory, selectively updating fields that
@@ -3694,6 +4229,20 @@ declare function rewriteEncryptedFilters(filters: IDataFilter$1 | IDataFilter$1[
3694
4229
  * @returns Batch processing result detailing modified rows, patches, and metrics
3695
4230
  */
3696
4231
  declare function reencryptBatch<TRow = any>(rows: TRow[], options: IReencryptBatchOptions<TRow>): Promise<IReencryptBatchResult<TRow>>;
4232
+
4233
+ /**
4234
+ * Determines whether a row's persisted blind-index or trigram tokens for `field` are stale
4235
+ * relative to `tokenVersion`, `versionTag`, `schemeId`, or `staleTokenVersions`.
4236
+ */
4237
+ declare function isFieldBlindIndexStale<TRow>(row: TRow, field: string, options: IReencryptBatchOptions<TRow>): boolean;
4238
+
4239
+ /**
4240
+ * Katlux Batch Re-Encryption & Key Migration Orchestrator
4241
+ *
4242
+ * Implements storage-agnostic, memory-bounded batch re-encryption and
4243
+ * key migration pipelines for persistent datasets across key rotation lifecycles.
4244
+ */
4245
+
3697
4246
  /**
3698
4247
  * Universal storage-agnostic orchestrator for executing memory-bounded batch
3699
4248
  * re-encryption across database tables or remote datasets with optimistic concurrency.
@@ -3703,6 +4252,103 @@ declare function reencryptBatch<TRow = any>(rows: TRow[], options: IReencryptBat
3703
4252
  */
3704
4253
  declare function reencryptDataset<TRow = any>(options: IReencryptDatasetOptions<TRow>): Promise<IMigrationSummary>;
3705
4254
 
4255
+ /**
4256
+ * Default minimum numeric bucket width enforced for non-sensitive fields to prevent
4257
+ * micro-bucketing (which approaches 1:1 deterministic equality leakage / exact value recovery).
4258
+ */
4259
+ declare const DEFAULT_MIN_BUCKET_STEP = 100;
4260
+ /**
4261
+ * High-sensitivity personal and demographic fields where deterministic shadow-bucket
4262
+ * range indexes are prohibited by default (`ERR_RANGE_BUCKET_SENSITIVE_FIELD`) unless
4263
+ * `allowSensitiveBucket: true` is explicitly configured and per-class floors are respected.
4264
+ */
4265
+ declare const SENSITIVE_RANGE_BUCKET_FIELDS: readonly string[];
4266
+ interface ISensitiveFieldPolicyRule {
4267
+ readonly classification: 'financial' | 'identifier' | 'creditScore' | 'age' | 'sensitiveDate';
4268
+ readonly minStep?: number;
4269
+ readonly allowedGranularities?: readonly TDateBucketGranularity[];
4270
+ }
4271
+ /**
4272
+ * Per-class range bucket security policy (`rangeBucketPolicy`).
4273
+ *
4274
+ * Sensitive fields throw `ERR_RANGE_BUCKET_SENSITIVE_FIELD` by default unless `allowSensitiveBucket: true`
4275
+ * is explicitly set. Even with `allowSensitiveBucket: true`, each class enforces a minimum floor
4276
+ * (cannot be weakened by `minStep`) unless `allowNarrowStep: true` / `allowNarrowGranularity: true` is passed.
4277
+ */
4278
+ declare const RANGE_BUCKET_POLICY: {
4279
+ readonly defaultMinStep: 100;
4280
+ readonly classes: {
4281
+ readonly financial: {
4282
+ readonly fields: Set<string>;
4283
+ readonly minStep: 10000;
4284
+ };
4285
+ readonly identifier: {
4286
+ readonly fields: Set<string>;
4287
+ readonly minStep: 1000000;
4288
+ };
4289
+ readonly creditScore: {
4290
+ readonly fields: Set<string>;
4291
+ readonly minStep: 100;
4292
+ };
4293
+ readonly age: {
4294
+ readonly fields: Set<string>;
4295
+ readonly minStep: 10;
4296
+ };
4297
+ readonly sensitiveDate: {
4298
+ readonly fields: Set<string>;
4299
+ readonly allowedGranularities: readonly TDateBucketGranularity[];
4300
+ };
4301
+ };
4302
+ };
4303
+ /** Alias for `RANGE_BUCKET_POLICY`. */
4304
+ declare const rangeBucketPolicy: {
4305
+ readonly defaultMinStep: 100;
4306
+ readonly classes: {
4307
+ readonly financial: {
4308
+ readonly fields: Set<string>;
4309
+ readonly minStep: 10000;
4310
+ };
4311
+ readonly identifier: {
4312
+ readonly fields: Set<string>;
4313
+ readonly minStep: 1000000;
4314
+ };
4315
+ readonly creditScore: {
4316
+ readonly fields: Set<string>;
4317
+ readonly minStep: 100;
4318
+ };
4319
+ readonly age: {
4320
+ readonly fields: Set<string>;
4321
+ readonly minStep: 10;
4322
+ };
4323
+ readonly sensitiveDate: {
4324
+ readonly fields: Set<string>;
4325
+ readonly allowedGranularities: readonly TDateBucketGranularity[];
4326
+ };
4327
+ };
4328
+ };
4329
+ /**
4330
+ * Options controlling bucket width validation, sensitive-field opt-in, and narrow-bucket opt-in behavior.
4331
+ */
4332
+ interface IRangeBucketValidationOptions {
4333
+ minStep?: number;
4334
+ minBucketWidth?: number;
4335
+ allowNarrowStep?: boolean;
4336
+ allowNarrowGranularity?: boolean;
4337
+ /** Explicit opt-in required to use range bucketing on fields in `SENSITIVE_RANGE_BUCKET_FIELDS`. */
4338
+ allowSensitiveBucket?: boolean;
4339
+ }
4340
+ /**
4341
+ * Validates a range bucket configuration against `rangeBucketPolicy` sensitivity and per-class floor rules.
4342
+ *
4343
+ * - Throws `ERR_RANGE_BUCKET_SENSITIVE_FIELD` for fields in `SENSITIVE_RANGE_BUCKET_FIELDS` unless
4344
+ * `allowSensitiveBucket: true` is set on `config` or `options`.
4345
+ * - Throws `ERR_BUCKET_STEP_TOO_NARROW` when a numeric bucket width/gap is below the effective floor
4346
+ * (per-class floor for sensitive fields, or `minStep` / `DEFAULT_MIN_BUCKET_STEP` = 100 otherwise)
4347
+ * unless `allowNarrowStep: true` is explicitly set (and `step > 0`).
4348
+ * - Throws `ERR_BUCKET_STEP_TOO_NARROW` when a sensitive date field uses fine granularity (`'month'`, `'week'`, `'day'`)
4349
+ * unless `allowNarrowGranularity: true` is explicitly set.
4350
+ */
4351
+ declare function validateRangeBucketConfig(config: TRangeBucketConfig, fieldName?: string, options?: IRangeBucketValidationOptions): void;
3706
4352
  /**
3707
4353
  * Safely parses any date string, Unix timestamp (in seconds or ms), or Date instance.
3708
4354
  */
@@ -3711,11 +4357,15 @@ declare function parseDateValue(val: any): Date | null;
3711
4357
  * Safely parses numbers from numbers or numeric strings (including currency/commas).
3712
4358
  */
3713
4359
  declare function parseNumericValue(val: any): number | null;
4360
+ type TDirectBucketValidationArg = string | (IRangeBucketValidationOptions & {
4361
+ fieldName?: string;
4362
+ });
3714
4363
  /**
3715
4364
  * Computes a deterministic string shadow bucket key for a date or timestamp.
3716
4365
  * Supported granularities: 'year', 'quarter', 'month', 'week', 'day'.
4366
+ * Validates sensitive-field and granularity rules when `fieldName` or `options` are provided.
3717
4367
  */
3718
- declare function computeDateBucket(val: any, granularity?: TDateBucketGranularity): string | undefined;
4368
+ declare function computeDateBucket(val: any, granularity?: TDateBucketGranularity, optionsOrFieldName?: TDirectBucketValidationArg, maybeOptions?: IRangeBucketValidationOptions): string | undefined;
3719
4369
  /**
3720
4370
  * Resolves the bounding interval [min, max] (in UTC milliseconds) for a given date bucket key.
3721
4371
  */
@@ -3725,8 +4375,10 @@ declare function getDateBucketRange(bucketKey: string, granularity?: TDateBucket
3725
4375
  } | null;
3726
4376
  /**
3727
4377
  * Computes a stepped numeric shadow bucket key (e.g. 10000 step -> '0-9999', '10000-19999').
4378
+ * Enforces `rangeBucketPolicy` sensitive-field checks and per-class minimum floors
4379
+ * (`DEFAULT_MIN_BUCKET_STEP` = 100 for non-sensitive fields) unless overridden via options.
3728
4380
  */
3729
- declare function computeSteppedBucket(val: any, step: number, min?: number): string | undefined;
4381
+ declare function computeSteppedBucket(val: any, step: number, min?: number, optionsOrFieldName?: TDirectBucketValidationArg, maybeOptions?: IRangeBucketValidationOptions): string | undefined;
3730
4382
  /**
3731
4383
  * Resolves the numeric interval [min, max] for a stepped bucket key.
3732
4384
  */
@@ -3736,8 +4388,9 @@ declare function getSteppedBucketRange(bucketKey: string, step?: number): {
3736
4388
  } | null;
3737
4389
  /**
3738
4390
  * Computes a threshold / tier shadow bucket key (e.g. [0, 25000, 50000] -> '<0', '0-24999', '25000-49999', '>=50000').
4391
+ * Enforces `rangeBucketPolicy` sensitive-field checks and per-class minimum threshold gap floors.
3739
4392
  */
3740
- declare function computeTierBucket(val: any, rawThresholds: number[]): string | undefined;
4393
+ declare function computeTierBucket(val: any, rawThresholds: number[], optionsOrFieldName?: TDirectBucketValidationArg, maybeOptions?: IRangeBucketValidationOptions): string | undefined;
3741
4394
  /**
3742
4395
  * Resolves the numeric interval [min, max] for a tier bucket key.
3743
4396
  */
@@ -3745,10 +4398,16 @@ declare function getTierBucketRange(bucketKey: string, rawThresholds: number[]):
3745
4398
  min: number;
3746
4399
  max: number;
3747
4400
  } | null;
4401
+ /**
4402
+ * Computes a shadow range bucket key without re-running config validation (for internal loops
4403
+ * where config has already been validated at setup time).
4404
+ */
4405
+ declare function computeRangeBucketUnchecked(val: any, config: TRangeBucketConfig): string | undefined;
3748
4406
  /**
3749
4407
  * Computes a shadow range bucket key for any value according to its configuration.
4408
+ * Validates the configuration via `validateRangeBucketConfig`.
3750
4409
  */
3751
- declare function computeRangeBucket(val: any, config: TRangeBucketConfig): string | undefined;
4410
+ declare function computeRangeBucket(val: any, config: TRangeBucketConfig, fieldName?: string, options?: IRangeBucketValidationOptions): string | undefined;
3752
4411
  /**
3753
4412
  * Resolves the bounding interval [min, max] for any bucket key and configuration.
3754
4413
  */
@@ -3757,19 +4416,57 @@ declare function getRangeBucketRange(bucketKey: string, config: TRangeBucketConf
3757
4416
  max: number;
3758
4417
  } | null;
3759
4418
  /**
3760
- * Resolves the set of eligible shadow bucket keys that satisfy a given range comparison query.
4419
+ * Comparator for stepped numeric shadow bucket keys (e.g. `'25000-49999'` vs `'100000-124999'`).
4420
+ * Orders buckets mathematically by their lower bound (and upper bound as tie-breaker) rather than ASCII order.
4421
+ */
4422
+ declare function compareSteppedBuckets(a: string, b: string): number;
4423
+ /**
4424
+ * Compares two shadow bucket values (or resolved sort values) numerically/chronologically
4425
+ * using the configured TRangeBucketConfig (supports stepped, tier, and date buckets).
4426
+ */
4427
+ declare function compareRangeBuckets(a: any, b: any, config?: TRangeBucketConfig): number;
4428
+ /**
4429
+ * Checks whether an interval [min, max] satisfies the given query comparison operator and target value.
4430
+ */
4431
+ declare function isIntervalMatchingOperator(interval: {
4432
+ min: number;
4433
+ max: number;
4434
+ }, operator: string, targetVal: any, isDate: boolean): boolean;
4435
+ /**
4436
+ * Checks whether an interval [min, max] fully satisfies the given query comparison operator and target value
4437
+ * across all points in the interval (i.e. every point in [min, max] satisfies the condition).
4438
+ */
4439
+ declare function isIntervalFullyMatchingOperator(interval: {
4440
+ min: number;
4441
+ max: number;
4442
+ }, operator: string, targetVal: any, isDate: boolean): boolean;
4443
+ /**
4444
+ * Resolves the complete set of eligible shadow bucket keys that satisfy a given range comparison query.
4445
+ *
4446
+ * Sound-or-throw contract:
4447
+ * - Never silently truncates open-ended stepped or date queries.
4448
+ * - When `knownBuckets` is omitted for open-ended queries (`>`, `>=`, `<`, `<=`, `!=`, `nin`),
4449
+ * requires explicit domain bounds (`min`/`floor` and/or `max`/`ceiling` for stepped; `minDate`/`maxDate` for date)
4450
+ * and throws `ERR_BUCKET_RANGE_UNBOUNDED` if the required bound is absent.
3761
4451
  *
3762
- * @param operator - Range operator: '>', '>=', '<', '<=', 'between', '==', '!=', 'in'
4452
+ * @param operator - Range operator: '>', '>=', '<', '<=', 'between', '==', '!=', 'in', 'nin'
3763
4453
  * @param targetValue - Plaintext target comparison value (number, date string, timestamp, or tuple for between)
3764
4454
  * @param config - Range bucketing configuration ('date', 'stepped', or 'tier')
3765
4455
  * @param knownBuckets - Optional iterable of all unique bucket keys present in the indexed dataset
3766
4456
  */
3767
- declare function resolveBucketsForRange(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>): Set<string>;
4457
+ declare function resolveBucketsForRangeUnchecked(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>): Set<string>;
4458
+ /**
4459
+ * Resolves all candidate shadow bucket keys for a filter operator and target value.
4460
+ * Validates the range bucket configuration via `validateRangeBucketConfig` (enforcing
4461
+ * `ERR_RANGE_BUCKET_SENSITIVE_FIELD` and `ERR_BUCKET_STEP_TOO_NARROW`) and enforces the
4462
+ * sound-or-throw range contract (`ERR_BUCKET_RANGE_UNBOUNDED`).
4463
+ */
4464
+ declare function resolveBucketsForRange(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>, fieldName?: string, options?: IRangeBucketValidationOptions): Set<string>;
3768
4465
 
3769
4466
  /**
3770
4467
  * Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
3771
4468
  */
3772
4469
  declare function isEncrypted(payload: any): boolean;
3773
4470
 
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 };
4471
+ 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, 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 };
4472
+ 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 };