@katlux/providers 0.1.1-alpha.131 → 0.1.1-alpha.133
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.cjs +8386 -3322
- package/dist/index.d.cts +1328 -627
- package/dist/index.d.mts +1328 -627
- package/dist/index.d.ts +1328 -627
- package/dist/index.mjs +8309 -3321
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { H3Event } from 'h3';
|
|
2
|
+
import * as crypto from 'node:crypto';
|
|
3
|
+
|
|
1
4
|
declare enum EDataFilterOperator {
|
|
2
5
|
Equal = "==",
|
|
3
6
|
NotEqual = "!=",
|
|
@@ -10,14 +13,17 @@ declare enum EDataFilterOperator {
|
|
|
10
13
|
And = "and",
|
|
11
14
|
Or = "or",
|
|
12
15
|
Nand = "nand",
|
|
13
|
-
Nor = "nor"
|
|
16
|
+
Nor = "nor",
|
|
17
|
+
Between = "between",
|
|
18
|
+
Contains = "contains",
|
|
19
|
+
Like = "like"
|
|
14
20
|
}
|
|
15
|
-
interface IDataFilter {
|
|
21
|
+
interface IDataFilter$1 {
|
|
16
22
|
operator: EDataFilterOperator;
|
|
17
|
-
field: TDataRow | IDataFilter | IDataFilter[];
|
|
23
|
+
field: TDataRow | IDataFilter$1 | IDataFilter$1[];
|
|
18
24
|
active: boolean;
|
|
19
25
|
}
|
|
20
|
-
interface IDataSort {
|
|
26
|
+
interface IDataSort$1 {
|
|
21
27
|
field: string;
|
|
22
28
|
direction: 'asc' | 'desc';
|
|
23
29
|
}
|
|
@@ -43,6 +49,7 @@ interface ICacheQuotaOptions {
|
|
|
43
49
|
maxSizeBytes?: number;
|
|
44
50
|
quotaThresholdRatio?: number;
|
|
45
51
|
fallbackToMemory?: boolean;
|
|
52
|
+
accessThrottleMs?: number;
|
|
46
53
|
}
|
|
47
54
|
interface ICookieCacheOptions {
|
|
48
55
|
/** Default: 'lax'. */
|
|
@@ -357,11 +364,342 @@ interface IVerifyAndPinResult {
|
|
|
357
364
|
fingerprint: string;
|
|
358
365
|
}
|
|
359
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Normalization options for string comparisons, filtering, and cryptographic indexing.
|
|
369
|
+
*/
|
|
370
|
+
interface INormalizeOptions {
|
|
371
|
+
/**
|
|
372
|
+
* Target locale for case conversion (e.g., 'tr', 'tr-TR', 'az', 'en', etc.).
|
|
373
|
+
* When specified, utilizes `String.prototype.toLocaleLowerCase(locale)`.
|
|
374
|
+
*/
|
|
375
|
+
locale?: string;
|
|
376
|
+
/**
|
|
377
|
+
* When true, folds non-ASCII, extended Latin, and accented characters to their closest standard ASCII equivalents.
|
|
378
|
+
* Mappings cover Turkish (İ/ı -> i, Ş/ş -> s, Ç/ç -> c, Ğ/ğ -> g, Ö/ö -> o, Ü/ü -> u), Polish (Ł/ł -> l),
|
|
379
|
+
* German (ß/ẞ -> ss), Nordic (Ø/ø -> o, Æ/æ -> ae, Ð/ð -> d, Þ/þ -> th), Croatian/Vietnamese (Đ/đ -> d),
|
|
380
|
+
* Maltese (Ħ/ħ -> h), French (Œ/œ -> oe), and Azerbaijani (Ə/ə -> e).
|
|
381
|
+
* Preserves distinct non-Latin base letters (such as Cyrillic Short I 'Й'/'й') from decomposition.
|
|
382
|
+
*/
|
|
383
|
+
asciiFold?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Optional custom normalizer callback for domain- or script-specific character transforms
|
|
386
|
+
* (e.g. Arabic/Persian Alef/Yeh unification, Hebrew Niqqud stripping, CJK fullwidth folding).
|
|
387
|
+
*/
|
|
388
|
+
normalizer?: (value: string) => string;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Folds special characters, extended Latin alphabets, and diacritics into deterministic lowercase ASCII equivalents.
|
|
392
|
+
*
|
|
393
|
+
* Rules:
|
|
394
|
+
* - Turkish / Azerbaijani: İ/ı -> i, Ş/ş -> s, Ç/ç -> c, Ğ/ğ -> g, Ö/ö -> o, Ü/ü -> u, Ə/ə -> e
|
|
395
|
+
* - Polish: Ł/ł -> l
|
|
396
|
+
* - German: ß/ẞ -> ss
|
|
397
|
+
* - Nordic (DA, NO, IS, FO): Ø/ø -> o, Æ/æ -> ae, Ð/ð -> d, Þ/þ -> th
|
|
398
|
+
* - Croatian / Vietnamese / Maltese: Đ/đ -> d, Ħ/ħ -> h
|
|
399
|
+
* - French / Latin Ligatures: Œ/œ -> oe
|
|
400
|
+
* - Cyrillic: Preserves distinct base letter Short I (Й / й) from being corrupted into И / и during NFD stripping.
|
|
401
|
+
* - Standard Unicode NFD decomposition to strip all combining diacritical marks.
|
|
402
|
+
* - Final lowercasing and NFKC normalization.
|
|
403
|
+
*/
|
|
404
|
+
declare function foldAscii(value: string): string;
|
|
405
|
+
/**
|
|
406
|
+
* Canonical normalization primitive shared across:
|
|
407
|
+
* - In-memory filter evaluations (`filterLogic.ts`)
|
|
408
|
+
* - Trigram search indexing (`CSearchIndex.ts`)
|
|
409
|
+
* - Blind-index token generation (`CKeyManager.ts`)
|
|
410
|
+
* - Encrypted filter rewrites (`rewriteEncryptedFilters.ts`)
|
|
411
|
+
*
|
|
412
|
+
* Default behavior:
|
|
413
|
+
* - Coerces value to string
|
|
414
|
+
* - Normalizes via Unicode NFKC (Compatibility Decomposition followed by Canonical Composition)
|
|
415
|
+
* - Trims leading and trailing whitespace
|
|
416
|
+
* - Converts to lowercase via standard Unicode case folding
|
|
417
|
+
* - Strips combining dot above (U+0307) so capital dotted 'İ' matches lowercase 'i' by default
|
|
418
|
+
* - Folds Greek final sigma (ς / U+03C2) to medial sigma (σ / U+03C3) so queries match across word boundaries
|
|
419
|
+
*
|
|
420
|
+
* Configurable options:
|
|
421
|
+
* - `locale`: When provided (such as 'tr' or 'tr-TR'), uses `toLocaleLowerCase(locale)`
|
|
422
|
+
* ensuring Turkish dotted/dotless I conversions (İ -> i, I -> ı).
|
|
423
|
+
* - `asciiFold`: When true, maps diacritics and extended Latin characters to pure ASCII equivalents
|
|
424
|
+
* ensuring cross-locale equivalence (e.g. 'Çelik' == 'Celik', 'Łódź' == 'lodz', 'Straße' == 'strasse').
|
|
425
|
+
* - `normalizer`: Optional custom transformer invoked after baseline normalization.
|
|
426
|
+
*/
|
|
427
|
+
declare function normalizeFilterValue(value: any, options?: INormalizeOptions): string;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Lifecycle status for blind-index HMAC keys in a multi-KID keyring.
|
|
431
|
+
*/
|
|
432
|
+
type TBlindIndexKeyStatus = 'active' | 'search-only' | 'retired';
|
|
433
|
+
/**
|
|
434
|
+
* Date bucketing granularity options for shadow range buckets.
|
|
435
|
+
*/
|
|
436
|
+
type TDateBucketGranularity = 'year' | 'quarter' | 'month' | 'week' | 'day';
|
|
437
|
+
/**
|
|
438
|
+
* Configuration for date/timestamp shadow range bucketing.
|
|
439
|
+
*/
|
|
440
|
+
interface IDateRangeBucketConfig {
|
|
441
|
+
type: 'date';
|
|
442
|
+
granularity?: TDateBucketGranularity;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Configuration for stepped numeric shadow range bucketing.
|
|
446
|
+
*/
|
|
447
|
+
interface ISteppedRangeBucketConfig {
|
|
448
|
+
type: 'stepped';
|
|
449
|
+
step: number;
|
|
450
|
+
min?: number;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Configuration for tier / threshold numeric shadow range bucketing.
|
|
454
|
+
*/
|
|
455
|
+
interface ITierRangeBucketConfig {
|
|
456
|
+
type: 'tier' | 'threshold';
|
|
457
|
+
thresholds: number[];
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Union type of all shadow range bucket configurations.
|
|
461
|
+
*/
|
|
462
|
+
type TRangeBucketConfig = IDateRangeBucketConfig | ISteppedRangeBucketConfig | ITierRangeBucketConfig;
|
|
463
|
+
/**
|
|
464
|
+
* Keyring mapping key IDs to HMAC CryptoKeys and their lifecycle status.
|
|
465
|
+
* Exactly one key must be 'active', matching activeKid.
|
|
466
|
+
*/
|
|
467
|
+
interface IBlindIndexKeyring {
|
|
468
|
+
/** Active key identifier used for all write-time blind index token generation */
|
|
469
|
+
activeKid: string;
|
|
470
|
+
/** Dictionary of key descriptors and their lifecycle statuses */
|
|
471
|
+
keys: Record<string, {
|
|
472
|
+
key: CryptoKey;
|
|
473
|
+
status: TBlindIndexKeyStatus;
|
|
474
|
+
algorithm?: string;
|
|
475
|
+
}>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Blind-index field configuration options.
|
|
480
|
+
*/
|
|
481
|
+
interface IBlindIndexFieldConfig {
|
|
482
|
+
/** Custom target persistence column name (defaults to `${fieldName}_bidx`) */
|
|
483
|
+
column?: string;
|
|
484
|
+
/** Optional custom trigram column name (defaults to `${fieldName}_trigrams`) */
|
|
485
|
+
trigramColumn?: string;
|
|
486
|
+
/** Blind index keyring */
|
|
487
|
+
keyring: IBlindIndexKeyring;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Trigram substring search field configuration options.
|
|
491
|
+
*/
|
|
492
|
+
interface ITrigramFieldConfig {
|
|
493
|
+
/** Custom target persistence column name (defaults to `${fieldName}_trigrams`) */
|
|
494
|
+
column?: string;
|
|
495
|
+
/** Blind index keyring */
|
|
496
|
+
keyring: IBlindIndexKeyring;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Range bucket persistence field configuration options.
|
|
500
|
+
*/
|
|
501
|
+
interface IRangeBucketFieldConfig {
|
|
502
|
+
/** Custom target persistence column name (defaults to `${fieldName}_bucket`) */
|
|
503
|
+
column?: string;
|
|
504
|
+
/** Range bucketing configuration ('date', 'stepped', or 'tier') */
|
|
505
|
+
config: TRangeBucketConfig;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Options for computing blind index HMAC-SHA256 tokens, supporting normalization and domain separation.
|
|
510
|
+
*/
|
|
511
|
+
interface IBlindIndexOptions extends INormalizeOptions {
|
|
512
|
+
/** Field name domain context (prevents cross-field token equality) */
|
|
513
|
+
field?: string;
|
|
514
|
+
/** Token type domain context ('eq' for exact equality, 'tri' for substring trigrams) */
|
|
515
|
+
type?: 'eq' | 'tri';
|
|
516
|
+
/** Optional Key Identifier */
|
|
517
|
+
kid?: string;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Options for rewriteEncryptedFilters.
|
|
521
|
+
*/
|
|
522
|
+
interface IEncryptedFilterRewriteOptions extends INormalizeOptions {
|
|
523
|
+
/** Map of field names to their blind-index column configuration or keyring */
|
|
524
|
+
blindIndexFields?: Record<string, IBlindIndexFieldConfig | IBlindIndexKeyring>;
|
|
525
|
+
/** Map of field names to their trigram substring search configuration or keyring */
|
|
526
|
+
trigramFields?: Record<string, ITrigramFieldConfig | IBlindIndexKeyring>;
|
|
527
|
+
/** Map of field names to their range bucket configuration or TRangeBucketConfig */
|
|
528
|
+
rangeBucketFields?: Record<string, IRangeBucketFieldConfig | TRangeBucketConfig>;
|
|
529
|
+
/** Direct map of field names to TRangeBucketConfig (alias for rangeBucketFields) */
|
|
530
|
+
rangeBuckets?: Record<string, TRangeBucketConfig>;
|
|
531
|
+
/** Optional known bucket keys present in persistence store */
|
|
532
|
+
knownBuckets?: Record<string, Iterable<string>>;
|
|
533
|
+
/** Maximum allowable candidate tokens across all expanded values (defaults to 500) */
|
|
534
|
+
maxCandidateTokens?: number;
|
|
535
|
+
/** Optional normalization options override */
|
|
536
|
+
normalizeOptions?: INormalizeOptions;
|
|
537
|
+
/** Generic fields map that may contain blindIndex, trigrams, and rangeBuckets */
|
|
538
|
+
fields?: Record<string, any>;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Result returned by rewriteEncryptedFilters.
|
|
542
|
+
*/
|
|
543
|
+
interface IRewrittenEncryptedFilters {
|
|
544
|
+
/** Transformed filter or array of filters with expanded blind-index candidate tokens */
|
|
545
|
+
filters: IDataFilter$1 | IDataFilter$1[];
|
|
546
|
+
/** Total candidate tokens generated across all filters */
|
|
547
|
+
totalCandidateTokens: number;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Alias for IRewrittenEncryptedFilters for backward compatibility.
|
|
551
|
+
*/
|
|
552
|
+
type IRewrittenPersistenceQuery = IRewrittenEncryptedFilters;
|
|
553
|
+
/**
|
|
554
|
+
* Options for reencryptBatch.
|
|
555
|
+
*/
|
|
556
|
+
interface IReencryptBatchOptions<TRow = any> {
|
|
557
|
+
/** Target Key Identifier to migrate payloads to */
|
|
558
|
+
targetKid: string;
|
|
559
|
+
/** Keyring containing source keys and target key */
|
|
560
|
+
keyring: Record<string, CryptoKey | string | Uint8Array | (() => Promise<CryptoKey>)>;
|
|
561
|
+
/** Model fields containing IEncryptedPayload envelopes */
|
|
562
|
+
encryptedFields: string[];
|
|
563
|
+
/** Model fields to compute and migrate trigram substring search tokens for */
|
|
564
|
+
trigramFields?: string[];
|
|
565
|
+
/** Direct blind index keyring for blind index and trigram computation */
|
|
566
|
+
blindIndexKeyring?: IBlindIndexKeyring;
|
|
567
|
+
/** Optional blind index configuration for sensitive fields */
|
|
568
|
+
blindIndex?: {
|
|
569
|
+
fields?: string[];
|
|
570
|
+
/** Optional fields to compute and migrate trigram substring search tokens for */
|
|
571
|
+
trigramFields?: string[];
|
|
572
|
+
keyring: IBlindIndexKeyring;
|
|
573
|
+
/** Optional mapping from field name to persistence column name (defaults to `${fieldName}_bidx`) */
|
|
574
|
+
columnMap?: Record<string, string>;
|
|
575
|
+
/** Enable cryptographic domain separation for blind index tokens */
|
|
576
|
+
domainSeparation?: boolean;
|
|
577
|
+
};
|
|
578
|
+
/** Maximum PBKDF2 iterations allowed during key derivation (default: 350,000) */
|
|
579
|
+
maxAllowedIterations?: number;
|
|
580
|
+
/** Whether to allow insecure KDF (kdf: 'none') under strict mode */
|
|
581
|
+
allowInsecureKdf?: boolean;
|
|
582
|
+
/** Concurrency version field name on row (default: 'updatedAt') */
|
|
583
|
+
versionField?: string;
|
|
584
|
+
/** Primary key extractor callback (defaults to (row) => row.id) */
|
|
585
|
+
getRowId?: (row: TRow) => string | number;
|
|
586
|
+
/** Force re-encryption even if kid === targetKid (default: false) */
|
|
587
|
+
force?: boolean;
|
|
588
|
+
/** Optional base AAD or contextual fields for AEAD binding */
|
|
589
|
+
baseAad?: string;
|
|
590
|
+
aadFields?: string[];
|
|
591
|
+
buildAad?: (row: TRow, fieldName: string) => string | Uint8Array | undefined;
|
|
592
|
+
/** Error handling strategy when decryption or processing of a row/field fails (default: 'abort') */
|
|
593
|
+
onRowError?: 'abort' | 'skip' | 'record';
|
|
594
|
+
/** Key derivation algorithm for string passphrases (default: 'pbkdf2') */
|
|
595
|
+
kdf?: 'pbkdf2' | 'hkdf' | 'none';
|
|
596
|
+
/** PBKDF2 iterations for string passphrases (default: 310,000) */
|
|
597
|
+
kdfIterations?: number;
|
|
598
|
+
/** Optional salt for string passphrases (default: random 16 bytes per target key) */
|
|
599
|
+
kdfSalt?: string | Uint8Array;
|
|
600
|
+
/** Force fresh PBKDF2 salt generation per row instead of sharing across batch/dataset */
|
|
601
|
+
perRowSalt?: boolean;
|
|
602
|
+
/** Cancellation signal for cooperative abort */
|
|
603
|
+
signal?: AbortSignal;
|
|
604
|
+
/** Strict mode: requires version field for CAS concurrency protection; fails if missing */
|
|
605
|
+
strict?: boolean;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Result returned by reencryptBatch.
|
|
609
|
+
*/
|
|
610
|
+
interface IReencryptBatchResult<TRow = any> {
|
|
611
|
+
rows: Array<{
|
|
612
|
+
row: TRow;
|
|
613
|
+
id: string | number;
|
|
614
|
+
needsUpdate: boolean;
|
|
615
|
+
patch: Partial<TRow>;
|
|
616
|
+
expectedVersion: any;
|
|
617
|
+
updatedFields: string[];
|
|
618
|
+
skippedFields: string[];
|
|
619
|
+
}>;
|
|
620
|
+
scannedCount: number;
|
|
621
|
+
migratedCount: number;
|
|
622
|
+
skippedCount: number;
|
|
623
|
+
failedRows: Array<{
|
|
624
|
+
id: any;
|
|
625
|
+
field: string;
|
|
626
|
+
error: Error | string;
|
|
627
|
+
}>;
|
|
628
|
+
/** Whether batch execution was aborted early via AbortSignal */
|
|
629
|
+
aborted?: boolean;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Universal orchestrator options for dataset re-encryption.
|
|
633
|
+
*/
|
|
634
|
+
interface IReencryptDatasetOptions<TRow = any> extends IReencryptBatchOptions<TRow> {
|
|
635
|
+
/** Size of each chunk fetched into memory (default: 100) */
|
|
636
|
+
batchSize?: number;
|
|
637
|
+
/** Starting cursor for resuming an interrupted migration */
|
|
638
|
+
cursor?: string | number;
|
|
639
|
+
/** Maximum retry attempts when an optimistic lock conflict occurs (default: 3) */
|
|
640
|
+
maxRetries?: number;
|
|
641
|
+
/** Dry run mode: executes decryption and validation without committing writes */
|
|
642
|
+
dryRun?: boolean;
|
|
643
|
+
/** Callback to fetch a batch of rows ordered by cursor/primary key */
|
|
644
|
+
fetchBatch: (cursor: string | number | undefined, limit: number) => Promise<{
|
|
645
|
+
rows: TRow[];
|
|
646
|
+
nextCursor?: string | number;
|
|
647
|
+
totalCount?: number;
|
|
648
|
+
}>;
|
|
649
|
+
/** Callback to persist updated row with optimistic lock verification. Returns false on conflict. */
|
|
650
|
+
updateRow: (rowId: string | number, patch: Partial<TRow>, expectedVersion: any) => Promise<boolean>;
|
|
651
|
+
/** Callback to refetch a single conflicting record during optimistic concurrency retries */
|
|
652
|
+
refetchRow?: (rowId: string | number) => Promise<TRow | null>;
|
|
653
|
+
/** Progress telemetry callback (can be async to persist checkpoints) */
|
|
654
|
+
onProgress?: (progress: IMigrationProgress) => void | Promise<void>;
|
|
655
|
+
/** Cancellation signal for cooperative abort */
|
|
656
|
+
signal?: AbortSignal;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Telemetry emitted by reencryptDataset during migration.
|
|
660
|
+
*/
|
|
661
|
+
interface IMigrationProgress {
|
|
662
|
+
scannedRows: number;
|
|
663
|
+
migratedRows: number;
|
|
664
|
+
skippedRows: number;
|
|
665
|
+
conflictRows: number;
|
|
666
|
+
failedRows?: number;
|
|
667
|
+
currentCursor?: string | number;
|
|
668
|
+
percentComplete?: number;
|
|
669
|
+
/** Persistent checkpoint payload */
|
|
670
|
+
checkpoint?: {
|
|
671
|
+
lastProcessedId: any;
|
|
672
|
+
count: number;
|
|
673
|
+
};
|
|
674
|
+
lastProcessedId?: any;
|
|
675
|
+
count?: number;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Final execution report returned by reencryptDataset.
|
|
679
|
+
*/
|
|
680
|
+
interface IMigrationSummary {
|
|
681
|
+
success: boolean;
|
|
682
|
+
scannedRows: number;
|
|
683
|
+
migratedRows: number;
|
|
684
|
+
skippedRows: number;
|
|
685
|
+
conflictRows: number;
|
|
686
|
+
lastProcessedCursor?: string | number;
|
|
687
|
+
completed: boolean;
|
|
688
|
+
durationMs: number;
|
|
689
|
+
failedRows?: Array<{
|
|
690
|
+
id: any;
|
|
691
|
+
field: string;
|
|
692
|
+
error: Error | string;
|
|
693
|
+
}>;
|
|
694
|
+
/** Whether the migration was cancelled/aborted via AbortSignal */
|
|
695
|
+
aborted?: boolean;
|
|
696
|
+
}
|
|
697
|
+
|
|
360
698
|
interface IEncryptionContext {
|
|
361
699
|
url?: string;
|
|
362
700
|
method?: string;
|
|
363
701
|
isServer?: boolean;
|
|
364
|
-
/** Whether to bind the request context (URL and method as `req:${method}:${
|
|
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). */
|
|
365
703
|
bindRequestContextAad?: boolean;
|
|
366
704
|
/** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
|
|
367
705
|
fields?: string[];
|
|
@@ -412,6 +750,10 @@ interface IEncryptionContext {
|
|
|
412
750
|
kdfIterations?: number;
|
|
413
751
|
kdfHash?: 'SHA-256' | 'SHA-512';
|
|
414
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;
|
|
415
757
|
}
|
|
416
758
|
/**
|
|
417
759
|
* Context options for single scalar field encryption/decryption with bound AAD.
|
|
@@ -469,9 +811,9 @@ interface IProviderEncryptionOptions {
|
|
|
469
811
|
/** Optional base AAD prefix when aadFields or dynamic aad is enabled */
|
|
470
812
|
baseAad?: string;
|
|
471
813
|
/**
|
|
472
|
-
* Whether to bind the request context (HTTP method and URL as `req:${method}:${
|
|
473
|
-
* Defaults to
|
|
474
|
-
*
|
|
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.
|
|
475
817
|
*/
|
|
476
818
|
bindRequestContextAad?: boolean;
|
|
477
819
|
/**
|
|
@@ -486,6 +828,11 @@ interface IProviderEncryptionOptions {
|
|
|
486
828
|
lazy?: boolean;
|
|
487
829
|
/** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
|
|
488
830
|
fields?: string[];
|
|
831
|
+
/**
|
|
832
|
+
* When enabled (true) with offline queueing, encrypts binary/FormData payloads
|
|
833
|
+
* at rest before persisting into IndexedDB/storage, and decrypts them upon flush.
|
|
834
|
+
*/
|
|
835
|
+
encryptBinary?: boolean;
|
|
489
836
|
/**
|
|
490
837
|
* Enforces strict encryption validation. When true:
|
|
491
838
|
* 1. Any field in `fields` that is NOT an encrypted envelope triggers a decryption error.
|
|
@@ -504,13 +851,38 @@ interface IProviderEncryptionOptions {
|
|
|
504
851
|
onDecryptError?: ((info: IDecryptErrorInfo) => any) | boolean | string;
|
|
505
852
|
/** Enable HMAC-SHA256 blind indexing and trigram search index on encrypted fields for local DataProviders */
|
|
506
853
|
searchIndex?: boolean;
|
|
854
|
+
/**
|
|
855
|
+
* Whether to allow matching against unscoped legacy blind index tokens (without field domain separation).
|
|
856
|
+
* Defaults to false for security (prevents cross-field and equality-vs-trigram token collisions).
|
|
857
|
+
*/
|
|
858
|
+
allowLegacyUnscopedTokens?: boolean;
|
|
859
|
+
/**
|
|
860
|
+
* When enabled, maintains an in-memory decrypted row cache to evaluate local client-side filters
|
|
861
|
+
* on encrypted fields directly without requiring blind indexing.
|
|
862
|
+
*/
|
|
863
|
+
decryptedCache?: boolean;
|
|
864
|
+
/** Target locale for case conversion (e.g. 'tr', 'az', 'en', etc.) */
|
|
865
|
+
locale?: string;
|
|
866
|
+
/** When true, folds non-ASCII and accented characters to their standard ASCII equivalents */
|
|
867
|
+
asciiFold?: boolean;
|
|
868
|
+
/** Custom normalizer callback for domain- or script-specific character transforms */
|
|
869
|
+
normalizer?: (value: string) => string;
|
|
870
|
+
/** Range query configuration for shadow bucketing across encrypted numeric or date columns (TASK-031) */
|
|
871
|
+
rangeBuckets?: Record<string, TRangeBucketConfig>;
|
|
872
|
+
/** Alias for rangeBuckets */
|
|
873
|
+
shadowBuckets?: Record<string, TRangeBucketConfig>;
|
|
507
874
|
/**
|
|
508
875
|
* Set to true if API endpoints or data sources return pre-encrypted ciphertext envelopes.
|
|
509
876
|
* When true, DataProviders decrypt search fields during ingest to populate CSearchIndex.
|
|
510
877
|
*/
|
|
511
878
|
preEncrypted?: boolean;
|
|
512
|
-
/**
|
|
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
|
+
*/
|
|
513
883
|
hmacKey?: TKeyProvider;
|
|
884
|
+
/** Minimum query length for trigram substring searches (default: 3). Queries shorter than this use fallback verification. */
|
|
885
|
+
minSearchLength?: number;
|
|
514
886
|
/** Cryptographic algorithm identifier (defaults to 'AES-GCM') */
|
|
515
887
|
algorithm?: 'AES-GCM' | string;
|
|
516
888
|
/** Custom cipher adapter implementing IEncryptionProvider (e.g. CRSAEncryptionProvider, CECDHEncryptionProvider, CWebCryptoAESCBCProvider) */
|
|
@@ -542,209 +914,50 @@ interface IProviderEncryptionOptions {
|
|
|
542
914
|
curve?: 'P-256' | 'P-384' | 'P-521';
|
|
543
915
|
/** Optional context/info string or buffer for HKDF key derivation */
|
|
544
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;
|
|
545
921
|
}
|
|
546
922
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
/** Active key identifier used for all write-time blind index token generation */
|
|
557
|
-
activeKid: string;
|
|
558
|
-
/** Dictionary of key descriptors and their lifecycle statuses */
|
|
559
|
-
keys: Record<string, {
|
|
560
|
-
key: CryptoKey;
|
|
561
|
-
status: TBlindIndexKeyStatus;
|
|
562
|
-
algorithm?: string;
|
|
563
|
-
}>;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Abstract persistence filter clause emitted by rewriteEncryptedFilters.
|
|
567
|
-
*/
|
|
568
|
-
interface IAbstractPersistenceClause {
|
|
569
|
-
/** Target column name (e.g. 'email_bidx') */
|
|
570
|
-
column: string;
|
|
571
|
-
/** Abstract operator ('in' or 'notIn') */
|
|
572
|
-
op: 'in' | 'notIn' | 'eq' | 'neq' | 'raw';
|
|
573
|
-
/** Candidate values / token list */
|
|
574
|
-
values: string[] | any[];
|
|
923
|
+
type TDataProviderListener<T = unknown> = (provider: T) => void;
|
|
924
|
+
type TUnsubscribe = () => void;
|
|
925
|
+
interface IKDatatableAction {
|
|
926
|
+
action: Function;
|
|
927
|
+
label: string;
|
|
928
|
+
icon?: string;
|
|
929
|
+
iconOnly?: boolean;
|
|
930
|
+
type?: 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
|
|
931
|
+
visible?: Function;
|
|
575
932
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
*/
|
|
583
|
-
interface IBlindIndexFieldConfig {
|
|
584
|
-
/** Custom target persistence column name (defaults to `${fieldName}_bidx`) */
|
|
585
|
-
column?: string;
|
|
586
|
-
/** Blind index keyring */
|
|
587
|
-
keyring: IBlindIndexKeyring;
|
|
933
|
+
type TDataRow = {
|
|
934
|
+
[key: string]: any;
|
|
935
|
+
};
|
|
936
|
+
interface IDataResult<TRow = TDataRow> {
|
|
937
|
+
rowCount: number;
|
|
938
|
+
rows: TRow[];
|
|
588
939
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
/** Target database dialect for SQL clause rendering (defaults to 'postgres') */
|
|
598
|
-
dialect?: TPersistenceDialect;
|
|
599
|
-
/** Parameter index offset for parameterized queries (defaults to 1) */
|
|
600
|
-
paramOffset?: number;
|
|
601
|
-
/** Maximum parameter limit before chunking (defaults: SQLite 999, MySQL 65535, Postgres unlimited) */
|
|
602
|
-
maxParametersPerClause?: number;
|
|
940
|
+
type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter$1 | null, sortList: IDataSort$1[], options?: {
|
|
941
|
+
disableCache?: boolean;
|
|
942
|
+
signal?: AbortSignal;
|
|
943
|
+
}) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
|
|
944
|
+
interface IBatchProgress {
|
|
945
|
+
loaded: number;
|
|
946
|
+
total: number;
|
|
947
|
+
percent: number;
|
|
603
948
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
params: any[];
|
|
949
|
+
interface IBatchLoadedEvent<TRow = any> {
|
|
950
|
+
pageNumber: number;
|
|
951
|
+
rows: TRow[];
|
|
952
|
+
totalLoaded: number;
|
|
953
|
+
rowCount: number;
|
|
610
954
|
}
|
|
611
|
-
/**
|
|
612
|
-
* Result returned by rewriteEncryptedFilters.
|
|
613
|
-
*/
|
|
614
|
-
interface IRewrittenPersistenceQuery {
|
|
615
|
-
/** Abstract dialect-agnostic persistence clauses */
|
|
616
|
-
clauses: IAbstractPersistenceClause[];
|
|
617
|
-
/** Total candidate tokens generated across all filters */
|
|
618
|
-
totalCandidateTokens: number;
|
|
619
|
-
/** Formats the abstract clauses into a dialect-specific SQL string and parameter array */
|
|
620
|
-
format(dialect?: TPersistenceDialect, options?: {
|
|
621
|
-
paramOffset?: number;
|
|
622
|
-
maxParametersPerClause?: number;
|
|
623
|
-
}): IRenderedSqlClause;
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Options for reencryptBatch.
|
|
627
|
-
*/
|
|
628
|
-
interface IReencryptBatchOptions<TRow = any> {
|
|
629
|
-
/** Target Key Identifier to migrate payloads to */
|
|
630
|
-
targetKid: string;
|
|
631
|
-
/** Keyring containing source keys and target key */
|
|
632
|
-
keyring: Record<string, CryptoKey | string | Uint8Array | (() => Promise<CryptoKey>)>;
|
|
633
|
-
/** Model fields containing IEncryptedPayload envelopes */
|
|
634
|
-
encryptedFields: string[];
|
|
635
|
-
/** Optional blind index configuration for sensitive fields */
|
|
636
|
-
blindIndex?: {
|
|
637
|
-
fields: string[];
|
|
638
|
-
keyring: IBlindIndexKeyring;
|
|
639
|
-
/** Optional mapping from field name to persistence column name (defaults to `${fieldName}_bidx`) */
|
|
640
|
-
columnMap?: Record<string, string>;
|
|
641
|
-
};
|
|
642
|
-
/** Concurrency version field name on row (default: 'updatedAt') */
|
|
643
|
-
versionField?: string;
|
|
644
|
-
/** Primary key extractor callback (defaults to (row) => row.id) */
|
|
645
|
-
getRowId?: (row: TRow) => string | number;
|
|
646
|
-
/** Force re-encryption even if kid === targetKid (default: false) */
|
|
647
|
-
force?: boolean;
|
|
648
|
-
/** Optional base AAD or contextual fields for AEAD binding */
|
|
649
|
-
baseAad?: string;
|
|
650
|
-
aadFields?: string[];
|
|
651
|
-
buildAad?: (row: TRow, fieldName: string) => string | Uint8Array | undefined;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Result returned by reencryptBatch.
|
|
655
|
-
*/
|
|
656
|
-
interface IReencryptBatchResult<TRow = any> {
|
|
657
|
-
rows: Array<{
|
|
658
|
-
row: TRow;
|
|
659
|
-
id: string | number;
|
|
660
|
-
needsUpdate: boolean;
|
|
661
|
-
patch: Partial<TRow>;
|
|
662
|
-
expectedVersion: any;
|
|
663
|
-
updatedFields: string[];
|
|
664
|
-
skippedFields: string[];
|
|
665
|
-
}>;
|
|
666
|
-
scannedCount: number;
|
|
667
|
-
migratedCount: number;
|
|
668
|
-
skippedCount: number;
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Universal orchestrator options for dataset re-encryption.
|
|
672
|
-
*/
|
|
673
|
-
interface IReencryptDatasetOptions<TRow = any> extends IReencryptBatchOptions<TRow> {
|
|
674
|
-
/** Size of each chunk fetched into memory (default: 100) */
|
|
675
|
-
batchSize?: number;
|
|
676
|
-
/** Starting cursor for resuming an interrupted migration */
|
|
677
|
-
cursor?: string | number;
|
|
678
|
-
/** Maximum retry attempts when an optimistic lock conflict occurs (default: 3) */
|
|
679
|
-
maxRetries?: number;
|
|
680
|
-
/** Dry run mode: executes decryption and validation without committing writes */
|
|
681
|
-
dryRun?: boolean;
|
|
682
|
-
/** Callback to fetch a batch of rows ordered by cursor/primary key */
|
|
683
|
-
fetchBatch: (cursor: string | number | undefined, limit: number) => Promise<{
|
|
684
|
-
rows: TRow[];
|
|
685
|
-
nextCursor?: string | number;
|
|
686
|
-
totalCount?: number;
|
|
687
|
-
}>;
|
|
688
|
-
/** Callback to persist updated row with optimistic lock verification. Returns false on conflict. */
|
|
689
|
-
updateRow: (rowId: string | number, patch: Partial<TRow>, expectedVersion: any) => Promise<boolean>;
|
|
690
|
-
/** Callback to refetch a single conflicting record during optimistic concurrency retries */
|
|
691
|
-
refetchRow?: (rowId: string | number) => Promise<TRow | null>;
|
|
692
|
-
/** Progress telemetry callback */
|
|
693
|
-
onProgress?: (progress: IMigrationProgress) => void;
|
|
694
|
-
/** Cancellation signal for cooperative abort */
|
|
695
|
-
signal?: AbortSignal;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Telemetry emitted by reencryptDataset during migration.
|
|
699
|
-
*/
|
|
700
|
-
interface IMigrationProgress {
|
|
701
|
-
scannedRows: number;
|
|
702
|
-
migratedRows: number;
|
|
703
|
-
skippedRows: number;
|
|
704
|
-
conflictRows: number;
|
|
705
|
-
currentCursor?: string | number;
|
|
706
|
-
percentComplete?: number;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Final execution report returned by reencryptDataset.
|
|
710
|
-
*/
|
|
711
|
-
interface IMigrationSummary {
|
|
712
|
-
success: boolean;
|
|
713
|
-
scannedRows: number;
|
|
714
|
-
migratedRows: number;
|
|
715
|
-
skippedRows: number;
|
|
716
|
-
conflictRows: number;
|
|
717
|
-
lastProcessedCursor?: string | number;
|
|
718
|
-
completed: boolean;
|
|
719
|
-
durationMs: number;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
type TDataProviderListener<T = unknown> = (provider: T) => void;
|
|
723
|
-
type TUnsubscribe = () => void;
|
|
724
|
-
interface IKDatatableAction {
|
|
725
|
-
action: Function;
|
|
726
|
-
label: string;
|
|
727
|
-
icon?: string;
|
|
728
|
-
iconOnly?: boolean;
|
|
729
|
-
type?: 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
|
|
730
|
-
visible?: Function;
|
|
731
|
-
}
|
|
732
|
-
type TDataRow = {
|
|
733
|
-
[key: string]: any;
|
|
734
|
-
};
|
|
735
|
-
interface IDataResult<TRow = TDataRow> {
|
|
736
|
-
rowCount: number;
|
|
737
|
-
rows: TRow[];
|
|
738
|
-
}
|
|
739
|
-
type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], options?: {
|
|
740
|
-
disableCache?: boolean;
|
|
741
|
-
signal?: AbortSignal;
|
|
742
|
-
}) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
|
|
743
955
|
interface IDataProviderOptions {
|
|
744
956
|
apiUrl?: string;
|
|
745
957
|
idKey?: string;
|
|
746
|
-
|
|
747
|
-
|
|
958
|
+
fields?: string[];
|
|
959
|
+
filter?: IDataFilter$1;
|
|
960
|
+
sortList?: IDataSort$1[];
|
|
748
961
|
pageSize?: number;
|
|
749
962
|
currentPage?: number;
|
|
750
963
|
SSR?: boolean;
|
|
@@ -754,22 +967,30 @@ interface IDataProviderOptions {
|
|
|
754
967
|
deduplicate?: boolean;
|
|
755
968
|
context?: Record<string, unknown>;
|
|
756
969
|
contextKey?: string;
|
|
757
|
-
urlPageParam?: string;
|
|
758
970
|
refreshOnMutation?: boolean;
|
|
759
971
|
filterDebounce?: number;
|
|
760
972
|
sortDebounce?: number;
|
|
761
973
|
encryption?: IProviderEncryptionOptions;
|
|
974
|
+
batchSize?: number | false;
|
|
975
|
+
batchLoad?: 'initially' | 'onDemand';
|
|
976
|
+
onDemandFilterPolicy?: 'ingestAll' | 'warnOnly';
|
|
977
|
+
onBatchLoaded?: (batch: IBatchLoadedEvent<any>) => void;
|
|
762
978
|
}
|
|
763
979
|
interface IDataProviderState<TRow = TDataRow> {
|
|
764
980
|
currentPage: number;
|
|
765
981
|
pageSize: number;
|
|
766
|
-
filter: IDataFilter | null;
|
|
767
|
-
sortList: IDataSort[];
|
|
982
|
+
filter: IDataFilter$1 | null;
|
|
983
|
+
sortList: IDataSort$1[];
|
|
768
984
|
rowCount?: number;
|
|
769
985
|
loading?: boolean;
|
|
770
986
|
initialLoad?: boolean;
|
|
771
987
|
error?: Error | unknown;
|
|
772
988
|
pageData?: TRow[];
|
|
989
|
+
fields?: string[];
|
|
990
|
+
isBatchLoading?: boolean;
|
|
991
|
+
batchProgress?: IBatchProgress;
|
|
992
|
+
loadedBatches?: number[];
|
|
993
|
+
stateVersion?: number;
|
|
773
994
|
}
|
|
774
995
|
interface IDataProviderSetStateOptions {
|
|
775
996
|
immediate?: boolean;
|
|
@@ -784,6 +1005,21 @@ interface IVirtualScrollState {
|
|
|
784
1005
|
itemHeight: number;
|
|
785
1006
|
}
|
|
786
1007
|
|
|
1008
|
+
/**
|
|
1009
|
+
* Server request event contract. Compatible with H3Event (Nuxt 3 / Nitro),
|
|
1010
|
+
* Node.js HTTP incoming messages, and mock/custom server context stubs.
|
|
1011
|
+
*/
|
|
1012
|
+
type TServerRequestEvent = H3Event | {
|
|
1013
|
+
headers?: Headers | Record<string, string | string[] | undefined> | {
|
|
1014
|
+
get?(name: string): string | null | undefined;
|
|
1015
|
+
};
|
|
1016
|
+
node?: {
|
|
1017
|
+
req?: any;
|
|
1018
|
+
res?: any;
|
|
1019
|
+
};
|
|
1020
|
+
context?: Record<string, any>;
|
|
1021
|
+
[key: string]: any;
|
|
1022
|
+
};
|
|
787
1023
|
interface IRequestOptions {
|
|
788
1024
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
789
1025
|
body?: any;
|
|
@@ -795,6 +1031,8 @@ interface IRequestOptions {
|
|
|
795
1031
|
query?: Record<string, unknown>;
|
|
796
1032
|
deduplicate?: boolean;
|
|
797
1033
|
context?: Record<string, unknown>;
|
|
1034
|
+
/** Active SSR request event (e.g. H3Event from useRequestEvent() or Nitro event handler) */
|
|
1035
|
+
event?: TServerRequestEvent;
|
|
798
1036
|
disableCache?: boolean;
|
|
799
1037
|
queue?: boolean;
|
|
800
1038
|
queueLabel?: string;
|
|
@@ -893,7 +1131,7 @@ interface ITreeDataProviderOptions extends IDataProviderOptions {
|
|
|
893
1131
|
* Tree-specific page data handler that includes tree parameters
|
|
894
1132
|
* Server handles tree building, visibility, and pagination
|
|
895
1133
|
*/
|
|
896
|
-
type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], treeParams: {
|
|
1134
|
+
type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter$1 | null, sortList: IDataSort$1[], treeParams: {
|
|
897
1135
|
expandedNodes: (string | number)[] | Set<string | number>;
|
|
898
1136
|
parentKey: string;
|
|
899
1137
|
idKey: string;
|
|
@@ -956,6 +1194,9 @@ declare abstract class ADataProvider<TRow = TDataRow> {
|
|
|
956
1194
|
protected _pageData: TRow[];
|
|
957
1195
|
get pageData(): TRow[];
|
|
958
1196
|
set pageData(val: TRow[]);
|
|
1197
|
+
protected _fields: string[];
|
|
1198
|
+
get fields(): string[];
|
|
1199
|
+
set fields(val: string[]);
|
|
959
1200
|
protected _rowCount: number;
|
|
960
1201
|
get rowCount(): number;
|
|
961
1202
|
set rowCount(val: number);
|
|
@@ -971,25 +1212,31 @@ declare abstract class ADataProvider<TRow = TDataRow> {
|
|
|
971
1212
|
SSR: boolean;
|
|
972
1213
|
deduplicate: boolean;
|
|
973
1214
|
context: any;
|
|
974
|
-
urlPageParam: string;
|
|
975
1215
|
protected _currentPage: number;
|
|
976
1216
|
protected _pageSize: number;
|
|
977
|
-
protected _filter: IDataFilter | null;
|
|
978
|
-
protected _sortList: IDataSort[];
|
|
1217
|
+
protected _filter: IDataFilter$1 | null;
|
|
1218
|
+
protected _sortList: IDataSort$1[];
|
|
979
1219
|
get currentPage(): number;
|
|
980
1220
|
set currentPage(page: number);
|
|
981
1221
|
get pageSize(): number;
|
|
982
1222
|
set pageSize(size: number);
|
|
983
|
-
get filter(): IDataFilter | null;
|
|
984
|
-
set filter(f: IDataFilter | null);
|
|
985
|
-
get sortList(): IDataSort[];
|
|
986
|
-
set sortList(s: IDataSort[]);
|
|
1223
|
+
get filter(): IDataFilter$1 | null;
|
|
1224
|
+
set filter(f: IDataFilter$1 | null);
|
|
1225
|
+
get sortList(): IDataSort$1[];
|
|
1226
|
+
set sortList(s: IDataSort$1[]);
|
|
987
1227
|
get hasMore(): boolean;
|
|
988
1228
|
nextPage(): Promise<void>;
|
|
989
1229
|
loadMore(): Promise<void>;
|
|
1230
|
+
prevPage(): Promise<void>;
|
|
1231
|
+
protected _stateVersion: number;
|
|
1232
|
+
get stateVersion(): number;
|
|
990
1233
|
private _listeners;
|
|
991
1234
|
private _stateListeners;
|
|
992
|
-
private
|
|
1235
|
+
private _sortListeners;
|
|
1236
|
+
private _filterListeners;
|
|
1237
|
+
private _dataListeners;
|
|
1238
|
+
protected _pendingChangedKeys: Set<keyof IDataProviderState<TRow>>;
|
|
1239
|
+
protected _options?: IDataProviderOptions;
|
|
993
1240
|
private _debouncedFilterLoad;
|
|
994
1241
|
private _debouncedSortLoad;
|
|
995
1242
|
constructor(options?: IDataProviderOptions);
|
|
@@ -1003,22 +1250,38 @@ declare abstract class ADataProvider<TRow = TDataRow> {
|
|
|
1003
1250
|
subscribe(listener: TDataProviderListener<this>): TUnsubscribe;
|
|
1004
1251
|
notify(): void;
|
|
1005
1252
|
onStateChange(listener: TDataProviderStateChangeListener<TRow>): TUnsubscribe;
|
|
1253
|
+
onSortChanged(listener: (sortList: IDataSort$1[]) => void): TUnsubscribe;
|
|
1254
|
+
onFilterChanged(listener: (filter: IDataFilter$1 | null) => void): TUnsubscribe;
|
|
1255
|
+
onDataChanged(listener: (pageData: TRow[]) => void): TUnsubscribe;
|
|
1006
1256
|
getState(): IDataProviderState<TRow>;
|
|
1007
1257
|
protected onFilterUpdated(): void;
|
|
1008
1258
|
protected onSortUpdated(): void;
|
|
1009
1259
|
setState(partial: Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
|
|
1010
1260
|
serializeState(): string;
|
|
1011
1261
|
deserializeState(serialized: string | Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
|
|
1012
|
-
setFilter(filter: IDataFilter | null, immediate?: boolean): void
|
|
1013
|
-
setSortList(sortList: IDataSort[], immediate?: boolean): void
|
|
1014
|
-
|
|
1015
|
-
|
|
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;
|
|
1265
|
+
setCurrentPage(currentPage: number): void | Promise<void>;
|
|
1266
|
+
setPageSize(pageSize: number, resetPage?: boolean): void | Promise<void>;
|
|
1016
1267
|
abstract loadPageData(options?: {
|
|
1017
1268
|
disableCache?: boolean;
|
|
1018
1269
|
signal?: AbortSignal;
|
|
1019
1270
|
}): void | Promise<void>;
|
|
1271
|
+
/**
|
|
1272
|
+
* Fetches or returns the full unpaginated dataset (e.g. for charts, analytics, or bulk exports).
|
|
1273
|
+
*/
|
|
1274
|
+
fetchAll?(options?: {
|
|
1275
|
+
disableCache?: boolean;
|
|
1276
|
+
signal?: AbortSignal;
|
|
1277
|
+
}): Promise<TRow[]>;
|
|
1020
1278
|
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1021
1279
|
cancelPending(): void;
|
|
1280
|
+
/**
|
|
1281
|
+
* Side-channel visible window slice resolution without reading or mutating currentPage or pageData.
|
|
1282
|
+
*/
|
|
1283
|
+
resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
|
|
1284
|
+
getWindowRows(startIndex: number, endIndex: number): Promise<TRow[]>;
|
|
1022
1285
|
}
|
|
1023
1286
|
|
|
1024
1287
|
interface ISetDataChunkedOptions {
|
|
@@ -1041,17 +1304,30 @@ declare function decryptPageRows<T = any>(rows: T[], encryption?: IProviderEncry
|
|
|
1041
1304
|
declare function encryptRows<T = any>(rows: T[], encryption?: IProviderEncryptionOptions, apiUrl?: string, idKey?: string): Promise<T[]>;
|
|
1042
1305
|
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[]>;
|
|
1043
1306
|
|
|
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
|
+
}
|
|
1044
1318
|
/**
|
|
1045
1319
|
* Normalizes text for consistent deterministic blind indexing (lowercased, trimmed, NFKC normalized).
|
|
1320
|
+
* Delegates to the shared normalizeFilterValue primitive.
|
|
1046
1321
|
*/
|
|
1047
|
-
declare function normalizeIndexTerm(value: any): string;
|
|
1322
|
+
declare function normalizeIndexTerm(value: any, options?: INormalizeOptions): string;
|
|
1048
1323
|
/**
|
|
1049
1324
|
* Extracts 3-character trigrams from a string for substring search.
|
|
1050
1325
|
*/
|
|
1051
|
-
declare function extractTrigrams(value: any): string[];
|
|
1326
|
+
declare function extractTrigrams(value: any, options?: INormalizeOptions): string[];
|
|
1052
1327
|
interface ISearchIndexRowEntry {
|
|
1053
1328
|
token: string;
|
|
1054
1329
|
trigrams: Set<string>;
|
|
1330
|
+
bucket?: string;
|
|
1055
1331
|
}
|
|
1056
1332
|
/**
|
|
1057
1333
|
* CSearchIndex provides deterministic blind indexing (HMAC-SHA256) and trigram token sets
|
|
@@ -1062,23 +1338,41 @@ declare class CSearchIndex {
|
|
|
1062
1338
|
private _rawKeyMaterial;
|
|
1063
1339
|
private _index;
|
|
1064
1340
|
private _indexedFields;
|
|
1065
|
-
|
|
1341
|
+
private _fieldBuckets;
|
|
1342
|
+
private _bucketToRows;
|
|
1343
|
+
minSearchLength: number;
|
|
1344
|
+
options: ISearchIndexOptions;
|
|
1345
|
+
constructor(keyMaterial: TKeyProvider, fields?: string[], options?: ISearchIndexOptions);
|
|
1066
1346
|
get indexedFields(): readonly string[];
|
|
1067
1347
|
setFields(fields: string[]): void;
|
|
1348
|
+
isFieldIndexed(field: string): boolean;
|
|
1349
|
+
private _decryptedRowResolver?;
|
|
1350
|
+
setDecryptedRowResolver(resolver?: (row: any) => any): void;
|
|
1351
|
+
hasDecryptedRowResolver(): boolean;
|
|
1352
|
+
private _addBucketRow;
|
|
1353
|
+
getBucketsForField(field: string): Set<string>;
|
|
1354
|
+
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>;
|
|
1357
|
+
getCandidateRowsForBuckets(field: string, bucketKeys: Iterable<string>): Set<any>;
|
|
1358
|
+
getCandidateRecordIdsForBuckets(field: string, bucketKeys: Iterable<string>, idKey?: string): Set<any>;
|
|
1359
|
+
getCandidateRecordIdsForRange(operator: string, targetValue: any, field: string, idKey?: string): Set<any>;
|
|
1068
1360
|
private _getHmacKey;
|
|
1069
1361
|
/**
|
|
1070
1362
|
* Computes a deterministic HMAC-SHA256 token for a term.
|
|
1363
|
+
* Supports domain separation via field name or full IBlindIndexOptions.
|
|
1071
1364
|
*/
|
|
1072
|
-
computeToken(term: any): Promise<string>;
|
|
1365
|
+
computeToken(term: any, fieldOrOptions?: string | IBlindIndexOptions): Promise<string>;
|
|
1073
1366
|
/**
|
|
1074
1367
|
* Computes a deterministic HMAC-SHA256 blind index hash for a term using the configured HMAC key.
|
|
1075
1368
|
* Performs Unicode NFKC normalization, trimming, and lowercasing.
|
|
1076
1369
|
*/
|
|
1077
|
-
computeBlindIndex(term: any): Promise<string>;
|
|
1370
|
+
computeBlindIndex(term: any, fieldOrOptions?: string | IBlindIndexOptions): Promise<string>;
|
|
1078
1371
|
/**
|
|
1079
1372
|
* Computes HMAC-SHA256 tokens for all trigrams of a term.
|
|
1373
|
+
* Supports domain separation via field name or full IBlindIndexOptions.
|
|
1080
1374
|
*/
|
|
1081
|
-
computeTrigramTokens(term: any): Promise<Set<string>>;
|
|
1375
|
+
computeTrigramTokens(term: any, fieldOrOptions?: string | IBlindIndexOptions): Promise<Set<string>>;
|
|
1082
1376
|
/**
|
|
1083
1377
|
* Indexes a single row before its fields are encrypted.
|
|
1084
1378
|
*/
|
|
@@ -1100,19 +1394,50 @@ declare class CSearchIndex {
|
|
|
1100
1394
|
* Evaluates whether a row matches an exact or substring query on an indexed encrypted field.
|
|
1101
1395
|
*/
|
|
1102
1396
|
evaluateField(operator: string, row: any, field: string, filterValue: any): Promise<boolean | null>;
|
|
1397
|
+
private _getRowFieldValue;
|
|
1103
1398
|
/**
|
|
1104
1399
|
* Pre-computes query tokens for an active filter, returning a high-performance synchronous
|
|
1105
1400
|
* evaluator function suitable for row-by-row filtering in memory.
|
|
1401
|
+
*
|
|
1402
|
+
* Supports hybrid evaluation across encrypted blind-indexed fields and unindexed / plaintext fields:
|
|
1403
|
+
* - Evaluates candidate rows matching the encrypted blind index first.
|
|
1404
|
+
* - Evaluates all unindexed filter conditions against decrypted/plaintext row fields in memory.
|
|
1405
|
+
* - Never treats an unhandled filter branch or null evaluator as a match-all inside an AND conjunction.
|
|
1406
|
+
*/
|
|
1407
|
+
createFilterEvaluator(filter: IDataFilter$1 | any): Promise<((row: any) => boolean) | null>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Secondary in-memory verification filter executed post-decryption to filter out
|
|
1410
|
+
* false positives from non-contiguous trigram matches and verify exact substring containment.
|
|
1411
|
+
*/
|
|
1412
|
+
verifyDecryptedRows<T = any>(rows: T[], filter: IDataFilter$1 | any): T[];
|
|
1413
|
+
/**
|
|
1414
|
+
* Verifies a single decrypted row against an active filter post-decryption.
|
|
1415
|
+
*/
|
|
1416
|
+
verifyDecryptedRow(row: any, filter: IDataFilter$1 | any): boolean;
|
|
1417
|
+
/**
|
|
1418
|
+
* Determines whether an active filter requires post-decryption verification
|
|
1419
|
+
* (e.g. for substring / trigram queries, short queries < minSearchLength, range buckets,
|
|
1420
|
+
* or any queries that may yield candidate false positives in stage-1 blind index filtering).
|
|
1106
1421
|
*/
|
|
1107
|
-
|
|
1422
|
+
requiresPostVerification(filter: IDataFilter$1 | any): boolean;
|
|
1423
|
+
private _compileEvaluator;
|
|
1108
1424
|
}
|
|
1109
1425
|
|
|
1110
1426
|
declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataProvider<TRow> {
|
|
1111
1427
|
encryption?: IProviderEncryptionOptions;
|
|
1112
1428
|
protected _searchIndex?: CSearchIndex;
|
|
1429
|
+
protected _decryptedCache: Map<string | number, TRow>;
|
|
1430
|
+
protected _decryptedRefCache: WeakMap<object, TRow>;
|
|
1113
1431
|
constructor(options?: IDataProviderOptions);
|
|
1114
1432
|
get isEncryptionEnabled(): boolean;
|
|
1115
1433
|
get searchIndex(): CSearchIndex | undefined;
|
|
1434
|
+
getDecryptedRow(rowOrId: any): TRow | undefined;
|
|
1435
|
+
cacheDecryptedRow(rowOrId: any, decryptedRow: TRow): void;
|
|
1436
|
+
clearDecryptedCache(): void;
|
|
1437
|
+
populateDecryptedCache(rows: TRow[]): Promise<void>;
|
|
1438
|
+
isFieldEncrypted(field: string, sampleRows?: TRow[]): boolean;
|
|
1439
|
+
warnIfEncryptedFilterWithoutSupport(filter: IDataFilter$1 | any, sampleRows?: TRow[]): void;
|
|
1440
|
+
protected _guardEncryptedSorting(sortList: IDataSort[]): void;
|
|
1116
1441
|
private _warmupKeyAsync;
|
|
1117
1442
|
protected _initSearchIndex(): void;
|
|
1118
1443
|
setEncryption(encryption?: IProviderEncryptionOptions): void;
|
|
@@ -1139,17 +1464,32 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
|
|
|
1139
1464
|
protected _filterDirty: boolean;
|
|
1140
1465
|
protected _sortDirty: boolean;
|
|
1141
1466
|
protected _activeFilterEvaluator: ((row: any) => boolean) | null;
|
|
1467
|
+
protected _expectedRowCount?: number;
|
|
1468
|
+
batchSize: number | false;
|
|
1469
|
+
batchLoad: 'initially' | 'onDemand';
|
|
1470
|
+
onDemandFilterPolicy: 'ingestAll' | 'warnOnly';
|
|
1471
|
+
onBatchLoaded?: (batch: IBatchLoadedEvent<TRow>) => void;
|
|
1472
|
+
loadedBatches: Set<number>;
|
|
1473
|
+
protected _rawSourceData?: TRow[];
|
|
1474
|
+
protected _isBatchLoading: boolean;
|
|
1475
|
+
get isBatchLoading(): boolean;
|
|
1476
|
+
set isBatchLoading(val: boolean);
|
|
1477
|
+
protected _batchProgress?: IBatchProgress;
|
|
1478
|
+
get batchProgress(): IBatchProgress | undefined;
|
|
1479
|
+
set batchProgress(val: IBatchProgress | undefined);
|
|
1480
|
+
protected _batchGeneration: number;
|
|
1142
1481
|
constructor(options?: IDataProviderOptions);
|
|
1143
1482
|
get allData(): TRow[];
|
|
1144
1483
|
set allData(data: TRow[]);
|
|
1145
1484
|
get rowMap(): readonly TRow[];
|
|
1146
1485
|
setData(data: TRow[]): Promise<void> | void;
|
|
1486
|
+
protected _setDataBatched(data: TRow[]): Promise<void>;
|
|
1147
1487
|
protected _setDataEncrypted(data: TRow[]): Promise<void>;
|
|
1148
1488
|
setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
|
|
1149
1489
|
protected onFilterUpdated(): void;
|
|
1150
1490
|
protected onSortUpdated(): void;
|
|
1151
|
-
setFilter(filter: IDataFilter | null, immediate?: boolean): void
|
|
1152
|
-
setSortList(sortList: IDataSort[], immediate?: boolean): void
|
|
1491
|
+
setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
|
|
1492
|
+
setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
|
|
1153
1493
|
clearEncryption(): void;
|
|
1154
1494
|
/**
|
|
1155
1495
|
* Explicitly rebuilds the reference map array if row properties inside allData were mutated in-place.
|
|
@@ -1159,8 +1499,24 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
|
|
|
1159
1499
|
disableCache?: boolean;
|
|
1160
1500
|
}): Promise<void>;
|
|
1161
1501
|
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1502
|
+
fetchAll(): Promise<TRow[]>;
|
|
1503
|
+
protected _getNormalizeOptions(): INormalizeOptions | undefined;
|
|
1162
1504
|
private _computeFilteredAndSorted;
|
|
1163
|
-
|
|
1505
|
+
protected _inFlightLoad?: Promise<void>;
|
|
1506
|
+
loadPageData(): void | Promise<void>;
|
|
1507
|
+
protected _executeLoadPageDataSync(): void;
|
|
1508
|
+
protected _executeLoadPageData(): Promise<void>;
|
|
1509
|
+
loadMore(): Promise<void>;
|
|
1510
|
+
loadBatch(batchNumber: number): Promise<void>;
|
|
1511
|
+
ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
|
|
1512
|
+
loadRange(startIndex: number, endIndex: number): Promise<void>;
|
|
1513
|
+
resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
|
|
1514
|
+
getWindowRows(startIndex: number, endIndex: number): Promise<TRow[]>;
|
|
1515
|
+
hasMissingBatches(): boolean;
|
|
1516
|
+
isBatchLoaded(batchNumber: number): boolean;
|
|
1517
|
+
isFullyLoaded(): boolean;
|
|
1518
|
+
getState(): IDataProviderState<TRow>;
|
|
1519
|
+
setState(partial: Partial<IDataProviderState<TRow>>, options?: IDataProviderSetStateOptions): void;
|
|
1164
1520
|
}
|
|
1165
1521
|
|
|
1166
1522
|
declare abstract class ACacheProvider {
|
|
@@ -1175,6 +1531,10 @@ declare abstract class ACacheProvider {
|
|
|
1175
1531
|
}
|
|
1176
1532
|
|
|
1177
1533
|
declare class RequestProvider {
|
|
1534
|
+
/**
|
|
1535
|
+
* Clears ephemeral session key discriminators. Used for testing fresh runtime sessions.
|
|
1536
|
+
*/
|
|
1537
|
+
static resetEphemeralKeyDiscriminators(): void;
|
|
1178
1538
|
cacheProvider: ACacheProvider | null;
|
|
1179
1539
|
cacheStrategy?: ECacheStrategy;
|
|
1180
1540
|
cacheLifetime: number | null;
|
|
@@ -1187,6 +1547,9 @@ declare class RequestProvider {
|
|
|
1187
1547
|
private static requestQueue;
|
|
1188
1548
|
private static executing;
|
|
1189
1549
|
private static requestsInFlight;
|
|
1550
|
+
private static inFlightBridges;
|
|
1551
|
+
private static contextResolver?;
|
|
1552
|
+
static setContextResolver(resolver: ((options?: IRequestOptions) => any) | undefined): void;
|
|
1190
1553
|
private lastUrl?;
|
|
1191
1554
|
private lastOptions?;
|
|
1192
1555
|
private dataReceivedCallback?;
|
|
@@ -1215,12 +1578,14 @@ declare class RequestProvider {
|
|
|
1215
1578
|
refresh(hardRefresh?: boolean): Promise<any>;
|
|
1216
1579
|
private resolveContext;
|
|
1217
1580
|
private getInFlightMap;
|
|
1581
|
+
private getInFlightBridgeMap;
|
|
1218
1582
|
getUniqueKey(url: string, options?: IRequestOptions): string;
|
|
1219
1583
|
registerRequest<T>(url: string, options?: IRequestOptions): Promise<T>;
|
|
1220
1584
|
static executeAll(): void;
|
|
1221
1585
|
private isSameOriginUrl;
|
|
1222
1586
|
private getCipherProvider;
|
|
1223
1587
|
private isDataEncrypted;
|
|
1588
|
+
private resolveFullRequestUrl;
|
|
1224
1589
|
private buildEncryptionContext;
|
|
1225
1590
|
private decryptPayloadIfNeeded;
|
|
1226
1591
|
request<T>(url: string, options?: IRequestOptions): Promise<T>;
|
|
@@ -1249,10 +1614,13 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
|
|
|
1249
1614
|
cacheStrategy: ECacheStrategy | null;
|
|
1250
1615
|
cacheLifetime: number;
|
|
1251
1616
|
refreshOnMutation: boolean | undefined;
|
|
1252
|
-
|
|
1253
|
-
|
|
1617
|
+
protected _isAccumulating: boolean;
|
|
1618
|
+
protected _inFlightLoadMore: boolean;
|
|
1619
|
+
protected _inFlightBatches: Map<number, Promise<void>>;
|
|
1620
|
+
protected _currentOnDemandBatch?: number;
|
|
1254
1621
|
private _lastDataReceivedPromise;
|
|
1255
1622
|
constructor(options?: IDataProviderOptions);
|
|
1623
|
+
get hasMore(): boolean;
|
|
1256
1624
|
loadMore(): Promise<void>;
|
|
1257
1625
|
setEncryption(encryption?: IProviderEncryptionOptions): void;
|
|
1258
1626
|
clearEncryption(): void;
|
|
@@ -1262,17 +1630,34 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
|
|
|
1262
1630
|
refreshData(options?: {
|
|
1263
1631
|
disableCache?: boolean;
|
|
1264
1632
|
}): 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>;
|
|
1636
|
+
ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
|
|
1637
|
+
loadRange(startIndex: number, endIndex: number): Promise<void>;
|
|
1638
|
+
setCurrentPage(currentPage: number): Promise<void>;
|
|
1639
|
+
ingestAllBatches(): Promise<void>;
|
|
1640
|
+
setFilter(filter: IDataFilter | null, immediate?: boolean): Promise<void>;
|
|
1641
|
+
setSortList(sortList: IDataSort[], immediate?: boolean): Promise<void>;
|
|
1642
|
+
loadPageData(options?: {
|
|
1643
|
+
disableCache?: boolean;
|
|
1644
|
+
signal?: AbortSignal;
|
|
1645
|
+
}): Promise<void>;
|
|
1265
1646
|
setAPIUrl(url: string): Promise<void>;
|
|
1266
1647
|
create(item: TRow): Promise<void>;
|
|
1267
1648
|
update(item: TRow): Promise<void>;
|
|
1268
1649
|
delete(items: TRow[]): Promise<void>;
|
|
1269
|
-
loadPageData(): Promise<void>;
|
|
1270
1650
|
}
|
|
1271
1651
|
|
|
1272
1652
|
declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRow> {
|
|
1273
1653
|
pageDataHandler: TPageDataHandler<TRow>;
|
|
1274
1654
|
contextKey: string;
|
|
1275
1655
|
encryption?: IProviderEncryptionOptions;
|
|
1656
|
+
protected _allData: TRow[];
|
|
1657
|
+
protected _isAccumulating: boolean;
|
|
1658
|
+
protected _inFlightLoadMore: boolean;
|
|
1659
|
+
get allData(): TRow[];
|
|
1660
|
+
set allData(val: TRow[]);
|
|
1276
1661
|
private latestRequestId;
|
|
1277
1662
|
private abortController;
|
|
1278
1663
|
constructor(options?: IDataProviderOptions);
|
|
@@ -1283,7 +1668,19 @@ declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
|
|
|
1283
1668
|
loadPageData(options?: {
|
|
1284
1669
|
disableCache?: boolean;
|
|
1285
1670
|
signal?: AbortSignal;
|
|
1671
|
+
page?: number;
|
|
1286
1672
|
}): Promise<void>;
|
|
1673
|
+
get hasMore(): boolean;
|
|
1674
|
+
loadMore(): Promise<void>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Fetches the complete unpaginated dataset from the server (e.g. for charts or exports).
|
|
1677
|
+
* Passes pageSize: 0 to the page data handler without modifying this provider's active paginated `pageSize`.
|
|
1678
|
+
* Stores the result in `_allData` and returns it.
|
|
1679
|
+
*/
|
|
1680
|
+
fetchAll(options?: {
|
|
1681
|
+
disableCache?: boolean;
|
|
1682
|
+
signal?: AbortSignal;
|
|
1683
|
+
}): Promise<TRow[]>;
|
|
1287
1684
|
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1288
1685
|
cancelPending(): void;
|
|
1289
1686
|
}
|
|
@@ -1322,7 +1719,8 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
|
|
|
1322
1719
|
private _allVisibleRowsCache;
|
|
1323
1720
|
private _decryptedNodeMap;
|
|
1324
1721
|
invalidateStaticCache(): void;
|
|
1325
|
-
|
|
1722
|
+
clearVisibleCache(): void;
|
|
1723
|
+
setFilter(filter: IDataFilter$1 | null, immediate?: boolean): void | Promise<void>;
|
|
1326
1724
|
protected onFilterUpdated(): void;
|
|
1327
1725
|
private get _staticNodes();
|
|
1328
1726
|
private get _nodeMap();
|
|
@@ -1330,16 +1728,19 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
|
|
|
1330
1728
|
constructor(options?: ITreeDataProviderOptions);
|
|
1331
1729
|
protected _applyTreeData(rows: TRow[]): void;
|
|
1332
1730
|
setData(data: TRow[]): Promise<void> | void;
|
|
1731
|
+
protected _setDataBatchedTree(data: TRow[]): Promise<void>;
|
|
1333
1732
|
protected _setDataEncrypted(data: TRow[]): Promise<void>;
|
|
1334
1733
|
setDataChunked(data: TRow[], options?: ISetDataChunkedOptions): Promise<void>;
|
|
1335
1734
|
private buildStaticNodes;
|
|
1336
1735
|
protected onSortUpdated(): void;
|
|
1337
|
-
setSortList(sortList: IDataSort[], immediate?: boolean): void
|
|
1736
|
+
setSortList(sortList: IDataSort$1[], immediate?: boolean): void | Promise<void>;
|
|
1338
1737
|
private computeSortedIds;
|
|
1339
1738
|
private isNodeVisible;
|
|
1340
1739
|
private paginateNodes;
|
|
1740
|
+
private _buildFilteredHierarchy;
|
|
1341
1741
|
private updatePageData;
|
|
1342
|
-
|
|
1742
|
+
protected _executeLoadPageDataSync(): void;
|
|
1743
|
+
protected _executeLoadPageData(): Promise<void>;
|
|
1343
1744
|
clearEncryption(): void;
|
|
1344
1745
|
get treeNodes(): ITreeNode<TRow>[];
|
|
1345
1746
|
get allVisibleNodes(): ITreeNode<TRow>[];
|
|
@@ -1349,6 +1750,8 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
|
|
|
1349
1750
|
get allVisibleRows(): (TRow & ITreeNode<TRow> & {
|
|
1350
1751
|
__treeNode: ITreeNode<TRow>;
|
|
1351
1752
|
})[];
|
|
1753
|
+
resolveRangeRows(startIndex: number, endIndex: number): Promise<TRow[]>;
|
|
1754
|
+
getWindowRows(startIndex: number, endIndex: number): Promise<TRow[]>;
|
|
1352
1755
|
get visibleRows(): ITreeNode<TRow>[];
|
|
1353
1756
|
getAllNodes(): ITreeNode<TRow>[];
|
|
1354
1757
|
getFlatNodes(): ITreeNode<TRow>[];
|
|
@@ -1359,6 +1762,7 @@ declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends
|
|
|
1359
1762
|
collapseNode(nodeId: string | number): void;
|
|
1360
1763
|
expandAll(): void;
|
|
1361
1764
|
collapseAll(): void;
|
|
1765
|
+
setExpandedNodes(nodes: Set<string | number> | (string | number)[]): void;
|
|
1362
1766
|
getNode(nodeId: string | number): ITreeNode<TRow> | undefined;
|
|
1363
1767
|
getChildren(nodeId: string | number): ITreeNode<TRow>[];
|
|
1364
1768
|
getParent(nodeId: string | number): ITreeNode<TRow> | undefined;
|
|
@@ -1371,6 +1775,9 @@ declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> exten
|
|
|
1371
1775
|
cacheStrategy: ECacheStrategy | null;
|
|
1372
1776
|
cacheLifetime: number;
|
|
1373
1777
|
refreshOnMutation: boolean | undefined;
|
|
1778
|
+
protected _isAccumulating: boolean;
|
|
1779
|
+
protected _inFlightBatches: Map<number, Promise<void>>;
|
|
1780
|
+
protected _currentOnDemandBatch?: number;
|
|
1374
1781
|
private _lastDataReceivedPromise;
|
|
1375
1782
|
constructor(options?: ITreeDataProviderOptions);
|
|
1376
1783
|
setEncryption(encryption?: IProviderEncryptionOptions): void;
|
|
@@ -1381,11 +1788,23 @@ declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> exten
|
|
|
1381
1788
|
disableCache?: boolean;
|
|
1382
1789
|
}): Promise<void>;
|
|
1383
1790
|
private _initialFetch;
|
|
1791
|
+
protected _fetchBatchedTree(batchGen: number, disableCache: boolean, shouldSkipDecryption: boolean): Promise<void>;
|
|
1792
|
+
protected _streamRemainingTreeBatches(batchGen: number, batchSize: number, disableCache: boolean, shouldSkipDecryption: boolean, startPage?: number): Promise<void>;
|
|
1793
|
+
loadBatch(batchNumber: number): Promise<void>;
|
|
1794
|
+
ensureRangeLoaded(startIndex: number, endIndex: number): Promise<void>;
|
|
1795
|
+
loadRange(startIndex: number, endIndex: number): Promise<void>;
|
|
1796
|
+
setCurrentPage(currentPage: number): Promise<void>;
|
|
1797
|
+
ingestAllBatches(): Promise<void>;
|
|
1798
|
+
setFilter(filter: IDataFilter | null, immediate?: boolean): Promise<void>;
|
|
1799
|
+
setSortList(sortList: IDataSort[], immediate?: boolean): Promise<void>;
|
|
1800
|
+
loadPageData(options?: {
|
|
1801
|
+
disableCache?: boolean;
|
|
1802
|
+
signal?: AbortSignal;
|
|
1803
|
+
}): Promise<void>;
|
|
1384
1804
|
setAPIUrl(url: string): Promise<void>;
|
|
1385
1805
|
create(item: TRow): Promise<void>;
|
|
1386
1806
|
update(item: TRow): Promise<void>;
|
|
1387
1807
|
delete(items: TRow[]): Promise<void>;
|
|
1388
|
-
loadPageData(): Promise<void>;
|
|
1389
1808
|
}
|
|
1390
1809
|
|
|
1391
1810
|
/**
|
|
@@ -1621,6 +2040,7 @@ declare class CLocalStorageCache extends ACacheProvider {
|
|
|
1621
2040
|
static getInstance(): CLocalStorageCache;
|
|
1622
2041
|
type: string;
|
|
1623
2042
|
private quotaOptions;
|
|
2043
|
+
private inMemoryAccessMeta;
|
|
1624
2044
|
configureQuota(options: Partial<ICacheQuotaOptions>): void;
|
|
1625
2045
|
getQuotaOptions(): Required<ICacheQuotaOptions>;
|
|
1626
2046
|
private constructor();
|
|
@@ -1942,54 +2362,90 @@ declare class QueueStorageFactory {
|
|
|
1942
2362
|
static _reset(): void;
|
|
1943
2363
|
}
|
|
1944
2364
|
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
declare const
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
declare const
|
|
2365
|
+
/**
|
|
2366
|
+
* Detects whether an arbitrary value is an encrypted payload envelope.
|
|
2367
|
+
*/
|
|
2368
|
+
declare const isEncryptedPayload: (payload: any) => boolean;
|
|
2369
|
+
/**
|
|
2370
|
+
* Recursively extracts all target field names referenced by an active filter.
|
|
2371
|
+
*/
|
|
2372
|
+
declare const extractFilterFieldNames: (filter: any) => string[];
|
|
2373
|
+
/**
|
|
2374
|
+
* Checks substring containment (`needle` in `haystack`) using shared normalization.
|
|
2375
|
+
*/
|
|
2376
|
+
declare const compareContains: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2377
|
+
/**
|
|
2378
|
+
* Standard set membership check (`val IN [a, b, c]`).
|
|
2379
|
+
*/
|
|
2380
|
+
declare const compareIn: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2381
|
+
declare const compareEqual: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2382
|
+
declare const compareValues: (rowValue: any, filterValue: any, options?: INormalizeOptions) => number;
|
|
2383
|
+
declare const compareAnd: (row: TDataRow, nested: any, options?: INormalizeOptions) => boolean;
|
|
2384
|
+
declare const compareOr: (row: TDataRow, nested: any, options?: INormalizeOptions) => boolean;
|
|
2385
|
+
declare const applyOperator: (operator: string, rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2386
|
+
/**
|
|
2387
|
+
* Normalizes standard and shorthand filter structures into a canonical IDataFilter tree.
|
|
2388
|
+
*/
|
|
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: {
|
|
1953
2392
|
idKey: string;
|
|
1954
2393
|
parentKey: string;
|
|
2394
|
+
normalizeOptions?: INormalizeOptions;
|
|
1955
2395
|
}) => {
|
|
1956
2396
|
visibleNodes: any[];
|
|
1957
2397
|
expandedNodes: Set<string | number>;
|
|
1958
2398
|
};
|
|
1959
|
-
declare const filterData: (data: any[], filter: IDataFilter, options?: {
|
|
2399
|
+
declare const filterData: (data: any[], filter: IDataFilter$1, options?: {
|
|
1960
2400
|
treeOptions?: {
|
|
1961
2401
|
idKey: string;
|
|
1962
2402
|
parentKey: string;
|
|
1963
2403
|
};
|
|
1964
2404
|
rowEvaluator?: (row: any) => boolean;
|
|
2405
|
+
normalizeOptions?: INormalizeOptions;
|
|
1965
2406
|
}) => {
|
|
1966
2407
|
results: any[];
|
|
1967
2408
|
expandedNodes?: Set<string | number>;
|
|
1968
2409
|
};
|
|
1969
|
-
declare const useFilterLogic: () => {
|
|
1970
|
-
|
|
1971
|
-
|
|
2410
|
+
declare const useFilterLogic: (defaultOptions?: INormalizeOptions) => {
|
|
2411
|
+
isEncryptedPayload: (payload: any) => boolean;
|
|
2412
|
+
extractFilterFieldNames: (filter: any) => string[];
|
|
2413
|
+
normalizeFilter: (filter: any) => IDataFilter$1 | null;
|
|
2414
|
+
normalizeFilterValue: typeof normalizeFilterValue;
|
|
2415
|
+
foldAscii: typeof foldAscii;
|
|
2416
|
+
compareEqual: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2417
|
+
compareIn: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2418
|
+
compareContains: (rowValue: any, filterValue: any, options?: INormalizeOptions) => boolean;
|
|
2419
|
+
compareValues: (rowValue: any, filterValue: any, options?: INormalizeOptions) => number;
|
|
2420
|
+
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: {
|
|
1972
2423
|
idKey: string;
|
|
1973
2424
|
parentKey: string;
|
|
2425
|
+
normalizeOptions?: INormalizeOptions;
|
|
1974
2426
|
}) => {
|
|
1975
2427
|
visibleNodes: any[];
|
|
1976
2428
|
expandedNodes: Set<string | number>;
|
|
1977
2429
|
};
|
|
1978
|
-
filterData: (data: any[], filter: IDataFilter, options?: {
|
|
2430
|
+
filterData: (data: any[], filter: IDataFilter$1, options?: {
|
|
1979
2431
|
treeOptions?: {
|
|
1980
2432
|
idKey: string;
|
|
1981
2433
|
parentKey: string;
|
|
1982
2434
|
};
|
|
1983
2435
|
rowEvaluator?: (row: any) => boolean;
|
|
2436
|
+
normalizeOptions?: INormalizeOptions;
|
|
1984
2437
|
}) => {
|
|
1985
2438
|
results: any[];
|
|
1986
2439
|
expandedNodes?: Set<string | number>;
|
|
1987
2440
|
};
|
|
1988
2441
|
};
|
|
1989
2442
|
|
|
1990
|
-
|
|
2443
|
+
interface ISortDataOptions {
|
|
2444
|
+
resolveValue?: (row: TDataRow, field: string) => any;
|
|
2445
|
+
}
|
|
2446
|
+
declare const sortData: (sortList: IDataSort$1[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
|
|
1991
2447
|
declare const useSortLogic: () => {
|
|
1992
|
-
sortData: (sortList: IDataSort[], rows: TDataRow[]) => TDataRow[];
|
|
2448
|
+
sortData: (sortList: IDataSort$1[], rows: TDataRow[], options?: ISortDataOptions) => TDataRow[];
|
|
1993
2449
|
};
|
|
1994
2450
|
|
|
1995
2451
|
interface IDebouncedFunction<T extends (...args: any[]) => any> {
|
|
@@ -2065,11 +2521,16 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
2065
2521
|
protected keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
2066
2522
|
protected activeKid?: string;
|
|
2067
2523
|
protected allowedKids?: string[];
|
|
2068
|
-
|
|
2524
|
+
protected defaultAllowedAlgorithms: string[];
|
|
2525
|
+
protected allowInsecureKdf?: boolean;
|
|
2526
|
+
protected maxAllowedIterations?: number;
|
|
2527
|
+
constructor(key?: TKeyProvider | IKeyPair | any, options?: {
|
|
2069
2528
|
keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
2070
2529
|
activeKid?: string;
|
|
2071
2530
|
allowedKids?: string[];
|
|
2072
2531
|
hmacKey?: TKeyProvider;
|
|
2532
|
+
allowInsecureKdf?: boolean;
|
|
2533
|
+
maxAllowedIterations?: number;
|
|
2073
2534
|
[key: string]: any;
|
|
2074
2535
|
});
|
|
2075
2536
|
/**
|
|
@@ -2106,9 +2567,10 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
2106
2567
|
getHmacKey(): TKeyProvider | undefined;
|
|
2107
2568
|
/**
|
|
2108
2569
|
* Computes a deterministic HMAC-SHA256 blind index hash for an arbitrary term.
|
|
2109
|
-
*
|
|
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.
|
|
2110
2572
|
*/
|
|
2111
|
-
computeBlindIndex(value: any,
|
|
2573
|
+
computeBlindIndex(value: any, hmacKeyOrOptions?: CryptoKey | TKeyProvider | IBlindIndexOptions, options?: IBlindIndexOptions): Promise<string>;
|
|
2112
2574
|
/**
|
|
2113
2575
|
* Pre-derives and caches the native CryptoKey for subsequent cryptographic operations.
|
|
2114
2576
|
* Subclasses should override this with a dedicated, non-side-effecting implementation.
|
|
@@ -2139,13 +2601,22 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
2139
2601
|
*/
|
|
2140
2602
|
[Symbol.dispose](): void;
|
|
2141
2603
|
[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
|
+
static normalizeUrl(rawUrl?: string): string;
|
|
2613
|
+
protected _normalizeUrl(rawUrl?: string): string;
|
|
2142
2614
|
/**
|
|
2143
2615
|
* Resolves effective Authenticated Additional Data (AAD) for the operation:
|
|
2144
2616
|
* 1. If options.bindRequestContextAad is explicitly false, returns options.aad directly without context binding.
|
|
2145
|
-
* 2. When encrypting
|
|
2146
|
-
* 3.
|
|
2147
|
-
* 4.
|
|
2148
|
-
* 5. Otherwise returns undefined.
|
|
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.
|
|
2149
2620
|
*/
|
|
2150
2621
|
protected _resolveEffectiveAad(options?: IEncryptionContext, isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
|
|
2151
2622
|
/**
|
|
@@ -2224,332 +2695,507 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
2224
2695
|
*/
|
|
2225
2696
|
decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
|
|
2226
2697
|
}
|
|
2698
|
+
declare function normalizeUrl(rawUrl?: string): string;
|
|
2227
2699
|
|
|
2228
2700
|
/**
|
|
2229
|
-
*
|
|
2230
|
-
* Provides key generation, JWK import/export, key wrapping (AES-KW / RSA-OAEP),
|
|
2231
|
-
* and standard Key Derivation Functions (PBKDF2 / HKDF).
|
|
2701
|
+
* Generates a cryptographically secure random byte buffer of the specified length.
|
|
2232
2702
|
*/
|
|
2233
|
-
declare
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2703
|
+
declare function randomBytes(length: number): Uint8Array;
|
|
2704
|
+
/**
|
|
2705
|
+
* Converts a Base64 or Base64URL-encoded string back into a Uint8Array.
|
|
2706
|
+
* Normalizes URL-safe characters and padding, strictly validating against the Base64 alphabet.
|
|
2707
|
+
*/
|
|
2708
|
+
declare function fromBase64(base64: string): Uint8Array;
|
|
2709
|
+
/**
|
|
2710
|
+
* Deterministically resolves a salt from Uint8Array, ArrayBuffer, Base64/Base64URL string, or raw text string.
|
|
2711
|
+
* Guarantees 100% identical salt byte resolution between Node.js and Browser environments.
|
|
2712
|
+
*/
|
|
2713
|
+
declare function resolveSalt(salt?: Uint8Array | ArrayBuffer | string): Uint8Array;
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* Generates a random AES CryptoKey suitable for AES-GCM or AES-CBC.
|
|
2717
|
+
*
|
|
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.
|
|
2722
|
+
*/
|
|
2723
|
+
declare function generateAESKey(length?: 128 | 256, algorithm?: 'AES-GCM' | 'AES-CBC' | 'AES-KW', extractable?: boolean): Promise<CryptoKey>;
|
|
2724
|
+
/**
|
|
2725
|
+
* Exports an AES CryptoKey as a raw base64 string.
|
|
2726
|
+
*/
|
|
2727
|
+
declare function exportAESKey(key: CryptoKey): Promise<string>;
|
|
2728
|
+
/**
|
|
2729
|
+
* Imports an AES CryptoKey from a raw base64 string.
|
|
2730
|
+
*/
|
|
2731
|
+
declare function importAESKey(base64: string, algorithm?: 'AES-GCM' | 'AES-CBC' | 'AES-KW', extractable?: boolean): Promise<CryptoKey>;
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* Generates an RSA-OAEP public/private key pair (2048 or 4096 bits).
|
|
2735
|
+
*/
|
|
2736
|
+
declare function generateRSAKeyPair(bits?: 2048 | 4096, hash?: 'SHA-256' | 'SHA-512', extractable?: boolean): Promise<IKeyPair>;
|
|
2737
|
+
/**
|
|
2738
|
+
* Generates an ECDH public/private key pair for elliptic curve Diffie-Hellman.
|
|
2739
|
+
*/
|
|
2740
|
+
declare function generateECDHKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
2741
|
+
/**
|
|
2742
|
+
* Exports a public CryptoKey to a portable JsonWebKey (JWK).
|
|
2743
|
+
*/
|
|
2744
|
+
declare function exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
2745
|
+
/**
|
|
2746
|
+
* Exports a private CryptoKey to a portable JsonWebKey (JWK).
|
|
2747
|
+
*/
|
|
2748
|
+
declare function exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
2749
|
+
/**
|
|
2750
|
+
* Imports a public key from a JsonWebKey (JWK).
|
|
2751
|
+
*/
|
|
2752
|
+
declare function importPublicKey(jwk: JsonWebKey, algorithm?: string | RsaHashedImportParams | EcKeyImportParams): Promise<CryptoKey>;
|
|
2753
|
+
/**
|
|
2754
|
+
* Imports a private key from a JsonWebKey (JWK).
|
|
2755
|
+
*/
|
|
2756
|
+
declare function importPrivateKey(jwk: JsonWebKey, algorithm?: string | RsaHashedImportParams | EcKeyImportParams, extractable?: boolean): Promise<CryptoKey>;
|
|
2757
|
+
/**
|
|
2758
|
+
* Imports a public key from a PEM (SPKI) or base64 SPKI string.
|
|
2759
|
+
*/
|
|
2760
|
+
declare function importPublicKeyFromPEM(pem: string, algorithm?: 'RSA-OAEP' | 'ECDH' | 'ECDSA', curve?: 'P-256' | 'P-384' | 'P-521', hash?: 'SHA-256' | 'SHA-512'): Promise<CryptoKey>;
|
|
2761
|
+
/**
|
|
2762
|
+
* Imports an ECDSA public key from PEM (SPKI) or base64 SPKI string for signature verification.
|
|
2763
|
+
*/
|
|
2764
|
+
declare function importECDSAPublicKeyFromPEM(pem: string, curve?: 'P-256' | 'P-384' | 'P-521'): Promise<CryptoKey>;
|
|
2765
|
+
/**
|
|
2766
|
+
* Imports a private key from a PEM (PKCS#8) or base64 PKCS#8 string.
|
|
2767
|
+
*/
|
|
2768
|
+
declare function importPrivateKeyFromPEM(pem: string, algorithm?: 'RSA-OAEP' | 'ECDH' | 'ECDSA', curve?: 'P-256' | 'P-384' | 'P-521', hash?: 'SHA-256' | 'SHA-512', extractable?: boolean): Promise<CryptoKey>;
|
|
2769
|
+
/**
|
|
2770
|
+
* Imports an ECDSA private key from PEM (PKCS#8) or base64 PKCS#8 string for signing.
|
|
2771
|
+
*/
|
|
2772
|
+
declare function importECDSAPrivateKeyFromPEM(pem: string, curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<CryptoKey>;
|
|
2773
|
+
/**
|
|
2774
|
+
* Exports a public CryptoKey to a standard PEM (SPKI) string.
|
|
2775
|
+
*/
|
|
2776
|
+
declare function exportPublicKeyToPEM(key: CryptoKey): Promise<string>;
|
|
2777
|
+
/**
|
|
2778
|
+
* Exports a private CryptoKey to a standard PEM (PKCS#8) string.
|
|
2779
|
+
*/
|
|
2780
|
+
declare function exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
|
|
2781
|
+
|
|
2782
|
+
/**
|
|
2783
|
+
* Wraps a target CryptoKey (e.g. an Account Symmetric Key) using a wrapping key
|
|
2784
|
+
* (AES-KW or RSA-OAEP).
|
|
2785
|
+
*/
|
|
2786
|
+
declare function wrapKey(keyToWrap: CryptoKey, wrappingKey: CryptoKey, format?: KeyFormat): Promise<string>;
|
|
2787
|
+
/**
|
|
2788
|
+
* Unwraps a base64-encoded wrapped key using an unwrapping key (AES-KW, AES-GCM, or RSA-OAEP).
|
|
2789
|
+
*/
|
|
2790
|
+
declare function unwrapKey(wrappedBase64: string, unwrappingKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean, keyUsages?: KeyUsage[], format?: KeyFormat): Promise<CryptoKey>;
|
|
2791
|
+
/**
|
|
2792
|
+
* Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
|
|
2793
|
+
* Designed for multi-user table and field-level encryption.
|
|
2794
|
+
*/
|
|
2795
|
+
declare function generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
|
|
2796
|
+
/**
|
|
2797
|
+
* Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
|
|
2798
|
+
* Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
|
|
2799
|
+
*/
|
|
2800
|
+
declare function wrapAccountKeyForUser(adek: CryptoKey, userPublicKey: CryptoKey): Promise<string>;
|
|
2801
|
+
/**
|
|
2802
|
+
* Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
|
|
2803
|
+
* Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
|
|
2804
|
+
*/
|
|
2805
|
+
declare function unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
|
|
2806
|
+
/**
|
|
2807
|
+
* Wraps an HMAC blind indexing key for a specific recipient user using their RSA-OAEP public key.
|
|
2808
|
+
* Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
|
|
2809
|
+
*/
|
|
2810
|
+
declare function wrapHMACKeyForUser(hmacKey: CryptoKey, userPublicKey: CryptoKey): Promise<string>;
|
|
2811
|
+
/**
|
|
2812
|
+
* Unwraps a Base64-encoded HMAC key using a recipient's RSA-OAEP private key.
|
|
2813
|
+
* Restores the CryptoKey configured for HMAC signing and verification in search indexing.
|
|
2814
|
+
*/
|
|
2815
|
+
declare function unwrapHMACKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, hash?: 'SHA-256' | 'SHA-384' | 'SHA-512', extractable?: boolean): Promise<CryptoKey>;
|
|
2816
|
+
/**
|
|
2817
|
+
* Atomically re-wraps an Account Data Encryption Key (ADEK) for a new recipient
|
|
2818
|
+
* without exposing the raw extractable symmetric key to caller application code.
|
|
2819
|
+
*
|
|
2820
|
+
* @param wrappedKeyBase64 - The existing ADEK envelope wrapped with current user's public key
|
|
2821
|
+
* @param myPrivateKey - Current user's RSA-OAEP private key
|
|
2822
|
+
* @param recipientPublicKey - New recipient's RSA-OAEP public key
|
|
2823
|
+
* @returns Base64-encoded wrapped key envelope for the recipient
|
|
2824
|
+
*/
|
|
2825
|
+
declare function rewrapAccountKeyForUser(wrappedKeyBase64: string, myPrivateKey: CryptoKey, recipientPublicKey: CryptoKey): Promise<string>;
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
|
|
2829
|
+
* Returns the derived CryptoKey and the base64-encoded salt.
|
|
2830
|
+
*/
|
|
2831
|
+
declare function deriveKey(passphrase: string | Uint8Array | ArrayBuffer, options: IKDFOptions): Promise<{
|
|
2832
|
+
key: CryptoKey;
|
|
2833
|
+
salt: string;
|
|
2834
|
+
}>;
|
|
2835
|
+
/**
|
|
2836
|
+
* Derives an AES-GCM CryptoKey from a high-entropy secret (e.g. an ECDH shared secret key)
|
|
2837
|
+
* using HKDF.
|
|
2838
|
+
*/
|
|
2839
|
+
declare function deriveKeyFromSecret(secretKey: CryptoKey, options?: IHKDFFromSecretOptions): Promise<CryptoKey>;
|
|
2840
|
+
/**
|
|
2841
|
+
* Derives two domain-separated, cryptographically isolated keys from a user password and salt:
|
|
2842
|
+
* 1. `authKey`: For client authentication, SRP, or server challenge proofs.
|
|
2843
|
+
* 2. `encryptionKey`: For AES-GCM local and field-level data encryption.
|
|
2844
|
+
*
|
|
2845
|
+
* Stage 1 (Password Stretching): PBKDF2-HMAC-SHA256 stretches low-entropy password into master secret.
|
|
2846
|
+
* Stage 2 (Domain Expansion): HKDF-Expand derives subkeys using domain-separated context info tags.
|
|
2847
|
+
* Immediate memory zeroization of intermediate master secret buffer is guaranteed.
|
|
2848
|
+
*
|
|
2849
|
+
* @param password - Master user password or passphrase
|
|
2850
|
+
* @param salt - Salt (or omitted to generate a secure random 16-byte salt)
|
|
2851
|
+
* @param options - PBKDF2 and HKDF configuration options
|
|
2852
|
+
*/
|
|
2853
|
+
declare function deriveAuthAndEncryptionKeys(password: string | Uint8Array | ArrayBuffer, salt?: Uint8Array | ArrayBuffer | string, options?: IDeriveAuthAndEncryptionOptions): Promise<IDomainDerivedKeys>;
|
|
2854
|
+
|
|
2855
|
+
declare const _bidxHmacKeyCache: Map<string, CryptoKey>;
|
|
2856
|
+
/**
|
|
2857
|
+
* Clears the in-memory memoization cache for derived blind-index HMAC CryptoKeys.
|
|
2858
|
+
*/
|
|
2859
|
+
declare function clearBlindIndexKeyCache(): void;
|
|
2860
|
+
/**
|
|
2861
|
+
* Generates an ECDSA P-256 signing key pair.
|
|
2862
|
+
*/
|
|
2863
|
+
declare function generateSigningKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
2864
|
+
/**
|
|
2865
|
+
* Generates an ECDSA signing key pair. Alias for generateSigningKeyPair.
|
|
2866
|
+
*/
|
|
2867
|
+
declare function generateECDSAKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
2868
|
+
/**
|
|
2869
|
+
* Generates a deterministic SHA-256 fingerprint for a public key (SPKI or raw).
|
|
2870
|
+
* Formatted as `SHA256:<base64url>`.
|
|
2871
|
+
*/
|
|
2872
|
+
declare function getKeyFingerprint(publicKey: CryptoKey | Uint8Array | ArrayBuffer | string): Promise<string>;
|
|
2873
|
+
/**
|
|
2874
|
+
* Signs arbitrary data or JSON objects using an ECDSA P-256 private key.
|
|
2875
|
+
* Objects are automatically serialized via canonicalizeJson() before hashing.
|
|
2876
|
+
*/
|
|
2877
|
+
declare function sign(data: any | string | Uint8Array, privateKey: CryptoKey): Promise<string>;
|
|
2878
|
+
/**
|
|
2879
|
+
* Verifies an ECDSA P-256 signature against original data or JSON object.
|
|
2880
|
+
*/
|
|
2881
|
+
declare function verify(data: any | string | Uint8Array, signature: string, publicKey: CryptoKey): Promise<boolean>;
|
|
2882
|
+
/**
|
|
2883
|
+
* Derives or validates an HMAC-SHA256 CryptoKey for deterministic blind indexing.
|
|
2884
|
+
*
|
|
2885
|
+
* Security Guarantees:
|
|
2886
|
+
* 1. Dedicated Key Requirement: Throws ERR_BIDX_MISSING_HMAC_KEY if keyMaterial is missing/undefined.
|
|
2887
|
+
* 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
|
|
2889
|
+
* domain separation info ('katlux-blind-index'). This prevents GPU dictionary attacks against the AES data key.
|
|
2890
|
+
* 3. Type Enforcement: If a CryptoKey is passed, enforces algorithm.name === 'HMAC'.
|
|
2891
|
+
*/
|
|
2892
|
+
declare function deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined): Promise<CryptoKey>;
|
|
2893
|
+
/**
|
|
2894
|
+
* Computes a deterministic HMAC-SHA256 blind index hash for an arbitrary term using the supplied CryptoKey.
|
|
2895
|
+
* Performs Unicode NFKC normalization, trimming, and lowercasing before computing the signature.
|
|
2896
|
+
*
|
|
2897
|
+
* Enforces cryptographic domain separation:
|
|
2898
|
+
* `token = HMAC("${kid ? kid + ':' : ''}${fieldName}:${tokenType}:${normalizedValue}", key)`
|
|
2899
|
+
*
|
|
2900
|
+
* @param value - The input string, number, or object to compute the blind index for.
|
|
2901
|
+
* @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.
|
|
2904
|
+
*/
|
|
2905
|
+
declare function computeBlindIndex(value: any, hmacKey: CryptoKey, options?: IBlindIndexOptions): Promise<string>;
|
|
2906
|
+
/**
|
|
2907
|
+
* Signs a structured access grant, embedding signature and granter key fingerprint.
|
|
2908
|
+
*/
|
|
2909
|
+
declare function signGrant(grant: IAccessGrant, granterPrivateKey: CryptoKey, granterPublicKey?: CryptoKey): Promise<ISignedGrant>;
|
|
2910
|
+
/**
|
|
2911
|
+
* Verifies the authenticity and integrity of a signed access grant against granter public key.
|
|
2912
|
+
*/
|
|
2913
|
+
declare function verifyGrant(signedGrant: ISignedGrant, granterPublicKey: CryptoKey, options?: IVerifyGrantOptions): Promise<boolean>;
|
|
2914
|
+
|
|
2915
|
+
/**
|
|
2916
|
+
* Encrypts raw bytes (e.g. PKCS#8 private key) into a standardized Katlux AES-GCM envelope.
|
|
2917
|
+
*
|
|
2918
|
+
* @param data - Raw byte buffer or Uint8Array to encrypt
|
|
2919
|
+
* @param key - AES-GCM CryptoKey (KEK)
|
|
2920
|
+
* @param options - Optional AAD, IV, or Key Identifier (kid)
|
|
2921
|
+
*/
|
|
2922
|
+
declare function encryptPayload(data: ArrayBuffer | Uint8Array, key: CryptoKey, options?: {
|
|
2923
|
+
iv?: Uint8Array;
|
|
2924
|
+
aad?: string | Uint8Array | ArrayBuffer;
|
|
2925
|
+
kid?: string;
|
|
2926
|
+
}): Promise<IEncryptedPayload>;
|
|
2927
|
+
/**
|
|
2928
|
+
* Decrypts an AES-GCM encrypted envelope back into raw bytes.
|
|
2929
|
+
*
|
|
2930
|
+
* @param payload - Standardized Katlux AES-GCM envelope
|
|
2931
|
+
* @param key - AES-GCM CryptoKey (KEK)
|
|
2932
|
+
* @param options - Optional AAD
|
|
2933
|
+
* @returns Raw decrypted ArrayBuffer
|
|
2934
|
+
*/
|
|
2935
|
+
declare function decryptPayload(payload: IEncryptedPayload, key: CryptoKey, options?: {
|
|
2936
|
+
aad?: string | Uint8Array | ArrayBuffer;
|
|
2937
|
+
}): Promise<ArrayBuffer>;
|
|
2938
|
+
/**
|
|
2939
|
+
* Atomically re-keys an existing AES-GCM encrypted envelope from oldKey to newKey.
|
|
2940
|
+
* Decrypts with oldKey, derives a fresh random 96-bit IV, and re-encrypts with newKey.
|
|
2941
|
+
* Memory zeroization of internal plaintext and ciphertext buffers is guaranteed via try...finally.
|
|
2942
|
+
*
|
|
2943
|
+
* @param payload - Existing AES-GCM encrypted payload envelope
|
|
2944
|
+
* @param oldKey - Current AES-GCM CryptoKey (KEK)
|
|
2945
|
+
* @param newKey - New AES-GCM CryptoKey (KEK)
|
|
2946
|
+
* @param options - Optional AAD, newAad, and newKid overrides
|
|
2947
|
+
*/
|
|
2948
|
+
declare function rekeyEncryptedPayload(payload: IEncryptedPayload, oldKey: CryptoKey, newKey: CryptoKey, options?: IRekeyPayloadOptions): Promise<IEncryptedPayload>;
|
|
2949
|
+
/**
|
|
2950
|
+
* Zero-knowledge master passphrase re-keying pipeline for user keypairs.
|
|
2951
|
+
*
|
|
2952
|
+
* Persistence Contract:
|
|
2953
|
+
* The caller must persist `encryptedPrivateKey`, `encryptedSigningKey`, `newSalt`, and the server
|
|
2954
|
+
* auth verifier ATOMICALLY (within a single database transaction or API request).
|
|
2955
|
+
* Partial persistence will lock the user out permanently.
|
|
2956
|
+
*
|
|
2957
|
+
* Zeroization Notice:
|
|
2958
|
+
* JavaScript memory zeroization (`fill(0)`) is best-effort due to garbage collector copies,
|
|
2959
|
+
* string immutability, and V8/SpiderMonkey engine internals. It strictly zeroes typed array buffers
|
|
2960
|
+
* allocated within Katlux control.
|
|
2961
|
+
*
|
|
2962
|
+
* Key Extractability:
|
|
2963
|
+
* All derived Key-Encrypting Keys (KEKs) are strictly non-extractable (`extractable: false`).
|
|
2964
|
+
* `authKey` extractability follows `newKdfOptions.extractable` (defaults to false).
|
|
2965
|
+
*
|
|
2966
|
+
* @param params - Re-keying configuration parameters
|
|
2967
|
+
* @returns Rekeyed private key envelopes, new salt, and fresh derived subkeys
|
|
2968
|
+
*/
|
|
2969
|
+
declare function rekeyUserKeypair(params: IRekeyKeypairParams): Promise<IRekeyedKeypairResult>;
|
|
2970
|
+
|
|
2971
|
+
/**
|
|
2972
|
+
* Helper to resolve a CryptoKey from a TTrustedAuthorities structure matching a given authorityFingerprint.
|
|
2973
|
+
*/
|
|
2974
|
+
declare function resolveAuthorityCryptoKey(trustedAuthorities: TTrustedAuthorities, authorityFingerprint: string): Promise<CryptoKey | null>;
|
|
2975
|
+
/**
|
|
2976
|
+
* Signs a key-reset attestation using an authority ECDSA P-256 private key.
|
|
2977
|
+
*
|
|
2978
|
+
* Used by trusted recovery authorities or administrators to certify that
|
|
2979
|
+
* an entity's pinned public key was legitimately superseded.
|
|
2980
|
+
*/
|
|
2981
|
+
declare function signKeyResetAttestation(attestation: {
|
|
2982
|
+
version?: 1;
|
|
2983
|
+
entityId: string;
|
|
2984
|
+
oldFingerprint: string;
|
|
2985
|
+
newFingerprint: string;
|
|
2986
|
+
sequence: number;
|
|
2987
|
+
issuedAt?: number;
|
|
2988
|
+
expiresAt: number;
|
|
2989
|
+
authorityFingerprint?: string;
|
|
2990
|
+
reason?: string;
|
|
2991
|
+
}, authorityPrivateKey: CryptoKey, authorityPublicKey?: CryptoKey): Promise<ISignedKeyResetAttestation>;
|
|
2992
|
+
/**
|
|
2993
|
+
* Cryptographically verifies a signed key reset attestation against trusted authorities.
|
|
2994
|
+
* Validates schema version (strictly 1), authority signature, and time validity window.
|
|
2995
|
+
*/
|
|
2996
|
+
declare function verifyAttestation(signedAttestation: ISignedKeyResetAttestation, trustedAuthorities: TTrustedAuthorities, options?: {
|
|
2997
|
+
clockSkewMs?: number;
|
|
2998
|
+
maxExpirationWindowMs?: number;
|
|
2999
|
+
now?: number;
|
|
3000
|
+
}): Promise<IKeyResetAttestation>;
|
|
3001
|
+
/**
|
|
3002
|
+
* Verifies an incoming public key against the Key Pinning Store (TOFU),
|
|
3003
|
+
* safely accepting legitimate key replacements accompanied by a valid signed reset attestation.
|
|
3004
|
+
*
|
|
3005
|
+
* Threat Model & Security Considerations:
|
|
3006
|
+
* - Protects against: Substituted public keys from a compromised or rogue key directory after first contact.
|
|
3007
|
+
* - Does not protect against: Initial contact substitution (TOFU attack), malicious JavaScript served by
|
|
3008
|
+
* the same origin, or client-side storage tampering via XSS. Pinning is defense-in-depth.
|
|
3009
|
+
* - Authorities MUST be provisioned out-of-band (e.g. bundled app config), NEVER fetched dynamically from the key server.
|
|
3010
|
+
*
|
|
3011
|
+
* @param entityId - Peer or entity unique identifier
|
|
3012
|
+
* @param publicKey - Presented public key (CryptoKey, SPKI Uint8Array/ArrayBuffer, or PEM/Base64 string)
|
|
3013
|
+
* @param options - Pinning store, trusted authorities, and optional attestation resolver
|
|
3014
|
+
*/
|
|
3015
|
+
declare function verifyAndPinKey(entityId: string, publicKey: CryptoKey | Uint8Array | ArrayBuffer | string, options: IVerifyAndPinOptions): Promise<IVerifyAndPinResult>;
|
|
3016
|
+
|
|
3017
|
+
/**
|
|
3018
|
+
* Validates the structural integrity and lifecycle rules of a blind-index keyring.
|
|
3019
|
+
*
|
|
3020
|
+
* Enforcement rules:
|
|
3021
|
+
* - Keyring must be an object with string `activeKid` and `keys` dictionary.
|
|
3022
|
+
* - Exactly one key in `keys` must have `status: 'active'`.
|
|
3023
|
+
* - The active key's key ID must strictly match `activeKid`.
|
|
3024
|
+
* - Every key must possess a valid HMAC `CryptoKey` instance.
|
|
3025
|
+
*
|
|
3026
|
+
* Throws `ERR_BIDX_KEYRING_INVALID` on any violation.
|
|
3027
|
+
*/
|
|
3028
|
+
declare function validateBlindIndexKeyring(keyring: IBlindIndexKeyring): void;
|
|
3029
|
+
/**
|
|
3030
|
+
* Computes multi-token blind index candidates for search queries across key rotation lifecycles.
|
|
3031
|
+
*
|
|
3032
|
+
* Generates candidate tokens using the currently `active` key and all `search-only` keys.
|
|
3033
|
+
* Normalization (Unicode NFKC -> trim -> lowercase) is 100% identical to write-time tokens.
|
|
3034
|
+
* Returns a de-duplicated array of tokens with the active key's token first.
|
|
3035
|
+
* Returns an empty array `[]` for null/empty inputs.
|
|
3036
|
+
*
|
|
3037
|
+
* @param value - Search term string or primitive
|
|
3038
|
+
* @param keyring - Validated multi-KID blind index keyring
|
|
3039
|
+
*/
|
|
3040
|
+
declare function computeMultiBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string[]>;
|
|
3041
|
+
/**
|
|
3042
|
+
* Computes the write-time blind index token using exclusively the currently active key.
|
|
3043
|
+
*
|
|
3044
|
+
* Used by data ingestion and re-indexing jobs.
|
|
3045
|
+
*
|
|
3046
|
+
* @param value - Ingest value string or primitive
|
|
3047
|
+
* @param keyring - Validated multi-KID blind index keyring
|
|
3048
|
+
*/
|
|
3049
|
+
declare function computeWriteBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string>;
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* Static cryptographic key lifecycle management facade.
|
|
3053
|
+
* Delegates calls to domain-specific submodules in `./keyManager/`.
|
|
3054
|
+
* Preserves 100% backward compatibility for all public static methods and signatures.
|
|
3055
|
+
*/
|
|
3056
|
+
declare class CKeyManager {
|
|
3057
|
+
private static get _bidxHmacKeyCache();
|
|
3058
|
+
/** Clears the in-memory memoization cache for derived blind-index HMAC CryptoKeys. */
|
|
3059
|
+
static clearBlindIndexKeyCache(): void;
|
|
3060
|
+
static randomBytes(length: number): Uint8Array;
|
|
3061
|
+
static toBase64(buffer: ArrayBuffer | Uint8Array): string;
|
|
3062
|
+
static fromBase64(base64: string): Uint8Array;
|
|
3063
|
+
static resolveSalt(salt?: Uint8Array | ArrayBuffer | string): Uint8Array;
|
|
3064
|
+
static generateAESKey(length?: 128 | 256, algorithm?: 'AES-GCM' | 'AES-CBC' | 'AES-KW', extractable?: boolean): Promise<CryptoKey>;
|
|
3065
|
+
static exportAESKey(key: CryptoKey): Promise<string>;
|
|
3066
|
+
static importAESKey(base64: string, algorithm?: 'AES-GCM' | 'AES-CBC' | 'AES-KW', extractable?: boolean): Promise<CryptoKey>;
|
|
3067
|
+
static generateRSAKeyPair(bits?: 2048 | 4096, hash?: 'SHA-256' | 'SHA-512', extractable?: boolean): Promise<IKeyPair>;
|
|
3068
|
+
static generateECDHKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
3069
|
+
static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
3070
|
+
static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
3071
|
+
static importPublicKey(jwk: JsonWebKey, algorithm?: string | RsaHashedImportParams | EcKeyImportParams): Promise<CryptoKey>;
|
|
3072
|
+
static importPrivateKey(jwk: JsonWebKey, algorithm?: string | RsaHashedImportParams | EcKeyImportParams, extractable?: boolean): Promise<CryptoKey>;
|
|
3073
|
+
static importPublicKeyFromPEM(pem: string, algorithm?: 'RSA-OAEP' | 'ECDH' | 'ECDSA', curve?: 'P-256' | 'P-384' | 'P-521', hash?: 'SHA-256' | 'SHA-512'): Promise<CryptoKey>;
|
|
3074
|
+
static importECDSAPublicKeyFromPEM(pem: string, curve?: 'P-256' | 'P-384' | 'P-521'): Promise<CryptoKey>;
|
|
3075
|
+
static importPrivateKeyFromPEM(pem: string, algorithm?: 'RSA-OAEP' | 'ECDH' | 'ECDSA', curve?: 'P-256' | 'P-384' | 'P-521', hash?: 'SHA-256' | 'SHA-512', extractable?: boolean): Promise<CryptoKey>;
|
|
3076
|
+
static importECDSAPrivateKeyFromPEM(pem: string, curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<CryptoKey>;
|
|
3077
|
+
static exportPublicKeyToPEM(key: CryptoKey): Promise<string>;
|
|
3078
|
+
static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
|
|
3079
|
+
static wrapKey(keyToWrap: CryptoKey, wrappingKey: CryptoKey, format?: KeyFormat): Promise<string>;
|
|
3080
|
+
static unwrapKey(wrappedBase64: string, unwrappingKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean, keyUsages?: KeyUsage[], format?: KeyFormat): Promise<CryptoKey>;
|
|
3081
|
+
static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
|
|
3082
|
+
static wrapAccountKeyForUser(adek: CryptoKey, userPublicKey: CryptoKey): Promise<string>;
|
|
3083
|
+
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
|
|
3084
|
+
static wrapHMACKeyForUser(hmacKey: CryptoKey, userPublicKey: CryptoKey): Promise<string>;
|
|
3085
|
+
static unwrapHMACKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, hash?: 'SHA-256' | 'SHA-384' | 'SHA-512', extractable?: boolean): Promise<CryptoKey>;
|
|
2360
3086
|
static rewrapAccountKeyForUser(wrappedKeyBase64: string, myPrivateKey: CryptoKey, recipientPublicKey: CryptoKey): Promise<string>;
|
|
2361
|
-
/**
|
|
2362
|
-
* Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
|
|
2363
|
-
* Returns the derived CryptoKey and the base64-encoded salt.
|
|
2364
|
-
*/
|
|
2365
3087
|
static deriveKey(passphrase: string | Uint8Array | ArrayBuffer, options: IKDFOptions): Promise<{
|
|
2366
3088
|
key: CryptoKey;
|
|
2367
3089
|
salt: string;
|
|
2368
3090
|
}>;
|
|
2369
|
-
/**
|
|
2370
|
-
* Derives an AES-GCM CryptoKey from a high-entropy secret (e.g. an ECDH shared secret key)
|
|
2371
|
-
* using HKDF.
|
|
2372
|
-
*/
|
|
2373
3091
|
static deriveKeyFromSecret(secretKey: CryptoKey, options?: IHKDFFromSecretOptions): Promise<CryptoKey>;
|
|
2374
|
-
/**
|
|
2375
|
-
* Derives two domain-separated, cryptographically isolated keys from a user password and salt:
|
|
2376
|
-
* 1. `authKey`: For client authentication, SRP, or server challenge proofs.
|
|
2377
|
-
* 2. `encryptionKey`: For AES-GCM local and field-level data encryption.
|
|
2378
|
-
*
|
|
2379
|
-
* Stage 1 (Password Stretching): PBKDF2-HMAC-SHA256 stretches low-entropy password into master secret.
|
|
2380
|
-
* Stage 2 (Domain Expansion): HKDF-Expand derives subkeys using domain-separated context info tags.
|
|
2381
|
-
* Immediate memory zeroization of intermediate master secret buffer is guaranteed.
|
|
2382
|
-
*
|
|
2383
|
-
* @param password - Master user password or passphrase
|
|
2384
|
-
* @param salt - Salt (or omitted to generate a secure random 16-byte salt)
|
|
2385
|
-
* @param options - PBKDF2 and HKDF configuration options
|
|
2386
|
-
*/
|
|
2387
3092
|
static deriveAuthAndEncryptionKeys(password: string | Uint8Array | ArrayBuffer, salt?: Uint8Array | ArrayBuffer | string, options?: IDeriveAuthAndEncryptionOptions): Promise<IDomainDerivedKeys>;
|
|
2388
|
-
/**
|
|
2389
|
-
* Generates an ECDSA P-256 signing key pair.
|
|
2390
|
-
*/
|
|
2391
3093
|
static generateSigningKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
2392
|
-
/**
|
|
2393
|
-
* Generates an ECDSA signing key pair. Alias for generateSigningKeyPair.
|
|
2394
|
-
*/
|
|
2395
3094
|
static generateECDSAKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
2396
|
-
/**
|
|
2397
|
-
* Generates a deterministic SHA-256 fingerprint for a public key (SPKI or raw).
|
|
2398
|
-
* Formatted as `SHA256:<base64url>`.
|
|
2399
|
-
*/
|
|
2400
3095
|
static getKeyFingerprint(publicKey: CryptoKey | Uint8Array | ArrayBuffer | string): Promise<string>;
|
|
2401
|
-
/**
|
|
2402
|
-
* Signs arbitrary data or JSON objects using an ECDSA P-256 private key.
|
|
2403
|
-
* Objects are automatically serialized via canonicalizeJson() before hashing.
|
|
2404
|
-
*/
|
|
2405
3096
|
static sign(data: any | string | Uint8Array, privateKey: CryptoKey): Promise<string>;
|
|
2406
|
-
/**
|
|
2407
|
-
* Verifies an ECDSA P-256 signature against original data or JSON object.
|
|
2408
|
-
*/
|
|
2409
3097
|
static verify(data: any | string | Uint8Array, signature: string, publicKey: CryptoKey): Promise<boolean>;
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
* Performs Unicode NFKC normalization, trimming, and lowercasing before computing the signature.
|
|
2413
|
-
*
|
|
2414
|
-
* @param value - The input string, number, or object to compute the blind index for.
|
|
2415
|
-
* @param hmacKey - CryptoKey configured for HMAC signing.
|
|
2416
|
-
* @returns Lowercase hexadecimal HMAC-SHA256 blind index hash.
|
|
2417
|
-
*/
|
|
2418
|
-
static computeBlindIndex(value: any, hmacKey: CryptoKey): Promise<string>;
|
|
2419
|
-
/**
|
|
2420
|
-
* Signs a structured access grant, embedding signature and granter key fingerprint.
|
|
2421
|
-
*/
|
|
3098
|
+
static deriveBlindIndexHmacKey(keyMaterial: TKeyProvider | CryptoKey | undefined): Promise<CryptoKey>;
|
|
3099
|
+
static computeBlindIndex(value: any, hmacKey: CryptoKey, options?: IBlindIndexOptions): Promise<string>;
|
|
2422
3100
|
static signGrant(grant: IAccessGrant, granterPrivateKey: CryptoKey, granterPublicKey?: CryptoKey): Promise<ISignedGrant>;
|
|
2423
|
-
/**
|
|
2424
|
-
* Verifies the authenticity and integrity of a signed access grant against granter public key.
|
|
2425
|
-
*/
|
|
2426
3101
|
static verifyGrant(signedGrant: ISignedGrant, granterPublicKey: CryptoKey, options?: IVerifyGrantOptions): Promise<boolean>;
|
|
2427
|
-
/**
|
|
2428
|
-
* Encrypts raw bytes (e.g. PKCS#8 private key) into a standardized Katlux AES-GCM envelope.
|
|
2429
|
-
*
|
|
2430
|
-
* @param data - Raw byte buffer or Uint8Array to encrypt
|
|
2431
|
-
* @param key - AES-GCM CryptoKey (KEK)
|
|
2432
|
-
* @param options - Optional AAD, IV, or Key Identifier (kid)
|
|
2433
|
-
*/
|
|
2434
3102
|
static encryptPayload(data: ArrayBuffer | Uint8Array, key: CryptoKey, options?: {
|
|
2435
3103
|
iv?: Uint8Array;
|
|
2436
3104
|
aad?: string | Uint8Array | ArrayBuffer;
|
|
2437
3105
|
kid?: string;
|
|
2438
3106
|
}): Promise<IEncryptedPayload>;
|
|
2439
|
-
/**
|
|
2440
|
-
* Decrypts an AES-GCM encrypted envelope back into raw bytes.
|
|
2441
|
-
*
|
|
2442
|
-
* @param payload - Standardized Katlux AES-GCM envelope
|
|
2443
|
-
* @param key - AES-GCM CryptoKey (KEK)
|
|
2444
|
-
* @param options - Optional AAD
|
|
2445
|
-
* @returns Raw decrypted ArrayBuffer
|
|
2446
|
-
*/
|
|
2447
3107
|
static decryptPayload(payload: IEncryptedPayload, key: CryptoKey, options?: {
|
|
2448
3108
|
aad?: string | Uint8Array | ArrayBuffer;
|
|
2449
3109
|
}): Promise<ArrayBuffer>;
|
|
2450
|
-
/**
|
|
2451
|
-
* Atomically re-keys an existing AES-GCM encrypted envelope from oldKey to newKey.
|
|
2452
|
-
* Decrypts with oldKey, derives a fresh random 96-bit IV, and re-encrypts with newKey.
|
|
2453
|
-
* Memory zeroization of internal plaintext and ciphertext buffers is guaranteed via try...finally.
|
|
2454
|
-
*
|
|
2455
|
-
* @param payload - Existing AES-GCM encrypted payload envelope
|
|
2456
|
-
* @param oldKey - Current AES-GCM CryptoKey (KEK)
|
|
2457
|
-
* @param newKey - New AES-GCM CryptoKey (KEK)
|
|
2458
|
-
* @param options - Optional AAD, newAad, and newKid overrides
|
|
2459
|
-
*/
|
|
2460
3110
|
static rekeyEncryptedPayload(payload: IEncryptedPayload, oldKey: CryptoKey, newKey: CryptoKey, options?: IRekeyPayloadOptions): Promise<IEncryptedPayload>;
|
|
2461
|
-
/**
|
|
2462
|
-
* Zero-knowledge master passphrase re-keying pipeline for user keypairs.
|
|
2463
|
-
*
|
|
2464
|
-
* Persistence Contract:
|
|
2465
|
-
* The caller must persist `encryptedPrivateKey`, `encryptedSigningKey`, `newSalt`, and the server
|
|
2466
|
-
* auth verifier ATOMICALLY (within a single database transaction or API request).
|
|
2467
|
-
* Partial persistence will lock the user out permanently.
|
|
2468
|
-
*
|
|
2469
|
-
* Zeroization Notice:
|
|
2470
|
-
* JavaScript memory zeroization (`fill(0)`) is best-effort due to garbage collector copies,
|
|
2471
|
-
* string immutability, and V8/SpiderMonkey engine internals. It strictly zeroes typed array buffers
|
|
2472
|
-
* allocated within Katlux control.
|
|
2473
|
-
*
|
|
2474
|
-
* Key Extractability:
|
|
2475
|
-
* All derived Key-Encrypting Keys (KEKs) are strictly non-extractable (`extractable: false`).
|
|
2476
|
-
* `authKey` extractability follows `newKdfOptions.extractable` (defaults to false).
|
|
2477
|
-
*
|
|
2478
|
-
* @param params - Re-keying configuration parameters
|
|
2479
|
-
* @returns Rekeyed private key envelopes, new salt, and fresh derived subkeys
|
|
2480
|
-
*/
|
|
2481
3111
|
static rekeyUserKeypair(params: IRekeyKeypairParams): Promise<IRekeyedKeypairResult>;
|
|
2482
|
-
/**
|
|
2483
|
-
* Helper to resolve a CryptoKey from a TTrustedAuthorities structure matching a given authorityFingerprint.
|
|
2484
|
-
*/
|
|
2485
3112
|
private static resolveAuthorityCryptoKey;
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
static signKeyResetAttestation(attestation: {
|
|
2493
|
-
version?: 1;
|
|
2494
|
-
entityId: string;
|
|
2495
|
-
oldFingerprint: string;
|
|
2496
|
-
newFingerprint: string;
|
|
2497
|
-
sequence: number;
|
|
2498
|
-
issuedAt?: number;
|
|
2499
|
-
expiresAt: number;
|
|
2500
|
-
authorityFingerprint?: string;
|
|
2501
|
-
reason?: string;
|
|
2502
|
-
}, authorityPrivateKey: CryptoKey, authorityPublicKey?: CryptoKey): Promise<ISignedKeyResetAttestation>;
|
|
2503
|
-
/**
|
|
2504
|
-
* Verifies an incoming public key against the Key Pinning Store (TOFU),
|
|
2505
|
-
* safely accepting legitimate key replacements accompanied by a valid signed reset attestation.
|
|
2506
|
-
*
|
|
2507
|
-
* Threat Model & Security Considerations:
|
|
2508
|
-
* - Protects against: Substituted public keys from a compromised or rogue key directory after first contact.
|
|
2509
|
-
* - Does not protect against: Initial contact substitution (TOFU attack), malicious JavaScript served by
|
|
2510
|
-
* the same origin, or client-side storage tampering via XSS. Pinning is defense-in-depth.
|
|
2511
|
-
* - Authorities MUST be provisioned out-of-band (e.g. bundled app config), NEVER fetched dynamically from the key server.
|
|
2512
|
-
*
|
|
2513
|
-
* @param entityId - Peer or entity unique identifier
|
|
2514
|
-
* @param publicKey - Presented public key (CryptoKey, SPKI Uint8Array/ArrayBuffer, or PEM/Base64 string)
|
|
2515
|
-
* @param options - Pinning store, trusted authorities, and optional attestation resolver
|
|
2516
|
-
*/
|
|
3113
|
+
static signKeyResetAttestation(attestation: Parameters<typeof signKeyResetAttestation>[0], authorityPrivateKey: CryptoKey, authorityPublicKey?: CryptoKey): Promise<ISignedKeyResetAttestation>;
|
|
3114
|
+
static verifyAttestation(signedAttestation: ISignedKeyResetAttestation, trustedAuthorities: TTrustedAuthorities, options?: {
|
|
3115
|
+
clockSkewMs?: number;
|
|
3116
|
+
maxExpirationWindowMs?: number;
|
|
3117
|
+
now?: number;
|
|
3118
|
+
}): Promise<IKeyResetAttestation>;
|
|
2517
3119
|
static verifyAndPinKey(entityId: string, publicKey: CryptoKey | Uint8Array | ArrayBuffer | string, options: IVerifyAndPinOptions): Promise<IVerifyAndPinResult>;
|
|
2518
|
-
/**
|
|
2519
|
-
* Validates the structural integrity and lifecycle rules of a blind-index keyring.
|
|
2520
|
-
*
|
|
2521
|
-
* Enforcement rules:
|
|
2522
|
-
* - Keyring must be an object with string `activeKid` and `keys` dictionary.
|
|
2523
|
-
* - Exactly one key in `keys` must have `status: 'active'`.
|
|
2524
|
-
* - The active key's key ID must strictly match `activeKid`.
|
|
2525
|
-
* - Every key must possess a valid HMAC `CryptoKey` instance.
|
|
2526
|
-
*
|
|
2527
|
-
* Throws `ERR_BIDX_KEYRING_INVALID` on any violation.
|
|
2528
|
-
*/
|
|
2529
3120
|
static validateBlindIndexKeyring(keyring: IBlindIndexKeyring): void;
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
*
|
|
2533
|
-
* Generates candidate tokens using the currently `active` key and all `search-only` keys.
|
|
2534
|
-
* Normalization (Unicode NFKC -> trim -> lowercase) is 100% identical to write-time tokens.
|
|
2535
|
-
* Returns a de-duplicated array of tokens with the active key's token first.
|
|
2536
|
-
* Returns an empty array `[]` for null/empty inputs.
|
|
2537
|
-
*
|
|
2538
|
-
* @param value - Search term string or primitive
|
|
2539
|
-
* @param keyring - Validated multi-KID blind index keyring
|
|
2540
|
-
*/
|
|
2541
|
-
static computeMultiBlindIndex(value: any, keyring: IBlindIndexKeyring): Promise<string[]>;
|
|
2542
|
-
/**
|
|
2543
|
-
* Computes the write-time blind index token using exclusively the currently active key.
|
|
2544
|
-
*
|
|
2545
|
-
* Used by data ingestion and re-indexing jobs.
|
|
2546
|
-
*
|
|
2547
|
-
* @param value - Ingest value string or primitive
|
|
2548
|
-
* @param keyring - Validated multi-KID blind index keyring
|
|
2549
|
-
*/
|
|
2550
|
-
static computeWriteBlindIndex(value: any, keyring: IBlindIndexKeyring): Promise<string>;
|
|
3121
|
+
static computeMultiBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string[]>;
|
|
3122
|
+
static computeWriteBlindIndex(value: any, keyring: IBlindIndexKeyring, options?: IBlindIndexOptions): Promise<string>;
|
|
2551
3123
|
}
|
|
2552
3124
|
|
|
3125
|
+
/**
|
|
3126
|
+
* Shared cryptographic utilities for Web Crypto API access and random byte generation.
|
|
3127
|
+
* Internal module for Katlux Encryption Providers.
|
|
3128
|
+
*/
|
|
3129
|
+
/**
|
|
3130
|
+
* Resolves the SubtleCrypto instance from globalThis.
|
|
3131
|
+
* Throws a descriptive error if Web Crypto API is unavailable.
|
|
3132
|
+
*/
|
|
3133
|
+
declare function getSubtleCrypto(): SubtleCrypto;
|
|
3134
|
+
/**
|
|
3135
|
+
* Fills a typed array with cryptographically secure random values using crypto.getRandomValues.
|
|
3136
|
+
*/
|
|
3137
|
+
declare function getRandomValues(array: Uint8Array): Uint8Array;
|
|
3138
|
+
declare const textEncoder: TextEncoder;
|
|
3139
|
+
declare const textDecoder: TextDecoder;
|
|
3140
|
+
/**
|
|
3141
|
+
* Resolves an HKDF info / context parameter into a Uint8Array.
|
|
3142
|
+
* Safely preserves raw binary buffers (Uint8Array, ArrayBuffer) without string coercion.
|
|
3143
|
+
*/
|
|
3144
|
+
declare function resolveInfoBytes(info?: string | Uint8Array | ArrayBuffer, fallback?: string): Uint8Array;
|
|
3145
|
+
/**
|
|
3146
|
+
* Safely assigns a property to a target object, preventing prototype pollution attacks
|
|
3147
|
+
* via __proto__, constructor, or prototype manipulation.
|
|
3148
|
+
*/
|
|
3149
|
+
declare function safeSetProperty(target: Record<string, any>, key: string, value: any): void;
|
|
3150
|
+
/**
|
|
3151
|
+
* Checks whether two cryptographic keys, passphrases, or buffers represent the identical key material.
|
|
3152
|
+
* Used to enforce strict key isolation between data encryption keys and HMAC blind index keys.
|
|
3153
|
+
*/
|
|
3154
|
+
declare function areKeysIdentical(key1: any, key2: any): boolean;
|
|
3155
|
+
/**
|
|
3156
|
+
* Converts an ArrayBuffer or Uint8Array into a Base64-encoded string.
|
|
3157
|
+
*/
|
|
3158
|
+
declare function toBase64(buffer: ArrayBuffer | Uint8Array): string;
|
|
3159
|
+
/**
|
|
3160
|
+
* Fast 64-bit FNV-1a hash formatted as a hex string.
|
|
3161
|
+
* Non-cryptographic, zero-allocation, synchronous hash used for safe heap cache indexing
|
|
3162
|
+
* without retaining plaintext secrets in compound Map keys.
|
|
3163
|
+
*/
|
|
3164
|
+
declare function fastKeyHash(str: string): string;
|
|
3165
|
+
/**
|
|
3166
|
+
* Computes a collision-free, safe string identifier for a resolved key.
|
|
3167
|
+
* Hashes raw string passphrases to ensure secrets never reside in compound Map keys (Minor 8)
|
|
3168
|
+
* and resolves function outputs so multi-tenant SSR requests never collide on function references (Major 3).
|
|
3169
|
+
*/
|
|
3170
|
+
declare function getSafeKeyIdentifier(rawKey: any): string;
|
|
3171
|
+
/**
|
|
3172
|
+
* Returns a collision-free string identifier for a key provider or fallback key.
|
|
3173
|
+
* Uses a hashed identifier for strings and WeakMap for objects to prevent
|
|
3174
|
+
* cross-tenant cache collisions and avoid storing secrets in heap Map keys.
|
|
3175
|
+
*/
|
|
3176
|
+
declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
|
|
3177
|
+
/**
|
|
3178
|
+
* Detects whether an error thrown during ciphertext decryption is an authentication failure
|
|
3179
|
+
* (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
|
|
3180
|
+
* Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
|
|
3181
|
+
*/
|
|
3182
|
+
declare const ERR_CRYPTO_DECRYPT_FAILED = "ERR_CRYPTO_DECRYPT_FAILED";
|
|
3183
|
+
declare const ERR_AUTH_UNAUTHORIZED = "ERR_AUTH_UNAUTHORIZED";
|
|
3184
|
+
declare const ERR_CRYPTO_TAG_MISMATCH = "ERR_CRYPTO_TAG_MISMATCH";
|
|
3185
|
+
declare const ERR_CRYPTO_AUTH_FAILED = "ERR_CRYPTO_AUTH_FAILED";
|
|
3186
|
+
/**
|
|
3187
|
+
* Detects whether an error thrown during ciphertext decryption is an authentication failure
|
|
3188
|
+
* (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
|
|
3189
|
+
* Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
|
|
3190
|
+
*/
|
|
3191
|
+
declare function isAuthOrDecryptionError(err: any): boolean;
|
|
3192
|
+
/**
|
|
3193
|
+
* Serializes a JavaScript value to a deterministic, canonical JSON string conforming to RFC 8785 (JCS).
|
|
3194
|
+
* Guarantees consistent property sorting by UTF-16 code units, omission of undefined/symbol/function values,
|
|
3195
|
+
* standard ECMAScript number formatting (-0 serialized as 0), and detection of circular references.
|
|
3196
|
+
*/
|
|
3197
|
+
declare function canonicalizeJson(value: any, seen?: Set<any>): string;
|
|
3198
|
+
|
|
2553
3199
|
interface ICWebCryptoOptions {
|
|
2554
3200
|
kdf?: 'none' | 'pbkdf2' | 'hkdf';
|
|
2555
3201
|
kdfIterations?: number;
|
|
@@ -2562,6 +3208,8 @@ interface ICWebCryptoOptions {
|
|
|
2562
3208
|
activeKid?: string;
|
|
2563
3209
|
allowedKids?: string[];
|
|
2564
3210
|
hmacKey?: TKeyProvider;
|
|
3211
|
+
allowInsecureKdf?: boolean;
|
|
3212
|
+
maxAllowedIterations?: number;
|
|
2565
3213
|
}
|
|
2566
3214
|
/**
|
|
2567
3215
|
* Zero-dependency AES-256-GCM cipher provider using native Web Crypto API (crypto.subtle).
|
|
@@ -2576,6 +3224,8 @@ interface ICWebCryptoOptions {
|
|
|
2576
3224
|
*/
|
|
2577
3225
|
declare class CWebCryptoEncryptionProvider extends AEncryptionProvider {
|
|
2578
3226
|
private _defaultKdf;
|
|
3227
|
+
private _allowInsecureKdf?;
|
|
3228
|
+
private _maxAllowedIterations?;
|
|
2579
3229
|
private _cachedKey?;
|
|
2580
3230
|
private _kdfOptions?;
|
|
2581
3231
|
private _cachedSalt?;
|
|
@@ -2615,6 +3265,11 @@ interface ICWebCryptoAESCBCOptions {
|
|
|
2615
3265
|
info?: string | Uint8Array | ArrayBuffer;
|
|
2616
3266
|
kid?: string;
|
|
2617
3267
|
keyId?: string;
|
|
3268
|
+
keys?: Record<string, TKeyProvider | IKeyPair | any>;
|
|
3269
|
+
activeKid?: string;
|
|
3270
|
+
allowedKids?: string[];
|
|
3271
|
+
allowInsecureKdf?: boolean;
|
|
3272
|
+
maxAllowedIterations?: number;
|
|
2618
3273
|
}
|
|
2619
3274
|
/**
|
|
2620
3275
|
* Authenticated AES-CBC-256 provider with Encrypt-then-MAC (HMAC-SHA-256).
|
|
@@ -2627,6 +3282,8 @@ interface ICWebCryptoAESCBCOptions {
|
|
|
2627
3282
|
*/
|
|
2628
3283
|
declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
|
|
2629
3284
|
private _defaultKdf;
|
|
3285
|
+
private _allowInsecureKdf?;
|
|
3286
|
+
private _maxAllowedIterations?;
|
|
2630
3287
|
private _cachedEncKey?;
|
|
2631
3288
|
private _cachedMacKey?;
|
|
2632
3289
|
private _cachedSalt?;
|
|
@@ -2637,7 +3294,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
|
|
|
2637
3294
|
private _configuredKid?;
|
|
2638
3295
|
private _kdfOptions?;
|
|
2639
3296
|
private _decryptSaltCache;
|
|
2640
|
-
constructor(key?: TKeyProvider | IKeyPair, options?: ICWebCryptoAESCBCOptions);
|
|
3297
|
+
constructor(key?: TKeyProvider | IKeyPair | any, options?: ICWebCryptoAESCBCOptions);
|
|
2641
3298
|
setDefaultKey(key: TKeyProvider | IKeyPair): void;
|
|
2642
3299
|
clearKeys(): void;
|
|
2643
3300
|
warmupKey(options?: IEncryptionContext): Promise<void>;
|
|
@@ -2696,9 +3353,9 @@ declare class CRSAEncryptionProvider extends AEncryptionProvider {
|
|
|
2696
3353
|
static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
2697
3354
|
static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
2698
3355
|
static importPublicKey(jwk: JsonWebKey): Promise<CryptoKey>;
|
|
2699
|
-
static importPrivateKey(jwk: JsonWebKey): Promise<CryptoKey>;
|
|
3356
|
+
static importPrivateKey(jwk: JsonWebKey, extractable?: boolean): Promise<CryptoKey>;
|
|
2700
3357
|
static importPublicKeyFromPEM(pem: string, hash?: 'SHA-256' | 'SHA-512'): Promise<CryptoKey>;
|
|
2701
|
-
static importPrivateKeyFromPEM(pem: string, hash?: 'SHA-256' | 'SHA-512'): Promise<CryptoKey>;
|
|
3358
|
+
static importPrivateKeyFromPEM(pem: string, hash?: 'SHA-256' | 'SHA-512', extractable?: boolean): Promise<CryptoKey>;
|
|
2702
3359
|
static exportPublicKeyToPEM(key: CryptoKey): Promise<string>;
|
|
2703
3360
|
static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
|
|
2704
3361
|
static isEncrypted(payload: any): boolean;
|
|
@@ -2756,9 +3413,9 @@ declare class CECDHEncryptionProvider extends AEncryptionProvider {
|
|
|
2756
3413
|
static exportPublicKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
2757
3414
|
static exportPrivateKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
2758
3415
|
static importPublicKey(jwk: JsonWebKey, curve?: TECDHCurve): Promise<CryptoKey>;
|
|
2759
|
-
static importPrivateKey(jwk: JsonWebKey, curve?: TECDHCurve): Promise<CryptoKey>;
|
|
3416
|
+
static importPrivateKey(jwk: JsonWebKey, curve?: TECDHCurve, extractable?: boolean): Promise<CryptoKey>;
|
|
2760
3417
|
static importPublicKeyFromPEM(pem: string, curve?: TECDHCurve): Promise<CryptoKey>;
|
|
2761
|
-
static importPrivateKeyFromPEM(pem: string, curve?: TECDHCurve): Promise<CryptoKey>;
|
|
3418
|
+
static importPrivateKeyFromPEM(pem: string, curve?: TECDHCurve, extractable?: boolean): Promise<CryptoKey>;
|
|
2762
3419
|
static exportPublicKeyToPEM(key: CryptoKey): Promise<string>;
|
|
2763
3420
|
static exportPrivateKeyToPEM(key: CryptoKey): Promise<string>;
|
|
2764
3421
|
static isEncrypted(payload: any): boolean;
|
|
@@ -2799,6 +3456,8 @@ interface ICNodeCryptoOptions {
|
|
|
2799
3456
|
activeKid?: string;
|
|
2800
3457
|
allowedKids?: string[];
|
|
2801
3458
|
hmacKey?: TKeyProvider;
|
|
3459
|
+
allowInsecureKdf?: boolean;
|
|
3460
|
+
maxAllowedIterations?: number;
|
|
2802
3461
|
}
|
|
2803
3462
|
/**
|
|
2804
3463
|
* Server-side synchronous AES-GCM-256 encryption provider using Node.js native `node:crypto`.
|
|
@@ -2811,7 +3470,17 @@ interface ICNodeCryptoOptions {
|
|
|
2811
3470
|
* (`encrypt`, `decrypt`) methods for Nitro routes, worker threads, and CLI tools.
|
|
2812
3471
|
*/
|
|
2813
3472
|
declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
3473
|
+
/**
|
|
3474
|
+
* Cryptographically secure random bytes generator for Node.js.
|
|
3475
|
+
*/
|
|
3476
|
+
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;
|
|
2814
3481
|
private _defaultKdf;
|
|
3482
|
+
private _allowInsecureKdf?;
|
|
3483
|
+
private _maxAllowedIterations?;
|
|
2815
3484
|
private _kdfOptions?;
|
|
2816
3485
|
private _cachedKey?;
|
|
2817
3486
|
private _cachedSalt?;
|
|
@@ -2821,9 +3490,12 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
2821
3490
|
private _cachedKeyId?;
|
|
2822
3491
|
private _configuredKid?;
|
|
2823
3492
|
private _keyringCache;
|
|
3493
|
+
private _decryptSaltCache;
|
|
3494
|
+
private _inFlightSaltDerivations;
|
|
2824
3495
|
private isKeyRetained;
|
|
2825
3496
|
setDefaultKey(key: TKeyProvider): void;
|
|
2826
3497
|
clearKeys(): void;
|
|
3498
|
+
setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
|
|
2827
3499
|
warmupKey(options?: IEncryptionContext): Promise<void>;
|
|
2828
3500
|
/**
|
|
2829
3501
|
* Synchronously pre-derives and caches the encryption key for subsequent synchronous operations.
|
|
@@ -2847,13 +3519,15 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
2847
3519
|
*/
|
|
2848
3520
|
decryptValueSync(payload: IEncryptedPayload, options?: IEncryptionContext): any;
|
|
2849
3521
|
encryptSync(data: any, options?: IEncryptionContext): any;
|
|
3522
|
+
private _decryptRowSync;
|
|
2850
3523
|
decryptSync(payload: any, options?: IEncryptionContext): any;
|
|
2851
3524
|
encryptFieldsSync(data: any, fields: string[]): any;
|
|
2852
|
-
decryptFieldsSync(data: any, fields: string[]): any;
|
|
3525
|
+
decryptFieldsSync(data: any, fields: string[], options?: IEncryptionContext): any;
|
|
2853
3526
|
encryptFields(data: any, fields: string[]): Promise<any>;
|
|
2854
|
-
decryptFields(data: any, fields: string[]): Promise<any>;
|
|
3527
|
+
decryptFields(data: any, fields: string[], options?: IEncryptionContext): Promise<any>;
|
|
2855
3528
|
encryptValue(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload>;
|
|
2856
3529
|
decryptValue(payload: IEncryptedPayload, options?: IEncryptionContext): Promise<any>;
|
|
3530
|
+
private _decryptRowAsync;
|
|
2857
3531
|
decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
|
|
2858
3532
|
}
|
|
2859
3533
|
|
|
@@ -2870,66 +3544,6 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
2870
3544
|
*/
|
|
2871
3545
|
declare function createEncryptionProvider(options?: IProviderEncryptionOptions): IEncryptionProvider;
|
|
2872
3546
|
|
|
2873
|
-
/**
|
|
2874
|
-
* Shared cryptographic utilities for Web Crypto API access and random byte generation.
|
|
2875
|
-
* Internal module for Katlux Encryption Providers.
|
|
2876
|
-
*/
|
|
2877
|
-
/**
|
|
2878
|
-
* Resolves the SubtleCrypto instance from globalThis.
|
|
2879
|
-
* Throws a descriptive error if Web Crypto API is unavailable.
|
|
2880
|
-
*/
|
|
2881
|
-
declare function getSubtleCrypto(): SubtleCrypto;
|
|
2882
|
-
/**
|
|
2883
|
-
* Fills a typed array with cryptographically secure random values using crypto.getRandomValues.
|
|
2884
|
-
*/
|
|
2885
|
-
declare function getRandomValues(array: Uint8Array): Uint8Array;
|
|
2886
|
-
declare const textEncoder: TextEncoder;
|
|
2887
|
-
declare const textDecoder: TextDecoder;
|
|
2888
|
-
/**
|
|
2889
|
-
* Resolves an HKDF info / context parameter into a Uint8Array.
|
|
2890
|
-
* Safely preserves raw binary buffers (Uint8Array, ArrayBuffer) without string coercion.
|
|
2891
|
-
*/
|
|
2892
|
-
declare function resolveInfoBytes(info?: string | Uint8Array | ArrayBuffer, fallback?: string): Uint8Array;
|
|
2893
|
-
/**
|
|
2894
|
-
* Safely assigns a property to a target object, preventing prototype pollution attacks
|
|
2895
|
-
* via __proto__, constructor, or prototype manipulation.
|
|
2896
|
-
*/
|
|
2897
|
-
declare function safeSetProperty(target: Record<string, any>, key: string, value: any): void;
|
|
2898
|
-
/**
|
|
2899
|
-
* Converts an ArrayBuffer or Uint8Array into a Base64-encoded string.
|
|
2900
|
-
*/
|
|
2901
|
-
declare function toBase64(buffer: ArrayBuffer | Uint8Array): string;
|
|
2902
|
-
/**
|
|
2903
|
-
* Fast 64-bit FNV-1a hash formatted as a hex string.
|
|
2904
|
-
* Non-cryptographic, zero-allocation, synchronous hash used for safe heap cache indexing
|
|
2905
|
-
* without retaining plaintext secrets in compound Map keys.
|
|
2906
|
-
*/
|
|
2907
|
-
declare function fastKeyHash(str: string): string;
|
|
2908
|
-
/**
|
|
2909
|
-
* Computes a collision-free, safe string identifier for a resolved key.
|
|
2910
|
-
* Hashes raw string passphrases to ensure secrets never reside in compound Map keys (Minor 8)
|
|
2911
|
-
* and resolves function outputs so multi-tenant SSR requests never collide on function references (Major 3).
|
|
2912
|
-
*/
|
|
2913
|
-
declare function getSafeKeyIdentifier(rawKey: any): string;
|
|
2914
|
-
/**
|
|
2915
|
-
* Returns a collision-free string identifier for a key provider or fallback key.
|
|
2916
|
-
* Uses a hashed identifier for strings and WeakMap for objects to prevent
|
|
2917
|
-
* cross-tenant cache collisions and avoid storing secrets in heap Map keys.
|
|
2918
|
-
*/
|
|
2919
|
-
declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
|
|
2920
|
-
/**
|
|
2921
|
-
* Detects whether an error thrown during ciphertext decryption is an authentication failure
|
|
2922
|
-
* (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
|
|
2923
|
-
* Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
|
|
2924
|
-
*/
|
|
2925
|
-
declare function isAuthOrDecryptionError(err: any): boolean;
|
|
2926
|
-
/**
|
|
2927
|
-
* Serializes a JavaScript value to a deterministic, canonical JSON string conforming to RFC 8785 (JCS).
|
|
2928
|
-
* Guarantees consistent property sorting by UTF-16 code units, omission of undefined/symbol/function values,
|
|
2929
|
-
* standard ECMAScript number formatting (-0 serialized as 0), and detection of circular references.
|
|
2930
|
-
*/
|
|
2931
|
-
declare function canonicalizeJson(value: any, seen?: Set<any>): string;
|
|
2932
|
-
|
|
2933
3547
|
/**
|
|
2934
3548
|
* Web Streams Chunked AEAD Encryption & Decryption for Large Payloads.
|
|
2935
3549
|
* Implements the STREAM construction (AES-GCM with 96-bit nonces, wrapped per-stream DEK,
|
|
@@ -2988,6 +3602,12 @@ declare function encryptBlob(blob: Blob, options: IStreamEncryptionOptions): Pro
|
|
|
2988
3602
|
* Decrypts a Blob payload using Web Streams chunked AEAD decryption.
|
|
2989
3603
|
*/
|
|
2990
3604
|
declare function decryptBlob(blob: Blob, options: IStreamDecryptionOptions, mimeType?: string): Promise<Blob>;
|
|
3605
|
+
declare const CWebCryptoStreamCipher: {
|
|
3606
|
+
createEncryptionStream: typeof createEncryptionStream;
|
|
3607
|
+
createDecryptionStream: typeof createDecryptionStream;
|
|
3608
|
+
encryptBlob: typeof encryptBlob;
|
|
3609
|
+
decryptBlob: typeof decryptBlob;
|
|
3610
|
+
};
|
|
2991
3611
|
|
|
2992
3612
|
/**
|
|
2993
3613
|
* In-memory storage adapter for public key pinning records.
|
|
@@ -3003,11 +3623,19 @@ declare class CMemoryKeyPinningStore implements IKeyPinningStore {
|
|
|
3003
3623
|
/**
|
|
3004
3624
|
* LocalStorage adapter for public key pinning records in browser environments.
|
|
3005
3625
|
* Uses namespaced keys in the form `katlux:pin:<namespace>:<entityId>`.
|
|
3626
|
+
*
|
|
3627
|
+
* SECURITY WARNING & THREAT MODEL NOTICE:
|
|
3628
|
+
* Storing pinned public keys in raw browser `localStorage` lacks hardware-backed integrity protection.
|
|
3629
|
+
* An XSS payload executing `localStorage.clear()` or deleting individual pinning keys will wipe stored pins
|
|
3630
|
+
* and force a silent fresh Trust-On-First-Use (TOFU) key registration. For high-security environments,
|
|
3631
|
+
* consider using signed server-side attestation, an authenticated IndexedDB store with subkey HMAC,
|
|
3632
|
+
* or an immutable storage back-end.
|
|
3006
3633
|
*/
|
|
3007
3634
|
declare class CLocalStorageKeyPinningStore implements IKeyPinningStore {
|
|
3008
3635
|
private readonly namespace;
|
|
3009
3636
|
private readonly prefix;
|
|
3010
3637
|
constructor(namespace?: string);
|
|
3638
|
+
private getStorage;
|
|
3011
3639
|
private getKey;
|
|
3012
3640
|
get(entityId: string): Promise<IKeyPin | null>;
|
|
3013
3641
|
compareAndSet(entityId: string, expectedFingerprint: string | null, next: IKeyPin): Promise<boolean>;
|
|
@@ -3027,18 +3655,28 @@ declare class CIndexedDBKeyPinningStore implements IKeyPinningStore {
|
|
|
3027
3655
|
delete(entityId: string): Promise<void>;
|
|
3028
3656
|
clear(): Promise<void>;
|
|
3029
3657
|
}
|
|
3658
|
+
declare const CKeyPinningStore: {
|
|
3659
|
+
Memory: typeof CMemoryKeyPinningStore;
|
|
3660
|
+
LocalStorage: typeof CLocalStorageKeyPinningStore;
|
|
3661
|
+
IndexedDB: typeof CIndexedDBKeyPinningStore;
|
|
3662
|
+
};
|
|
3030
3663
|
|
|
3031
3664
|
/**
|
|
3032
|
-
* Server query rewriter utility for encrypted
|
|
3665
|
+
* Server query rewriter utility for encrypted, blind-indexed, trigram-indexed, and shadow-bucketed columns.
|
|
3666
|
+
*
|
|
3667
|
+
* Operates strictly as an IDataFilter AST transformation function (No ORM / No SQL generation).
|
|
3668
|
+
* Automatically translates high-level filters on encrypted fields into persistence queries against
|
|
3669
|
+
* indexed persistence columns:
|
|
3670
|
+
* 1. Exact Match (`==`, `!=`, `in`, `nin`) -> Blind index tokens across multi-KID keyring (`_bidx`)
|
|
3671
|
+
* 2. Substring Search (`contains`, `like`) -> Trigram token containment (`_trigrams`)
|
|
3672
|
+
* 3. Range Queries (`<`, `<=`, `>`, `>=`, `between`) -> Shadow discrete bucket tokens (`_bucket`)
|
|
3033
3673
|
*
|
|
3034
|
-
*
|
|
3035
|
-
* across multi-KID keyrings (active and search-only keys), emitting abstract persistence
|
|
3036
|
-
* clauses that format cleanly into PostgreSQL (= ANY), MySQL and SQLite (IN (?, ...)).
|
|
3674
|
+
* Preserves compound boolean trees (and, or, nand, nor) seamlessly.
|
|
3037
3675
|
*
|
|
3038
3676
|
* @param filters - Single IDataFilter or array of filters
|
|
3039
|
-
* @param options - Configuration mapping fields to blind index keyrings and
|
|
3677
|
+
* @param options - Configuration mapping fields to blind index keyrings, trigrams, and range buckets
|
|
3040
3678
|
*/
|
|
3041
|
-
declare function rewriteEncryptedFilters(filters: IDataFilter | IDataFilter[], options: IEncryptedFilterRewriteOptions): Promise<
|
|
3679
|
+
declare function rewriteEncryptedFilters(filters: IDataFilter$1 | IDataFilter$1[], options: IEncryptedFilterRewriteOptions): Promise<IRewrittenEncryptedFilters>;
|
|
3042
3680
|
|
|
3043
3681
|
/**
|
|
3044
3682
|
* Katlux Batch Re-Encryption & Key Migration Orchestrator
|
|
@@ -3065,10 +3703,73 @@ declare function reencryptBatch<TRow = any>(rows: TRow[], options: IReencryptBat
|
|
|
3065
3703
|
*/
|
|
3066
3704
|
declare function reencryptDataset<TRow = any>(options: IReencryptDatasetOptions<TRow>): Promise<IMigrationSummary>;
|
|
3067
3705
|
|
|
3706
|
+
/**
|
|
3707
|
+
* Safely parses any date string, Unix timestamp (in seconds or ms), or Date instance.
|
|
3708
|
+
*/
|
|
3709
|
+
declare function parseDateValue(val: any): Date | null;
|
|
3710
|
+
/**
|
|
3711
|
+
* Safely parses numbers from numbers or numeric strings (including currency/commas).
|
|
3712
|
+
*/
|
|
3713
|
+
declare function parseNumericValue(val: any): number | null;
|
|
3714
|
+
/**
|
|
3715
|
+
* Computes a deterministic string shadow bucket key for a date or timestamp.
|
|
3716
|
+
* Supported granularities: 'year', 'quarter', 'month', 'week', 'day'.
|
|
3717
|
+
*/
|
|
3718
|
+
declare function computeDateBucket(val: any, granularity?: TDateBucketGranularity): string | undefined;
|
|
3719
|
+
/**
|
|
3720
|
+
* Resolves the bounding interval [min, max] (in UTC milliseconds) for a given date bucket key.
|
|
3721
|
+
*/
|
|
3722
|
+
declare function getDateBucketRange(bucketKey: string, granularity?: TDateBucketGranularity): {
|
|
3723
|
+
min: number;
|
|
3724
|
+
max: number;
|
|
3725
|
+
} | null;
|
|
3726
|
+
/**
|
|
3727
|
+
* Computes a stepped numeric shadow bucket key (e.g. 10000 step -> '0-9999', '10000-19999').
|
|
3728
|
+
*/
|
|
3729
|
+
declare function computeSteppedBucket(val: any, step: number, min?: number): string | undefined;
|
|
3730
|
+
/**
|
|
3731
|
+
* Resolves the numeric interval [min, max] for a stepped bucket key.
|
|
3732
|
+
*/
|
|
3733
|
+
declare function getSteppedBucketRange(bucketKey: string, step?: number): {
|
|
3734
|
+
min: number;
|
|
3735
|
+
max: number;
|
|
3736
|
+
} | null;
|
|
3737
|
+
/**
|
|
3738
|
+
* Computes a threshold / tier shadow bucket key (e.g. [0, 25000, 50000] -> '<0', '0-24999', '25000-49999', '>=50000').
|
|
3739
|
+
*/
|
|
3740
|
+
declare function computeTierBucket(val: any, rawThresholds: number[]): string | undefined;
|
|
3741
|
+
/**
|
|
3742
|
+
* Resolves the numeric interval [min, max] for a tier bucket key.
|
|
3743
|
+
*/
|
|
3744
|
+
declare function getTierBucketRange(bucketKey: string, rawThresholds: number[]): {
|
|
3745
|
+
min: number;
|
|
3746
|
+
max: number;
|
|
3747
|
+
} | null;
|
|
3748
|
+
/**
|
|
3749
|
+
* Computes a shadow range bucket key for any value according to its configuration.
|
|
3750
|
+
*/
|
|
3751
|
+
declare function computeRangeBucket(val: any, config: TRangeBucketConfig): string | undefined;
|
|
3752
|
+
/**
|
|
3753
|
+
* Resolves the bounding interval [min, max] for any bucket key and configuration.
|
|
3754
|
+
*/
|
|
3755
|
+
declare function getRangeBucketRange(bucketKey: string, config: TRangeBucketConfig): {
|
|
3756
|
+
min: number;
|
|
3757
|
+
max: number;
|
|
3758
|
+
} | null;
|
|
3759
|
+
/**
|
|
3760
|
+
* Resolves the set of eligible shadow bucket keys that satisfy a given range comparison query.
|
|
3761
|
+
*
|
|
3762
|
+
* @param operator - Range operator: '>', '>=', '<', '<=', 'between', '==', '!=', 'in'
|
|
3763
|
+
* @param targetValue - Plaintext target comparison value (number, date string, timestamp, or tuple for between)
|
|
3764
|
+
* @param config - Range bucketing configuration ('date', 'stepped', or 'tier')
|
|
3765
|
+
* @param knownBuckets - Optional iterable of all unique bucket keys present in the indexed dataset
|
|
3766
|
+
*/
|
|
3767
|
+
declare function resolveBucketsForRange(operator: string, targetValue: any, config: TRangeBucketConfig, knownBuckets?: Iterable<string>): Set<string>;
|
|
3768
|
+
|
|
3068
3769
|
/**
|
|
3069
3770
|
* Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
|
|
3070
3771
|
*/
|
|
3071
3772
|
declare function isEncrypted(payload: any): boolean;
|
|
3072
3773
|
|
|
3073
|
-
export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CIndexedDBKeyPinningStore, CKeyManager, CLocalStorageCache, CLocalStorageKeyPinningStore, CMemoryCache, CMemoryKeyPinningStore, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DECRYPT_ERROR_SENTINEL, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, canonicalizeJson, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createDecryptionStream, createEncryptionProvider, createEncryptionStream, debounce, decryptBlob, decryptPageRows, encryptBlob, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, reencryptBatch, reencryptDataset, resolveInfoBytes, rewriteEncryptedFilters, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
|
|
3074
|
-
export type { CacheDriverLoader,
|
|
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 };
|