mitigator 1.0.0
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/LICENSE.md +15 -0
- package/README.md +355 -0
- package/dist/bin/mitigator-audit.cjs +187 -0
- package/dist/bin/mitigator-audit.cjs.map +1 -0
- package/dist/bin/mitigator-audit.d.cts +14 -0
- package/dist/bin/mitigator-audit.d.ts +14 -0
- package/dist/bin/mitigator-audit.js +135 -0
- package/dist/bin/mitigator-audit.js.map +1 -0
- package/dist/chunk-TT2DUALY.js +123 -0
- package/dist/chunk-TT2DUALY.js.map +1 -0
- package/dist/index.cjs +1643 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1116 -0
- package/dist/index.d.ts +1116 -0
- package/dist/index.js +1501 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1116 @@
|
|
|
1
|
+
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
2
|
+
import * as https from 'node:https';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Basic HTML escaping for common characters.
|
|
6
|
+
*/
|
|
7
|
+
declare const escapeHtml: (input: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Strips all HTML tags from a string.
|
|
10
|
+
*/
|
|
11
|
+
declare const stripTags: (input: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Standard allowlist for "clean" HTML sanitization.
|
|
14
|
+
*/
|
|
15
|
+
declare const ALLOWLIST: Record<string, string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Robust HTML sanitizer.
|
|
18
|
+
* Uses the industry-standard `sanitize-html` library.
|
|
19
|
+
*/
|
|
20
|
+
declare const sanitizeHtml: (html: string, rules?: Record<string, string[]>) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Defensive post-processor that namespaces 'id' and 'name' attributes to prevent DOM Clobbering attacks.
|
|
23
|
+
* Attackers use clobbering to overwrite global variables (window.foo) by naming an element 'id=foo'.
|
|
24
|
+
*
|
|
25
|
+
* @param html The HTML string to process.
|
|
26
|
+
* @param prefix The unique namespace prefix (default: sk-).
|
|
27
|
+
*/
|
|
28
|
+
declare const preventDOMClobbering: (html: string, prefix?: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Basic SVG & MathML sanitization.
|
|
31
|
+
*/
|
|
32
|
+
declare const sanitizeMediaTags: (html: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Validates if a string is a safe URL.
|
|
35
|
+
*/
|
|
36
|
+
declare const isSafeUrl: (url: string) => boolean;
|
|
37
|
+
|
|
38
|
+
declare const index$a_ALLOWLIST: typeof ALLOWLIST;
|
|
39
|
+
declare const index$a_escapeHtml: typeof escapeHtml;
|
|
40
|
+
declare const index$a_isSafeUrl: typeof isSafeUrl;
|
|
41
|
+
declare const index$a_preventDOMClobbering: typeof preventDOMClobbering;
|
|
42
|
+
declare const index$a_sanitizeHtml: typeof sanitizeHtml;
|
|
43
|
+
declare const index$a_sanitizeMediaTags: typeof sanitizeMediaTags;
|
|
44
|
+
declare const index$a_stripTags: typeof stripTags;
|
|
45
|
+
declare namespace index$a {
|
|
46
|
+
export { index$a_ALLOWLIST as ALLOWLIST, index$a_escapeHtml as escapeHtml, index$a_isSafeUrl as isSafeUrl, index$a_preventDOMClobbering as preventDOMClobbering, index$a_sanitizeHtml as sanitizeHtml, index$a_sanitizeMediaTags as sanitizeMediaTags, index$a_stripTags as stripTags };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Result returned by `checkPwnedPassword`.
|
|
51
|
+
* Always resolves (never rejects) to preserve fail-open availability semantics.
|
|
52
|
+
*/
|
|
53
|
+
interface CheckPwnedResult {
|
|
54
|
+
/** Number of times this password appeared in known data breaches. 0 if not found. */
|
|
55
|
+
count: number;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the HIBP API was reachable during this check.
|
|
58
|
+
* If `false`, the result is inconclusive — the password may or may not be compromised.
|
|
59
|
+
* Callers should treat `apiAvailable: false` as a signal to retry or log a warning.
|
|
60
|
+
*/
|
|
61
|
+
apiAvailable: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a password has been leaked in a data breach using the Have I Been Pwned (HIBP) API.
|
|
65
|
+
* Uses k-Anonymity (sending only the first 5 characters of the SHA-1 hash) to ensure
|
|
66
|
+
* the password is never exposed to the API.
|
|
67
|
+
*
|
|
68
|
+
* Always resolves — never rejects. If the API is unreachable, `apiAvailable` will be `false`
|
|
69
|
+
* and `count` will be `0` (inconclusive). Callers should check `apiAvailable` before
|
|
70
|
+
* treating a zero count as "password is clean".
|
|
71
|
+
*
|
|
72
|
+
* @param password The password to check.
|
|
73
|
+
* @returns {Promise<CheckPwnedResult>} Structured result with breach count and API availability.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* const { count, apiAvailable } = await checkPwnedPassword('hunter2');
|
|
77
|
+
* if (!apiAvailable) logger.warn('HIBP API unreachable — skipping pwned check');
|
|
78
|
+
* else if (count > 0) throw new Error('Password found in data breaches');
|
|
79
|
+
*/
|
|
80
|
+
declare const checkPwnedPassword: (password: string) => Promise<CheckPwnedResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Patterns for secrets.
|
|
83
|
+
*/
|
|
84
|
+
declare const SECRET_PATTERNS: RegExp[];
|
|
85
|
+
/**
|
|
86
|
+
* Scans for secrets.
|
|
87
|
+
*/
|
|
88
|
+
declare const scanForSecrets: (input: any) => boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Weak password check.
|
|
91
|
+
*/
|
|
92
|
+
declare const isWeakPassword: (password: string) => boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Schema types.
|
|
95
|
+
*/
|
|
96
|
+
type Schema = {
|
|
97
|
+
[key: string]: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Type validation.
|
|
101
|
+
*/
|
|
102
|
+
declare const isType: (val: any, type: Schema[keyof Schema]) => boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Schema enforcement.
|
|
105
|
+
*/
|
|
106
|
+
declare const enforceSchema: <T extends Record<string, any>>(data: any, schema: Schema) => T | null;
|
|
107
|
+
/**
|
|
108
|
+
* Email validation.
|
|
109
|
+
*/
|
|
110
|
+
declare const isEmail: (input: string) => boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Injection pattern detection (Heuristic).
|
|
113
|
+
* Detects common SQL, NoSQL, and Command Injection payloads.
|
|
114
|
+
*/
|
|
115
|
+
declare const hasInjectionPattern: (input: string) => boolean;
|
|
116
|
+
|
|
117
|
+
type index$9_CheckPwnedResult = CheckPwnedResult;
|
|
118
|
+
declare const index$9_SECRET_PATTERNS: typeof SECRET_PATTERNS;
|
|
119
|
+
type index$9_Schema = Schema;
|
|
120
|
+
declare const index$9_checkPwnedPassword: typeof checkPwnedPassword;
|
|
121
|
+
declare const index$9_enforceSchema: typeof enforceSchema;
|
|
122
|
+
declare const index$9_hasInjectionPattern: typeof hasInjectionPattern;
|
|
123
|
+
declare const index$9_isEmail: typeof isEmail;
|
|
124
|
+
declare const index$9_isType: typeof isType;
|
|
125
|
+
declare const index$9_isWeakPassword: typeof isWeakPassword;
|
|
126
|
+
declare const index$9_scanForSecrets: typeof scanForSecrets;
|
|
127
|
+
declare namespace index$9 {
|
|
128
|
+
export { type index$9_CheckPwnedResult as CheckPwnedResult, index$9_SECRET_PATTERNS as SECRET_PATTERNS, type index$9_Schema as Schema, index$9_checkPwnedPassword as checkPwnedPassword, index$9_enforceSchema as enforceSchema, index$9_hasInjectionPattern as hasInjectionPattern, index$9_isEmail as isEmail, index$9_isType as isType, index$9_isWeakPassword as isWeakPassword, index$9_scanForSecrets as scanForSecrets };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Standard security header presets.
|
|
133
|
+
*/
|
|
134
|
+
declare const standardHeaders: {
|
|
135
|
+
'Content-Security-Policy': string;
|
|
136
|
+
'X-Frame-Options': string;
|
|
137
|
+
'X-Content-Type-Options': string;
|
|
138
|
+
'Referrer-Policy': string;
|
|
139
|
+
'Strict-Transport-Security': string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* CSP Directive Map type.
|
|
143
|
+
*/
|
|
144
|
+
type CSPDirectives = {
|
|
145
|
+
'default-src'?: string[];
|
|
146
|
+
'script-src'?: string[];
|
|
147
|
+
'style-src'?: string[];
|
|
148
|
+
'img-src'?: string[];
|
|
149
|
+
'connect-src'?: string[];
|
|
150
|
+
'font-src'?: string[];
|
|
151
|
+
'object-src'?: string[];
|
|
152
|
+
'media-src'?: string[];
|
|
153
|
+
'frame-src'?: string[];
|
|
154
|
+
sandbox?: string[];
|
|
155
|
+
'report-uri'?: string[];
|
|
156
|
+
'child-src'?: string[];
|
|
157
|
+
'form-action'?: string[];
|
|
158
|
+
'frame-ancestors'?: string[];
|
|
159
|
+
'plugin-types'?: string[];
|
|
160
|
+
'base-uri'?: string[];
|
|
161
|
+
'report-to'?: string[];
|
|
162
|
+
'worker-src'?: string[];
|
|
163
|
+
'manifest-src'?: string[];
|
|
164
|
+
'prefetch-src'?: string[];
|
|
165
|
+
'navigate-to'?: string[];
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Generates a random nonce for CSP headers.
|
|
169
|
+
*/
|
|
170
|
+
declare const generateNonce: (length?: number) => string;
|
|
171
|
+
/**
|
|
172
|
+
* Builds a CSP string.
|
|
173
|
+
*/
|
|
174
|
+
declare const buildCSP: (directives: CSPDirectives, nonce?: string) => string;
|
|
175
|
+
/**
|
|
176
|
+
* Builds a 'Strict CSP' which is the industry gold standard.
|
|
177
|
+
* It uses 'strict-dynamic' and nonces, rendering 99.9% of XSS impossible.
|
|
178
|
+
*
|
|
179
|
+
* @param nonce The nonce generated for the current request.
|
|
180
|
+
* @returns {string} The formatted Strict CSP string.
|
|
181
|
+
*/
|
|
182
|
+
declare const buildStrictCSP: (nonce: string) => string;
|
|
183
|
+
/**
|
|
184
|
+
* Parses CSP violation report.
|
|
185
|
+
*/
|
|
186
|
+
declare const parseCSPReport: (reportBody: any) => {
|
|
187
|
+
documentUri: any;
|
|
188
|
+
referrer: any;
|
|
189
|
+
blockedUri: any;
|
|
190
|
+
violatedDirective: any;
|
|
191
|
+
originalPolicy: any;
|
|
192
|
+
disposition: any;
|
|
193
|
+
statusCode: any;
|
|
194
|
+
timestamp: string;
|
|
195
|
+
} | null;
|
|
196
|
+
/**
|
|
197
|
+
* Returns a secure-by-default CSP string.
|
|
198
|
+
*/
|
|
199
|
+
declare const secureCSP: string;
|
|
200
|
+
|
|
201
|
+
type index$8_CSPDirectives = CSPDirectives;
|
|
202
|
+
declare const index$8_buildCSP: typeof buildCSP;
|
|
203
|
+
declare const index$8_buildStrictCSP: typeof buildStrictCSP;
|
|
204
|
+
declare const index$8_generateNonce: typeof generateNonce;
|
|
205
|
+
declare const index$8_parseCSPReport: typeof parseCSPReport;
|
|
206
|
+
declare const index$8_secureCSP: typeof secureCSP;
|
|
207
|
+
declare const index$8_standardHeaders: typeof standardHeaders;
|
|
208
|
+
declare namespace index$8 {
|
|
209
|
+
export { type index$8_CSPDirectives as CSPDirectives, index$8_buildCSP as buildCSP, index$8_buildStrictCSP as buildStrictCSP, index$8_generateNonce as generateNonce, index$8_parseCSPReport as parseCSPReport, index$8_secureCSP as secureCSP, index$8_standardHeaders as standardHeaders };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Basic authentication helper.
|
|
214
|
+
*/
|
|
215
|
+
declare const basicAuth: (user: string, pass: string) => string;
|
|
216
|
+
/**
|
|
217
|
+
* Passkey / WebAuthn Core Helper to verify an authentication signature.
|
|
218
|
+
* Supports industry-standard RS256 and ES256 algorithms.
|
|
219
|
+
*
|
|
220
|
+
* @param challenge The challenge originally sent to the client.
|
|
221
|
+
* @param response Authenticatable data from the client (authenticatorData + clientDataJSON).
|
|
222
|
+
* @param signature The cryptographic signature from the WebAuthn response.
|
|
223
|
+
* @param publicKey The credential's public key (PEM format).
|
|
224
|
+
*/
|
|
225
|
+
declare const verifyPasskeySignature: (_challenge: string | Buffer$1, response: string | Buffer$1, signature: string | Buffer$1, publicKey: string, algorithm?: "sha256" | "sha512") => boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Heuristic Auth Advisor.
|
|
228
|
+
*/
|
|
229
|
+
declare const suggestMFA: (riskScore: number, lastFingerprint: string, currentFingerprint: string) => boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Generates a random HMAC-based challenge for a challenge-response authentication flow.
|
|
232
|
+
*
|
|
233
|
+
* The server generates a per-request challenge that is tied to a user-specific salt.
|
|
234
|
+
* The client proves knowledge of a shared secret by computing HMAC(challenge, secret)
|
|
235
|
+
* and returning the result. The server verifies it with `verifyHmacResponse`.
|
|
236
|
+
*
|
|
237
|
+
* Note: This is an HMAC challenge-response protocol, not a zero-knowledge proof (ZKP).
|
|
238
|
+
* A true ZKP would allow the client to prove knowledge of the secret without revealing
|
|
239
|
+
* it even to a compromised verifier. Use this for server-side mutual authentication only.
|
|
240
|
+
*
|
|
241
|
+
* @param userSalt - A per-user, per-session random salt to bind the challenge.
|
|
242
|
+
*/
|
|
243
|
+
declare const generateHmacChallenge: (userSalt: string) => string;
|
|
244
|
+
/**
|
|
245
|
+
* Verifies an HMAC challenge-response: checks that `proof === HMAC(challenge, secret)`
|
|
246
|
+
* using a timing-safe comparison to prevent timing attacks.
|
|
247
|
+
*
|
|
248
|
+
* @param challenge - The challenge string previously returned by `generateHmacChallenge`.
|
|
249
|
+
* @param proof - The response computed by the client: `HMAC-SHA256(secret, challenge)`.
|
|
250
|
+
* @param secret - The shared secret known to the server.
|
|
251
|
+
*/
|
|
252
|
+
declare const verifyHmacResponse: (challenge: string, proof: string, secret: string) => boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Honey-Token generation.
|
|
255
|
+
*/
|
|
256
|
+
declare const generateHoneyToken: (prefix?: string) => string;
|
|
257
|
+
declare const isHoneyToken: (token: string, prefix?: string) => boolean;
|
|
258
|
+
/**
|
|
259
|
+
* CSRF management.
|
|
260
|
+
*/
|
|
261
|
+
declare const generateCSRF: () => {
|
|
262
|
+
token: string;
|
|
263
|
+
cookieValue: string;
|
|
264
|
+
};
|
|
265
|
+
declare const verifyCSRF: (providedToken: string, cookieToken: string) => boolean;
|
|
266
|
+
/**
|
|
267
|
+
* JWT Validation.
|
|
268
|
+
* Verifies the structure, expiration, and cryptographic signature of the token.
|
|
269
|
+
*
|
|
270
|
+
* @param token The JWT string.
|
|
271
|
+
* @param secretOrPublicKey The secret (for HS256) or public key (for RS256) to verify the signature.
|
|
272
|
+
* @param algorithm Optional. The expected algorithm (e.g., 'HS256', 'RS256'). Defaults to 'HS256'.
|
|
273
|
+
*/
|
|
274
|
+
declare const isJwtValid: (token: string, secretOrPublicKey: string | Buffer$1, algorithm?: string) => boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Auth guards.
|
|
277
|
+
*/
|
|
278
|
+
declare const canAccess: <U, R>(user: U, resource: R, rule: (u: U, r: R) => boolean) => boolean;
|
|
279
|
+
declare const hasRole: (userRoles: string[], requiredRoles: string[]) => boolean;
|
|
280
|
+
declare const can: (userPermissions: string[], requiredPermission: string) => boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Generates a random base64url challenge for FIDO2 WebAuthn / Passkeys.
|
|
283
|
+
*/
|
|
284
|
+
declare const generatePasskeyChallenge: (length?: number) => string;
|
|
285
|
+
/**
|
|
286
|
+
* Interface representing the unpacked and verified result of a Passkey registration.
|
|
287
|
+
*/
|
|
288
|
+
interface PasskeyRegistrationResult {
|
|
289
|
+
verified: boolean;
|
|
290
|
+
error?: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Validates a Passkey registration response against the expected challenge and origin.
|
|
294
|
+
*
|
|
295
|
+
* Accepts `clientDataJSONStr` as either:
|
|
296
|
+
* - A raw UTF-8 JSON string (for testing/server-side construction)
|
|
297
|
+
* - A base64url-encoded JSON string (as browsers send in `response.clientDataJSON`)
|
|
298
|
+
*
|
|
299
|
+
* The challenge is compared at the byte level using `timingSafeEqual` after
|
|
300
|
+
* decoding both sides from base64url, per the WebAuthn Level 2 spec §7.1.
|
|
301
|
+
*/
|
|
302
|
+
declare const verifyPasskeyRegistration: (clientDataJSONStr: string, expectedChallenge: string, expectedOrigin?: string) => PasskeyRegistrationResult;
|
|
303
|
+
/**
|
|
304
|
+
* Parses WebAuthn raw authenticator data (authData) buffer to extract the
|
|
305
|
+
* aaguid, credential ID, and public key bytes according to the FIDO2 spec.
|
|
306
|
+
*/
|
|
307
|
+
declare const parseAuthenticatorData: (authData: Buffer$1) => {
|
|
308
|
+
rpIdHash: Buffer$1<ArrayBufferLike>;
|
|
309
|
+
flags: number;
|
|
310
|
+
signCount: number;
|
|
311
|
+
aaguid?: undefined;
|
|
312
|
+
credentialId?: undefined;
|
|
313
|
+
publicKeyBytes?: undefined;
|
|
314
|
+
} | {
|
|
315
|
+
rpIdHash: Buffer$1<ArrayBufferLike>;
|
|
316
|
+
flags: number;
|
|
317
|
+
signCount: number;
|
|
318
|
+
aaguid: Buffer$1<ArrayBufferLike>;
|
|
319
|
+
credentialId: string;
|
|
320
|
+
publicKeyBytes: string;
|
|
321
|
+
} | null;
|
|
322
|
+
/**
|
|
323
|
+
* Result returned by `verifyPasskeyAssertion`.
|
|
324
|
+
*/
|
|
325
|
+
interface PasskeyAssertionResult {
|
|
326
|
+
/** Whether the assertion passed all WebAuthn §7.2 checks. */
|
|
327
|
+
verified: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* The new signature counter value from the authenticator.
|
|
330
|
+
* Persist this value and pass it as `storedSignCount` on the next assertion to
|
|
331
|
+
* detect cloned authenticators (replay attack protection).
|
|
332
|
+
*/
|
|
333
|
+
newSignCount?: number;
|
|
334
|
+
/** Human-readable error message when `verified` is false. */
|
|
335
|
+
error?: string;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Verifies a FIDO2 WebAuthn assertion response (navigator.credentials.get flow).
|
|
339
|
+
*
|
|
340
|
+
* Implements WebAuthn Level 2 §7.2 — Verifying an Authentication Assertion.
|
|
341
|
+
*
|
|
342
|
+
* Checks performed (in order):
|
|
343
|
+
* 1. Parses `clientDataJSON` — accepts both raw JSON and browser base64url-encoded format.
|
|
344
|
+
* 2. Verifies `type === 'webauthn.get'`.
|
|
345
|
+
* 3. Verifies the challenge at the byte level using `timingSafeEqual` (prevents timing attacks).
|
|
346
|
+
* 4. Verifies the origin.
|
|
347
|
+
* 5. Verifies `signCount > storedSignCount` (replay / cloned-authenticator detection).
|
|
348
|
+
* 6. Verifies the cryptographic signature over `authData || SHA-256(clientDataJSON)`
|
|
349
|
+
* using the stored public key.
|
|
350
|
+
*
|
|
351
|
+
* @param clientDataJSONStr - The `response.clientDataJSON` from the browser, as either a
|
|
352
|
+
* raw UTF-8 JSON string or a base64url-encoded string (browser format).
|
|
353
|
+
* @param expectedChallenge - The base64url-encoded challenge originally sent to the client.
|
|
354
|
+
* @param expectedOrigin - The expected origin (e.g. `'https://example.com'`).
|
|
355
|
+
* @param storedSignCount - The sign count stored server-side from the last successful assertion.
|
|
356
|
+
* Pass `0` for the first assertion after registration.
|
|
357
|
+
* @param authData - The raw `response.authenticatorData` buffer from the browser.
|
|
358
|
+
* @param signature - The raw `response.signature` buffer from the browser.
|
|
359
|
+
* @param publicKeyPem - The credential's stored public key in PEM (SPKI) format.
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* const result = verifyPasskeyAssertion(
|
|
363
|
+
* clientDataJSON, // from navigator.credentials.get() response
|
|
364
|
+
* storedChallenge,
|
|
365
|
+
* 'https://example.com',
|
|
366
|
+
* storedSignCount,
|
|
367
|
+
* authDataBuffer,
|
|
368
|
+
* signatureBuffer,
|
|
369
|
+
* credentialPublicKeyPem,
|
|
370
|
+
* );
|
|
371
|
+
* if (!result.verified) throw new Error(result.error);
|
|
372
|
+
* await db.updateSignCount(credentialId, result.newSignCount!);
|
|
373
|
+
*/
|
|
374
|
+
declare const verifyPasskeyAssertion: (clientDataJSONStr: string, expectedChallenge: string, expectedOrigin: string, storedSignCount: number, authData: Buffer$1, signature: Buffer$1, publicKeyPem: string) => PasskeyAssertionResult;
|
|
375
|
+
|
|
376
|
+
type index$7_PasskeyAssertionResult = PasskeyAssertionResult;
|
|
377
|
+
type index$7_PasskeyRegistrationResult = PasskeyRegistrationResult;
|
|
378
|
+
declare const index$7_basicAuth: typeof basicAuth;
|
|
379
|
+
declare const index$7_can: typeof can;
|
|
380
|
+
declare const index$7_canAccess: typeof canAccess;
|
|
381
|
+
declare const index$7_generateCSRF: typeof generateCSRF;
|
|
382
|
+
declare const index$7_generateHmacChallenge: typeof generateHmacChallenge;
|
|
383
|
+
declare const index$7_generateHoneyToken: typeof generateHoneyToken;
|
|
384
|
+
declare const index$7_generatePasskeyChallenge: typeof generatePasskeyChallenge;
|
|
385
|
+
declare const index$7_hasRole: typeof hasRole;
|
|
386
|
+
declare const index$7_isHoneyToken: typeof isHoneyToken;
|
|
387
|
+
declare const index$7_isJwtValid: typeof isJwtValid;
|
|
388
|
+
declare const index$7_parseAuthenticatorData: typeof parseAuthenticatorData;
|
|
389
|
+
declare const index$7_suggestMFA: typeof suggestMFA;
|
|
390
|
+
declare const index$7_verifyCSRF: typeof verifyCSRF;
|
|
391
|
+
declare const index$7_verifyHmacResponse: typeof verifyHmacResponse;
|
|
392
|
+
declare const index$7_verifyPasskeyAssertion: typeof verifyPasskeyAssertion;
|
|
393
|
+
declare const index$7_verifyPasskeyRegistration: typeof verifyPasskeyRegistration;
|
|
394
|
+
declare const index$7_verifyPasskeySignature: typeof verifyPasskeySignature;
|
|
395
|
+
declare namespace index$7 {
|
|
396
|
+
export { type index$7_PasskeyAssertionResult as PasskeyAssertionResult, type index$7_PasskeyRegistrationResult as PasskeyRegistrationResult, index$7_basicAuth as basicAuth, index$7_can as can, index$7_canAccess as canAccess, index$7_generateCSRF as generateCSRF, index$7_generateHmacChallenge as generateHmacChallenge, index$7_generateHoneyToken as generateHoneyToken, index$7_generatePasskeyChallenge as generatePasskeyChallenge, index$7_hasRole as hasRole, index$7_isHoneyToken as isHoneyToken, index$7_isJwtValid as isJwtValid, index$7_parseAuthenticatorData as parseAuthenticatorData, index$7_suggestMFA as suggestMFA, index$7_verifyCSRF as verifyCSRF, index$7_verifyHmacResponse as verifyHmacResponse, index$7_verifyPasskeyAssertion as verifyPasskeyAssertion, index$7_verifyPasskeyRegistration as verifyPasskeyRegistration, index$7_verifyPasskeySignature as verifyPasskeySignature };
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Runs a high-CPU cryptographic function in a separate Worker Thread.
|
|
401
|
+
* Concurrency is bounded by the module-level `workerPool` semaphore, preventing
|
|
402
|
+
* unbounded thread allocation under high load.
|
|
403
|
+
*
|
|
404
|
+
* Note: Workers are still spawned on-demand (not persistent). For extremely
|
|
405
|
+
* high-throughput workloads consider replacing this with a persistent pool
|
|
406
|
+
* library such as Piscina.
|
|
407
|
+
*/
|
|
408
|
+
declare const runIsolatedCrypto: (functionName: string, args: any[]) => Promise<any>;
|
|
409
|
+
/**
|
|
410
|
+
* Implements a production-grade verifiable Shamir's Secret Sharing (SSS) pattern to split
|
|
411
|
+
* a master secret into multiple 'shares'. N-of-M shares are required to reconstruct.
|
|
412
|
+
* This provides Threshold Security.
|
|
413
|
+
*
|
|
414
|
+
* @param secret The master secret string or buffer.
|
|
415
|
+
* @param sharesCount Global number of shares (M).
|
|
416
|
+
* @param threshold Minimum number of shares required to reconstruct (N).
|
|
417
|
+
*/
|
|
418
|
+
declare const splitSecret: (secret: string | Buffer$1, sharesCount: number, threshold: number) => string[];
|
|
419
|
+
/**
|
|
420
|
+
* Reconstructs a master secret from N-of-M Shamir's Secret Sharing shares.
|
|
421
|
+
*
|
|
422
|
+
* @param shares Array of hex-encoded shares formatted as 'x:hex_payload'.
|
|
423
|
+
*/
|
|
424
|
+
declare const reconstructSecret: (shares: string[]) => Buffer$1;
|
|
425
|
+
/**
|
|
426
|
+
* Blind Signature Framework placeholder.
|
|
427
|
+
* Allows a client to 'blind' a piece of data before sending it for signing.
|
|
428
|
+
*/
|
|
429
|
+
declare const blindData: (data: string | Buffer$1, factor: string) => string;
|
|
430
|
+
/**
|
|
431
|
+
* Generates a random token.
|
|
432
|
+
*/
|
|
433
|
+
declare const generateToken: (length?: number, encoding?: BufferEncoding) => string;
|
|
434
|
+
/**
|
|
435
|
+
* HKDF key derivation using the standard HKDF-SHA-256 algorithm (RFC 5869).
|
|
436
|
+
*
|
|
437
|
+
* Derives a cryptographically strong sub-key from a master secret using
|
|
438
|
+
* HKDF-SHA-256 (extract + expand). Safe to use for key diversification,
|
|
439
|
+
* e.g. deriving encryption and MAC keys from a single master secret.
|
|
440
|
+
*
|
|
441
|
+
* @param secret - The input key material (IKM). A high-entropy master secret.
|
|
442
|
+
* @param info - Context/application-specific info string (e.g. 'session-key').
|
|
443
|
+
* Different values produce independent, unrelated sub-keys.
|
|
444
|
+
* @param length - Length of the derived key in bytes (default: 32).
|
|
445
|
+
* @returns Hex-encoded derived key.
|
|
446
|
+
*/
|
|
447
|
+
declare const deriveSubKey: (secret: string | Buffer$1, info: string, length?: number) => string;
|
|
448
|
+
/**
|
|
449
|
+
* AES-256-GCM encrypted persistence.
|
|
450
|
+
*/
|
|
451
|
+
declare const encryptSession: (obj: any, key: string | Buffer$1) => string;
|
|
452
|
+
/**
|
|
453
|
+
* Decrypts AES-256-GCM.
|
|
454
|
+
*/
|
|
455
|
+
declare const decryptSession: (sessionStr: string, key: string | Buffer$1) => any;
|
|
456
|
+
/**
|
|
457
|
+
* Generates a Winternitz One-Time Signature (WOTS) key pair for post-quantum signing.
|
|
458
|
+
*
|
|
459
|
+
* @returns An object with `publicKey` and `privateKey` as semicolon-delimited hex strings.
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* const { publicKey, privateKey } = generatePQCKeyPair();
|
|
463
|
+
* const signature = signPQC('my message', privateKey);
|
|
464
|
+
* const valid = verifyPQCSignature('my message', signature, publicKey); // true
|
|
465
|
+
*
|
|
466
|
+
* @caution **ONE-TIME USE ONLY.**
|
|
467
|
+
* WOTS is a one-time signature scheme. Each `privateKey` **must only be used to sign
|
|
468
|
+
* a single message**. Signing a second message with the same key reveals partial private
|
|
469
|
+
* key material, completely breaking the security of the scheme. Always generate a new
|
|
470
|
+
* key pair for each message you need to sign.
|
|
471
|
+
*/
|
|
472
|
+
declare const generatePQCKeyPair: () => {
|
|
473
|
+
publicKey: string;
|
|
474
|
+
privateKey: string;
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* Signs a message using a Winternitz One-Time Signature (WOTS) private key.
|
|
478
|
+
*
|
|
479
|
+
* @param data - The message or data to sign.
|
|
480
|
+
* @param privateKeyStr - The private key string returned by `generatePQCKeyPair`.
|
|
481
|
+
*
|
|
482
|
+
* @throws {Error} If `privateKeyStr` is invalid (wrong number of key parts).
|
|
483
|
+
* @throws {Error} If this private key has already been used to sign a message
|
|
484
|
+
* (`WOTS_KEY_REUSE`). Generate a fresh key pair for each message.
|
|
485
|
+
*
|
|
486
|
+
* @caution **ONE-TIME USE ONLY.** See `generatePQCKeyPair` for the full warning.
|
|
487
|
+
*/
|
|
488
|
+
declare const signPQC: (data: string | Buffer$1, privateKeyStr: string) => string;
|
|
489
|
+
/**
|
|
490
|
+
* Verifies a Winternitz One-Time Signature (WOTS) against a message and public key.
|
|
491
|
+
*
|
|
492
|
+
* This operation is safe to call multiple times for the same public key — verification
|
|
493
|
+
* does not consume the key or leak any private key material.
|
|
494
|
+
*
|
|
495
|
+
* @param data - The original message that was signed.
|
|
496
|
+
* @param signature - The signature string returned by `signPQC`.
|
|
497
|
+
* @param publicKey - The public key string returned by `generatePQCKeyPair`.
|
|
498
|
+
* @returns `true` if the signature is valid for the given message and public key.
|
|
499
|
+
*/
|
|
500
|
+
declare const verifyPQCSignature: (data: Buffer$1 | string, signature: string, publicKey: string) => boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Password hashing.
|
|
503
|
+
*/
|
|
504
|
+
declare const hashPassword: (password: string, salt?: string) => Promise<{
|
|
505
|
+
hash: string;
|
|
506
|
+
salt: string;
|
|
507
|
+
}>;
|
|
508
|
+
/**
|
|
509
|
+
* verification.
|
|
510
|
+
*/
|
|
511
|
+
declare const verifyPassword: (password: string, storedHash: string, salt: string) => Promise<boolean>;
|
|
512
|
+
/**
|
|
513
|
+
* SHA-256.
|
|
514
|
+
*/
|
|
515
|
+
declare const sha256: (data: string) => string;
|
|
516
|
+
|
|
517
|
+
declare const index$6_blindData: typeof blindData;
|
|
518
|
+
declare const index$6_decryptSession: typeof decryptSession;
|
|
519
|
+
declare const index$6_deriveSubKey: typeof deriveSubKey;
|
|
520
|
+
declare const index$6_encryptSession: typeof encryptSession;
|
|
521
|
+
declare const index$6_generatePQCKeyPair: typeof generatePQCKeyPair;
|
|
522
|
+
declare const index$6_generateToken: typeof generateToken;
|
|
523
|
+
declare const index$6_hashPassword: typeof hashPassword;
|
|
524
|
+
declare const index$6_reconstructSecret: typeof reconstructSecret;
|
|
525
|
+
declare const index$6_runIsolatedCrypto: typeof runIsolatedCrypto;
|
|
526
|
+
declare const index$6_sha256: typeof sha256;
|
|
527
|
+
declare const index$6_signPQC: typeof signPQC;
|
|
528
|
+
declare const index$6_splitSecret: typeof splitSecret;
|
|
529
|
+
declare const index$6_verifyPQCSignature: typeof verifyPQCSignature;
|
|
530
|
+
declare const index$6_verifyPassword: typeof verifyPassword;
|
|
531
|
+
declare namespace index$6 {
|
|
532
|
+
export { index$6_blindData as blindData, index$6_decryptSession as decryptSession, index$6_deriveSubKey as deriveSubKey, index$6_encryptSession as encryptSession, index$6_generatePQCKeyPair as generatePQCKeyPair, index$6_generateToken as generateToken, index$6_hashPassword as hashPassword, index$6_reconstructSecret as reconstructSecret, index$6_runIsolatedCrypto as runIsolatedCrypto, index$6_sha256 as sha256, index$6_signPQC as signPQC, index$6_splitSecret as splitSecret, index$6_verifyPQCSignature as verifyPQCSignature, index$6_verifyPassword as verifyPassword };
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Standard Magic Numbers for common file types.
|
|
537
|
+
*/
|
|
538
|
+
declare const MAGIC_NUMBERS: {
|
|
539
|
+
PNG: number[];
|
|
540
|
+
JPEG: number[];
|
|
541
|
+
PDF: number[];
|
|
542
|
+
GIF: number[];
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Resolves a path relative to a root directory and ensures it doesn't escape the root.
|
|
546
|
+
*/
|
|
547
|
+
declare const resolveSafePath: (rootDir: string, userInputPath: string) => string;
|
|
548
|
+
/**
|
|
549
|
+
* Verifies that a file's magic numbers match the expected type.
|
|
550
|
+
* This is much more secure than trusting file extensions or MIME types.
|
|
551
|
+
*
|
|
552
|
+
* @param filePath The path to the file.
|
|
553
|
+
* @param expectedMagic The array of bytes to match.
|
|
554
|
+
* @returns true if the file matches.
|
|
555
|
+
*/
|
|
556
|
+
declare const verifyMagicNumber: (filePath: string, expectedMagic: number[]) => Promise<boolean>;
|
|
557
|
+
/**
|
|
558
|
+
* Safely reads a file from a root-locked directory.
|
|
559
|
+
*/
|
|
560
|
+
declare const safeRead: (rootDir: string, filePath: string) => Promise<string>;
|
|
561
|
+
/**
|
|
562
|
+
* Checks if a path is safe (within the root) without throwing.
|
|
563
|
+
*/
|
|
564
|
+
declare const isPathSafe: (rootDir: string, filePath: string) => boolean;
|
|
565
|
+
|
|
566
|
+
declare const index$5_MAGIC_NUMBERS: typeof MAGIC_NUMBERS;
|
|
567
|
+
declare const index$5_isPathSafe: typeof isPathSafe;
|
|
568
|
+
declare const index$5_resolveSafePath: typeof resolveSafePath;
|
|
569
|
+
declare const index$5_safeRead: typeof safeRead;
|
|
570
|
+
declare const index$5_verifyMagicNumber: typeof verifyMagicNumber;
|
|
571
|
+
declare namespace index$5 {
|
|
572
|
+
export { index$5_MAGIC_NUMBERS as MAGIC_NUMBERS, index$5_isPathSafe as isPathSafe, index$5_resolveSafePath as resolveSafePath, index$5_safeRead as safeRead, index$5_verifyMagicNumber as verifyMagicNumber };
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Checks if a request is over HTTPS.
|
|
577
|
+
*/
|
|
578
|
+
declare const isSecure: (url?: string, headers?: Record<string, string | string[] | undefined>) => boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Normalizes a URL.
|
|
581
|
+
*/
|
|
582
|
+
declare const normalizeUrl: (url: string) => string;
|
|
583
|
+
/**
|
|
584
|
+
* Hardened HTTPS Tunneling Helper.
|
|
585
|
+
* Configures an outgoing https.request with strictly-enforced security options,
|
|
586
|
+
* including TLS 1.3, strong ciphers, and OCSP stapling if supported.
|
|
587
|
+
*
|
|
588
|
+
* @param options Custom https.RequestOptions to extend.
|
|
589
|
+
* @returns {https.RequestOptions} The hardened options.
|
|
590
|
+
*/
|
|
591
|
+
declare const getHardenedRequestOptions: (options?: https.RequestOptions) => https.RequestOptions;
|
|
592
|
+
/**
|
|
593
|
+
* JA3 TLS Fingerprinting.
|
|
594
|
+
*/
|
|
595
|
+
declare const generateTLSFingerprint: (req: any) => string;
|
|
596
|
+
/**
|
|
597
|
+
* Analyzestraffic for DoS patterns.
|
|
598
|
+
*/
|
|
599
|
+
declare const analyzeDoSThreat: (req: any) => boolean;
|
|
600
|
+
/**
|
|
601
|
+
* Generates client fingerprint.
|
|
602
|
+
*/
|
|
603
|
+
declare const generateFingerprint: (reqHeaders: Record<string, string | string[] | undefined>, ip: string) => string;
|
|
604
|
+
/**
|
|
605
|
+
* Projects noise.
|
|
606
|
+
*/
|
|
607
|
+
declare const projectNoise: (obj: any) => any;
|
|
608
|
+
/**
|
|
609
|
+
* Safe Redirect.
|
|
610
|
+
*/
|
|
611
|
+
declare const isSafeRedirect: (url: string, allowedHosts?: string[]) => boolean;
|
|
612
|
+
/**
|
|
613
|
+
* SRI Hash.
|
|
614
|
+
*/
|
|
615
|
+
declare const generateSRI: (data: string | Buffer, algorithm?: "sha256" | "sha384" | "sha512") => string;
|
|
616
|
+
|
|
617
|
+
declare const index$4_analyzeDoSThreat: typeof analyzeDoSThreat;
|
|
618
|
+
declare const index$4_generateFingerprint: typeof generateFingerprint;
|
|
619
|
+
declare const index$4_generateSRI: typeof generateSRI;
|
|
620
|
+
declare const index$4_generateTLSFingerprint: typeof generateTLSFingerprint;
|
|
621
|
+
declare const index$4_getHardenedRequestOptions: typeof getHardenedRequestOptions;
|
|
622
|
+
declare const index$4_isSafeRedirect: typeof isSafeRedirect;
|
|
623
|
+
declare const index$4_isSecure: typeof isSecure;
|
|
624
|
+
declare const index$4_normalizeUrl: typeof normalizeUrl;
|
|
625
|
+
declare const index$4_projectNoise: typeof projectNoise;
|
|
626
|
+
declare namespace index$4 {
|
|
627
|
+
export { index$4_analyzeDoSThreat as analyzeDoSThreat, index$4_generateFingerprint as generateFingerprint, index$4_generateSRI as generateSRI, index$4_generateTLSFingerprint as generateTLSFingerprint, index$4_getHardenedRequestOptions as getHardenedRequestOptions, index$4_isSafeRedirect as isSafeRedirect, index$4_isSecure as isSecure, index$4_normalizeUrl as normalizeUrl, index$4_projectNoise as projectNoise };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* A simple in-memory Store for the rate limiter.
|
|
632
|
+
*/
|
|
633
|
+
interface RateLimitStore {
|
|
634
|
+
increment(key: string, amount?: number): Promise<number>;
|
|
635
|
+
get(key: string): Promise<number | undefined>;
|
|
636
|
+
reset(key: string): Promise<void>;
|
|
637
|
+
setTTL(key: string, value: number, ttlMs: number): Promise<void>;
|
|
638
|
+
}
|
|
639
|
+
declare class MemoryStore implements RateLimitStore {
|
|
640
|
+
private readonly windowMs;
|
|
641
|
+
private readonly hits;
|
|
642
|
+
private readonly gcInterval;
|
|
643
|
+
constructor(windowMs: number);
|
|
644
|
+
private gc;
|
|
645
|
+
increment(key: string, amount?: number): Promise<number>;
|
|
646
|
+
get(key: string): Promise<number | undefined>;
|
|
647
|
+
reset(key: string): Promise<void>;
|
|
648
|
+
setTTL(key: string, value: number, ttlMs: number): Promise<void>;
|
|
649
|
+
destroy(): void;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Redis Store implementation for the rate limiter.
|
|
653
|
+
* Expects a Redis-compatible client (e.g., from 'ioredis' or 'redis').
|
|
654
|
+
*/
|
|
655
|
+
/**
|
|
656
|
+
* Minimal structural interface for a Redis-compatible client.
|
|
657
|
+
*
|
|
658
|
+
* This is intentionally narrow — it describes only the API surface that
|
|
659
|
+
* `RedisStore` actually uses. Any client that satisfies this interface
|
|
660
|
+
* (e.g. `ioredis`, `node-redis` v4) will work without importing their
|
|
661
|
+
* types as a dependency.
|
|
662
|
+
*/
|
|
663
|
+
interface RedisMultiChain {
|
|
664
|
+
incrby(key: string, amount: number): RedisMultiChain;
|
|
665
|
+
pttl(key: string): RedisMultiChain;
|
|
666
|
+
exec(): Promise<Array<[error: Error | null, result: unknown]>>;
|
|
667
|
+
}
|
|
668
|
+
interface RedisClientLike {
|
|
669
|
+
multi(): RedisMultiChain;
|
|
670
|
+
get(key: string): Promise<string | null>;
|
|
671
|
+
del(key: string): Promise<number>;
|
|
672
|
+
set(key: string, value: number | string, mode: 'PX', ttlMs: number): Promise<string | null>;
|
|
673
|
+
pexpire(key: string, ttlMs: number): Promise<number>;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Redis Store implementation for the rate limiter.
|
|
677
|
+
* Accepts any `RedisClientLike`-compatible client (e.g. `ioredis`, `redis` v4).
|
|
678
|
+
*/
|
|
679
|
+
declare class RedisStore implements RateLimitStore {
|
|
680
|
+
private readonly redisClient;
|
|
681
|
+
private readonly windowMs;
|
|
682
|
+
private readonly prefix;
|
|
683
|
+
constructor(redisClient: RedisClientLike, windowMs: number, prefix?: string);
|
|
684
|
+
increment(key: string, amount?: number): Promise<number>;
|
|
685
|
+
get(key: string): Promise<number | undefined>;
|
|
686
|
+
reset(key: string): Promise<void>;
|
|
687
|
+
setTTL(key: string, value: number, ttlMs: number): Promise<void>;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* TokenBucket implementation for smooth rate limiting.
|
|
691
|
+
*/
|
|
692
|
+
declare class TokenBucket {
|
|
693
|
+
private readonly capacity;
|
|
694
|
+
private readonly refillRatePerSecond;
|
|
695
|
+
private readonly buckets;
|
|
696
|
+
constructor(capacity: number, refillRatePerSecond: number);
|
|
697
|
+
consume(id: string, tokens?: number): Promise<boolean>;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Adaptive RateLimiter implementation with Global Kill-Switch and IR Hook support.
|
|
701
|
+
*/
|
|
702
|
+
declare class AdaptiveRateLimiter {
|
|
703
|
+
private readonly config;
|
|
704
|
+
private readonly store;
|
|
705
|
+
private readonly securityStore;
|
|
706
|
+
private readonly burstStore;
|
|
707
|
+
private readonly ipCheckers;
|
|
708
|
+
constructor(config: {
|
|
709
|
+
standardLimit: number;
|
|
710
|
+
penaltyLimit: number;
|
|
711
|
+
windowMs: number;
|
|
712
|
+
securityThreshold: number;
|
|
713
|
+
burstThreshold: number;
|
|
714
|
+
}, store?: RateLimitStore, securityStore?: RateLimitStore, burstStore?: RateLimitStore);
|
|
715
|
+
/**
|
|
716
|
+
* Automates Incident Response by globally "killing" a session or IP.
|
|
717
|
+
* This sets an infinite (effectively 1-year) block on the ID.
|
|
718
|
+
*
|
|
719
|
+
* @param id The client ID to block.
|
|
720
|
+
*
|
|
721
|
+
* @remarks
|
|
722
|
+
* **Persistence warning**: If the underlying store is `MemoryStore` (the default),
|
|
723
|
+
* the block is held in process memory and will be **lost on process restart**.
|
|
724
|
+
* For a persistent kill-switch that survives restarts and works across multiple
|
|
725
|
+
* instances, pass a `RedisStore` as the `store` and `securityStore` arguments
|
|
726
|
+
* to the `AdaptiveRateLimiter` constructor.
|
|
727
|
+
*
|
|
728
|
+
* @see {@link RedisStore} for a production-grade persistent store.
|
|
729
|
+
*/
|
|
730
|
+
triggerGlobalKillSwitch(id: string): Promise<void>;
|
|
731
|
+
registerIPChecker(checker: (ip: string) => Promise<boolean>): void;
|
|
732
|
+
recordSecurityEvent(id: string, weight?: number): Promise<void>;
|
|
733
|
+
isLimited(id: string): Promise<boolean>;
|
|
734
|
+
isHighRisk(id: string): Promise<boolean>;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Basic Sliding Window RateLimiter for backward compatibility.
|
|
738
|
+
*/
|
|
739
|
+
declare class RateLimiter {
|
|
740
|
+
private readonly limit;
|
|
741
|
+
private readonly windowMs;
|
|
742
|
+
private readonly store;
|
|
743
|
+
constructor(limit: number, windowMs: number, store?: RateLimitStore);
|
|
744
|
+
isLimited(id: string): Promise<boolean>;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
type index$3_AdaptiveRateLimiter = AdaptiveRateLimiter;
|
|
748
|
+
declare const index$3_AdaptiveRateLimiter: typeof AdaptiveRateLimiter;
|
|
749
|
+
type index$3_MemoryStore = MemoryStore;
|
|
750
|
+
declare const index$3_MemoryStore: typeof MemoryStore;
|
|
751
|
+
type index$3_RateLimitStore = RateLimitStore;
|
|
752
|
+
type index$3_RateLimiter = RateLimiter;
|
|
753
|
+
declare const index$3_RateLimiter: typeof RateLimiter;
|
|
754
|
+
type index$3_RedisClientLike = RedisClientLike;
|
|
755
|
+
type index$3_RedisMultiChain = RedisMultiChain;
|
|
756
|
+
type index$3_RedisStore = RedisStore;
|
|
757
|
+
declare const index$3_RedisStore: typeof RedisStore;
|
|
758
|
+
type index$3_TokenBucket = TokenBucket;
|
|
759
|
+
declare const index$3_TokenBucket: typeof TokenBucket;
|
|
760
|
+
declare namespace index$3 {
|
|
761
|
+
export { index$3_AdaptiveRateLimiter as AdaptiveRateLimiter, index$3_MemoryStore as MemoryStore, type index$3_RateLimitStore as RateLimitStore, index$3_RateLimiter as RateLimiter, type index$3_RedisClientLike as RedisClientLike, type index$3_RedisMultiChain as RedisMultiChain, index$3_RedisStore as RedisStore, index$3_TokenBucket as TokenBucket };
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Prototype pollution safe JSON parsing with depth limiting to prevent
|
|
766
|
+
* "JSON Depth" or "Billion Laughs" style DoS attacks.
|
|
767
|
+
*/
|
|
768
|
+
declare const parse: (text: string, maxDepth?: number) => any;
|
|
769
|
+
/**
|
|
770
|
+
* Calculates the maximum depth of an object to detect nested-complexity attacks.
|
|
771
|
+
*/
|
|
772
|
+
declare const getDepth: (obj: any) => number;
|
|
773
|
+
/**
|
|
774
|
+
* Recursively checks an object for prototype pollution keys.
|
|
775
|
+
*/
|
|
776
|
+
declare const containsPollution: (obj: any) => boolean;
|
|
777
|
+
|
|
778
|
+
declare const index$2_containsPollution: typeof containsPollution;
|
|
779
|
+
declare const index$2_getDepth: typeof getDepth;
|
|
780
|
+
declare const index$2_parse: typeof parse;
|
|
781
|
+
declare namespace index$2 {
|
|
782
|
+
export { index$2_containsPollution as containsPollution, index$2_getDepth as getDepth, index$2_parse as parse };
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Deep merges source into target securely, preventing:
|
|
787
|
+
* 1. Prototype pollution (key filtering)
|
|
788
|
+
* 2. Infinite loops (circular reference detection)
|
|
789
|
+
*
|
|
790
|
+
* @param target The target object to merge into.
|
|
791
|
+
* @param source The source object to merge from.
|
|
792
|
+
* @param seen WeakSet to track seen objects for circular reference detection.
|
|
793
|
+
* @returns The merged object.
|
|
794
|
+
*/
|
|
795
|
+
declare const merge: <T extends object, S extends object>(target: T, source: S, seen?: WeakSet<object>) => T & S;
|
|
796
|
+
/**
|
|
797
|
+
* Recursively removes prototype-related keys from an object to sanitize untrusted input.
|
|
798
|
+
*/
|
|
799
|
+
declare const sanitizeObject: <T>(obj: T, seen?: WeakSet<object>) => T;
|
|
800
|
+
/**
|
|
801
|
+
* Deep freezes an object to prevent any modifications.
|
|
802
|
+
*/
|
|
803
|
+
declare const deepFreeze: <T extends object>(obj: T) => T;
|
|
804
|
+
|
|
805
|
+
declare const index$1_deepFreeze: typeof deepFreeze;
|
|
806
|
+
declare const index$1_merge: typeof merge;
|
|
807
|
+
declare const index$1_sanitizeObject: typeof sanitizeObject;
|
|
808
|
+
declare namespace index$1 {
|
|
809
|
+
export { index$1_deepFreeze as deepFreeze, index$1_merge as merge, index$1_sanitizeObject as sanitizeObject };
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Common sensitive keys for redaction.
|
|
814
|
+
*/
|
|
815
|
+
declare const SENSITIVE_KEYS: Set<string>;
|
|
816
|
+
/**
|
|
817
|
+
* Redacts sensitive keys.
|
|
818
|
+
*/
|
|
819
|
+
declare const redact: <T>(obj: T, redactKeys?: Set<string>) => T;
|
|
820
|
+
/**
|
|
821
|
+
* SecureError wrapper.
|
|
822
|
+
*/
|
|
823
|
+
declare class SecureError extends Error {
|
|
824
|
+
readonly code: string;
|
|
825
|
+
readonly userMessage: string;
|
|
826
|
+
constructor(message: string, code?: string, userMessage?: string);
|
|
827
|
+
toJSON(): {
|
|
828
|
+
error: boolean;
|
|
829
|
+
code: string;
|
|
830
|
+
message: string;
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Normalizes an error.
|
|
835
|
+
*/
|
|
836
|
+
declare const normalizeError: (error: any) => SecureError;
|
|
837
|
+
/**
|
|
838
|
+
* Memory-Wiping (Anti-Forensics) utility.
|
|
839
|
+
* Explicitly overwrites the content of a Buffer or Uint8Array with zero bytes.
|
|
840
|
+
* This is the ultimate "last step" for protecting high-entropy key material.
|
|
841
|
+
*
|
|
842
|
+
* @param buf The Buffer or Uint8Array to zero-out.
|
|
843
|
+
*/
|
|
844
|
+
declare const wipeBuffer: (buf: Buffer | Uint8Array | any[]) => void;
|
|
845
|
+
/**
|
|
846
|
+
* Minimal logger interface for dependency injection.
|
|
847
|
+
* Any object with `error` and `warn` methods satisfies this —
|
|
848
|
+
* e.g. `console`, `winston`, `pino`, or a custom OTEL-aware logger.
|
|
849
|
+
*/
|
|
850
|
+
interface MinimalLogger {
|
|
851
|
+
error(message: string, ...args: unknown[]): void;
|
|
852
|
+
warn(message: string, ...args: unknown[]): void;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Self-healing configuration monitor.
|
|
856
|
+
*
|
|
857
|
+
* Runs `auditConfig` on the supplied configuration at a fixed interval and
|
|
858
|
+
* logs any detected drift through the provided `logger`.
|
|
859
|
+
*
|
|
860
|
+
* @param config The configuration object to audit.
|
|
861
|
+
* @param type The configuration type ('db' | 'redis' | 'auth').
|
|
862
|
+
* @param intervalMs How often to run the audit (default: 10 minutes).
|
|
863
|
+
* @param logger Optional logger to receive drift alerts. Defaults to `console`.
|
|
864
|
+
* Inject a structured logger (Winston, Pino, OTEL) for production.
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* // Default — uses console
|
|
868
|
+
* startSelfHealingMonitor(dbConfig, 'db');
|
|
869
|
+
*
|
|
870
|
+
* // Production — inject your logger
|
|
871
|
+
* startSelfHealingMonitor(dbConfig, 'db', 600_000, pinoLogger);
|
|
872
|
+
*/
|
|
873
|
+
declare const startSelfHealingMonitor: (config: Parameters<typeof auditConfig>[0], type: Parameters<typeof auditConfig>[1], intervalMs?: number, logger?: MinimalLogger) => void;
|
|
874
|
+
/**
|
|
875
|
+
* SQL Injection Hardening.
|
|
876
|
+
*/
|
|
877
|
+
declare const enforceSafeQuery: (query: string, params: any[]) => void;
|
|
878
|
+
/**
|
|
879
|
+
* Deterministic digit substitution using SHA-256 offset encoding.
|
|
880
|
+
*
|
|
881
|
+
* @remarks
|
|
882
|
+
* **This is NOT Format-Preserving Encryption (FPE).**
|
|
883
|
+
* It does NOT implement NIST SP 800-38G (FF1/FF3-1). It is a lightweight,
|
|
884
|
+
* deterministic digit-level obfuscation function suitable for display masking
|
|
885
|
+
* and non-compliance-grade transformations only.
|
|
886
|
+
*
|
|
887
|
+
* Do NOT use this for PCI-DSS, HIPAA, or any standard requiring certified FPE.
|
|
888
|
+
*
|
|
889
|
+
* @param input A string of decimal digit characters (0–9) to transform.
|
|
890
|
+
* @param secret A secret key string used to derive the substitution offsets.
|
|
891
|
+
* @returns A digit-length-preserving transformed string.
|
|
892
|
+
*/
|
|
893
|
+
declare const deterministicDigitTransform: (input: string, secret: string) => string;
|
|
894
|
+
/**
|
|
895
|
+
* Environment security check.
|
|
896
|
+
*/
|
|
897
|
+
declare const checkSecureEnv: () => void;
|
|
898
|
+
/**
|
|
899
|
+
* Configuration Auditor.
|
|
900
|
+
*/
|
|
901
|
+
declare const auditConfig: (config: any, type: "db" | "redis" | "auth") => string[];
|
|
902
|
+
/**
|
|
903
|
+
* Global prototype lockdown.
|
|
904
|
+
*/
|
|
905
|
+
declare const lockdownPrototypes: () => void;
|
|
906
|
+
/**
|
|
907
|
+
* mTLS Helper.
|
|
908
|
+
*/
|
|
909
|
+
declare const createMTLSOptions: (serverCert: Buffer, serverKey: Buffer, caCert: Buffer) => {
|
|
910
|
+
cert: Buffer<ArrayBufferLike>;
|
|
911
|
+
key: Buffer<ArrayBufferLike>;
|
|
912
|
+
ca: Buffer<ArrayBufferLike>;
|
|
913
|
+
requestCert: boolean;
|
|
914
|
+
rejectUnauthorized: boolean;
|
|
915
|
+
};
|
|
916
|
+
/**
|
|
917
|
+
* Security preset.
|
|
918
|
+
*/
|
|
919
|
+
declare const standardSecurityPreset: {
|
|
920
|
+
trustProxy: boolean;
|
|
921
|
+
strictTransportSecurity: {
|
|
922
|
+
maxAge: number;
|
|
923
|
+
includeSubDomains: boolean;
|
|
924
|
+
preload: boolean;
|
|
925
|
+
};
|
|
926
|
+
contentSecurityPolicy: boolean;
|
|
927
|
+
referrerPolicy: "strict-origin-when-cross-origin";
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
type index_MinimalLogger = MinimalLogger;
|
|
931
|
+
declare const index_SENSITIVE_KEYS: typeof SENSITIVE_KEYS;
|
|
932
|
+
type index_SecureError = SecureError;
|
|
933
|
+
declare const index_SecureError: typeof SecureError;
|
|
934
|
+
declare const index_auditConfig: typeof auditConfig;
|
|
935
|
+
declare const index_checkSecureEnv: typeof checkSecureEnv;
|
|
936
|
+
declare const index_createMTLSOptions: typeof createMTLSOptions;
|
|
937
|
+
declare const index_deterministicDigitTransform: typeof deterministicDigitTransform;
|
|
938
|
+
declare const index_enforceSafeQuery: typeof enforceSafeQuery;
|
|
939
|
+
declare const index_lockdownPrototypes: typeof lockdownPrototypes;
|
|
940
|
+
declare const index_normalizeError: typeof normalizeError;
|
|
941
|
+
declare const index_redact: typeof redact;
|
|
942
|
+
declare const index_standardSecurityPreset: typeof standardSecurityPreset;
|
|
943
|
+
declare const index_startSelfHealingMonitor: typeof startSelfHealingMonitor;
|
|
944
|
+
declare const index_wipeBuffer: typeof wipeBuffer;
|
|
945
|
+
declare namespace index {
|
|
946
|
+
export { type index_MinimalLogger as MinimalLogger, index_SENSITIVE_KEYS as SENSITIVE_KEYS, index_SecureError as SecureError, index_auditConfig as auditConfig, index_checkSecureEnv as checkSecureEnv, index_createMTLSOptions as createMTLSOptions, index_deterministicDigitTransform as deterministicDigitTransform, index_enforceSafeQuery as enforceSafeQuery, index_lockdownPrototypes as lockdownPrototypes, index_normalizeError as normalizeError, index_redact as redact, index_standardSecurityPreset as standardSecurityPreset, index_startSelfHealingMonitor as startSelfHealingMonitor, index_wipeBuffer as wipeBuffer };
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* A lightweight Express middleware preset.
|
|
951
|
+
*/
|
|
952
|
+
declare const expressMiddleware: (options?: {
|
|
953
|
+
rateLimit?: boolean;
|
|
954
|
+
rateLimitWindowMs?: number;
|
|
955
|
+
rateLimitMax?: number;
|
|
956
|
+
}) => (req: any, res: any, next: any) => Promise<any>;
|
|
957
|
+
/**
|
|
958
|
+
* Next.js Edge Middleware Preset.
|
|
959
|
+
* Note: Next.js edge runtime doesn't support all Node APIs, so we keep it lightweight.
|
|
960
|
+
*/
|
|
961
|
+
declare const nextJsMiddleware: (_req: any, res: any) => any;
|
|
962
|
+
/**
|
|
963
|
+
* Global response error handler for Express.
|
|
964
|
+
*/
|
|
965
|
+
declare const expressErrorHandler: (err: any, _req: any, res: any, _next: any) => void;
|
|
966
|
+
/**
|
|
967
|
+
* Secure Logger with Cryptographic Hash-Chain (Tamper-Proof Logs).
|
|
968
|
+
* Every entry is linked to the previous one via a SHA-256 hash, making it
|
|
969
|
+
* mathematically detectable if an attacker deletes or modifies log entries.
|
|
970
|
+
*/
|
|
971
|
+
declare class SecureLoggerChain {
|
|
972
|
+
private readonly baseLogger;
|
|
973
|
+
private lastHash;
|
|
974
|
+
constructor(baseLogger: {
|
|
975
|
+
info: Function;
|
|
976
|
+
error: Function;
|
|
977
|
+
warn: Function;
|
|
978
|
+
});
|
|
979
|
+
private chain;
|
|
980
|
+
info(msg: string, data?: any): void;
|
|
981
|
+
warn(msg: string, data?: any): void;
|
|
982
|
+
error(msg: string, err?: any): void;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Convenience logger creator.
|
|
986
|
+
*/
|
|
987
|
+
declare const createSecureLogger: (baseLogger: any) => SecureLoggerChain;
|
|
988
|
+
/**
|
|
989
|
+
* Fastify Plugin Preset.
|
|
990
|
+
* Fastify hooks to inject secure headers, rate limiter, and scan inputs.
|
|
991
|
+
*/
|
|
992
|
+
declare const fastifyPlugin: (options?: {
|
|
993
|
+
rateLimit?: boolean;
|
|
994
|
+
rateLimitWindowMs?: number;
|
|
995
|
+
rateLimitMax?: number;
|
|
996
|
+
}) => (fastify: any) => Promise<void>;
|
|
997
|
+
/**
|
|
998
|
+
* NestJS Guard / Middleware class creator.
|
|
999
|
+
* Dynamic NestJS Middleware to apply Mitigator protections.
|
|
1000
|
+
*/
|
|
1001
|
+
declare class NestJsMitigatorMiddleware {
|
|
1002
|
+
private static limiter;
|
|
1003
|
+
static configure(options?: {
|
|
1004
|
+
rateLimit?: boolean;
|
|
1005
|
+
rateLimitWindowMs?: number;
|
|
1006
|
+
rateLimitMax?: number;
|
|
1007
|
+
}): void;
|
|
1008
|
+
use(req: any, res: any, next: () => void): Promise<void>;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
type presets_NestJsMitigatorMiddleware = NestJsMitigatorMiddleware;
|
|
1012
|
+
declare const presets_NestJsMitigatorMiddleware: typeof NestJsMitigatorMiddleware;
|
|
1013
|
+
type presets_SecureLoggerChain = SecureLoggerChain;
|
|
1014
|
+
declare const presets_SecureLoggerChain: typeof SecureLoggerChain;
|
|
1015
|
+
declare const presets_createSecureLogger: typeof createSecureLogger;
|
|
1016
|
+
declare const presets_expressErrorHandler: typeof expressErrorHandler;
|
|
1017
|
+
declare const presets_expressMiddleware: typeof expressMiddleware;
|
|
1018
|
+
declare const presets_fastifyPlugin: typeof fastifyPlugin;
|
|
1019
|
+
declare const presets_nextJsMiddleware: typeof nextJsMiddleware;
|
|
1020
|
+
declare namespace presets {
|
|
1021
|
+
export { presets_NestJsMitigatorMiddleware as NestJsMitigatorMiddleware, presets_SecureLoggerChain as SecureLoggerChain, presets_createSecureLogger as createSecureLogger, presets_expressErrorHandler as expressErrorHandler, presets_expressMiddleware as expressMiddleware, presets_fastifyPlugin as fastifyPlugin, presets_nextJsMiddleware as nextJsMiddleware };
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Lightweight OpenTelemetry-compatible telemetry hook system for Mitigator.
|
|
1026
|
+
*
|
|
1027
|
+
* This module provides a zero-dependency, zero-overhead telemetry integration point.
|
|
1028
|
+
* By default all hooks are no-ops. Consumers inject their own tracer/metrics provider
|
|
1029
|
+
* via `setTelemetryProvider()` — works with any OTEL SDK, Datadog, Prometheus, or custom.
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* ```ts
|
|
1033
|
+
* import { setTelemetryProvider } from 'mitigator/telemetry';
|
|
1034
|
+
* import { trace, metrics } from '@opentelemetry/api';
|
|
1035
|
+
*
|
|
1036
|
+
* const tracer = trace.getTracer('mitigator');
|
|
1037
|
+
* const meter = metrics.getMeter('mitigator');
|
|
1038
|
+
* const rateLimitCounter = meter.createCounter('mitigator.rate_limit.blocked');
|
|
1039
|
+
* const securityEventCounter = meter.createCounter('mitigator.security.events');
|
|
1040
|
+
*
|
|
1041
|
+
* setTelemetryProvider({
|
|
1042
|
+
* onRateLimitBlocked(id, severity) {
|
|
1043
|
+
* rateLimitCounter.add(1, { id, severity });
|
|
1044
|
+
* },
|
|
1045
|
+
* onSecurityEvent(id, weight) {
|
|
1046
|
+
* securityEventCounter.add(weight, { id });
|
|
1047
|
+
* },
|
|
1048
|
+
* onKillSwitchTriggered(id) {
|
|
1049
|
+
* const span = tracer.startSpan('mitigator.kill_switch');
|
|
1050
|
+
* span.setAttribute('actor.id', id);
|
|
1051
|
+
* span.end();
|
|
1052
|
+
* },
|
|
1053
|
+
* onWorkerSpawned(functionName) {
|
|
1054
|
+
* // track worker thread usage
|
|
1055
|
+
* },
|
|
1056
|
+
* });
|
|
1057
|
+
* ```
|
|
1058
|
+
*/
|
|
1059
|
+
/**
|
|
1060
|
+
* Telemetry event hooks that Mitigator calls at key security decision points.
|
|
1061
|
+
* All methods are optional — implement only what your observability stack needs.
|
|
1062
|
+
*/
|
|
1063
|
+
interface MitigatorTelemetryProvider {
|
|
1064
|
+
/**
|
|
1065
|
+
* Called when a request is blocked by `AdaptiveRateLimiter.isLimited()`.
|
|
1066
|
+
* @param id The client ID (IP, session, etc.) that was blocked.
|
|
1067
|
+
* @param severity `'penalty'` if the actor is high-risk, `'standard'` otherwise.
|
|
1068
|
+
*/
|
|
1069
|
+
onRateLimitBlocked?(id: string, severity: 'standard' | 'penalty'): void;
|
|
1070
|
+
/**
|
|
1071
|
+
* Called when `AdaptiveRateLimiter.recordSecurityEvent()` is invoked.
|
|
1072
|
+
* @param id The client ID receiving the security score increment.
|
|
1073
|
+
* @param weight The weight of the security event.
|
|
1074
|
+
*/
|
|
1075
|
+
onSecurityEvent?(id: string, weight: number): void;
|
|
1076
|
+
/**
|
|
1077
|
+
* Called immediately before `AdaptiveRateLimiter.triggerGlobalKillSwitch()` writes.
|
|
1078
|
+
* @param id The client ID being permanently blocked.
|
|
1079
|
+
*/
|
|
1080
|
+
onKillSwitchTriggered?(id: string): void;
|
|
1081
|
+
/**
|
|
1082
|
+
* Called each time `runIsolatedCrypto` acquires a worker thread slot.
|
|
1083
|
+
* @param functionName The crypto function being dispatched to the worker.
|
|
1084
|
+
*/
|
|
1085
|
+
onWorkerSpawned?(functionName: string): void;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Registers a telemetry provider that Mitigator will call at key security events.
|
|
1089
|
+
*
|
|
1090
|
+
* Call this once at application startup, before any Mitigator functions are used.
|
|
1091
|
+
* Replaces any previously registered provider.
|
|
1092
|
+
*
|
|
1093
|
+
* @param provider An object implementing any subset of `MitigatorTelemetryProvider`.
|
|
1094
|
+
*/
|
|
1095
|
+
declare const setTelemetryProvider: (provider: MitigatorTelemetryProvider) => void;
|
|
1096
|
+
/**
|
|
1097
|
+
* Resets the telemetry provider to the built-in no-op (useful in tests).
|
|
1098
|
+
*/
|
|
1099
|
+
declare const resetTelemetryProvider: () => void;
|
|
1100
|
+
/**
|
|
1101
|
+
* Internal accessor used by Mitigator modules to emit telemetry events.
|
|
1102
|
+
* Not part of the public API — use `setTelemetryProvider` instead.
|
|
1103
|
+
*
|
|
1104
|
+
* @internal
|
|
1105
|
+
*/
|
|
1106
|
+
declare const getTelemetryProvider: () => MitigatorTelemetryProvider;
|
|
1107
|
+
|
|
1108
|
+
type telemetry_MitigatorTelemetryProvider = MitigatorTelemetryProvider;
|
|
1109
|
+
declare const telemetry_getTelemetryProvider: typeof getTelemetryProvider;
|
|
1110
|
+
declare const telemetry_resetTelemetryProvider: typeof resetTelemetryProvider;
|
|
1111
|
+
declare const telemetry_setTelemetryProvider: typeof setTelemetryProvider;
|
|
1112
|
+
declare namespace telemetry {
|
|
1113
|
+
export { type telemetry_MitigatorTelemetryProvider as MitigatorTelemetryProvider, telemetry_getTelemetryProvider as getTelemetryProvider, telemetry_resetTelemetryProvider as resetTelemetryProvider, telemetry_setTelemetryProvider as setTelemetryProvider };
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
export { index$7 as auth, index$6 as crypto, index$5 as fs, index$8 as headers, index$4 as http, presets, index$3 as rateLimit, index$2 as safeJson, index$1 as safeMerge, index$a as sanitize, telemetry, index as utils, index$9 as validate };
|