@katlux/providers 0.1.1-alpha.126 → 0.1.1-alpha.127
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 +1031 -164
- package/dist/index.d.cts +242 -17
- package/dist/index.d.mts +242 -17
- package/dist/index.d.ts +242 -17
- package/dist/index.mjs +1030 -165
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -17,6 +17,14 @@ interface IEncryptedPayload {
|
|
|
17
17
|
}
|
|
18
18
|
type TRawKey = string | CryptoKey | Uint8Array | ArrayBuffer;
|
|
19
19
|
type TKeyProvider = TRawKey | (() => TRawKey | Promise<TRawKey>);
|
|
20
|
+
interface IDecryptErrorInfo {
|
|
21
|
+
record: any;
|
|
22
|
+
field: string;
|
|
23
|
+
value: any;
|
|
24
|
+
error: Error;
|
|
25
|
+
index?: number;
|
|
26
|
+
}
|
|
27
|
+
declare const DECRYPT_ERROR_SENTINEL: unique symbol;
|
|
20
28
|
interface IEncryptionContext {
|
|
21
29
|
url?: string;
|
|
22
30
|
method?: string;
|
|
@@ -25,12 +33,39 @@ interface IEncryptionContext {
|
|
|
25
33
|
bindRequestContextAad?: boolean;
|
|
26
34
|
/** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
|
|
27
35
|
fields?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Enforces strict encryption validation. When true:
|
|
38
|
+
* 1. Any field in `fields` that is NOT an encrypted envelope triggers a decryption error.
|
|
39
|
+
* 2. Envelope algorithm MUST match `allowedAlgorithms` (defaults to ['AES-GCM']).
|
|
40
|
+
* 3. Envelope `kid` (if present) MUST match `allowedKids`.
|
|
41
|
+
*/
|
|
42
|
+
strict?: boolean;
|
|
43
|
+
/** Whitelist of permitted cryptographic algorithms (e.g. ['AES-GCM']). Defaults to ['AES-GCM'] in strict mode. */
|
|
44
|
+
allowedAlgorithms?: string[];
|
|
45
|
+
/** Whitelist of allowed Key Identifiers (kid). */
|
|
46
|
+
allowedKids?: string[];
|
|
47
|
+
/** Built-in Keyring dictionary mapping Key Identifiers (kid) to keys or key provider functions */
|
|
48
|
+
keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
49
|
+
/** Active key identifier from `keys` to use for all outbound encryption operations */
|
|
50
|
+
activeKid?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Hook invoked whenever decryption fails for an individual field or row.
|
|
53
|
+
* Can return a fallback cell value (e.g. sentinel or marker), or string/boolean.
|
|
54
|
+
*/
|
|
55
|
+
onDecryptError?: ((info: IDecryptErrorInfo) => any) | boolean | string;
|
|
28
56
|
key?: TKeyProvider | IKeyPair;
|
|
29
57
|
/** Optional Key Identifier for multi-role key routing and rotation */
|
|
30
58
|
kid?: string;
|
|
31
59
|
keyId?: string;
|
|
32
|
-
/**
|
|
33
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping.
|
|
62
|
+
* Can be static string/buffer or dynamic callback evaluated per record and field.
|
|
63
|
+
*/
|
|
64
|
+
aad?: string | Uint8Array | ArrayBuffer | ((record: any, field: string) => string | Uint8Array | ArrayBuffer);
|
|
65
|
+
/** Sibling record fields to deterministically bind into AEAD additional data (e.g. ['contact_id', 'version']) */
|
|
66
|
+
aadFields?: string[];
|
|
67
|
+
/** Optional base AAD prefix when aadFields or dynamic aad is enabled */
|
|
68
|
+
baseAad?: string;
|
|
34
69
|
/** Internal flag indicating that key derivation has already been warmed for this batch */
|
|
35
70
|
_warmedKey?: any;
|
|
36
71
|
/** Whether to encrypt/decrypt individual values while preserving JSON keys (default: true) */
|
|
@@ -52,6 +87,10 @@ interface IEncryptionProvider {
|
|
|
52
87
|
warmupKey?(options?: IEncryptionContext): Promise<void>;
|
|
53
88
|
isEncrypted?(payload: any): boolean;
|
|
54
89
|
setDefaultKey?(key: TKeyProvider | IKeyPair): void;
|
|
90
|
+
setKeyring?(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
|
|
91
|
+
getKeyring?(): Record<string, TKeyProvider | IKeyPair> | undefined;
|
|
92
|
+
setActiveKid?(kid: string): void;
|
|
93
|
+
getActiveKid?(): string | undefined;
|
|
55
94
|
clearKeys?(): void;
|
|
56
95
|
dispose?(): void;
|
|
57
96
|
[Symbol.dispose]?(): void;
|
|
@@ -62,11 +101,22 @@ interface IProviderEncryptionOptions {
|
|
|
62
101
|
enabled?: boolean;
|
|
63
102
|
/** Secret key, passphrase, CryptoKey, key pair, or async key provider function */
|
|
64
103
|
key?: TKeyProvider | IKeyPair;
|
|
104
|
+
/** Built-in Keyring dictionary mapping Key Identifiers (kid) to keys or key provider functions */
|
|
105
|
+
keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
106
|
+
/** Active key identifier from `keys` to use for all outbound encryption operations */
|
|
107
|
+
activeKid?: string;
|
|
65
108
|
/** Optional Key Identifier for multi-role key routing and key rotation */
|
|
66
109
|
kid?: string;
|
|
67
110
|
keyId?: string;
|
|
68
|
-
/**
|
|
69
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Authenticated Additional Data (AAD) bound to the ciphertext to prevent field/record swapping.
|
|
113
|
+
* Can be static string/buffer or dynamic callback evaluated per record and field.
|
|
114
|
+
*/
|
|
115
|
+
aad?: string | Uint8Array | ArrayBuffer | ((record: any, field: string) => string | Uint8Array | ArrayBuffer);
|
|
116
|
+
/** Sibling record fields to deterministically bind into AEAD additional data (e.g. ['contact_id', 'version']) */
|
|
117
|
+
aadFields?: string[];
|
|
118
|
+
/** Optional base AAD prefix when aadFields or dynamic aad is enabled */
|
|
119
|
+
baseAad?: string;
|
|
70
120
|
/**
|
|
71
121
|
* Whether to bind the request context (HTTP method and URL as `req:${method}:${url}`) into AEAD Authenticated Additional Data (AAD).
|
|
72
122
|
* Defaults to true when URL or method is provided in context, mitigating replay and cross-endpoint confusion attacks (BUG-015).
|
|
@@ -85,6 +135,22 @@ interface IProviderEncryptionOptions {
|
|
|
85
135
|
lazy?: boolean;
|
|
86
136
|
/** Whitelist of specific field names to encrypt/decrypt (e.g. ['name', 'surname']). Any unlisted field remains plaintext. */
|
|
87
137
|
fields?: string[];
|
|
138
|
+
/**
|
|
139
|
+
* Enforces strict encryption validation. When true:
|
|
140
|
+
* 1. Any field in `fields` that is NOT an encrypted envelope triggers a decryption error.
|
|
141
|
+
* 2. Envelope algorithm MUST match `allowedAlgorithms` (defaults to ['AES-GCM']).
|
|
142
|
+
* 3. Envelope `kid` (if present) MUST match `allowedKids`.
|
|
143
|
+
*/
|
|
144
|
+
strict?: boolean;
|
|
145
|
+
/** Whitelist of permitted cryptographic algorithms (e.g. ['AES-GCM']). Defaults to ['AES-GCM'] in strict mode. */
|
|
146
|
+
allowedAlgorithms?: string[];
|
|
147
|
+
/** Whitelist of allowed Key Identifiers (kid). */
|
|
148
|
+
allowedKids?: string[];
|
|
149
|
+
/**
|
|
150
|
+
* Hook invoked whenever decryption fails for an individual field or row.
|
|
151
|
+
* Can return a fallback cell value (e.g. sentinel or marker), or string/boolean.
|
|
152
|
+
*/
|
|
153
|
+
onDecryptError?: ((info: IDecryptErrorInfo) => any) | boolean | string;
|
|
88
154
|
/** Enable HMAC-SHA256 blind indexing and trigram search index on encrypted fields for local DataProviders */
|
|
89
155
|
searchIndex?: boolean;
|
|
90
156
|
/** Optional dedicated HMAC key for search indexing (defaults to encryption key if omitted) */
|
|
@@ -157,6 +223,56 @@ interface IHKDFFromSecretOptions {
|
|
|
157
223
|
keyLength?: 128 | 256;
|
|
158
224
|
extractable?: boolean;
|
|
159
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Structured organization access grant for role-based key sharing.
|
|
228
|
+
*/
|
|
229
|
+
interface IAccessGrant {
|
|
230
|
+
grantId: string;
|
|
231
|
+
accountId: string;
|
|
232
|
+
granteeUserId: string;
|
|
233
|
+
granterUserId: string;
|
|
234
|
+
wrappedKey: string;
|
|
235
|
+
expiresAt?: number;
|
|
236
|
+
permissions?: string[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Digitally signed access grant container with granter key fingerprint.
|
|
240
|
+
*/
|
|
241
|
+
interface ISignedGrant {
|
|
242
|
+
grant: IAccessGrant;
|
|
243
|
+
signature: string;
|
|
244
|
+
fingerprint: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Options for verifying access grant validity.
|
|
248
|
+
*/
|
|
249
|
+
interface IVerifyGrantOptions {
|
|
250
|
+
/** If true, checks whether grant.expiresAt is past the current timestamp */
|
|
251
|
+
checkExpiry?: boolean;
|
|
252
|
+
/** Optional reference timestamp for expiration checking (defaults to Date.now()) */
|
|
253
|
+
now?: number;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Result container for domain-separated key derivation.
|
|
257
|
+
*/
|
|
258
|
+
interface IDomainDerivedKeys {
|
|
259
|
+
authKey: CryptoKey;
|
|
260
|
+
encryptionKey: CryptoKey;
|
|
261
|
+
salt: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Configuration options for domain-separated key derivation.
|
|
265
|
+
*/
|
|
266
|
+
interface IDeriveAuthAndEncryptionOptions {
|
|
267
|
+
iterations?: number;
|
|
268
|
+
hash?: 'SHA-256' | 'SHA-512';
|
|
269
|
+
authKeyLength?: 128 | 256;
|
|
270
|
+
encryptionKeyLength?: 128 | 256;
|
|
271
|
+
authAlgorithm?: 'HMAC' | 'AES-GCM';
|
|
272
|
+
authInfo?: string;
|
|
273
|
+
encryptionInfo?: string;
|
|
274
|
+
extractable?: boolean;
|
|
275
|
+
}
|
|
160
276
|
|
|
161
277
|
/**
|
|
162
278
|
* types.ts — Framework-agnostic hydration and platform abstraction contracts.
|
|
@@ -1544,7 +1660,15 @@ declare function onPlatformReady(cb: () => void): void;
|
|
|
1544
1660
|
*/
|
|
1545
1661
|
declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
1546
1662
|
protected defaultKey?: TKeyProvider | IKeyPair;
|
|
1547
|
-
|
|
1663
|
+
protected keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
1664
|
+
protected activeKid?: string;
|
|
1665
|
+
protected allowedKids?: string[];
|
|
1666
|
+
constructor(key?: TKeyProvider | IKeyPair, options?: {
|
|
1667
|
+
keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
1668
|
+
activeKid?: string;
|
|
1669
|
+
allowedKids?: string[];
|
|
1670
|
+
[key: string]: any;
|
|
1671
|
+
});
|
|
1548
1672
|
/**
|
|
1549
1673
|
* Sets or updates the default secret key, CryptoKey, or async key provider function.
|
|
1550
1674
|
*/
|
|
@@ -1553,6 +1677,22 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
1553
1677
|
* Retrieves the currently configured default key or key provider callback.
|
|
1554
1678
|
*/
|
|
1555
1679
|
getDefaultKey(): TKeyProvider | IKeyPair | undefined;
|
|
1680
|
+
/**
|
|
1681
|
+
* Configures a keyring dictionary of keys with an optional active key identifier.
|
|
1682
|
+
*/
|
|
1683
|
+
setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void;
|
|
1684
|
+
/**
|
|
1685
|
+
* Retrieves the currently configured keyring dictionary.
|
|
1686
|
+
*/
|
|
1687
|
+
getKeyring(): Record<string, TKeyProvider | IKeyPair> | undefined;
|
|
1688
|
+
/**
|
|
1689
|
+
* Sets the active Key Identifier (kid) to use for outbound encryption.
|
|
1690
|
+
*/
|
|
1691
|
+
setActiveKid(kid: string): void;
|
|
1692
|
+
/**
|
|
1693
|
+
* Retrieves the active Key Identifier (kid).
|
|
1694
|
+
*/
|
|
1695
|
+
getActiveKid(): string | undefined;
|
|
1556
1696
|
/**
|
|
1557
1697
|
* Pre-derives and caches the native CryptoKey for subsequent cryptographic operations.
|
|
1558
1698
|
* Subclasses should override this with a dedicated, non-side-effecting implementation.
|
|
@@ -1593,10 +1733,33 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
1593
1733
|
*/
|
|
1594
1734
|
protected _resolveEffectiveAad(options?: IEncryptionContext, isDecrypt?: boolean): string | Uint8Array | ArrayBuffer | undefined;
|
|
1595
1735
|
/**
|
|
1596
|
-
* Helper to deterministically bind record ID
|
|
1597
|
-
* to prevent ciphertext swapping
|
|
1736
|
+
* Helper to deterministically bind record ID, contextual sibling fields (aadFields),
|
|
1737
|
+
* dynamic AAD callbacks, and field name into the AAD to prevent ciphertext swapping
|
|
1738
|
+
* between fields, records, or parent entities.
|
|
1598
1739
|
*/
|
|
1599
1740
|
protected _bindFieldAad(data: any, field: string, options?: IEncryptionContext): IEncryptionContext;
|
|
1741
|
+
/**
|
|
1742
|
+
* Validates envelope metadata against algorithm whitelists and key identifiers (kid).
|
|
1743
|
+
* In strict mode, allowedAlgorithms defaults to ['AES-GCM'].
|
|
1744
|
+
*/
|
|
1745
|
+
protected _validateEnvelopeMetadata(payload: any, options?: IEncryptionContext): Error | undefined;
|
|
1746
|
+
/**
|
|
1747
|
+
* Normalizes encryption options with active keyring parameters:
|
|
1748
|
+
* If `keys` and `activeKid` are configured, selects `key = keys[activeKid]` and sets `kid = activeKid`.
|
|
1749
|
+
*/
|
|
1750
|
+
protected _resolveOutboundKeyringOptions(options?: IEncryptionContext): IEncryptionContext;
|
|
1751
|
+
/**
|
|
1752
|
+
* Resolves the appropriate decryption key for a specific payload envelope based on its `kid`
|
|
1753
|
+
* and the configured keyring (`keys`, `activeKid`, or fallback `key`).
|
|
1754
|
+
*/
|
|
1755
|
+
protected _resolveDecryptionKeyForEnvelope(payload: any, options?: IEncryptionContext): TKeyProvider | IKeyPair | undefined;
|
|
1756
|
+
/**
|
|
1757
|
+
* Handles a per-field or per-payload decryption error according to configured options:
|
|
1758
|
+
* - Invokes onDecryptError callback if provided
|
|
1759
|
+
* - Attaches error metadata (__decryptErrors) to the record object
|
|
1760
|
+
* - Returns fallback cell placeholder ('[⚠ Decryption Error]') or rethrows
|
|
1761
|
+
*/
|
|
1762
|
+
protected _handleDecryptError(err: Error, record: any, field: string, value: any, index: number | undefined, options?: IEncryptionContext): any;
|
|
1600
1763
|
/**
|
|
1601
1764
|
* Encrypts a single value (string, object, primitive) into an IEncryptedPayload envelope.
|
|
1602
1765
|
* Implemented by concrete cryptographic providers.
|
|
@@ -1619,16 +1782,13 @@ declare abstract class AEncryptionProvider implements IEncryptionProvider {
|
|
|
1619
1782
|
/**
|
|
1620
1783
|
* Top-level polymorphic decryption method.
|
|
1621
1784
|
* Automatically performs value-level decryption:
|
|
1622
|
-
* - If payload is an encrypted envelope: decrypts directly via decryptValue.
|
|
1623
|
-
* - If payload is an array of objects: decrypts each row.
|
|
1624
|
-
* - If payload is an object: decrypts any encrypted value cells across fields.
|
|
1625
|
-
*/
|
|
1626
|
-
/**
|
|
1627
|
-
* Top-level polymorphic decryption method.
|
|
1628
|
-
* Automatically performs value-level decryption:
|
|
1629
|
-
* - If payload is an encrypted envelope: decrypts directly via decryptValue.
|
|
1785
|
+
* - If payload is an encrypted envelope: validates metadata and decrypts directly via decryptValue.
|
|
1630
1786
|
* - If payload is an array of objects: decrypts each row (batched with local memoization).
|
|
1631
1787
|
* - If payload is an object: decrypts any encrypted value cells across fields.
|
|
1788
|
+
* In strict mode:
|
|
1789
|
+
* - Unencrypted plaintext in configured `fields` triggers a decryption error.
|
|
1790
|
+
* - Envelopes are validated against `allowedAlgorithms` and `allowedKids`.
|
|
1791
|
+
* - Errors are routed through `onDecryptError` or populated into `__decryptErrors`.
|
|
1632
1792
|
*/
|
|
1633
1793
|
decrypt(payload: any, options?: IEncryptionContext): Promise<any>;
|
|
1634
1794
|
}
|
|
@@ -1738,6 +1898,16 @@ declare class CKeyManager {
|
|
|
1738
1898
|
* Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
|
|
1739
1899
|
*/
|
|
1740
1900
|
static unwrapAccountKeyForUser(wrappedKeyBase64: string, userPrivateKey: CryptoKey, unwrappedKeyAlgorithm?: any, extractable?: boolean): Promise<CryptoKey>;
|
|
1901
|
+
/**
|
|
1902
|
+
* Atomically re-wraps an Account Data Encryption Key (ADEK) for a new recipient
|
|
1903
|
+
* without exposing the raw extractable symmetric key to caller application code.
|
|
1904
|
+
*
|
|
1905
|
+
* @param wrappedKeyBase64 - The existing ADEK envelope wrapped with current user's public key
|
|
1906
|
+
* @param myPrivateKey - Current user's RSA-OAEP private key
|
|
1907
|
+
* @param recipientPublicKey - New recipient's RSA-OAEP public key
|
|
1908
|
+
* @returns Base64-encoded wrapped key envelope for the recipient
|
|
1909
|
+
*/
|
|
1910
|
+
static rewrapAccountKeyForUser(wrappedKeyBase64: string, myPrivateKey: CryptoKey, recipientPublicKey: CryptoKey): Promise<string>;
|
|
1741
1911
|
/**
|
|
1742
1912
|
* Derives a symmetric AES-GCM CryptoKey from a passphrase using PBKDF2 or HKDF.
|
|
1743
1913
|
* Returns the derived CryptoKey and the base64-encoded salt.
|
|
@@ -1751,6 +1921,46 @@ declare class CKeyManager {
|
|
|
1751
1921
|
* using HKDF.
|
|
1752
1922
|
*/
|
|
1753
1923
|
static deriveKeyFromSecret(secretKey: CryptoKey, options?: IHKDFFromSecretOptions): Promise<CryptoKey>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Derives two domain-separated, cryptographically isolated keys from a user password and salt:
|
|
1926
|
+
* 1. `authKey`: For client authentication, SRP, or server challenge proofs.
|
|
1927
|
+
* 2. `encryptionKey`: For AES-GCM local and field-level data encryption.
|
|
1928
|
+
*
|
|
1929
|
+
* Stage 1 (Password Stretching): PBKDF2-HMAC-SHA256 stretches low-entropy password into master secret.
|
|
1930
|
+
* Stage 2 (Domain Expansion): HKDF-Expand derives subkeys using domain-separated context info tags.
|
|
1931
|
+
* Immediate memory zeroization of intermediate master secret buffer is guaranteed.
|
|
1932
|
+
*
|
|
1933
|
+
* @param password - Master user password or passphrase
|
|
1934
|
+
* @param salt - Salt (or omitted to generate a secure random 16-byte salt)
|
|
1935
|
+
* @param options - PBKDF2 and HKDF configuration options
|
|
1936
|
+
*/
|
|
1937
|
+
static deriveAuthAndEncryptionKeys(password: string | Uint8Array | ArrayBuffer, salt?: Uint8Array | ArrayBuffer | string, options?: IDeriveAuthAndEncryptionOptions): Promise<IDomainDerivedKeys>;
|
|
1938
|
+
/**
|
|
1939
|
+
* Generates an ECDSA P-256 signing key pair.
|
|
1940
|
+
*/
|
|
1941
|
+
static generateSigningKeyPair(curve?: 'P-256' | 'P-384' | 'P-521', extractable?: boolean): Promise<IKeyPair>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Generates a deterministic SHA-256 fingerprint for a public key (SPKI or raw).
|
|
1944
|
+
* Formatted as `SHA256:<base64url>`.
|
|
1945
|
+
*/
|
|
1946
|
+
static getKeyFingerprint(publicKey: CryptoKey | Uint8Array | ArrayBuffer | string): Promise<string>;
|
|
1947
|
+
/**
|
|
1948
|
+
* Signs arbitrary data or JSON objects using an ECDSA P-256 private key.
|
|
1949
|
+
* Objects are automatically serialized via canonicalizeJson() before hashing.
|
|
1950
|
+
*/
|
|
1951
|
+
static sign(data: any | string | Uint8Array, privateKey: CryptoKey): Promise<string>;
|
|
1952
|
+
/**
|
|
1953
|
+
* Verifies an ECDSA P-256 signature against original data or JSON object.
|
|
1954
|
+
*/
|
|
1955
|
+
static verify(data: any | string | Uint8Array, signature: string, publicKey: CryptoKey): Promise<boolean>;
|
|
1956
|
+
/**
|
|
1957
|
+
* Signs a structured access grant, embedding signature and granter key fingerprint.
|
|
1958
|
+
*/
|
|
1959
|
+
static signGrant(grant: IAccessGrant, granterPrivateKey: CryptoKey, granterPublicKey?: CryptoKey): Promise<ISignedGrant>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Verifies the authenticity and integrity of a signed access grant against granter public key.
|
|
1962
|
+
*/
|
|
1963
|
+
static verifyGrant(signedGrant: ISignedGrant, granterPublicKey: CryptoKey, options?: IVerifyGrantOptions): Promise<boolean>;
|
|
1754
1964
|
}
|
|
1755
1965
|
|
|
1756
1966
|
interface ICWebCryptoOptions {
|
|
@@ -1761,6 +1971,9 @@ interface ICWebCryptoOptions {
|
|
|
1761
1971
|
info?: string | Uint8Array | ArrayBuffer;
|
|
1762
1972
|
kid?: string;
|
|
1763
1973
|
keyId?: string;
|
|
1974
|
+
keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
1975
|
+
activeKid?: string;
|
|
1976
|
+
allowedKids?: string[];
|
|
1764
1977
|
}
|
|
1765
1978
|
/**
|
|
1766
1979
|
* Zero-dependency AES-256-GCM cipher provider using native Web Crypto API (crypto.subtle).
|
|
@@ -1784,6 +1997,7 @@ declare class CWebCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
1784
1997
|
private _cachedKeyId?;
|
|
1785
1998
|
private _configuredKid?;
|
|
1786
1999
|
private _decryptSaltCache;
|
|
2000
|
+
private _keyringCache;
|
|
1787
2001
|
setDefaultKey(key: TKeyProvider): void;
|
|
1788
2002
|
clearKeys(): void;
|
|
1789
2003
|
constructor(key?: TKeyProvider | IKeyPair, options?: ICWebCryptoOptions);
|
|
@@ -1993,6 +2207,9 @@ interface ICNodeCryptoOptions {
|
|
|
1993
2207
|
info?: string | Uint8Array | ArrayBuffer;
|
|
1994
2208
|
kid?: string;
|
|
1995
2209
|
keyId?: string;
|
|
2210
|
+
keys?: Record<string, TKeyProvider | IKeyPair>;
|
|
2211
|
+
activeKid?: string;
|
|
2212
|
+
allowedKids?: string[];
|
|
1996
2213
|
}
|
|
1997
2214
|
/**
|
|
1998
2215
|
* Server-side synchronous AES-GCM-256 encryption provider using Node.js native `node:crypto`.
|
|
@@ -2014,6 +2231,8 @@ declare class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
|
|
|
2014
2231
|
private _cachedHash?;
|
|
2015
2232
|
private _cachedKeyId?;
|
|
2016
2233
|
private _configuredKid?;
|
|
2234
|
+
private _keyringCache;
|
|
2235
|
+
private isKeyRetained;
|
|
2017
2236
|
setDefaultKey(key: TKeyProvider): void;
|
|
2018
2237
|
clearKeys(): void;
|
|
2019
2238
|
warmupKey(options?: IEncryptionContext): Promise<void>;
|
|
@@ -2115,11 +2334,17 @@ declare function getKeyIdentifier(keyProvider?: any, defaultKey?: any): string;
|
|
|
2115
2334
|
* Conforms to W3C Web Cryptography API specification (OperationError) and Node.js crypto error codes.
|
|
2116
2335
|
*/
|
|
2117
2336
|
declare function isAuthOrDecryptionError(err: any): boolean;
|
|
2337
|
+
/**
|
|
2338
|
+
* Serializes a JavaScript value to a deterministic, canonical JSON string conforming to RFC 8785 (JCS).
|
|
2339
|
+
* Guarantees consistent property sorting by UTF-16 code units, omission of undefined/symbol/function values,
|
|
2340
|
+
* standard ECMAScript number formatting (-0 serialized as 0), and detection of circular references.
|
|
2341
|
+
*/
|
|
2342
|
+
declare function canonicalizeJson(value: any, seen?: Set<any>): string;
|
|
2118
2343
|
|
|
2119
2344
|
/**
|
|
2120
2345
|
* Universal helper that verifies whether an arbitrary object is a Katlux encrypted payload envelope.
|
|
2121
2346
|
*/
|
|
2122
2347
|
declare function isEncrypted(payload: any): boolean;
|
|
2123
2348
|
|
|
2124
|
-
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 };
|
|
2125
|
-
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 };
|
|
2349
|
+
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, DECRYPT_ERROR_SENTINEL, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, canonicalizeJson, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, 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 };
|
|
2350
|
+
export type { CacheDriverLoader, IAccessGrant, ICNodeCryptoOptions, ICWebCryptoAESCBCOptions, ICWebCryptoOptions, ICacheEntry, ICacheQuotaOptions, ICookieCacheOptions, IDataFilter, IDataProviderOptions, IDataProviderSetStateOptions, IDataProviderState, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IDecryptErrorInfo, IDeriveAuthAndEncryptionOptions, IDomainDerivedKeys, IEncryptedPayload, IEncryptionContext, IEncryptionProvider, IFlushOptions, IHKDFFromSecretOptions, IKDFOptions, IKDatatableAction, IKeyPair, IPlatformRouter, IProviderEncryptionOptions, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ISearchIndexRowEntry, ISetDataChunkedOptions, ISignedGrant, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, IVerifyGrantOptions, IVirtualScrollState, IWrappedKey, KProductItemData, KProductRowAction, TDataProviderListener, TDataProviderStateChangeListener, TDataRow, TECDHCurve, TKatluxStore, TKeyProvider, TPageDataHandler, TQueueItemStatus, TRawKey, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
|