pompelmi 0.18.0 → 0.19.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.
@@ -0,0 +1,15 @@
1
+ import type { ScanReport } from './types';
2
+ /**
3
+ * React Hook: handles <input type="file" onChange> with validation + scanning.
4
+ */
5
+ export declare function useFileScanner(): {
6
+ results: {
7
+ file: File;
8
+ report: ScanReport;
9
+ }[];
10
+ errors: {
11
+ file: File;
12
+ error: string;
13
+ }[];
14
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
15
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Validates a File by MIME type and size (max 5 MB).
3
+ */
4
+ export declare function validateFile(file: File): {
5
+ valid: boolean;
6
+ error?: string;
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { YaraMatch, Verdict } from './types';
2
+ export declare function mapMatchesToVerdict(matches?: YaraMatch[]): Verdict;
@@ -0,0 +1,7 @@
1
+ import type { YaraEngine } from './index';
2
+ /**
3
+ * Engine YARA lato browser — NO WASM.
4
+ * È un no-op sicuro: non produce match e non richiede dipendenze native.
5
+ * Se vuoi YARA in browser senza WASM, userai un adapter remoto (vedi step successivo).
6
+ */
7
+ export declare function createBrowserEngine(): Promise<YaraEngine>;
@@ -0,0 +1,17 @@
1
+ export interface YaraMatch {
2
+ rule: string;
3
+ tags?: string[];
4
+ }
5
+ export interface YaraCompiled {
6
+ scan(data: Uint8Array): Promise<YaraMatch[]>;
7
+ scanFile?: (filePath: string) => Promise<YaraMatch[]>;
8
+ scanFileAsync?: (filePath: string) => Promise<YaraMatch[]>;
9
+ }
10
+ export interface YaraEngine {
11
+ compile(rulesSource: string): Promise<YaraCompiled>;
12
+ compileFile?: (rulesPath: string) => Promise<YaraCompiled>;
13
+ }
14
+ export declare function createYaraEngine(): Promise<YaraEngine>;
15
+ export declare function createYaraScannerFromRules(rulesSource: string): Promise<YaraCompiled>;
16
+ export declare function createYaraScannerFromFile(rulesPath: string): Promise<YaraCompiled>;
17
+ export { createRemoteEngine } from './remote';
@@ -0,0 +1,2 @@
1
+ import type { YaraEngine } from './index';
2
+ export declare function createNodeEngine(): Promise<YaraEngine>;
@@ -0,0 +1,10 @@
1
+ import type { YaraEngine } from './index';
2
+ export interface RemoteEngineOptions {
3
+ endpoint: string;
4
+ headers?: Record<string, string>;
5
+ rulesField?: string;
6
+ fileField?: string;
7
+ mode?: 'multipart' | 'json-base64';
8
+ rulesAsBase64?: boolean;
9
+ }
10
+ export declare function createRemoteEngine(opts: RemoteEngineOptions): Promise<YaraEngine>;
@@ -0,0 +1,3 @@
1
+ export declare function createScanner(rulesPath?: string): {
2
+ scan(bytes: Uint8Array): Promise<unknown>;
3
+ };
@@ -0,0 +1,13 @@
1
+ export type ZipBudget = {
2
+ maxEntries: number;
3
+ maxDepth: number;
4
+ maxTotalUncompressed: number;
5
+ maxPerEntryUncompressed: number;
6
+ maxCompressionRatio: number;
7
+ };
8
+ export type ZipEntry = {
9
+ path: string;
10
+ depth: number;
11
+ data: Uint8Array;
12
+ };
13
+ export declare function iterateZip(buffer: Uint8Array, budget: ZipBudget, depth?: number): AsyncGenerator<ZipEntry>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pompelmi",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "RFI-safe file uploads for Node.js — Express/Koa/Next.js middleware with deep ZIP inspection, MIME/size checks, and optional YARA scanning.",
5
5
  "main": "./dist/pompelmi.cjs",
6
6
  "module": "./dist/pompelmi.esm.js",