@katlux/providers 0.1.1-alpha.111 → 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.cjs +554 -74
- package/dist/index.d.cts +84 -5
- package/dist/index.d.mts +84 -5
- package/dist/index.d.ts +84 -5
- package/dist/index.mjs +554 -75
- package/package.json +1 -1
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 {
|
|
@@ -1055,8 +1080,18 @@ declare class CCookieCache extends ACacheProvider {
|
|
|
1055
1080
|
private static instance;
|
|
1056
1081
|
static getInstance(): CCookieCache;
|
|
1057
1082
|
type: string;
|
|
1058
|
-
|
|
1083
|
+
sameSite: 'strict' | 'lax' | 'none';
|
|
1084
|
+
secure: boolean | undefined;
|
|
1085
|
+
httpOnly: boolean;
|
|
1086
|
+
path: string;
|
|
1087
|
+
constructor(options?: ICookieCacheOptions);
|
|
1088
|
+
configure(options: ICookieCacheOptions): void;
|
|
1059
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;
|
|
1060
1095
|
private parseKeyFromCookieName;
|
|
1061
1096
|
private isClient;
|
|
1062
1097
|
getKeyList(context?: any): Promise<Array<string>>;
|
|
@@ -1267,6 +1302,7 @@ declare const SENSITIVE_HEADER_KEYS: string[];
|
|
|
1267
1302
|
* RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
|
|
1268
1303
|
* RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
|
|
1269
1304
|
* RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
|
|
1305
|
+
* RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
|
|
1270
1306
|
*
|
|
1271
1307
|
* // Flush when back online
|
|
1272
1308
|
* window.addEventListener('online', () => RequestQueue.flushAll())
|
|
@@ -1281,6 +1317,24 @@ declare class RequestQueue {
|
|
|
1281
1317
|
static setMaxPayloadSize(bytes: number): void;
|
|
1282
1318
|
static setMaxQueueSize(limit: number): void;
|
|
1283
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;
|
|
1284
1338
|
/**
|
|
1285
1339
|
* Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
|
|
1286
1340
|
* request options to persistent storage (IndexedDB / LocalStorage).
|
|
@@ -1297,6 +1351,7 @@ declare class RequestQueue {
|
|
|
1297
1351
|
private static _onDeadLetter;
|
|
1298
1352
|
private static _onFlushComplete;
|
|
1299
1353
|
private static _onNetworkError;
|
|
1354
|
+
private static _onError;
|
|
1300
1355
|
private static _headerProvider;
|
|
1301
1356
|
static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
|
|
1302
1357
|
/**
|
|
@@ -1312,6 +1367,8 @@ declare class RequestQueue {
|
|
|
1312
1367
|
static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
|
|
1313
1368
|
static onFlushComplete(cb: (succeededTags: string[]) => void): void;
|
|
1314
1369
|
static onNetworkError(cb: (item: IQueuedOperation) => void): void;
|
|
1370
|
+
static onError(cb: (error: Error) => void): void;
|
|
1371
|
+
static onQueueFatalError(cb: (error: Error) => void): void;
|
|
1315
1372
|
/**
|
|
1316
1373
|
* Add an operation to the pending queue and persist it.
|
|
1317
1374
|
* Called internally by RequestProvider when queue: true.
|
|
@@ -1531,6 +1588,20 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
1531
1588
|
*/
|
|
1532
1589
|
[Symbol.dispose](): void;
|
|
1533
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;
|
|
1534
1605
|
/**
|
|
1535
1606
|
* Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
|
|
1536
1607
|
* Implemented by concrete cryptographic providers.
|
|
@@ -1654,7 +1725,7 @@ declare class CKeyManager {
|
|
|
1654
1725
|
* Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
|
|
1655
1726
|
* Designed for multi-user table and field-level encryption.
|
|
1656
1727
|
*/
|
|
1657
|
-
static generateAccountDataKey(length?: 128 | 192 | 256): Promise<CryptoKey>;
|
|
1728
|
+
static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
|
|
1658
1729
|
/**
|
|
1659
1730
|
* Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
|
|
1660
1731
|
* Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
|
|
@@ -1664,7 +1735,7 @@ declare class CKeyManager {
|
|
|
1664
1735
|
* Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
|
|
1665
1736
|
* Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
|
|
1666
1737
|
*/
|
|
1667
|
-
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any): Promise<CryptoKey>;
|
|
1738
|
+
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
|
|
1668
1739
|
/**
|
|
1669
1740
|
* Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
|
|
1670
1741
|
* Returns the derived CryptoKey and the base64-encoded salt.
|
|
@@ -1758,6 +1829,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
|
|
|
1758
1829
|
private _cachedKdf?;
|
|
1759
1830
|
private _cachedIter?;
|
|
1760
1831
|
private _cachedHash?;
|
|
1832
|
+
private _cachedKeyId?;
|
|
1761
1833
|
private _configuredKid?;
|
|
1762
1834
|
private _kdfOptions?;
|
|
1763
1835
|
private _decryptSaltCache;
|
|
@@ -1938,6 +2010,7 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
1938
2010
|
private _cachedKdf?;
|
|
1939
2011
|
private _cachedIter?;
|
|
1940
2012
|
private _cachedHash?;
|
|
2013
|
+
private _cachedKeyId?;
|
|
1941
2014
|
private _configuredKid?;
|
|
1942
2015
|
setDefaultKey(key: TKeyProvider): void;
|
|
1943
2016
|
clearKeys(): void;
|
|
@@ -2034,11 +2107,17 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
|
|
|
2034
2107
|
* cross-tenant cache collisions and avoid storing secrets in heap Map keys.
|
|
2035
2108
|
*/
|
|
2036
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;
|
|
2037
2116
|
|
|
2038
2117
|
/**
|
|
2039
2118
|
* Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
|
|
2040
2119
|
*/
|
|
2041
2120
|
declare function isEncrypted(payload: any): boolean;
|
|
2042
2121
|
|
|
2043
|
-
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 };
|
|
2044
|
-
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 {
|
|
@@ -1055,8 +1080,18 @@ declare class CCookieCache extends ACacheProvider {
|
|
|
1055
1080
|
private static instance;
|
|
1056
1081
|
static getInstance(): CCookieCache;
|
|
1057
1082
|
type: string;
|
|
1058
|
-
|
|
1083
|
+
sameSite: 'strict' | 'lax' | 'none';
|
|
1084
|
+
secure: boolean | undefined;
|
|
1085
|
+
httpOnly: boolean;
|
|
1086
|
+
path: string;
|
|
1087
|
+
constructor(options?: ICookieCacheOptions);
|
|
1088
|
+
configure(options: ICookieCacheOptions): void;
|
|
1059
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;
|
|
1060
1095
|
private parseKeyFromCookieName;
|
|
1061
1096
|
private isClient;
|
|
1062
1097
|
getKeyList(context?: any): Promise<Array<string>>;
|
|
@@ -1267,6 +1302,7 @@ declare const SENSITIVE_HEADER_KEYS: string[];
|
|
|
1267
1302
|
* RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
|
|
1268
1303
|
* RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
|
|
1269
1304
|
* RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
|
|
1305
|
+
* RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
|
|
1270
1306
|
*
|
|
1271
1307
|
* // Flush when back online
|
|
1272
1308
|
* window.addEventListener('online', () => RequestQueue.flushAll())
|
|
@@ -1281,6 +1317,24 @@ declare class RequestQueue {
|
|
|
1281
1317
|
static setMaxPayloadSize(bytes: number): void;
|
|
1282
1318
|
static setMaxQueueSize(limit: number): void;
|
|
1283
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;
|
|
1284
1338
|
/**
|
|
1285
1339
|
* Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
|
|
1286
1340
|
* request options to persistent storage (IndexedDB / LocalStorage).
|
|
@@ -1297,6 +1351,7 @@ declare class RequestQueue {
|
|
|
1297
1351
|
private static _onDeadLetter;
|
|
1298
1352
|
private static _onFlushComplete;
|
|
1299
1353
|
private static _onNetworkError;
|
|
1354
|
+
private static _onError;
|
|
1300
1355
|
private static _headerProvider;
|
|
1301
1356
|
static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
|
|
1302
1357
|
/**
|
|
@@ -1312,6 +1367,8 @@ declare class RequestQueue {
|
|
|
1312
1367
|
static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
|
|
1313
1368
|
static onFlushComplete(cb: (succeededTags: string[]) => void): void;
|
|
1314
1369
|
static onNetworkError(cb: (item: IQueuedOperation) => void): void;
|
|
1370
|
+
static onError(cb: (error: Error) => void): void;
|
|
1371
|
+
static onQueueFatalError(cb: (error: Error) => void): void;
|
|
1315
1372
|
/**
|
|
1316
1373
|
* Add an operation to the pending queue and persist it.
|
|
1317
1374
|
* Called internally by RequestProvider when queue: true.
|
|
@@ -1531,6 +1588,20 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
1531
1588
|
*/
|
|
1532
1589
|
[Symbol.dispose](): void;
|
|
1533
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;
|
|
1534
1605
|
/**
|
|
1535
1606
|
* Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
|
|
1536
1607
|
* Implemented by concrete cryptographic providers.
|
|
@@ -1654,7 +1725,7 @@ declare class CKeyManager {
|
|
|
1654
1725
|
* Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
|
|
1655
1726
|
* Designed for multi-user table and field-level encryption.
|
|
1656
1727
|
*/
|
|
1657
|
-
static generateAccountDataKey(length?: 128 | 192 | 256): Promise<CryptoKey>;
|
|
1728
|
+
static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
|
|
1658
1729
|
/**
|
|
1659
1730
|
* Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
|
|
1660
1731
|
* Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
|
|
@@ -1664,7 +1735,7 @@ declare class CKeyManager {
|
|
|
1664
1735
|
* Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
|
|
1665
1736
|
* Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
|
|
1666
1737
|
*/
|
|
1667
|
-
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any): Promise<CryptoKey>;
|
|
1738
|
+
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
|
|
1668
1739
|
/**
|
|
1669
1740
|
* Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
|
|
1670
1741
|
* Returns the derived CryptoKey and the base64-encoded salt.
|
|
@@ -1758,6 +1829,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
|
|
|
1758
1829
|
private _cachedKdf?;
|
|
1759
1830
|
private _cachedIter?;
|
|
1760
1831
|
private _cachedHash?;
|
|
1832
|
+
private _cachedKeyId?;
|
|
1761
1833
|
private _configuredKid?;
|
|
1762
1834
|
private _kdfOptions?;
|
|
1763
1835
|
private _decryptSaltCache;
|
|
@@ -1938,6 +2010,7 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
1938
2010
|
private _cachedKdf?;
|
|
1939
2011
|
private _cachedIter?;
|
|
1940
2012
|
private _cachedHash?;
|
|
2013
|
+
private _cachedKeyId?;
|
|
1941
2014
|
private _configuredKid?;
|
|
1942
2015
|
setDefaultKey(key: TKeyProvider): void;
|
|
1943
2016
|
clearKeys(): void;
|
|
@@ -2034,11 +2107,17 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
|
|
|
2034
2107
|
* cross-tenant cache collisions and avoid storing secrets in heap Map keys.
|
|
2035
2108
|
*/
|
|
2036
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;
|
|
2037
2116
|
|
|
2038
2117
|
/**
|
|
2039
2118
|
* Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
|
|
2040
2119
|
*/
|
|
2041
2120
|
declare function isEncrypted(payload: any): boolean;
|
|
2042
2121
|
|
|
2043
|
-
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 };
|
|
2044
|
-
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 {
|
|
@@ -1055,8 +1080,18 @@ declare class CCookieCache extends ACacheProvider {
|
|
|
1055
1080
|
private static instance;
|
|
1056
1081
|
static getInstance(): CCookieCache;
|
|
1057
1082
|
type: string;
|
|
1058
|
-
|
|
1083
|
+
sameSite: 'strict' | 'lax' | 'none';
|
|
1084
|
+
secure: boolean | undefined;
|
|
1085
|
+
httpOnly: boolean;
|
|
1086
|
+
path: string;
|
|
1087
|
+
constructor(options?: ICookieCacheOptions);
|
|
1088
|
+
configure(options: ICookieCacheOptions): void;
|
|
1059
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;
|
|
1060
1095
|
private parseKeyFromCookieName;
|
|
1061
1096
|
private isClient;
|
|
1062
1097
|
getKeyList(context?: any): Promise<Array<string>>;
|
|
@@ -1267,6 +1302,7 @@ declare const SENSITIVE_HEADER_KEYS: string[];
|
|
|
1267
1302
|
* RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
|
|
1268
1303
|
* RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
|
|
1269
1304
|
* RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
|
|
1305
|
+
* RequestQueue.onError((err) => toast.error(`Queue error: ${err.message}`))
|
|
1270
1306
|
*
|
|
1271
1307
|
* // Flush when back online
|
|
1272
1308
|
* window.addEventListener('online', () => RequestQueue.flushAll())
|
|
@@ -1281,6 +1317,24 @@ declare class RequestQueue {
|
|
|
1281
1317
|
static setMaxPayloadSize(bytes: number): void;
|
|
1282
1318
|
static setMaxQueueSize(limit: number): void;
|
|
1283
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;
|
|
1284
1338
|
/**
|
|
1285
1339
|
* Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
|
|
1286
1340
|
* request options to persistent storage (IndexedDB / LocalStorage).
|
|
@@ -1297,6 +1351,7 @@ declare class RequestQueue {
|
|
|
1297
1351
|
private static _onDeadLetter;
|
|
1298
1352
|
private static _onFlushComplete;
|
|
1299
1353
|
private static _onNetworkError;
|
|
1354
|
+
private static _onError;
|
|
1300
1355
|
private static _headerProvider;
|
|
1301
1356
|
static setHeaderProvider(provider: (() => Record<string, string> | Promise<Record<string, string>>) | null): void;
|
|
1302
1357
|
/**
|
|
@@ -1312,6 +1367,8 @@ declare class RequestQueue {
|
|
|
1312
1367
|
static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
|
|
1313
1368
|
static onFlushComplete(cb: (succeededTags: string[]) => void): void;
|
|
1314
1369
|
static onNetworkError(cb: (item: IQueuedOperation) => void): void;
|
|
1370
|
+
static onError(cb: (error: Error) => void): void;
|
|
1371
|
+
static onQueueFatalError(cb: (error: Error) => void): void;
|
|
1315
1372
|
/**
|
|
1316
1373
|
* Add an operation to the pending queue and persist it.
|
|
1317
1374
|
* Called internally by RequestProvider when queue: true.
|
|
@@ -1531,6 +1588,20 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
1531
1588
|
*/
|
|
1532
1589
|
[Symbol.dispose](): void;
|
|
1533
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;
|
|
1534
1605
|
/**
|
|
1535
1606
|
* Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
|
|
1536
1607
|
* Implemented by concrete cryptographic providers.
|
|
@@ -1654,7 +1725,7 @@ declare class CKeyManager {
|
|
|
1654
1725
|
* Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
|
|
1655
1726
|
* Designed for multi-user table and field-level encryption.
|
|
1656
1727
|
*/
|
|
1657
|
-
static generateAccountDataKey(length?: 128 | 192 | 256): Promise<CryptoKey>;
|
|
1728
|
+
static generateAccountDataKey(length?: 128 | 192 | 256, extractable?: boolean): Promise<CryptoKey>;
|
|
1658
1729
|
/**
|
|
1659
1730
|
* Wraps an Account Data Encryption Key (ADEK) for a specific user using the user's public key (RSA-OAEP).
|
|
1660
1731
|
* Returns a Base64-encoded wrapped key string suitable for storage in role-map / access tables.
|
|
@@ -1664,7 +1735,7 @@ declare class CKeyManager {
|
|
|
1664
1735
|
* Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
|
|
1665
1736
|
* Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
|
|
1666
1737
|
*/
|
|
1667
|
-
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any): Promise<CryptoKey>;
|
|
1738
|
+
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
|
|
1668
1739
|
/**
|
|
1669
1740
|
* Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
|
|
1670
1741
|
* Returns the derived CryptoKey and the base64-encoded salt.
|
|
@@ -1758,6 +1829,7 @@ declare class CWebCryptoAESCBCProvider extends AEncryptionProvider {
|
|
|
1758
1829
|
private _cachedKdf?;
|
|
1759
1830
|
private _cachedIter?;
|
|
1760
1831
|
private _cachedHash?;
|
|
1832
|
+
private _cachedKeyId?;
|
|
1761
1833
|
private _configuredKid?;
|
|
1762
1834
|
private _kdfOptions?;
|
|
1763
1835
|
private _decryptSaltCache;
|
|
@@ -1938,6 +2010,7 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
1938
2010
|
private _cachedKdf?;
|
|
1939
2011
|
private _cachedIter?;
|
|
1940
2012
|
private _cachedHash?;
|
|
2013
|
+
private _cachedKeyId?;
|
|
1941
2014
|
private _configuredKid?;
|
|
1942
2015
|
setDefaultKey(key: TKeyProvider): void;
|
|
1943
2016
|
clearKeys(): void;
|
|
@@ -2034,11 +2107,17 @@ declare function getSafeKeyIdentifier(rawKey: any): string;
|
|
|
2034
2107
|
* cross-tenant cache collisions and avoid storing secrets in heap Map keys.
|
|
2035
2108
|
*/
|
|
2036
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;
|
|
2037
2116
|
|
|
2038
2117
|
/**
|
|
2039
2118
|
* Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
|
|
2040
2119
|
*/
|
|
2041
2120
|
declare function isEncrypted(payload: any): boolean;
|
|
2042
2121
|
|
|
2043
|
-
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 };
|
|
2044
|
-
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 };
|