@katlux/providers 0.1.1-alpha.109 → 0.1.1-alpha.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -21,6 +21,8 @@ interface IEncryptionContext {
21
21
  url?: string;
22
22
  method?: string;
23
23
  isServer?: boolean;
24
+ /** Whether to bind the request context (URL and method as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD) */
25
+ bindRequestContextAad?: boolean;
24
26
  /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
25
27
  fields?: string[];
26
28
  key?: TKeyProvider | IKeyPair;
@@ -65,6 +67,12 @@ interface IProviderEncryptionOptions {
65
67
  keyId?: string;
66
68
  /** Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping */
67
69
  aad?: string | Uint8Array | ArrayBuffer;
70
+ /**
71
+ * Whether to bind the request context (HTTP method and URL as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD).
72
+ * Defaults to true when URL or method is provided in context, mitigating replay and cross-endpoint confusion attacks (BUG-015).
73
+ * Set to false to disable request context AAD binding.
74
+ */
75
+ bindRequestContextAad?: boolean;
68
76
  /**
69
77
  * Whether decryption is permitted during Server-Side Rendering (SSR).
70
78
  * In an End-to-End (E2E) zero-trust model, defaults to false to prevent
@@ -219,6 +227,22 @@ interface ICacheQuotaOptions {
219
227
  quotaThresholdRatio?: number;
220
228
  fallbackToMemory?: boolean;
221
229
  }
230
+ interface ICookieCacheOptions {
231
+ /** Default: 'lax'. */
232
+ sameSite?: 'strict' | 'lax' | 'none';
233
+ /**
234
+ * Adds the `Secure` flag. Default: auto-detected from the request protocol
235
+ * (https => true). Set explicitly to force it on or off.
236
+ */
237
+ secure?: boolean;
238
+ /**
239
+ * Default: true. Only effective for cookies written on the server: browsers
240
+ * do not allow `document.cookie` to set HttpOnly, so client writes ignore it.
241
+ */
242
+ httpOnly?: boolean;
243
+ /** Default: '/'. */
244
+ path?: string;
245
+ }
222
246
  interface IRequestOptions {
223
247
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
224
248
  body?: any;
@@ -240,6 +264,7 @@ interface IRequestOptions {
240
264
  encryption?: IProviderEncryptionOptions;
241
265
  /** If true, returns raw response without decrypting, useful for DataProvider lazy page-level decryption */
242
266
  skipDecryption?: boolean;
267
+ credentials?: RequestCredentials;
243
268
  }
244
269
  /** Queue persistence backend with automatic fallback: IndexedDB → LocalStorage → Memory */
245
270
  declare enum EQueueStorage {
@@ -453,6 +478,7 @@ declare abstract class ADataProvider<TRow = TDataRow> {
453
478
  protected _selectAll: boolean;
454
479
  get selectAll(): boolean;
455
480
  set selectAll(val: boolean);
481
+ getSelectedRows(): TRow[];
456
482
  protected _currentPage: number;
457
483
  protected _pageSize: number;
458
484
  protected _filter: IDataFilter | null;
@@ -628,6 +654,7 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
628
654
  refresh(hardRefresh?: boolean): Promise<void>;
629
655
  private _computeFilteredAndSorted;
630
656
  loadPageData(): Promise<void>;
657
+ getSelectedRows(): TRow[];
631
658
  }
632
659
 
633
660
  declare abstract class ACacheProvider {
@@ -1053,8 +1080,18 @@ declare class CCookieCache extends ACacheProvider {
1053
1080
  private static instance;
1054
1081
  static getInstance(): CCookieCache;
1055
1082
  type: string;
1056
- constructor();
1083
+ sameSite: 'strict' | 'lax' | 'none';
1084
+ secure: boolean | undefined;
1085
+ httpOnly: boolean;
1086
+ path: string;
1087
+ constructor(options?: ICookieCacheOptions);
1088
+ configure(options: ICookieCacheOptions): void;
1057
1089
  private getCookieKey;
1090
+ /**
1091
+ * Resolves the `Secure` flag: an explicit option wins, otherwise follow the
1092
+ * actual protocol so cookies are not silently dropped by browsers over plain HTTP.
1093
+ */
1094
+ private resolveSecure;
1058
1095
  private parseKeyFromCookieName;
1059
1096
  private isClient;
1060
1097
  getKeyList(context?: any): Promise<Array<string>>;
@@ -1265,6 +1302,7 @@ declare const SENSITIVE_HEADER_KEYS: string[];
1265
1302
  * RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
1266
1303
  * RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
1267
1304
  * RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
1305
+ * RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
1268
1306
  *
1269
1307
  * // Flush when back online
1270
1308
  * window.addEventListener('online', () => RequestQueue.flushAll())
@@ -1279,6 +1317,24 @@ declare class RequestQueue {
1279
1317
  static setMaxPayloadSize(bytes: number): void;
1280
1318
  static setMaxQueueSize(limit: number): void;
1281
1319
  static setMaxDeadLetterSize(limit: number): void;
1320
+ /**
1321
+ * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
1322
+ * request options to persistent storage (IndexedDB / LocalStorage).
1323
+ * Sensitive credentials must never be stored in plaintext in browser storage, and are
1324
+ * instead regenerated dynamically at execution time.
1325
+ */
1326
+ /**
1327
+ * Adapts binary, multipart, and specialized payload types (FormData, Blob, File,
1328
+ * ArrayBuffer, TypedArrays, URLSearchParams) into JSON-serializable structures
1329
+ * to prevent silent payload loss (BUG-014) when persisting to offline storage.
1330
+ */
1331
+ static serializeBody(body: any): Promise<any>;
1332
+ private static serializeFieldValue;
1333
+ /**
1334
+ * Reconstitutes serialized offline request bodies back into their live runtime instances
1335
+ * (FormData, Blob, File, ArrayBuffer, Uint8Array, URLSearchParams) before network transmission.
1336
+ */
1337
+ static reconstituteBody(body: any): any;
1282
1338
  /**
1283
1339
  * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
1284
1340
  * request options to persistent storage (IndexedDB / LocalStorage).
@@ -1295,6 +1351,7 @@ declare class RequestQueue {
1295
1351
  private static _onDeadLetter;
1296
1352
  private static _onFlushComplete;
1297
1353
  private static _onNetworkError;
1354
+ private static _onError;
1298
1355
  private static _headerProvider;
1299
1356
  static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
1300
1357
  /**
@@ -1310,6 +1367,8 @@ declare class RequestQueue {
1310
1367
  static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
1311
1368
  static onFlushComplete(cb: (succeededTags: string[]) => void): void;
1312
1369
  static onNetworkError(cb: (item: IQueuedOperation) => void): void;
1370
+ static onError(cb: (error: Error) => void): void;
1371
+ static onQueueFatalError(cb: (error: Error) => void): void;
1313
1372
  /**
1314
1373
  * Add an operation to the pending queue and persist it.
1315
1374
  * Called internally by RequestProvider when queue: true.
@@ -1529,6 +1588,20 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
1529
1588
  */
1530
1589
  [Symbol.dispose](): void;
1531
1590
  [Symbol.asyncDispose](): Promise<void>;
1591
+ /**
1592
+ * Resolves effective Authenticated Additional Data (AAD) for the operation:
1593
+ * 1. If options.bindRequestContextAad is explicitly false, returns options.aad directly without context binding.
1594
+ * 2. When encrypting (isDecrypt=false): binds request context `req:${method}:${url}` only if options.bindRequestContextAad === true.
1595
+ * 3. When decrypting (isDecrypt=true): derives request context `req:${method}:${url}` if url or method is provided.
1596
+ * 4. If explicit options.aad is provided: combines with request context if bound, or returns options.aad directly.
1597
+ * 5. Otherwise returns undefined.
1598
+ */
1599
+ protected _resolveEffectiveAad(options?: IEncryptionContext, isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
1600
+ /**
1601
+ * Helper to deterministically bind record ID and field name into the AAD
1602
+ * to prevent ciphertext swapping between fields or records.
1603
+ */
1604
+ protected _bindFieldAad(data: any, field: string, options?: IEncryptionContext): IEncryptionContext;
1532
1605
  /**
1533
1606
  * Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
1534
1607
  * Implemented by concrete cryptographic providers.
@@ -1652,7 +1725,7 @@ declare class CKeyManager {
1652
1725
  * Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
1653
1726
  * Designed for multi-user table and field-level encryption.
1654
1727
  */
1655
- static generateAccountDataKey(length?: 128 | 192 | 256): Promise<CryptoKey>;
1728
+ static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
1656
1729
  /**
1657
1730
  * Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
1658
1731
  * Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
@@ -1662,7 +1735,7 @@ declare class CKeyManager {
1662
1735
  * Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
1663
1736
  * Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
1664
1737
  */
1665
- static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any): Promise<CryptoKey>;
1738
+ static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
1666
1739
  /**
1667
1740
  * Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
1668
1741
  * Returns the derived CryptoKey and the base64-encoded salt.
@@ -1756,6 +1829,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1756
1829
  private _cachedKdf?;
1757
1830
  private _cachedIter?;
1758
1831
  private _cachedHash?;
1832
+ private _cachedKeyId?;
1759
1833
  private _configuredKid?;
1760
1834
  private _kdfOptions?;
1761
1835
  private _decryptSaltCache;
@@ -1936,6 +2010,7 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
1936
2010
  private _cachedKdf?;
1937
2011
  private _cachedIter?;
1938
2012
  private _cachedHash?;
2013
+ private _cachedKeyId?;
1939
2014
  private _configuredKid?;
1940
2015
  setDefaultKey(key: TKeyProvider): void;
1941
2016
  clearKeys(): void;
@@ -2032,11 +2107,17 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
2032
2107
  * cross-tenant cache collisions and avoid storing secrets in heap Map keys.
2033
2108
  */
2034
2109
  declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
2110
+ /**
2111
+ * Detects whether an error thrown during ciphertext decryption is an authentication failure
2112
+ * (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
2113
+ * Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
2114
+ */
2115
+ declare function isAuthOrDecryptionError(err: any): boolean;
2035
2116
 
2036
2117
  /**
2037
2118
  * Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
2038
2119
  */
2039
2120
  declare function isEncrypted(payload: any): boolean;
2040
2121
 
2041
- export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
2042
- export type { CacheDriverLoader, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
2122
+ export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
2123
+ export type { CacheDriverLoader, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, ICookieCacheOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
package/dist/index.d.mts CHANGED
@@ -21,6 +21,8 @@ interface IEncryptionContext {
21
21
  url?: string;
22
22
  method?: string;
23
23
  isServer?: boolean;
24
+ /** Whether to bind the request context (URL and method as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD) */
25
+ bindRequestContextAad?: boolean;
24
26
  /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
25
27
  fields?: string[];
26
28
  key?: TKeyProvider | IKeyPair;
@@ -65,6 +67,12 @@ interface IProviderEncryptionOptions {
65
67
  keyId?: string;
66
68
  /** Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping */
67
69
  aad?: string | Uint8Array | ArrayBuffer;
70
+ /**
71
+ * Whether to bind the request context (HTTP method and URL as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD).
72
+ * Defaults to true when URL or method is provided in context, mitigating replay and cross-endpoint confusion attacks (BUG-015).
73
+ * Set to false to disable request context AAD binding.
74
+ */
75
+ bindRequestContextAad?: boolean;
68
76
  /**
69
77
  * Whether decryption is permitted during Server-Side Rendering (SSR).
70
78
  * In an End-to-End (E2E) zero-trust model, defaults to false to prevent
@@ -219,6 +227,22 @@ interface ICacheQuotaOptions {
219
227
  quotaThresholdRatio?: number;
220
228
  fallbackToMemory?: boolean;
221
229
  }
230
+ interface ICookieCacheOptions {
231
+ /** Default: 'lax'. */
232
+ sameSite?: 'strict' | 'lax' | 'none';
233
+ /**
234
+ * Adds the `Secure` flag. Default: auto-detected from the request protocol
235
+ * (https => true). Set explicitly to force it on or off.
236
+ */
237
+ secure?: boolean;
238
+ /**
239
+ * Default: true. Only effective for cookies written on the server: browsers
240
+ * do not allow `document.cookie` to set HttpOnly, so client writes ignore it.
241
+ */
242
+ httpOnly?: boolean;
243
+ /** Default: '/'. */
244
+ path?: string;
245
+ }
222
246
  interface IRequestOptions {
223
247
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
224
248
  body?: any;
@@ -240,6 +264,7 @@ interface IRequestOptions {
240
264
  encryption?: IProviderEncryptionOptions;
241
265
  /** If true, returns raw response without decrypting, useful for DataProvider lazy page-level decryption */
242
266
  skipDecryption?: boolean;
267
+ credentials?: RequestCredentials;
243
268
  }
244
269
  /** Queue persistence backend with automatic fallback: IndexedDB → LocalStorage → Memory */
245
270
  declare enum EQueueStorage {
@@ -453,6 +478,7 @@ declare abstract class ADataProvider<TRow = TDataRow> {
453
478
  protected _selectAll: boolean;
454
479
  get selectAll(): boolean;
455
480
  set selectAll(val: boolean);
481
+ getSelectedRows(): TRow[];
456
482
  protected _currentPage: number;
457
483
  protected _pageSize: number;
458
484
  protected _filter: IDataFilter | null;
@@ -628,6 +654,7 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
628
654
  refresh(hardRefresh?: boolean): Promise<void>;
629
655
  private _computeFilteredAndSorted;
630
656
  loadPageData(): Promise<void>;
657
+ getSelectedRows(): TRow[];
631
658
  }
632
659
 
633
660
  declare abstract class ACacheProvider {
@@ -1053,8 +1080,18 @@ declare class CCookieCache extends ACacheProvider {
1053
1080
  private static instance;
1054
1081
  static getInstance(): CCookieCache;
1055
1082
  type: string;
1056
- constructor();
1083
+ sameSite: 'strict' | 'lax' | 'none';
1084
+ secure: boolean | undefined;
1085
+ httpOnly: boolean;
1086
+ path: string;
1087
+ constructor(options?: ICookieCacheOptions);
1088
+ configure(options: ICookieCacheOptions): void;
1057
1089
  private getCookieKey;
1090
+ /**
1091
+ * Resolves the `Secure` flag: an explicit option wins, otherwise follow the
1092
+ * actual protocol so cookies are not silently dropped by browsers over plain HTTP.
1093
+ */
1094
+ private resolveSecure;
1058
1095
  private parseKeyFromCookieName;
1059
1096
  private isClient;
1060
1097
  getKeyList(context?: any): Promise<Array<string>>;
@@ -1265,6 +1302,7 @@ declare const SENSITIVE_HEADER_KEYS: string[];
1265
1302
  * RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
1266
1303
  * RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
1267
1304
  * RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
1305
+ * RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
1268
1306
  *
1269
1307
  * // Flush when back online
1270
1308
  * window.addEventListener('online', () => RequestQueue.flushAll())
@@ -1279,6 +1317,24 @@ declare class RequestQueue {
1279
1317
  static setMaxPayloadSize(bytes: number): void;
1280
1318
  static setMaxQueueSize(limit: number): void;
1281
1319
  static setMaxDeadLetterSize(limit: number): void;
1320
+ /**
1321
+ * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
1322
+ * request options to persistent storage (IndexedDB / LocalStorage).
1323
+ * Sensitive credentials must never be stored in plaintext in browser storage, and are
1324
+ * instead regenerated dynamically at execution time.
1325
+ */
1326
+ /**
1327
+ * Adapts binary, multipart, and specialized payload types (FormData, Blob, File,
1328
+ * ArrayBuffer, TypedArrays, URLSearchParams) into JSON-serializable structures
1329
+ * to prevent silent payload loss (BUG-014) when persisting to offline storage.
1330
+ */
1331
+ static serializeBody(body: any): Promise<any>;
1332
+ private static serializeFieldValue;
1333
+ /**
1334
+ * Reconstitutes serialized offline request bodies back into their live runtime instances
1335
+ * (FormData, Blob, File, ArrayBuffer, Uint8Array, URLSearchParams) before network transmission.
1336
+ */
1337
+ static reconstituteBody(body: any): any;
1282
1338
  /**
1283
1339
  * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
1284
1340
  * request options to persistent storage (IndexedDB / LocalStorage).
@@ -1295,6 +1351,7 @@ declare class RequestQueue {
1295
1351
  private static _onDeadLetter;
1296
1352
  private static _onFlushComplete;
1297
1353
  private static _onNetworkError;
1354
+ private static _onError;
1298
1355
  private static _headerProvider;
1299
1356
  static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
1300
1357
  /**
@@ -1310,6 +1367,8 @@ declare class RequestQueue {
1310
1367
  static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
1311
1368
  static onFlushComplete(cb: (succeededTags: string[]) => void): void;
1312
1369
  static onNetworkError(cb: (item: IQueuedOperation) => void): void;
1370
+ static onError(cb: (error: Error) => void): void;
1371
+ static onQueueFatalError(cb: (error: Error) => void): void;
1313
1372
  /**
1314
1373
  * Add an operation to the pending queue and persist it.
1315
1374
  * Called internally by RequestProvider when queue: true.
@@ -1529,6 +1588,20 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
1529
1588
  */
1530
1589
  [Symbol.dispose](): void;
1531
1590
  [Symbol.asyncDispose](): Promise<void>;
1591
+ /**
1592
+ * Resolves effective Authenticated Additional Data (AAD) for the operation:
1593
+ * 1. If options.bindRequestContextAad is explicitly false, returns options.aad directly without context binding.
1594
+ * 2. When encrypting (isDecrypt=false): binds request context `req:${method}:${url}` only if options.bindRequestContextAad === true.
1595
+ * 3. When decrypting (isDecrypt=true): derives request context `req:${method}:${url}` if url or method is provided.
1596
+ * 4. If explicit options.aad is provided: combines with request context if bound, or returns options.aad directly.
1597
+ * 5. Otherwise returns undefined.
1598
+ */
1599
+ protected _resolveEffectiveAad(options?: IEncryptionContext, isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
1600
+ /**
1601
+ * Helper to deterministically bind record ID and field name into the AAD
1602
+ * to prevent ciphertext swapping between fields or records.
1603
+ */
1604
+ protected _bindFieldAad(data: any, field: string, options?: IEncryptionContext): IEncryptionContext;
1532
1605
  /**
1533
1606
  * Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
1534
1607
  * Implemented by concrete cryptographic providers.
@@ -1652,7 +1725,7 @@ declare class CKeyManager {
1652
1725
  * Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
1653
1726
  * Designed for multi-user table and field-level encryption.
1654
1727
  */
1655
- static generateAccountDataKey(length?: 128 | 192 | 256): Promise<CryptoKey>;
1728
+ static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
1656
1729
  /**
1657
1730
  * Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
1658
1731
  * Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
@@ -1662,7 +1735,7 @@ declare class CKeyManager {
1662
1735
  * Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
1663
1736
  * Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
1664
1737
  */
1665
- static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any): Promise<CryptoKey>;
1738
+ static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
1666
1739
  /**
1667
1740
  * Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
1668
1741
  * Returns the derived CryptoKey and the base64-encoded salt.
@@ -1756,6 +1829,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1756
1829
  private _cachedKdf?;
1757
1830
  private _cachedIter?;
1758
1831
  private _cachedHash?;
1832
+ private _cachedKeyId?;
1759
1833
  private _configuredKid?;
1760
1834
  private _kdfOptions?;
1761
1835
  private _decryptSaltCache;
@@ -1936,6 +2010,7 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
1936
2010
  private _cachedKdf?;
1937
2011
  private _cachedIter?;
1938
2012
  private _cachedHash?;
2013
+ private _cachedKeyId?;
1939
2014
  private _configuredKid?;
1940
2015
  setDefaultKey(key: TKeyProvider): void;
1941
2016
  clearKeys(): void;
@@ -2032,11 +2107,17 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
2032
2107
  * cross-tenant cache collisions and avoid storing secrets in heap Map keys.
2033
2108
  */
2034
2109
  declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
2110
+ /**
2111
+ * Detects whether an error thrown during ciphertext decryption is an authentication failure
2112
+ * (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
2113
+ * Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
2114
+ */
2115
+ declare function isAuthOrDecryptionError(err: any): boolean;
2035
2116
 
2036
2117
  /**
2037
2118
  * Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
2038
2119
  */
2039
2120
  declare function isEncrypted(payload: any): boolean;
2040
2121
 
2041
- export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
2042
- export type { CacheDriverLoader, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
2122
+ export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
2123
+ export type { CacheDriverLoader, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, ICookieCacheOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
package/dist/index.d.ts CHANGED
@@ -21,6 +21,8 @@ interface IEncryptionContext {
21
21
  url?: string;
22
22
  method?: string;
23
23
  isServer?: boolean;
24
+ /** Whether to bind the request context (URL and method as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD) */
25
+ bindRequestContextAad?: boolean;
24
26
  /** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
25
27
  fields?: string[];
26
28
  key?: TKeyProvider | IKeyPair;
@@ -65,6 +67,12 @@ interface IProviderEncryptionOptions {
65
67
  keyId?: string;
66
68
  /** Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping */
67
69
  aad?: string | Uint8Array | ArrayBuffer;
70
+ /**
71
+ * Whether to bind the request context (HTTP method and URL as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD).
72
+ * Defaults to true when URL or method is provided in context, mitigating replay and cross-endpoint confusion attacks (BUG-015).
73
+ * Set to false to disable request context AAD binding.
74
+ */
75
+ bindRequestContextAad?: boolean;
68
76
  /**
69
77
  * Whether decryption is permitted during Server-Side Rendering (SSR).
70
78
  * In an End-to-End (E2E) zero-trust model, defaults to false to prevent
@@ -219,6 +227,22 @@ interface ICacheQuotaOptions {
219
227
  quotaThresholdRatio?: number;
220
228
  fallbackToMemory?: boolean;
221
229
  }
230
+ interface ICookieCacheOptions {
231
+ /** Default: 'lax'. */
232
+ sameSite?: 'strict' | 'lax' | 'none';
233
+ /**
234
+ * Adds the `Secure` flag. Default: auto-detected from the request protocol
235
+ * (https => true). Set explicitly to force it on or off.
236
+ */
237
+ secure?: boolean;
238
+ /**
239
+ * Default: true. Only effective for cookies written on the server: browsers
240
+ * do not allow `document.cookie` to set HttpOnly, so client writes ignore it.
241
+ */
242
+ httpOnly?: boolean;
243
+ /** Default: '/'. */
244
+ path?: string;
245
+ }
222
246
  interface IRequestOptions {
223
247
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
224
248
  body?: any;
@@ -240,6 +264,7 @@ interface IRequestOptions {
240
264
  encryption?: IProviderEncryptionOptions;
241
265
  /** If true, returns raw response without decrypting, useful for DataProvider lazy page-level decryption */
242
266
  skipDecryption?: boolean;
267
+ credentials?: RequestCredentials;
243
268
  }
244
269
  /** Queue persistence backend with automatic fallback: IndexedDB → LocalStorage → Memory */
245
270
  declare enum EQueueStorage {
@@ -453,6 +478,7 @@ declare abstract class ADataProvider<TRow = TDataRow> {
453
478
  protected _selectAll: boolean;
454
479
  get selectAll(): boolean;
455
480
  set selectAll(val: boolean);
481
+ getSelectedRows(): TRow[];
456
482
  protected _currentPage: number;
457
483
  protected _pageSize: number;
458
484
  protected _filter: IDataFilter | null;
@@ -628,6 +654,7 @@ declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientP
628
654
  refresh(hardRefresh?: boolean): Promise<void>;
629
655
  private _computeFilteredAndSorted;
630
656
  loadPageData(): Promise<void>;
657
+ getSelectedRows(): TRow[];
631
658
  }
632
659
 
633
660
  declare abstract class ACacheProvider {
@@ -1053,8 +1080,18 @@ declare class CCookieCache extends ACacheProvider {
1053
1080
  private static instance;
1054
1081
  static getInstance(): CCookieCache;
1055
1082
  type: string;
1056
- constructor();
1083
+ sameSite: 'strict' | 'lax' | 'none';
1084
+ secure: boolean | undefined;
1085
+ httpOnly: boolean;
1086
+ path: string;
1087
+ constructor(options?: ICookieCacheOptions);
1088
+ configure(options: ICookieCacheOptions): void;
1057
1089
  private getCookieKey;
1090
+ /**
1091
+ * Resolves the `Secure` flag: an explicit option wins, otherwise follow the
1092
+ * actual protocol so cookies are not silently dropped by browsers over plain HTTP.
1093
+ */
1094
+ private resolveSecure;
1058
1095
  private parseKeyFromCookieName;
1059
1096
  private isClient;
1060
1097
  getKeyList(context?: any): Promise<Array<string>>;
@@ -1265,6 +1302,7 @@ declare const SENSITIVE_HEADER_KEYS: string[];
1265
1302
  * RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
1266
1303
  * RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
1267
1304
  * RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
1305
+ * RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
1268
1306
  *
1269
1307
  * // Flush when back online
1270
1308
  * window.addEventListener('online', () => RequestQueue.flushAll())
@@ -1279,6 +1317,24 @@ declare class RequestQueue {
1279
1317
  static setMaxPayloadSize(bytes: number): void;
1280
1318
  static setMaxQueueSize(limit: number): void;
1281
1319
  static setMaxDeadLetterSize(limit: number): void;
1320
+ /**
1321
+ * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
1322
+ * request options to persistent storage (IndexedDB / LocalStorage).
1323
+ * Sensitive credentials must never be stored in plaintext in browser storage, and are
1324
+ * instead regenerated dynamically at execution time.
1325
+ */
1326
+ /**
1327
+ * Adapts binary, multipart, and specialized payload types (FormData, Blob, File,
1328
+ * ArrayBuffer, TypedArrays, URLSearchParams) into JSON-serializable structures
1329
+ * to prevent silent payload loss (BUG-014) when persisting to offline storage.
1330
+ */
1331
+ static serializeBody(body: any): Promise<any>;
1332
+ private static serializeFieldValue;
1333
+ /**
1334
+ * Reconstitutes serialized offline request bodies back into their live runtime instances
1335
+ * (FormData, Blob, File, ArrayBuffer, Uint8Array, URLSearchParams) before network transmission.
1336
+ */
1337
+ static reconstituteBody(body: any): any;
1282
1338
  /**
1283
1339
  * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
1284
1340
  * request options to persistent storage (IndexedDB / LocalStorage).
@@ -1295,6 +1351,7 @@ declare class RequestQueue {
1295
1351
  private static _onDeadLetter;
1296
1352
  private static _onFlushComplete;
1297
1353
  private static _onNetworkError;
1354
+ private static _onError;
1298
1355
  private static _headerProvider;
1299
1356
  static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
1300
1357
  /**
@@ -1310,6 +1367,8 @@ declare class RequestQueue {
1310
1367
  static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
1311
1368
  static onFlushComplete(cb: (succeededTags: string[]) => void): void;
1312
1369
  static onNetworkError(cb: (item: IQueuedOperation) => void): void;
1370
+ static onError(cb: (error: Error) => void): void;
1371
+ static onQueueFatalError(cb: (error: Error) => void): void;
1313
1372
  /**
1314
1373
  * Add an operation to the pending queue and persist it.
1315
1374
  * Called internally by RequestProvider when queue: true.
@@ -1529,6 +1588,20 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
1529
1588
  */
1530
1589
  [Symbol.dispose](): void;
1531
1590
  [Symbol.asyncDispose](): Promise<void>;
1591
+ /**
1592
+ * Resolves effective Authenticated Additional Data (AAD) for the operation:
1593
+ * 1. If options.bindRequestContextAad is explicitly false, returns options.aad directly without context binding.
1594
+ * 2. When encrypting (isDecrypt=false): binds request context `req:${method}:${url}` only if options.bindRequestContextAad === true.
1595
+ * 3. When decrypting (isDecrypt=true): derives request context `req:${method}:${url}` if url or method is provided.
1596
+ * 4. If explicit options.aad is provided: combines with request context if bound, or returns options.aad directly.
1597
+ * 5. Otherwise returns undefined.
1598
+ */
1599
+ protected _resolveEffectiveAad(options?: IEncryptionContext, isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
1600
+ /**
1601
+ * Helper to deterministically bind record ID and field name into the AAD
1602
+ * to prevent ciphertext swapping between fields or records.
1603
+ */
1604
+ protected _bindFieldAad(data: any, field: string, options?: IEncryptionContext): IEncryptionContext;
1532
1605
  /**
1533
1606
  * Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
1534
1607
  * Implemented by concrete cryptographic providers.
@@ -1652,7 +1725,7 @@ declare class CKeyManager {
1652
1725
  * Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
1653
1726
  * Designed for multi-user table and field-level encryption.
1654
1727
  */
1655
- static generateAccountDataKey(length?: 128 | 192 | 256): Promise<CryptoKey>;
1728
+ static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
1656
1729
  /**
1657
1730
  * Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
1658
1731
  * Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
@@ -1662,7 +1735,7 @@ declare class CKeyManager {
1662
1735
  * Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
1663
1736
  * Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
1664
1737
  */
1665
- static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any): Promise<CryptoKey>;
1738
+ static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
1666
1739
  /**
1667
1740
  * Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
1668
1741
  * Returns the derived CryptoKey and the base64-encoded salt.
@@ -1756,6 +1829,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1756
1829
  private _cachedKdf?;
1757
1830
  private _cachedIter?;
1758
1831
  private _cachedHash?;
1832
+ private _cachedKeyId?;
1759
1833
  private _configuredKid?;
1760
1834
  private _kdfOptions?;
1761
1835
  private _decryptSaltCache;
@@ -1936,6 +2010,7 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
1936
2010
  private _cachedKdf?;
1937
2011
  private _cachedIter?;
1938
2012
  private _cachedHash?;
2013
+ private _cachedKeyId?;
1939
2014
  private _configuredKid?;
1940
2015
  setDefaultKey(key: TKeyProvider): void;
1941
2016
  clearKeys(): void;
@@ -2032,11 +2107,17 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
2032
2107
  * cross-tenant cache collisions and avoid storing secrets in heap Map keys.
2033
2108
  */
2034
2109
  declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
2110
+ /**
2111
+ * Detects whether an error thrown during ciphertext decryption is an authentication failure
2112
+ * (e.g. tag mismatch, invalid AAD, corrupted ciphertext) across Web Crypto and Node.js runtimes.
2113
+ * Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
2114
+ */
2115
+ declare function isAuthOrDecryptionError(err: any): boolean;
2035
2116
 
2036
2117
  /**
2037
2118
  * Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
2038
2119
  */
2039
2120
  declare function isEncrypted(payload: any): boolean;
2040
2121
 
2041
- export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
2042
- export type { CacheDriverLoader, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
2122
+ export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
2123
+ export type { CacheDriverLoader, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, ICookieCacheOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };